Basler Vision Connector: ZeroMQ JSON Test File#
Info
Before you start the sample script: If you want to run the script in the Siemens ecosystem, make sure that you have installed node-red-contrib-zmq. Also, replace the camera ID in JSON commands according to your camera.
For further possible JSON commands, refer to the Messaging topics in this documentation.
[
{
"id": "a0a13470cb75b19e",
"type": "tab",
"label": "Flow 1",
"disabled": false,
"info": "",
"env": []
},
{
"id": "abd9243539533978",
"type": "inject",
"z": "a0a13470cb75b19e",
"name": "EnumerateDevices",
"props": [
{
"p": "payload"
},
{
"p": "topic",
"vt": "str"
}
],
"repeat": "",
"crontab": "",
"once": false,
"onceDelay": 0.1,
"topic": "",
"payload": "{\"Action\":\"EnumerateDevices\"}",
"payloadType": "json",
"x": 790,
"y": 300,
"wires": [
[
"badf60852443c51a"
]
]
},
{
"id": "ecca1025aa227dc9",
"type": "debug",
"z": "a0a13470cb75b19e",
"name": "debug",
"active": true,
"tosidebar": true,
"console": false,
"tostatus": false,
"complete": "payload",
"targetType": "msg",
"statusVal": "",
"statusType": "auto",
"x": 1310,
"y": 320,
"wires": []
},
{
"id": "badf60852443c51a",
"type": "zeromq request",
"z": "a0a13470cb75b19e",
"name": "",
"fields": "payload",
"server": "tcp://baslervisionconnector-x86-64:5555",
"output": "string",
"isserver": false,
"intype": "req",
"x": 1180,
"y": 320,
"wires": [
[
"ecca1025aa227dc9"
]
]
},
{
"id": "f0d916b21bb7837a",
"type": "inject",
"z": "a0a13470cb75b19e",
"name": "OpenDevice",
"props": [
{
"p": "payload"
},
{
"p": "topic",
"vt": "str"
}
],
"repeat": "",
"crontab": "",
"once": false,
"onceDelay": 0.1,
"topic": "",
"payload": "{\"Action\":\"OpenDevice\",\"DeviceID\":\"Device ID\"}",
"payloadType": "json",
"x": 770,
"y": 340,
"wires": [
[
"55192b93decc7c44"
]
]
},
{
"id": "3896a10752735e93",
"type": "inject",
"z": "a0a13470cb75b19e",
"name": "CloseDevice",
"props": [
{
"p": "payload"
},
{
"p": "topic",
"vt": "str"
}
],
"repeat": "",
"crontab": "",
"once": false,
"onceDelay": 0.1,
"topic": "",
"payload": "{\"Action\":\"CloseDevice\",\"DeviceID\":\"Device ID\"}",
"payloadType": "json",
"x": 770,
"y": 380,
"wires": [
[
"55192b93decc7c44"
]
]
},
{
"id": "f8588afb42fceba1",
"type": "zeromq in",
"z": "a0a13470cb75b19e",
"name": "",
"topic": "40062774/stream",
"fields": "topic,image,metadata",
"server": "tcp://baslervisionconnector-x86-64:5556",
"output": "buffer",
"isserver": false,
"intype": "sub",
"x": 780,
"y": 620,
"wires": [
[
"2e60608a45307819"
]
]
},
{
"id": "2e60608a45307819",
"type": "debug",
"z": "a0a13470cb75b19e",
"name": "debug image stream",
"active": false,
"tosidebar": true,
"console": false,
"tostatus": false,
"complete": "true",
"targetType": "full",
"statusVal": "",
"statusType": "auto",
"x": 1000,
"y": 620,
"wires": []
},
{
"id": "44cc9bda7fd098d4",
"type": "inject",
"z": "a0a13470cb75b19e",
"name": "StartStreaming",
"props": [
{
"p": "payload"
},
{
"p": "topic",
"vt": "str"
}
],
"repeat": "",
"crontab": "",
"once": false,
"onceDelay": 0.1,
"topic": "",
"payload": "{\"Action\":\"StartStreaming\",\"DeviceID\":\"Device ID\"}",
"payloadType": "json",
"x": 780,
"y": 420,
"wires": [
[
"55192b93decc7c44"
]
]
},
{
"id": "412fe2cf539bd1cc",
"type": "inject",
"z": "a0a13470cb75b19e",
"name": "StopStreaming",
"props": [
{
"p": "payload"
},
{
"p": "topic",
"vt": "str"
}
],
"repeat": "",
"crontab": "",
"once": false,
"onceDelay": 0.1,
"topic": "",
"payload": "{\"Action\":\"StopStreaming\",\"DeviceID\":\"Device ID\"}",
"payloadType": "json",
"x": 780,
"y": 460,
"wires": [
[
"55192b93decc7c44"
]
]
},
{
"id": "809fafe130fc3385",
"type": "inject",
"z": "a0a13470cb75b19e",
"name": "GetStatus",
"props": [
{
"p": "payload"
}
],
"repeat": "",
"crontab": "",
"once": false,
"onceDelay": 0.1,
"topic": "",
"payload": "{\"Action\":\"GetStatus\"}",
"payloadType": "json",
"x": 760,
"y": 260,
"wires": [
[
"badf60852443c51a"
]
]
},
{
"id": "55192b93decc7c44",
"type": "function",
"z": "a0a13470cb75b19e",
"name": "Device ID",
"func": "let jsonMessage = msg.payload;\njsonMessage.DeviceID = \"40062774\";\n\nmsg.payload = jsonMessage;\n\nreturn msg;",
"outputs": 1,
"timeout": 0,
"noerr": 0,
"initialize": "",
"finalize": "",
"libs": [],
"x": 1040,
"y": 380,
"wires": [
[
"badf60852443c51a"
]
]
},
{
"id": "fc71dc1ac25e9f30",
"type": "comment",
"z": "a0a13470cb75b19e",
"name": "Update Device ID in subscribe topic",
"info": "",
"x": 840,
"y": 580,
"wires": []
},
{
"id": "81059b5f1b8b23c8",
"type": "comment",
"z": "a0a13470cb75b19e",
"name": "This example demonstrates how to use Basler Vision Conenctor using ZMQ Nodes. \\n \\n Note: Before execution, ensure that the camera ID is correctly set in the Device ID node.\\n ",
"info": "",
"x": 960,
"y": 160,
"wires": []
}
]