Navigate to Settings > Analytic > JSON to setup the integration.
Check Enable JSON sender to enable the integration.
At Type of recognized text select Unicode plate number.
At Protocol version select Version 1.0
Assign unique Sensor ID of your choice.
At Cloud URL add fully qualified listener / receiver URL, e.g. http://primm.limbio.cloud:8080/receiver/ for Limbio Cloud.
Check Multipart screenshot to enable event frame snapshot delivery along with JSON event data in a multi-part request.
Check Send lost recognize event only for to have event data sent only once when license plate leaves the recognition zone (on LP loss). Otherwise multiple events for the same Licence Plate will be sent.
FF JSON Protocol
{
"packetCounter":"0",
"datetime":"20170221 081331000",
"plateText":"\u0059\u0058\u0034\u0035\u0036\u0037\u0031",
"plateCountry":"DNK",
"plateConfidence":"0.808824",
"carState":"new",
"geotag":{
"lat": 50.418114,
"lon": 30.476213
},
"imageType": "plate",
"plateImageType": "png",
"plateImageSize": "0",
"carMoveDirection":"in",
"timeProcessing":"409",
"plateCoordinates":[0, 680, 440, 272],
"carID":"27",
"GEOtarget":"",
"sensorProviderID":"SAMSUNG00",
"channel":"1"
}
JSON validation tool: http://jsonlint.com/
This example uses cross platform library curl (https://curl.haxx.se/).
Before sending event (JSON data) is saved to file “json_name”.
Image is in lp_image.
Url is in cld.cloud_url.
CURL *curl;
CURLcode res;
struct curl_httppost *formpost=NULL;
struct curl_httppost *lastptr=NULL;
std::string cloud_url = "sovabi-dev.cloudapp.net:8081/receiver/";
std::string lp_image = "etalon_hd.jpg";
std::string json_name = "test_json.json";
curl_global_init(CURL_GLOBAL_ALL);
/* Fill in the file upload field */
curl_formadd(&formpost,
&lastptr,
CURLFORM_COPYNAME, "event",
CURLFORM_FILE, json_name.c_str(),
CURLFORM_END);
curl_formadd(&formpost,
&lastptr,
CURLFORM_COPYNAME, "image",
CURLFORM_FILE, lp_image.c_str(),
CURLFORM_END);
curl = curl_easy_init();
curl_easy_setopt(curl, CURLOPT_URL, cloud_url.c_str() );
curl_easy_setopt(curl, CURLOPT_HTTPPOST, formpost );
res = curl_easy_perform( curl );
If (res != CURLE_OK)
{
fprintf(stderr, "curl_easy_perform() failed: %s\n",curl_easy_strerror( res ) );
}
curl_easy_cleanup(curl);
curl_formfree(formpost);
=> Send header, 227 bytes (0xe3)
0000: POST /ff_post.php HTTP/1.1
0025: User-Agent: curl/7.35.0
003e: Host: 10.0.3.160
0050: Accept: */*
005d: Content-Length: 377541
0075: Expect: 100-continue
008b: Content-Type: multipart/form-data; boundary=--------------------
00cb: ----c83536ed0d118f9a
00e1:.
<= Recv header, 23 bytes (0x17)
0000: HTTP/1.1 100 Continue
=> Send data, 152 bytes (0x98)
0000: --------------------------c83536ed0d118f9a
002c: Content-Disposition: form-data; name="event"; filename="14703115
006c: 85.json"
0076: Content-Type: application/json
0096:.
=> Send data, 337 bytes (0x151)
0000: {"packetCounter":"1","datetime":"20160805 145305000","plateText"
0040: :"\u4100\u4100\u3400\u3200\u3900\u3500\u4f00\u4b00","plateCountr
0080: y":"UKR","plateConfidence":"0.852113","carState":"new","carMoveD
00c0: irection":"IN","timeProcessing":"20","plateCoordinates":[1233, 1
0100: 429, 104, 144],"carID":"1","GEOtarget":"Office","sensorProviderI
0140: D":"CameraTest2"}
=> Send data, 146 bytes (0x92)
0000:.
0002: --------------------------c83536ed0d118f9a
002e: Content-Disposition: form-data; name="image"; filename="etalon_h
006e: d.jpg"
0076: Content-Type: image/jpeg
0090:.
=> Send data, 16384 bytes (0x4000)
0000: ......JFIF.....H.H.....C........................................
0040: ......!........."$".$..........8................................
0080: .......J........................!..1AQ"a..2q#B..R......3.$Cb....
…..
…..
3f80: f...kq.q{1..).~..(.j.FU..J..K(..E..d.3..|..tp......#yV9..>..cqH.
3fc0: ..$..f.Bh..v*.N..P....I#..9........Dc.Z...&.9].....]..#.v%..R...
=> Send data, 48 bytes (0x30)
0000:.
0002: --------------------------c83536ed0d118f9a--
The following simple receiver may be used with any HTTP server that supports PHP extension.
ff_post.php
<?php
$uploaddir = 'log/';
echo "<pre>\n";
$uploadfile = $uploaddir . basename($_FILES['event']['name']);
if (move_uploaded_file($_FILES['event']['tmp_name'], $uploadfile)) {
echo "File json uploaded.\n";
} else {
echo "Upload report error!\n";
}
$uploadfile = $uploaddir . basename($_FILES['image']['name']);
if (move_uploaded_file($_FILES['image']['tmp_name'], $uploadfile)) {
echo "File image uploaded.\n";
} else {
echo "Upload image error!\n";
}
echo 'Debug info:\n';
print_r($_FILES);
echo "</pre>\n";
?>
Simple Web form to send events:
ff_post_form.html
<html>
<head>
<meta http-equiv="content-type" content="text/html; charset=UTF-8">
</head>
<form method="post" enctype="multipart/form-data" action="ff_post.php">
Enter event file: <input type="file" name="event" size="40">
Enter image file: <input type="file" name="image" size="40">
<input type="submit" value="send" name="submit">
</form>
</html>
Provided we have following files
1470311582.json - event
etalon_hd.jpg - image
curl --trace-ascii headers.txt -i -X POST -F "event=@1470311582.json" -F "image=@etalon_hd.jpg" http://sovabi-dev.cloudapp.net:8081/receiver/
headers.txt - headers log
Result from data being sent to test server
curl --trace-ascii headers.txt -i -X POST -F 'event=@1470311582.json;type=application/json' -F image=@etalon_hd.jpg http://10.0.3.160/ff_post.php
HTTP/1.1 100 Continue
HTTP/1.1 200 OK
Date: Tue, 21 Feb 2017 12:23:22 GMT
Server: Apache/2.4.7 (Ubuntu)
X-Powered-By: PHP/5.5.9-1ubuntu4.17
Vary: Accept-Encoding
Content-Length: 494
Content-Type: text/html
<pre>
File json uploaded.
File image uploaded.
Debug info:\nArray
(
[event] => Array
(
[name] => 1470311582.json
[type] => application/json
[tmp_name] => /tmp/phpG2utRR
[error] => 0
[size] => 337
)
[image] => Array
(
[name] => etalon_hd.jpg
[type] => image/jpeg
[tmp_name] => /tmp/phpUURZBu
[error] => 0
[size] => 376858
)
)
</pre>
Reasons and Solutions:
1) The most often reason is that receiving party requires explicit instruction to allow inbound traffic of certain type and through certain ports. Network infrastructure or firewalls may also restrict traffic of certain type and may require explicit permissions. It is more to be the case when traffic is expected to cross network boundaries.
2) FF Edge ANPR applications rely on camera underlying platform layer API. Some firmwares (especially for products less than a year old) may not support required networking features (most often issues are caused by curl and ssl system libraries and API access restrictions).
Make sure you have your cameraJr firmware upgraded to the latest available version.
3) To test JSON sender try a portable local web-server, which is able to expose inbound requests. Note that it may be required to adjust firewalls (e.g. Windows Firewall) appropriately to allow inbound HTTP traffic on a machine the web-server is launched on.
There are two recommended tools executable under Windows to choose among:
portable http listener based on UsbWebServer available from https://goo.gl/ce3SNP . Please, download the archive and refer to the `README.md` from the archive or online. Please, note that archive contains complete distribution including the web-server itself.
http://fenixwebserver.com/ Please check short how-to video on using local web-server to listen for HTTP POST requests;
4) To test a receiving party with arbitrary HTTP inquiries consider using the tool to send HTTP requests and approach as described here: https://goo.gl/oB66Xx