The communication protocol consists in exchanging of messages. Each message consists of binary-based length field followed by text-based json package. The message can be described by this packed C structure:
struct __attribute__((packed)) message { uint32_t length; uint8_t json[]; };
length | - | length of json package (binary - LE) |
data | - | flexible array containing json package (text - UTF8) |
At the root level each json package must contain element named as id. Its string-typed value determines both the meaning of json package and also the presence of another elements. So the minimal json package looks like this:
{ "id": <value> }
Configuration properties have these features:
Currently the validation of configuration properties is very limited, so it is mainly on user's own responsibility to set the correct values.
You can set the configuration properties with:
{ "id": "set_configuration_properties", "properties": { <property_name>: <property_value>, <property_name>: <property_value>, ... } }
Any unknown property is ignored silently.
Response:
{ "id": "set_configuration_properties_response", "result": <value> "properties": { <property_name>: <property_value>, <property_name>: <property_value>, ... } }
Result is contained in boolean-typed result element. Possible values:
true | - | all properties were set to the requested values. In this case properties element is empty. |
false | - | at least one property couldn't be set to the requested value. In this case properties element contains these not-changed properties with their actual values. |
You can get the configuration properties with:
{ "id": "get_configuration_properties", "properties": [<property_name>, <property_name>, ...] }
Empty properties element is considered as to get all available configuration properties. Any unknown property is ignored silently.
Response:
{ "id": "get_configuration_properties_response", "properties": { <property_name>: <property_value>, <property_name>: <property_value>, ... } }
Whenever the configuration properties are changed, then all the control socket clients (not causing this change) are informed with:
{ "id": "configuration_properties", "properties": { <property_name>: <property_value>, <property_name>: <property_value>, ... } }
Name | Type | Values | Reboot needed | Description |
---|---|---|---|---|
video_enabled | boolean | no | Video streaming enabled | |
video_preview | boolean | no | Video preview (on HDMI) enabled | |
video_trig_mark_visible | boolean | no | Trigger mark visible | |
video_pretrig_buff_length | number | [0,60] | no | Pre-trigger buffer length [seconds] |
video_protocol | string | {H264-RTP-UDP, H264-MPEGTS-TCP, JPEG-RTP-UDP, JPEG-MUX-TCP, RAW-RTP-UDP, RAW-TCP} | no | Video protocol |
video_ip | string | no | IP address (UDP: remote address, TCP: unused) | |
video_port | number | no | TCP port (UDP: remote port, TCP: local port) | |
video_framerate | number | no | Framerate [fps] (currently this property has no effect) | |
video_aoi_enabled | boolean | no | AOI (Area of Interest) enabled | |
video_aoi_x | number | no | X coordinate of the top-left AOI corner [pixels] | |
video_aoi_y | number | no | Y coordinate of the top-left AOI corner [pixels] | |
video_aoi_width | number | no | AOI width [pixels] | |
video_aoi_height | number | no | AOI height [pixels] | |
video_ts_enabled | boolean | no | Timestamp (in-picture) enabled | |
video_ts_tstype | string | {MONOTONIC_RELATIVE, MONOTONIC_ABSOLUTE, REALTIME} | no | Timestamp type |
video_ts_xpos | number | no | Timestamp horizontal position [pixels] | |
video_ts_ypos | number | no | Timestamp vertical position [pixels] | |
video_ts_bitwidth | number | no | Timestamp bit width [pixels] | |
video_ts_bitheight | number | no | Timestamp bit height [pixels] | |
video_nosig_color | string | {BLACK, PINK} | no | No-signal color |
photo_server_port | number | no | Screenshot server port | |
photo_periodic_enabled | boolean | no | Periodical screenshots enabled | |
photo_period | number | no | Periodical screenshots period [milliseconds] | |
photo_store_enabled | boolean | no | Store periodical screenshots to file system enabled | |
photo_format | string | no | Format of stored screenshots | |
photo_stored_frames | number | no | Maximum number of last stored periodical screenshots | |
lan_mgb_address | string | yes | MGB IP address (reboot needed) | |
lan_mgb_netmask | string | yes | MGB network mask (reboot needed) | |
lan_mgb_gateway | string | yes | MGB gateway (reboot needed) | |
lan_mgb_namesrv | string | yes | MGB nameserver (reboot needed) | |
iface_module | string | {LVDS-FPD-LINK-2, LVDS-FPD-LINK-3, DIFF-FPK-MEDIUM-1, DIFF-FPK-BASIC-1, GMSL} | yes | Interface module |
iface_lvds_input | string | {AUTO, SINGLE, DUAL} | no | LVDS input |
iface_openldi | string | {SINGLE, DUAL} | no | OpenLDI |
iface_color_depth | string | {24BIT, 18BIT} | no | Color depth |
iface_color_mapping | string | {MAPSEL-L, MAPSEL-H} | no | Color mapping |
iface_olfe_reset | string | {NONE, DES, DES-SER} | no | On lock falling edge reset |
iface_olre_reset | string | {NONE, DES, DES-SER} | no | On lock rising edge reset |
iface_syncgen | boolean | no | Internal Hsync/Vsync generator enabled | |
iface_syncgen_devsync | number | no | DE/Vsync length [pixels] | |
iface_custom_config | boolean | no | Custom configuration enabled | |
iface_lvds3desctrl0 | string | no | LVDS3DESCTRL0 [hex] | |
iface_lvds3desctrl1 | string | no | LVDS3DESCTRL1 [hex] | |
iface_lvds3desctrl2 | string | no | LVDS3DESCTRL2 [hex] | |
iface_lvds3serctrl0 | string | no | LVDS3SERCTRL0 [hex] | |
iface_lvds3serctrl1 | string | no | LVDS3SERCTRL1 [hex] | |
iface_bchannel | string | {NONE, UART, FORWARD-SPI, REVERSE-SPI} | no | Back channel |
iface_bchannel_sniffer | boolean | no | Back channel sniffer enabled | |
iface_bchannel_port | number | no | Back channel server port | |
iface_bchannel_uart_br | number | no | Back channel UART baudrate [bps] | |
iface_lockdrop_counter_enabled | boolean | no | Interface lock-drop counter enabled | |
iface_lockdrop_counter_timeout | number | [1,42949672] | no | Interface lock-drop counter timeout [microseconds] |
iface_gmsl_protocol | string | {GMSL2, GMSL3} | no | GMSL protocol |
iface_gmsl_rate | string | {3Gbps, 6Gbps, 12Gbps} | no | GMSL rate |
iface_gmsl_stream_id | string | {0, 1, 2, 3} | no | GMSL stream identifier |
iface_gmsl_fec_enabled | boolean | no | GMSL FEC enabled | |
trig_pwrbtn_release | string | {NONE, SCREENSHOT-TO-TCP, SCREENSHOT-TO-SDC, VIDEOREC-TOGGLE} | no | Trigger button release |
trig_tr1_rising | string | {NONE, SCREENSHOT-TO-TCP, SCREENSHOT-TO-SDC, VIDEOREC-START, VIDEOREC-STOP, VIDEOREC-TOGGLE, MGB-ON, MGB-OFF} | no | External trigger TR1 rising |
trig_tr1_falling | string | {NONE, SCREENSHOT-TO-TCP, SCREENSHOT-TO-SDC, VIDEOREC-START, VIDEOREC-STOP, VIDEOREC-TOGGLE, MGB-ON, MGB-OFF} | no | External trigger TR1 falling |
trig_tr2_rising | string | {NONE, SCREENSHOT-TO-TCP, SCREENSHOT-TO-SDC, VIDEOREC-START, VIDEOREC-STOP, VIDEOREC-TOGGLE, MGB-ON, MGB-OFF} | no | External trigger TR2 rising |
trig_tr2_falling | string | {NONE, SCREENSHOT-TO-TCP, SCREENSHOT-TO-SDC, VIDEOREC-START, VIDEOREC-STOP, VIDEOREC-TOGGLE, MGB-ON, MGB-OFF} | no | External trigger TR2 falling |
trig_can_match1 | string | {NONE, SCREENSHOT-TO-TCP, SCREENSHOT-TO-SDC, VIDEOREC-START, VIDEOREC-STOP, VIDEOREC-TOGGLE, MGB-ON, MGB-OFF} | no | CAN match 1 |
trig_can_match1_id | string | no | CAN match 1 Identifier [hex] (append x to consider identifier as extended) | |
trig_can_match1_data | string | no | CAN match 1 Data [hex] (concatenate all bytes into one number) | |
trig_can_match1_data_mask | string | no | CAN match 1 Data mask [hex] (concatenate all bytes into one number) | |
trig_can_match2 | string | {NONE, SCREENSHOT-TO-TCP, SCREENSHOT-TO-SDC, VIDEOREC-START, VIDEOREC-STOP, VIDEOREC-TOGGLE, MGB-ON, MGB-OFF} | no | CAN match 2 |
trig_can_match2_id | string | no | CAN match 2 Identifier [hex] (append x to consider identifier as extended) | |
trig_can_match2_data | string | no | CAN match 2 Data [hex] (concatenate all bytes into one number) | |
trig_can_match2_data_mask | string | no | CAN match 2 Data mask [hex] (concatenate all bytes into one number) | |
trig_can_timeout | string | {NONE, SCREENSHOT-TO-TCP, SCREENSHOT-TO-SDC, VIDEOREC-START, VIDEOREC-STOP, MGB-OFF} | no | CAN timeout |
trig_can_timeout_val | number | no | CAN timeout value [seconds] | |
trig_can_wakeup | string | {NONE, SCREENSHOT-TO-TCP, SCREENSHOT-TO-SDC, VIDEOREC-START, VIDEOREC-STOP, MGB-ON} | no | CAN wakeup |
trig_mgb_startup | string | {NONE, SCREENSHOT-TO-SDC, VIDEOREC-START} | no | MGB startup |
ntp_server1 | string | yes | NTP server 1 (leave empty if not used, reboot needed) | |
ntp_server2 | string | yes | NTP server 2 (leave empty if not used, reboot needed) | |
ntp_server3 | string | yes | NTP server 3 (leave empty if not used, reboot needed) | |
ntp_server4 | string | yes | NTP server 4 (leave empty if not used, reboot needed) | |
ntp_tos_orphan | string | yes | NTP Orphan stratum (reboot needed) | |
ntp_tos_orphanwait | string | yes | NTP Orphan wait [seconds] (reboot needed) | |
system_control_port | number | no | Control server port | |
system_timezone | string | no | Olson timezone | |
system_statprop_defsubscr | boolean | no | Default subscription to status variables |
Status properties have these features:
You can get the status properties with:
{ "id": "get_status_properties", "properties": [<property_name>, <property_name>, ...] }
Empty properties element is considered as to get all available status properties. Any unknown property is ignored silently.
Response:
{ "id": "get_status_properties_response", "properties": { <property_name>: <property_value>, <property_name>: <property_value>, ... } }
Whenever the status properties are changed, then all the control socket clients are informed with:
{ "id": "status_properties", "properties": { <property_name>: <property_value>, <property_name>: <property_value>, ... } }
Each control socket client gets only its own subscribed status properties.
When control socket client wants to receive changed status properties, it must subscribe to them with:
{ "id": "subscribe_status_properties", "properties": [<property_name>, <property_name>, ...] }
Empty properties element is considered as to subscribe to all available status properties. Any unknown property is ignored silently.
Response:
{ "id": "subscribe_status_properties_response", "result": <value> }
Result is contained in boolean-typed result element. Possible values:
true | - | Subscription succeeded |
false | - | Subscription failed |
When control socket client doesn't want to receive changed status properties, it must unsubscribe to them with:
{ "id": "unsubscribe_status_properties", "properties": [<property_name>, <property_name>, ...] }
Empty properties element is considered as to unsubscribe to all subscribed status properties. Any unknown property is ignored silently.
Response:
{ "id": "unsubscribe_status_properties_response", "result": <value> }
Result is contained in boolean-typed result element. Possible values:
true | - | Unsubscription succeeded |
false | - | Unsubscription failed |
The subscription state of each just connected control socket client is controlled by system_statprop_defsubscr configuration property. When the property is set to true, then each just connected control socket client is subscribed to all available status properties automatically. When the property is set to false, then each just connected client is not subscribed to any status property.
Name | Type | Values | Description |
---|---|---|---|
mgb_version | string | MGB version | |
app_version | string | App version | |
lpc_sw_version | string | LPC version | |
fpga_sw_version | string | FPGA version | |
xpdriver_version | string | PCIe driver version | |
mgb_board_version | string | Board version | |
sn | string | Serial number | |
video_streamed | boolean | true if video is streamed, otherwise false | |
video_locked | boolean | true if video input is locked, otherwise false | |
video_detected_resolution | array | Last detected valid resolution in form of [width, height]. [0, 0] means, that no valid video has been detected yet. |
|
video_streamed_resolution | array | Last streamed resolution in form of [width, height]. [0, 0] means, that no video has been streamed yet. |
|
iface_lockdrop_counter | number | Interface lock-drop counter (uint32_t) |
You can reset lock-drop counter with:
{ "id": "reset_iface_lockdrop_counter" }
Response:
{ "id": "reset_iface_lockdrop_counter_response", "result": <value> }
Result is contained in boolean-typed result element. Possible values:
true | - | Lock-drop counter reset succeeded |
false | - | Lock-drop counter reset failed |
All datetime elements are string-typed and hold the local date and time in this format (see POSIX function strptime):
%Y-%m-%d %H:%M:%S
You can set the local date and time with:
{ "id": "set_local_datetime", "datetime": <value> }
Response:
{ "id": "set_local_datetime_response", "result": <value> }
Result is contained in boolean-typed result element. Possible values:
true | - | Local date and time were set successfully |
false | - | Local date and time setting failed |
You can get the local date and time with:
{ "id": "get_local_datetime" }
Response:
{ "id": "get_local_datetime_response", "datetime": <value> }
{ "id": "reboot" }
There is no response. However if the command is executed successfully, then the control socket closes at the MGB side.
{ "id": "poweroff" }
There is no response. However if the command is executed successfully, then the control socket closes at the MGB side.
In case of any problem with parsing of received json package (missing, unknown or wrong-typed elements), the response will be:
{ "id": "error" }