1.7.6. DLN_GET_DEVICE_COUNT
GET_DEVICE_COUNT Command
Go to responseThe DLN_GET_DEVICE_COUNT command retrieves the total number of DLN-devices available.
typedef struct
{
DLN_MSG_HEADER header;
uint16_t filter;
uint32_t hardwareType;
uint32_t sn;
uint32_t id;
} __PACKED_ATTR DLN_GET_DEVICE_COUNT_CMD;
Parameters:
- header
- Defines the DLN message header
DLN_MSG_HEADER. The header
contains several predefined
fields and is used to identify and route messages. When sending the
command, a user must fill the following fields:
- size - The size of the message. Must be equal to the size of the DLN_GET_DEVICE_COUNT_CMD structure.
- msgId - Defines the message. For the DLN_GET_DEVICE_COUNT command it must be set to 0x0020. You can use the DLN_MSG_ID_GET_DEVICE_COUNT constant.
- echoCounter - Can be used to link a command to a response. The response will have the same echoCounter value. This field can be any numerical value from 0 to 0xFFFF (65536).
- handle - A handle to the DLN-series adapter. For the DLN_GET_DEVICE_COUNT command the HDLN_ALL_DEVICES value must be used.
- filter
A bit field that defines how the device will be identified for counting. Each bit corresponds to a DLN-series adapter identification, namely:
Bit Identification 0 Hardware type 1 Device serial number 2 Device ID number Only the identifications with corresponding mask bits set to 1 will be taken into account. The identifications with mask bits set to 0 will be ignored.
A user can set several mask bits to 1. This way only devices with all identifications matching the specified ones will be counted.
For example, if we need to count the devices with the specific hardware type and ID number, we should set the filter parameter as follows:
010You can use the following constants:
- DLN_DEVICE_FILTER_NUMBER - the number parameter;
- DLN_DEVICE_FILTER_HW_TYPE - the hardwareType parameter;
- DLN_DEVICE_FILTER_SN - the sn parameter;
- DLN_DEVICE_FILTER_ID - the id parameter;
- hardwareType
- A type of the DLN-series adapter.
- sn
- A serial number of the DLN-series adapter.
- id
- An ID number of the DLN-series adapter.
DLN_GET_DEVICE_COUNT Response
Go to commandThe adapter sends the DLN_GET_DEVICE_COUNT response after the command execution. The response will contain the number of connected devices.
typedef struct
{
DLN_MSG_HEADER header;
DLN_RESULT result;
uint32_t deviceCount;
} __PACKED_ATTR DLN_GET_DEVICE_COUNT_RSP;
Parameters:
- header
Defines the DLN message header DLN_MSG_HEADER. The response header contains the following fields:
- size - The size of the message. It is equal to the size of the DLN_GET_DEVICE_COUNT_RSP structure.
- msgId - Defines the message. For the DLN_GET_DEVICE_COUNT response it is set to 0x0020. The DLN_MSG_ID_GET_DEVICE_COUNT constant can be used.
- echoCounter - Links a command to a response. The echoCounter value is copied from the respective command header.
- handle - A handle to the DLN-series adapter. For the DLN_GET_DEVICE_COUNT response the HDLN_ALL_DEVICES value is used.
- result
Contains the result of the command execution. The following values are available:
- DLN_RES_SUCCESS - the number of the connected devices has been successfully retrieved.
- deviceCount
- The number of connected devices.
2006-2012