Added more icsneo functions
parent
a6f8684a0c
commit
e4f69dfcc3
|
|
@ -147,7 +147,6 @@ ICSNEO_API icsneo_error_t icsneo_device_type(icsneo_device_t* device, icsneo_dev
|
||||||
return icsneo_error_invalid_parameters;
|
return icsneo_error_invalid_parameters;
|
||||||
}
|
}
|
||||||
auto dev = device->device;
|
auto dev = device->device;
|
||||||
// TODO: We should expose these types
|
|
||||||
*value = dev->getType().getDeviceType();
|
*value = dev->getType().getDeviceType();
|
||||||
|
|
||||||
return icsneo_error_success;
|
return icsneo_error_success;
|
||||||
|
|
@ -166,3 +165,58 @@ ICSNEO_API icsneo_error_t icsneo_device_serial(icsneo_device_t* device, const ch
|
||||||
|
|
||||||
return icsneo_error_success;
|
return icsneo_error_success;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
ICSNEO_API icsneo_error_t icsneo_go_online(icsneo_device_t* device, bool go_online) {
|
||||||
|
if (!device) {
|
||||||
|
return icsneo_error_invalid_parameters;
|
||||||
|
}
|
||||||
|
auto dev = device->device;
|
||||||
|
// Go online
|
||||||
|
if (go_online && dev->goOnline()) {
|
||||||
|
return icsneo_error_success;
|
||||||
|
}
|
||||||
|
// Go offline
|
||||||
|
if (!go_online && dev->goOffline()) {
|
||||||
|
return icsneo_error_success;
|
||||||
|
}
|
||||||
|
|
||||||
|
return icsneo_error_go_online_failed;
|
||||||
|
}
|
||||||
|
|
||||||
|
ICSNEO_API icsneo_error_t icsneo_is_online(icsneo_device_t* device, bool* is_online) {
|
||||||
|
if (!device || !is_online) {
|
||||||
|
return icsneo_error_invalid_parameters;
|
||||||
|
}
|
||||||
|
auto dev = device->device;
|
||||||
|
*is_online = dev->isOnline();
|
||||||
|
|
||||||
|
return icsneo_error_success;
|
||||||
|
}
|
||||||
|
|
||||||
|
ICSNEO_API icsneo_error_t icsneo_set_message_polling(icsneo_device_t* device, bool enable) {
|
||||||
|
if (!device) {
|
||||||
|
return icsneo_error_invalid_parameters;
|
||||||
|
}
|
||||||
|
auto dev = device->device;
|
||||||
|
// Enable message polling
|
||||||
|
if (enable && dev->enableMessagePolling()) {
|
||||||
|
return icsneo_error_success;
|
||||||
|
}
|
||||||
|
// Disable message polling
|
||||||
|
if (!enable && dev->disableMessagePolling()) {
|
||||||
|
return icsneo_error_success;
|
||||||
|
}
|
||||||
|
|
||||||
|
return icsneo_error_enable_message_polling_failed;
|
||||||
|
}
|
||||||
|
|
||||||
|
ICSNEO_API icsneo_error_t icsneo_get_message_polling(icsneo_device_t* device, bool* is_enabled) {
|
||||||
|
if (!device || !is_enabled) {
|
||||||
|
return icsneo_error_invalid_parameters;
|
||||||
|
}
|
||||||
|
auto dev = device->device;
|
||||||
|
*is_enabled = dev->isMessagePollingEnabled();
|
||||||
|
|
||||||
|
return icsneo_error_success;
|
||||||
|
}
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,7 @@
|
||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
#include <stdint.h>
|
#include <stdint.h>
|
||||||
|
#include <stdbool.h>
|
||||||
|
|
||||||
#include <icsneo/icsneotypes.h>
|
#include <icsneo/icsneotypes.h>
|
||||||
|
|
||||||
|
|
@ -153,6 +154,46 @@ ICSNEO_API icsneo_error_t icsneo_device_type(icsneo_device_t* device, icsneo_dev
|
||||||
*/
|
*/
|
||||||
ICSNEO_API icsneo_error_t icsneo_device_serial(icsneo_device_t* device, const char* value, uint32_t* value_length);
|
ICSNEO_API icsneo_error_t icsneo_device_serial(icsneo_device_t* device, const char* value, uint32_t* value_length);
|
||||||
|
|
||||||
|
|
||||||
|
/** @brief Set the online state of a device.
|
||||||
|
*
|
||||||
|
* @param[in] icsneo_device_t device The device to set the online state of.
|
||||||
|
* @param[in] bool go_online true to go online, false to go offline.
|
||||||
|
*
|
||||||
|
* @return icsneo_error_t icsneo_error_success if successful, icsneo_error_invalid_parameters otherwise.
|
||||||
|
*/
|
||||||
|
ICSNEO_API icsneo_error_t icsneo_go_online(icsneo_device_t* device, bool go_online);
|
||||||
|
|
||||||
|
/** @brief Get the online state of a device.
|
||||||
|
*
|
||||||
|
* @param[in] icsneo_device_t device The device to set the online state of.
|
||||||
|
* @param[out] bool true if online, false if offline.
|
||||||
|
*
|
||||||
|
* @return icsneo_error_t icsneo_error_success if successful, icsneo_error_invalid_parameters otherwise.
|
||||||
|
*/
|
||||||
|
ICSNEO_API icsneo_error_t icsneo_is_online(icsneo_device_t* device, bool* is_online);
|
||||||
|
|
||||||
|
|
||||||
|
/** @brief Set the message polling state of a device.
|
||||||
|
*
|
||||||
|
* @param[in] icsneo_device_t device The device to set the message polling state of.
|
||||||
|
* @param[in] bool enable true to enable message polling, false to disable message polling..
|
||||||
|
*
|
||||||
|
* @return icsneo_error_t icsneo_error_success if successful, icsneo_error_invalid_parameters otherwise.
|
||||||
|
*/
|
||||||
|
ICSNEO_API icsneo_error_t icsneo_set_message_polling(icsneo_device_t* device, bool enable);
|
||||||
|
|
||||||
|
/** @brief Get the message polling state of a device.
|
||||||
|
*
|
||||||
|
* @param[in] icsneo_device_t device The device to set the message polling state of.
|
||||||
|
* @param[out] bool is_enabled true if message polling is enabled, false if message polling is disabled.
|
||||||
|
*
|
||||||
|
* @return icsneo_error_t icsneo_error_success if successful, icsneo_error_invalid_parameters otherwise.
|
||||||
|
*/
|
||||||
|
ICSNEO_API icsneo_error_t icsneo_get_message_polling(icsneo_device_t* device, bool* is_enabled);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
Loading…
Reference in New Issue