Sorry, you need to enable JavaScript to visit this website.

Viewfinder

Used to control camera's viewfinder start/stop behaviour.

When viewfinder is started on selected port, camera will start sending JPGs at 30 frames per second. JPEG resolution is set to 768x432px and, to achieve more reliable transfer, apart from JPEG payload data some additional metadata is added to the protocol.

NOTE: All data transmitted by the camera is sent in big-endian format.

Before sending each frame, camera sends sync sequence (containing, among other things, size of the JPG that is about to be sent) of total 15 bytes in the following order:

 

Field Length (in bytes) Description
sync 2 These two bytes are sync bytes and are always the same: 0x55AA.
message_type 1 Type of the packet:
0 - start packet.
packet_number 2 Auto-incremented number of the packet sent. Should be used by the received to verify that all packets for one JPG image arrived correctly.
payload_length 2 Length (in bytes) of remaining packet content.
JPG_size 4 Size of the JPG that is about to be sent.
PTS 4 Not used in viewfinder mode while recording is not running. In preview mode it contains PTS of the currently delivered frame. In viewfinder mode, if video recording is running, it contains PTS of the video file which is currently being recorded.

After sending sync sequence, camera sends packets containing JPEG payload, according to following format:

 

Field Length (in bytes) Description
sync 2 These two bytes are sync bytes and are always the same: 0x55AA.
message_type 1 Type of the packet:
1 - frame payload packet.
packet_number 2 Auto-incremented number of the packet sent. Should be used by the received to verify that all packets for one JPG image arrived correctly.
payload_length 2 Length (in bytes) of remaining packet content.
payload payload_length Contains part of the JPEG which is being sent.

For as long as viewfinder is active camera will continue to send frames (start packet + some number of frame payload packets). Client should make use of packet_number to make sure that no packets are being dropped before received data is passed to the JPEG decoder (or validation engine). If some packets are missing, client should attempt to sync on start packet sync sequence and start receiving following frames.

POST /api/<versionNumber>/viewfinder

Format:

http://<baseURL>/api/<versionNumber>/viewfinder

Example:

http://192.168.1.101/api/2/viewfinder

Parameters

Parameter Description Req'd? Type / Values
baseURL Fixed address, Bandit acts like an access point with this addres. TomTom Bandit's WiFi has to be turned on. Yes 192.168.1.101
versionNumber Service version number. The current value is 2. Yes 2

JSON Parameters:

Parameters will be passed as JSON object.

Parameter Description Req'd? Type
viewfinder_active true - turns viewfinder on
false - turns viewfinder off
Yes boolean
[viewfinder_streaming_port] Specifies port to be used by viewfinder to stream JPGs. If not specified, defaults to 4001. No integer

Field 'viewfinder_streaming_port' should equal to port number that will be used for UDP streaming (frame sending). 

Description:

Starts or stops viewfinder on the camera on designated streaming port.

Only one viewfinder session can be started at one time. If viewfinder is already running and new instance is requested, status code indicating error will be returned.

Response codes:

Code Description
200 OK
400 Bad Request (wrong or unrecognised parameters)
409 Conflict (can't start new instance of viewfinder since it's either already running or some other process is blocking it)
500 Server Error (request can't be processed)

Response:

None.

Example request (starts viewfinder at port 4001):

POST http://192.168.1.101/api/2/viewfinder

Parameters:

{
    "viewfinder_active":true,
    "viewfinder_streaming_port":4001
}

Example request (stops viewfinder):

POST http://192.168.1.101/api/2/viewfinder
{
    "viewfinder_active":false
}
 

You are here