Skip to content
STAGING SERVER
DEVELOPMENT SERVER

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.

Value range for custom info messages: 0x008000000x008FFFFF.

Standard Message Codes Meaning
0x00000000 Request was completed successfully.
0x00000001 Application is online.
0x00000002 Application is offline.
0x00000003 Streaming of a device is stopped.
Custom Message Codes Meaning
0x00800000 Streaming was started.
0x00800001 Device was opened.
0x00800002 Device was closed.
0x00800003 Set parameter was applied.
0x00800004 Device configuration was set.
0x00800005 User set was loaded.
0x00800006 A state of a communication protocol has been changed.
0x00800007 Recipe is OK.
0x00800008 Application settings have been changed.
0x00800009 A recipe file was uploaded.
0x0080000A A recipe file was deleted.
0x0080000B A recipe was opened.
0x0080000C A recipe was closed.
0x0080000D The device connections to a recipe were changed.

Warning Message Codes#

Value range for standard warning messages: 0x010000000x010FFFFF.

Value range for custom warning messages: 0x018000000x018FFFFF.

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.
Custom Message Codes Meaning
0x01800000 One or multiple frames couldn't be written into a recipe.
0x01800001 The Multi-Camera Connection License has expired.

Debug Message Codes#

Value range for standard debug messages: 0x020000000x020FFFFF.

Value range for custom debug messages: 0x028000000x028FFFFF.

Error Message Codes#

Value range for standard error messages: 0x030000000x030FFFFF.

Value range for custom error messages: 0x038000000x038FFFFF.

Standard 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.
Custom Message Codes Meaning
0x03800000 A connection of a communication protocol was lost.
0x03800001 Error while running a recipe.
0x03800002 Can't open another camera because of a missing multi camera license.

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 ZeroMQ and for MQTT:

  • In ZeroMQ, 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.

ZeroMQ 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 ZeroMQ and for MQTT:

  • In ZeroMQ, 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.

ZeroMQ 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 standard events:

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

The following custom device specific events are defined:

Custom Message Codes Meaning
0x00800001 Opened device
0x00800002 Closed device
0x00800004 A device configuration was set.
0x00800005 A user set was loaded.

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 standard 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
    }
}

Frame Info Events#

Frame info 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 info events:

Custom Message Codes Meaning
0x00800000 Streaming of a device is started

Additional Data Object#

Field Optional Type Description
DeviceID No String Current device identification
FrameCount Yes Int Number of frames to be streamed. If no frame count is provided, the camera will stream continuously until the user stops the streaming.

Example event Info:

{
    "Timestamp":"2014-01-09T13:35:34.000000000+0100",
    "Code": 8388608,
    "Level":"Info",
    "Message":"Streaming has been started on the device with ID 'myDevice'",
    "AdditionalData":
    {
      "DeviceID": "myDevice",
      "FrameCount": 1
    }
}

Parameter Changed Events#

Parameter changed events must contain additional data with the entries DeviceID and ParameterNames, which will provide the device ID that this event happened on and the names of the parameter that are affected.

List of all parameter changed events:

Custom Message Codes Meaning
0x00800003 Set parameter was applied.

Additional Data Object#

Field Optional Type Description
DeviceID No String Current device identification
ParameterNames No Array of strings Names of the parameters that have been changed

Example event for a device connection loss:

{
    "Timestamp":"2014-01-09T13:35:34.000000000+0100",
    "Code": 8388611,
    "Level":"Info",
    "Message":"Parameters were changed for device with ID 'myDevice'",
    "AdditionalData":
    {
      "DeviceID": "myDevice",
      "ParameterNames": ["Width", "Height"]
    }
}

Protocol State Events#

Protocol state events must contain additional data with the entries Protocol and ProtocolState, which will provide the protocol affected and the new state of the protocol.

List of all protocol state events:

Custom Message Codes Meaning
0x00800006 A state of a communication protocol was changed.
0x03800000 A connection of a communication protocol was lost.

Additional Data Object#

Field Optional Type Description
Protocol No String The protocol affected by this event.
Valid protocols are:
- MQTT
- ZMQReqRep
- ZMQPubSub
ProtocolState No String The new state of the protocol.
Valid states are:
- Disabled
- Disconnected
- Ready

Example event for connection state changed:

{
    "Timestamp": "2014-01-09T13:35:34.000000000+0100",
    "Code": 8388614,
    "Level": "Info",
    "Message": "The MQTT client is running.",
    "AdditionalData":
    {
      "Protocol": "MQTT",
      "ProtocolState": "Ready"
    }
}

Recipe File Specific Events#

Recipe file specific events must contain additional data with the entry FileName, which will provide the file name of the recipe this event happened on.

List of all recipe file specific events:

Custom Message Codes Meaning
0x00800009 A recipe file was uploaded.
0x0080000A A recipe file was deleted.

Additional Data Object#

Field Optional Type Description
FileName No String Current recipe identification

Example event for a recipe upload:

{
    "Timestamp":"2014-01-09T13:35:34.000000000+0100",
    "Code": 8388617,
    "Level":"Info",
    "Message":"Recipe file uploaded successfully.",
    "AdditionalData":
    {
      "FileName": "myRecipe.precipe"
    }
}

Recipe Specific Events#

Recipe specific events must contain additional data with the entry RecipeID, which will provide the recipe ID that this event happened on.

List of all recipe specific events:

Custom Message Codes Meaning
0x00800007 Recipe is ok
0x03800001 Error while running a recipe
0x0080000B A recipe was opened
0x0080000C A recipe was closed
0x0080000D The device connections to a recipe were changed

Additional Data Object#

Field Optional Type Description
RecipeID No String Current recipe identification

Example event for an error while running a recipe:

{
    "Timestamp":"2014-01-09T13:35:34.000000000+0100",
    "Code": 58720257,
    "Level":"Error",
    "Message":"Error while running a recipe.",
    "AdditionalData":
    {
      "RecipeID": "myRecipe"
    }
}

Recipe and Device Specific Events#

Recipe and device specific events must contain additional data with the entries RecipeID and DeviceID, which will provide the IDs of the recipe and device that this event happened on.

List of all recipe specific events:

Custom Message Codes Meaning
0x01800000 One or multiple frames couldn't be written into a recipe.

Additional Data Object#

Field Optional Type Description
RecipeID No String Current recipe identification
DeviceID No String Current device identification

Example event for an error while running a recipe:

{
    "Timestamp":"2014-01-09T13:35:34.000000000+0100",
    "Code": 25165824,
    "Level":"Warning",
    "Message":"Error while running a recipe.",
    "AdditionalData":
    {
      "RecipeID": "myRecipe",
      "DeviceID": "myDevice"
    }
}