![]() |
IDTech Windows SDK Guide
3.2.4.393
API reference for Visual Studio .Net
|
Zero Messaging Queue (ZMQ) allows you to turn your PC into a server that can service remote requests from IDTech ZMQ Clients.
IDTech ZMQ Server SDK can be utilized to create a server app that controls locally connected IDTech devices (usually USB connected). The ZMQ Server will spin up a TCP/IP listener socket that ZMQ Clients can connect to. This not only allows you ZMQ Clients to be located in remote locations, but also give you the ability to control the IDTech device connected to the ZMQ Server from muliple locations/clients.
For your project, import from NuGet the library IDTechZMQ_Server.
After the library is linked, add it's refernce to your form/project
If you are building a GUI interface and would like the server app to display/report information, you have the following four callback you can optionally utilize:
You set the callback usually upon form/project initialization by utilizing the RemoteAPI class
To start the ZMQ server, you utilize the following API from the RemoteAPI class:
The RemoteAPI class has a singleton instance called SharedController.
Example to start and stop the ZMQ Server:
The ZMQ Client SDK device API are in the IDT_Device class which mirrors the same methods/signatures as the IDT_Device class in our main IDTechSDK_STD SDK. This means the implementation is identical to using IDTechSDK_STD SDK (when using IDT_Device class and not individual device classes like IDT_VP330 and IDT_NEO2), except for the device connection.
When using IDTechSDK_STD, you enable USB and devices automaically appear. When using ZMQ Client SDK, you must first connect to the ZMQ Server app, and once that is established, any devices connected to ZMQ Server app will be passed to the ZMQ Client app as if they are locally attached.
You establish your application as you would if using the regular IDTechSDK_STD, but you must only send device commands using IDT_Device class.
Establish/test your application for local device access using IDTechSDK_STD. Once you are happy with the operation and ready to convert it to a ZMQ Client app, remove the link to IDTechSDK_STD, and instead import from NuGet IDTechZMQ_Client.
There should be no error in your app after importing the client SDK. If there are any, it probably is because your app using individual device class calls (IDT_VP3300.SharedController.device_getFirmawareVersion(ref ver, ident)), instead of the IDT_Device version (IDT_Device.SharedController.device_getFirmawareVersion(ref ver, ident)). Please update any of your existing methods if this is the case.
To connect/disconnect your client to the server app, you use the following API call
port: The port were the server is running at
Example to start and stop the ZMQ Client:
The following steps will allow you to execute a ZMQ Server/Client environment using sample code provided by IDTech. This requires you to open IDTech uDemo source code in Visual Studio and adjust the imported SDK.
Please download and unzip the ZMQ Server App
Please download and unzip IDTech uDemo source code
In Visual Studio, open uDemo with file SDKDemo.csproj
Right-click on SDKDemo project, and Manage Nuget Packages...
Under the Installed tab, click the red X to REMOVE IDTechSDK_STD
Under the Browse tab, Browse and install IDTechSDK_Client
Plug a device into your PC, example VP3350
In the ZMQ Sever App bin/Release folder, run the server app ZMQ_Server_App.exe
Click "Start Server" and enter one of the valid IP address the server NIC has access to. In our example, we will use 10.211.55.27
You should see the server successfully start, and the VP3300 as connected device
Back in Visual Studio, run uDemo. Select Menu->Enable Client.
You will be asked to provide a name of your client. Example "SDK_DEMO".
You will be asked the address of the server. In our example, we are using 10.211.55.27
You will now see uDemo connect the client, and you will see the server app serving the client.
At this point, you can now send commands to the VP3300.