Generic Device
10 min
review the following information for setting up and configuring the generic device driver the generic device driver is a user configured client driver which connects to tcp, udp, or serial servers such as sensors, scales, or barcode scanners use this driver to build requests or commands to send to servers, or receive and parse streaming data from servers manufacturing connect edge compatible series compatibility parameter compatible items driver type ethernet (tcp, udp), serial validated devices/series generic tcp servers, keyence sr 750, parker sensonode receiver replaces gen 1 driver(s) n/a to set up and configure this device in manufacturing connect edge, you will need to do the following step 1 set up and configure the device step 2 set up the device in manufacturing connect edge devicehub step 3 configure the list of registers step 1 set up and configure the device ensure the device is configured for tcp/udp/serial access and find its communication parameters, including ip address and port number serial communication parameters any required connection payload to establish connection with the device step 2 set up the device in manufacturing connect edge devicehub configure the following parameters when you connect a device docid\ nm1lqfefya dsiffitity with this driver update default values to the specific setup of your device parameter value type generic driver generic device transport tcp udp serial ip address if tcp or udp is selected the device ip address you recorded in step 1 port if tcp or udp is selected the device port number you recorded in step 1 device file if serial is selected the file of the serial port you are using baud rate if serial is selected 1200 2400 4800 9600 19200 38400 57600 115200 230400 460800 921600 data bits if serial is selected 5 6 7 8 stop bits if serial is selected 1 1 5 2 parity if serial is selected even mark none odd space connection request enable/disable connection request if enabled, this field is used to enter the command that is required by the device to initiate the connection protocol byte order bigendian (bytes little) badc bigendian abcd littleendian (bytes big) cdab littleendian dcba data byte order bigendian (bytes little) badc bigendian abcd littleendian (bytes big) cdab littleendian dcba multiple connections if tcp or udp is selected enable/disable for multiple streams enable tls if tcp is selected enable/disable tls encryption step 3 configure the list of registers when you add tags docid\ h5heqicxrcy3nch9kbg9i to the connected device, refer to the following register table and tag parameters refer to the following additional resources organize device and tag data by using metadata docid\ jouzsq77y8z4dt jdgct tag formula variables docid 4yhyz92z7ggpgswqp05tf register table name value types access type description poll poll request uint8, uint16, uint32, uint64, int8, int16, int32, int64, float32, float64, string, \[]byte r/o poll request sends a request and reads the response from the device at regular polling intervals or when triggered write write request uint8, uint16, uint32, uint64, int8, int16, int32, int64, float32, float64, string, \[]byte r/w write request sends a write command to the device when triggered stream stream request uint8, uint16, uint32, uint64, int8, int16, int32, int64, float32, float64, string, \[]byte r/o stream request listens for unsolicited data from the device response linked response value uint8, uint16, uint32, uint64, int8, int16, int32, int64, float32, float64, string, \[]byte r/o linked response value parses additional value from existing poll/stream requests this tag is useful when a single poll/stream response contains multiple values and you want to parse each one separately tag parameters name select a register name from the drop down list the available options depend on the names in the register table value type select a data type from the drop down list the available options depend on the register name selected supported types include uint8, uint16, uint32, uint64, int8, int16, int32, int64, float32, float64, string, \[]byte polling interval enter a value in seconds this determines how often the tag should poll the register for data tag name enter a name for the tag description (optional) enter a description for the tag payload enter the command/request that needs to be send to the device in hex string or ascii format refer to the following examples if you want to send a command test with command terminator \r to the device, in the payload, enter "test\r", or "test" 0d, or 544553540d make sure that the value type is string request params enter the request params formatted as json this field is used to enter address or area code that can be used in request this field should be kept empty if no request params are needed and user just needs to send command example {"addr" "0007"} response index enter the start index of values within response value length enter the length of single value in bytes (0 for entire response) response terminator specifies the characters or byte sequence (for example \r\n) that indicate the end of the device response include terminator enable to include the response terminator in the value response max length input the largest full response frame size driver is allowed to read from socket before parsing stops (0 for unlimited) override transport enable to define alternate endpoint for single request note connection of override transport is not persistent tag formula enter a formula for the tag to process the generated data two variables are permitted value (current tag value) and timestamp (current tag unix time in milliseconds) the following math functions are available sin cos sqrt tan power power ( x ) performs the operation 10^x log log(x) is the natural logarithm (the logarithm is in base e ) exp exp ( x ) performs the operation e^x only publish on change of value select the checkbox to customize nats messages to be published only when the value parameter changes to a new one change of value only applies to boolean, numeric (such as int or float), and simple string data types it does not apply to complex types, such as json or array poll once topics will not be affected by change of value settings these topics will still only see a single message meta data metadata summarizes basic information about data this feature allows you to define key value pair data for the device output payload later on it can then be used to find, use, and reuse particular instances of data note if you use special characters in meta data key names, the special characters are replaced with underscore characters in the payload this can cause two key names to be combined into one for example, configuring the key names a b and a&\&b will cause only one key name to be created (a b) example send a print command to a barcode printer the following example shows how to configure the generic device driver to send print commands to a tcp enabled barcode printer step 1 set up and configure the device ensure the printer is connected to your network collect the following the printer's ip address and port number the print command and syntax required by the printer's language (for example, zpl, ipl, or dpl) refer to your printer's documentation the response terminator used by the printer (for example, \r\n ) step 2 set up the device in manufacturing connect edge devicehub configure the following parameters when connecting the device parameter value type generic driver generic device transport tcp ip address your printer's ip address port your printer's port number recorded in step 1 step 3 configure the tag add a tag to the device with the following parameters parameter value name write write request value type string payload the print command for your printer enclosed in quotation marks "" for example, if the printer uses print as its print command, enter "print" response index 0 value length 0 (0 for entire response) response terminator the terminator used by your printer (for example, \r\n ) to trigger a print, publish to the write topic of the configured tag