dnsDeviceMsg, dnsDeviceMsgSync

dnsDeviceMsg, dnsDeviceMsgSync — send an explicit message to a device.

Synopsis

(dnsDeviceMsg card_id device service class instance [serviceData...])
(dnsDeviceMsgSync card_id device service class instance [serviceData...])
	

Parameters

card_id
The target card ID (0..3).
device
The MAC ID of the target device (0..63).
service
The DeviceNet service code.
class
The DeviceNet object class of which this is requested.
instance
The specific instance of the object class to which the request is directed.
serviceData
Optional data as required by the service, as a number of bytes. All bytes required by the service must be supplied.

Returns

If successful:

(dnsDeviceMsg card_id device service data1...dataN "data_string")

where datai is the i'th byte of the n bytes returned by the device, and data_string is the same data represented as a string, where '.' is used in place of unprintable characters.

Otherwise, one of the following error messages:

(error "dnsDeviceMsg DR_ERR_CARD_INVALID (time) invalid card: card_id")
(error "dnsDeviceMsg DR_ERR_NO_CARD (time) card not available")
(error "dnsDeviceMsg DVN_ERR_MSG_ILOCK (time)
        Device card_id:device msg interlock unavailable")
(error "dnsDeviceMsg DVN_ERR_MSG_CONNECTION (time)
        Device card_id:device Failed to open explicit connection")
(error "dnsDeviceMsg DVN_ERR_MSG_INTERNAL (time) Device card_id:device
        Internal msg error: Service service Errorcode error_code")
(error "dnsDeviceMsg DVN_ERR_MSG_DEVICE (time) Device card_id:device
        Device msg error: Service service Errorcode error_code")
(error "dnsDeviceMsg DVN_ERR_MSG_TRUNC (time) Device card_id:device msg truncated")
(error "dnsDeviceMsg DVN_ERR_MSG_TIMEOUT (time) Device card_id:device msg timeout")
(error "dnsDeviceMsg DVN_ERR_MSG_INTR (time) Device card_id:device msg SIGINTR")
(error "dnsDeviceMsg DVN_ERR_MSG_NOT_RCVD (time) Device card_id:device no msg received")

Description

These commands send the explicit message request to the specified device, returning with the response provided by the device.

Since some requests may not return an immediate response, and since in most cases the potential impact of the delay on normal I/O processing would not be acceptable, the dnsDeviceMsg command will suspend the client and continue to process all commands from other clients and card events until the response is received.

The dnsDeviceMsgSync form of the command will force the driver to ignore other commands or events until the reply is received from the device (or a timeout occurs), and is suitable for use in the configuration file to initialize the driver (before the driver enters the event loop).

Examples

  1. A request for the product code attribute returns the value 0x132:
    > (dnsDeviceMsg 0 2 0xe 1 1 3)
    (dnsDeviceMsg 0 2 0x000E 0x32 0x1 "2.")
  2. A request for the product name attribute returns as show below:
    > (dnsDeviceMsg 0 2 0xe 1 1 7)
    (dnsDeviceMsg 0 2 0x000E 0x19 0x20 0x20 0x57 0x41 0x47 0x4F 0x20 0x20 0x20
        0x37 0x35 0x30 0x2D 0x33 0x30 0x36 0x20 0x56 0x30 0x32 0x2E 0x30 0x32 0x20
        0x20 ".  WAGO   750-306 V02.02  ")
  3. Also see Appendix C, Macro Definitions for the dnsDeviceMsg command.