Skip to content

Basler Vision Connector Messaging: Application Feedback#

Message Codes#

The following message codes are sent as responses.

Message codes are 32-bit integers that are encoded in the following way:

Bit offset [lsb << x] Width [bits] Description
0 20 Index of the message code starting at 0 for each log level.
20 3 Reserved bits. Must be set to 0.
23 1 Must be set to 1 for custom message codes and to 0 for standard message codes.
24 2 Log level. The following log levels exist:
0 = info message
1 = warning message
2 = debug message
3 = error message
26 6 Reserved bits, must be set to 0.

Info Message Codes#

Value range for standard info messages: 0x000000000x000FFFFF

Standard Message Codes Meaning
0x00000000 Request was completed successfully.
0x00000001 Application is online.
0x00000002 Application is offline.
0x00000003 Streaming of a device is stopped.

Warning Message Codes#

Value range for standard warning messages: 0x010000000x010FFFFF

Standard Message Codes Meaning
0x01000000 A request was only partially successful.
0x01000001 One or multiple corrupt frames were received.
0x01000002 One or multiple dropped frames were received.

Debug Message Codes#

Value range for standard debug messages: 0x020000000x020FFFFF

Error Message Codes#

Value range for standard error messages: 0x030000000x030FFFFF

Message Codes Meaning
0x03000000 Error while parsing a request
0x03000001 Error while handling a request
0x03000002 An opened device was removed
0x03000003 A feature, e.g. a command or argument, isn't supported

Application Logging#

The application log is published in the logging topic. In this log, you find any general application log information that is no direct response to any given command, such as application unhandled errors, camera error messages and camera connectivity issues. The purpose of this log is to provide a human-readable application feedback that isn't intended for interpretation by any software.

There are different structures to receive logging messages for ZMQ and for MQTT:

  • In ZMQ, subscribe to the app/logging topic on the PUB/SUB port to receive application feedback.
  • In MQTT, subscribe to the {mqttRoot}/app/logging topic to receive application feedback.

ZMQ Response on PUB/SUB Channel#

Frame Field Description Type
1 topic Logging topic Binary string (UTF-8): logging
2 payload JSON response object Binary string (UTF-8)

MQTT Reponse#

In MQTT, the JSON messages are written directly into the payload of the MQTT message. No specific envelop is required.

JSON Response Object#

Field Optional Type Description
Timestamp Yes String Application host date and time in ISO8601 format, i.e. when the message was created.
Code Yes Integer (32-bit unsigned) Message code following Message Codes
Level No String Log level - Debug, Info, Warning, Error
Message No String Response message
{
    "Timestamp":"2014-01-09T13:35:34.000000000+0100",
    "Code": 50331650,
    "Level":"Error",
    "Message":"Lost connection with myCam1"
}

Application Events#

The application events are expected to be published on the event topic. The application events contain general application events which aren't direct responses to any given command, such as application unhandled errors, camera error messages, and camera connectivity issues. In contrast to the application log, the purpose of these events is to provide notifications that can be interpreted by software. Certain message types may carry additional data. However, this is only required for the message codes listed below.

There are different structures to receive logging messages for ZMQ and for MQTT:

  • In ZMQ, subscribe to the app/events topic on the PUB/SUB port to receive application feedback.
  • In MQTT, subscribe to the {mqttRoot}/app/events topic to receive application feedback.

ZMQ Response on PUB/SUB Channel#

Frame Field Description Type
1 topic Logging topic Binary string (UTF-8): logging
2 payload Response object Binary String (UTF-8)

MQTT Response#

In MQTT, the JSON messages are written directly into the payload of the MQTT message. No specific envelop is required.

JSON Response Object#

Field Optional Type Description
Timestamp Yes String Application host date and time on ISO8601 format, when the message was created
Code No Integer Message code following Message Codes
Level No String Log level. Possible values: Debug, Info, Warning, Error
Message No String Response message
AdditionalData Depends on code Additional data object Additional message code dependent data. AdditionalData doesn't exist unless explicitly specified for a certain message code.
{
    "Timestamp":"2014-01-09T13:35:34.000000000+0100",
    "Code": 2,
    "Level":"Info",
    "Message":"The vision connector is offline now."
}

Device-Specific Events#

Device-specific events must contain additional data that contains the entry DeviceID of the device on which this event occurred.

List of all device-specific events:

  • 0x00000003: Streaming of a device is stopped
  • 0x03000002: An opened device was removed

Additional Data Object#

Field Optional Type Description
DeviceID No String Current camera identification

Example event for a connection loss of a device:

{
    "Timestamp":"2014-01-09T13:35:34.000000000+0100",
    "Code": 50331650,
    "Level":"Error",
    "Message":"Lost connection with myCam1",
    "AdditionalData":
    {
      "DeviceID": "myCam1"
    }
}

Frame Warning Events#

Frame warning events must contain additional data that contains the entry DeviceID of the device on which this event occurred. If more than 1 frame is affected, you must add a FrameCount.

List of all frame warning events:

  • 0x01000001: One or multiple corrupt frames were received.
  • 0x01000002: One or multiple dropped frames were detected.

Additional Data Object#

Field Optional Type Description
DeviceID No String Current camera identification
FrameCount Yes Integer The number of images affected. If no frame count is provided, this is interpreted as a frame count of 1.

Example event for dropped frames:

{
    "Timestamp":"2014-01-09T13:35:34.000000000+0100",
    "Code": 16777218,
    "Level":"Warning",
    "Message":"3 dropped frames have been detected on myCam1",
    "AdditionalData":
    {
      "DeviceID": "myCam1",
      "FrameCount": 3
    }
}