Skip to content

Basler Vision Connector: ZMQ JSON Test File#

This ZMQ sample demonstrates how to use the Basler Vision Connector to open or close a camera by injecting JSON commands via the ZMQ protocol.

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": "4a40dc15014b9a20",
        "type": "tab",
        "label": "Flow 1",
        "disabled": false,
        "info": "",
        "env": []
    },
    {
        "id": "152000978925fa93",
        "type": "inject",
        "z": "4a40dc15014b9a20",
        "name": "EnumerateDevices",
        "props": [
            {"p": "payload"},
            {
                "p": "topic",
                "vt": "str"
            }
        ],
        "repeat": "",
        "crontab": "",
        "once": false,
        "onceDelay": 0.1,
        "topic": "",
        "payload": "{\"TransactionID\": \"1\", \"Action\": \"EnumerateDevices\"}",
        "payloadType": "json",
        "x": 770,
        "y": 300,
        "wires": [
            ["714d8f1b0818057c"]
        ]
    },
    {
        "id": "9d488911cabe0a27",
        "type": "debug",
        "z": "4a40dc15014b9a20",
        "name": "debug",
        "active": true,
        "tosidebar": true,
        "console": false,
        "tostatus": false,
        "complete": "payload",
        "targetType": "msg",
        "statusVal": "",
        "statusType": "auto",
        "x": 1150,
        "y": 380,
        "wires": []
    },
    {
        "id": "714d8f1b0818057c",
        "type": "zeromq request",
        "z": "4a40dc15014b9a20",
        "name": "",
        "fields": "payload",
        "server": "tcp://baslervisionconnector-multi-x86-64:5555",
        "output": "string",
        "isserver": false,
        "intype": "req",
        "x": 1000,
        "y": 380,
        "wires": [
            ["9d488911cabe0a27"]
        ]
    },
    {
        "id": "e6cc45d3db48617a",
        "type": "inject",
        "z": "4a40dc15014b9a20",
        "name": "OpenDevice",
        "props": [
            {"p": "payload"},
            {
                "p": "topic",
                "vt": "str"
            }
        ],
        "repeat": "",
        "crontab": "",
        "once": false,
        "onceDelay": 0.1,
        "topic": "",
        "payload": "{\"TransactionID\": \"12\", \"Action\": \"OpenDevice\", \"DeviceID\": \"40062774\"}",
        "payloadType": "json",
        "x": 770,
        "y": 340,
        "wires": [
            ["714d8f1b0818057c"]
        ]
    },
    {
        "id": "38e9c602f73ae725",
        "type": "inject",
        "z": "4a40dc15014b9a20",
        "name": "CloseDevice",
        "props": [
            {"p": "payload"},
            {
                "p": "topic",
                "vt": "str"
            }
        ],
        "repeat": "",
        "crontab": "",
        "once": false,
        "onceDelay": 0.1,
        "topic": "",
        "payload": "{\"TransactionID\": \"12\", \"Action\": \"CloseDevice\", \"DeviceID\": \"40062774\"}",
        "payloadType": "json",
        "x": 770,
        "y": 380,
        "wires": [
            ["714d8f1b0818057c"]
        ]
    },
    {
        "id": "abe9f81be854bc27",
        "type": "zeromq in",
        "z": "4a40dc15014b9a20",
        "name": "",
        "topic": "40062774/stream",
        "fields": "topic,image,metadata",
        "server": "tcp://baslervisionconnector-multi-x86-64:5556",
        "output": "buffer",
        "isserver": false,
        "intype": "sub",
        "x": 840,
        "y": 540,
        "wires": [
            ["a4b9d49bdbcda0b4"]
        ]
    },
    {
        "id": "a4b9d49bdbcda0b4",
        "type": "debug",
        "z": "4a40dc15014b9a20",
        "name": "debug image stream",
        "active": false,
        "tosidebar": true,
        "console": false,
        "tostatus": false,
        "complete": "true",
        "targetType": "full",
        "statusVal": "",
        "statusType": "auto",
        "x": 1060,
        "y": 540,
        "wires": []
    },
    {
        "id": "3c90c86f5ce77086",
        "type": "inject",
        "z": "4a40dc15014b9a20",
        "name": "StartStreaming",
        "props": [
            {"p": "payload"},
            {
                "p": "topic",
                "vt": "str"
            }
        ],
        "repeat": "",
        "crontab": "",
        "once": false,
        "onceDelay": 0.1,
        "topic": "",
        "payload": "{\"Action\": \"StartStreaming\", \"DeviceID\": \"40062774\"}",
        "payloadType": "json",
        "x": 780,
        "y": 420,
        "wires": [
            ["714d8f1b0818057c"]
        ]
    },
    {
        "id": "12537745924f252e",
        "type": "inject",
        "z": "4a40dc15014b9a20",
        "name": "StopStreaming",
        "props": [
            {"p": "payload"},
            {
                "p": "topic",
                "vt": "str"
            }
        ],
        "repeat": "",
        "crontab": "",
        "once": false,
        "onceDelay": 0.1,
        "topic": "",
        "payload": "{\"Action\": \"StopStreaming\", \"DeviceID\": \"40062774\"}",
        "payloadType": "json",
        "x": 780,
        "y": 460,
        "wires": [
            ["714d8f1b0818057c"]
        ]
    }
]