Add a device info event for the Reefnet Sensus Original, Pro and Ultra.
This commit is contained in:
parent
75d3792016
commit
64e3f4b4bf
@ -244,6 +244,13 @@ reefnet_sensus_device_handshake (device_t *abstract, unsigned char *data, unsign
|
||||
|
||||
memcpy (data, handshake + 2, REEFNET_SENSUS_HANDSHAKE_SIZE);
|
||||
|
||||
// Emit a device info event.
|
||||
device_devinfo_t devinfo;
|
||||
devinfo.model = handshake[2] - '0';
|
||||
devinfo.firmware = handshake[3] - '0';
|
||||
devinfo.serial = handshake[6] + (handshake[7] << 8);
|
||||
device_event_emit (abstract, DEVICE_EVENT_DEVINFO, &devinfo);
|
||||
|
||||
// Wait at least 10 ms to ensures the data line is
|
||||
// clear before transmission from the host begins.
|
||||
|
||||
|
||||
@ -215,6 +215,13 @@ reefnet_sensuspro_device_handshake (device_t *abstract, unsigned char *data, uns
|
||||
|
||||
memcpy (data, handshake, REEFNET_SENSUSPRO_HANDSHAKE_SIZE);
|
||||
|
||||
// Emit a device info event.
|
||||
device_devinfo_t devinfo;
|
||||
devinfo.model = handshake[0];
|
||||
devinfo.firmware = handshake[1];
|
||||
devinfo.serial = handshake[4] + (handshake[5] << 8);
|
||||
device_event_emit (abstract, DEVICE_EVENT_DEVINFO, &devinfo);
|
||||
|
||||
serial_sleep (10);
|
||||
|
||||
return DEVICE_STATUS_SUCCESS;
|
||||
|
||||
@ -329,6 +329,13 @@ reefnet_sensusultra_device_handshake (device_t *abstract, unsigned char *data, u
|
||||
|
||||
memcpy (data, handshake, REEFNET_SENSUSULTRA_HANDSHAKE_SIZE);
|
||||
|
||||
// Emit a device info event.
|
||||
device_devinfo_t devinfo;
|
||||
devinfo.model = handshake[1];
|
||||
devinfo.firmware = handshake[0];
|
||||
devinfo.serial = handshake[2] + (handshake[3] << 8);
|
||||
device_event_emit (abstract, DEVICE_EVENT_DEVINFO, &devinfo);
|
||||
|
||||
return DEVICE_STATUS_SUCCESS;
|
||||
}
|
||||
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user