Barcode scanners developed by Cognex can be configured to send data to ClearStream, and then ClearStream will stream the barcode data to the user-selected destination. To configure a Cognex barcode scanner follow the steps below.
- Install the Cognex DataMan Setup Utility.
- Open the setup utility and allow it to find your Cognex barcode reader.
- Double click on the barcode reader to configure it (take note of the serial number at this step).
- Navigate to the Communication category within the setup utility.
- Set the Destination to ‘Ethernet/IP’, set the Type to TCP, and set the IP address to the IP address where ClearStream is running. If required, you can also set the port that ClearStream should be listening on to receive the barcode TCP data (make sure this port is open on the PC running ClearStream).
Note: To set the destination IP/Port, you need to disable the option in order for you to be able to change the settings, and then you need to re-enable the setting once done.
- Navigate to the Data Formatting category of the setup utility and select the Custom Script section. Enter the script as below:
function onResult (decodeResults, readerProperties, output){
var mac = dmccGet('DEVICE.MAC-ADDRESS').response;
var serial = dmccGet('DEVICE.SERIAL-NUMBER').response;
if (decodeResults[0].decoded){
output.content = '[{"MAC":"'+ mac+'","DeviceID":"'+serial+'","barcode":"'+ decodeResults[0].content +'"}]’;
}
}
- Save your settings, and allow the device to reboot.
At this point, the barcode scanner is configured to send all barcode data to the IP address specified. ClearStream will now need to be configured to listen for this data, and map it to a destination following the steps below:
- Install/Open ClearStream RFID.
- Create a new project, and add a Profile/Process.
- From the source side of the configuration screen, click on the Devices button.
- Add a new Device to the configuration of type Cognex.
- Set the Device ID to match the serial number that was noted in the earlier step. This is used to verify the scanned data from the barcode data, as well as indicate which reader the scanned data is being sent from.
- Add a Custom Field called barcode to the Custom field list. You will note that this matched the JSON field from the custom script section.
- On the Data Settings tab select the barcode field as the Key Field.
- From the Device tab, set the Listener Type to TCP, and set the port to match what you selected during the barcode reader setup.
- Configure a destination for the barcode device, and map the columns as appropriate.
- Save the project.
ClearStream can now be started by navigating to the form Start/Stop, and clicking the Start Selected on this device. Anytime a barcode is decoded by the Cognex reader, it will be sent to ClearStream and streamed to the selected destination.
Comments
0 comments
Article is closed for comments.