The icsneolegacy API finds devices correctly now

This commit is contained in:
Paul Hollinsky
2018-09-27 13:34:16 -04:00
parent 06b7181492
commit 2b443ad83d
3 changed files with 13 additions and 11 deletions
+3 -2
View File
@@ -6,11 +6,12 @@
static NeoDevice OldNeoDeviceFromNew(const neodevice_t* newnd) {
NeoDevice oldnd = { 0 };
oldnd.DeviceType = newnd->type;
oldnd.SerialNumber = icsneo_serialStringToNum(newnd->serial);
oldnd.NumberOfClients = 0;
oldnd.MaxAllowedClients = 1;
static_assert(sizeof(neodevice_handle_t) <= sizeof(oldnd.Handle), "neodevice_handle_t size must be at least sizeof(int) for compatibility reasons");
*(neodevice_handle_t*)(&oldnd.Handle) = newnd->handle;
static_assert(sizeof(neodevice_handle_t) == sizeof(oldnd.Handle), "neodevice_handle_t size must be sizeof(int) for compatibility reasons");
oldnd.Handle = newnd->handle;
return oldnd;
}