Compare commits
3 Commits
200c488bba
...
c31d883b51
| Author | SHA1 | Date |
|---|---|---|
|
|
c31d883b51 | |
|
|
19df557b4a | |
|
|
7afa41bf2a |
|
|
@ -757,3 +757,33 @@ bool icsneo_isOnlineSupported(const neodevice_t* device) {
|
||||||
|
|
||||||
return device->device->isOnlineSupported();
|
return device->device->isOnlineSupported();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool icsneo_requestTC10Wake(const neodevice_t* device, neonetid_t netid) {
|
||||||
|
if(!icsneo_isValidNeoDevice(device))
|
||||||
|
return false;
|
||||||
|
|
||||||
|
return device->device->requestTC10Wake((Network::NetID)netid);
|
||||||
|
}
|
||||||
|
|
||||||
|
bool icsneo_requestTC10Sleep(const neodevice_t* device, neonetid_t netid) {
|
||||||
|
if(!icsneo_isValidNeoDevice(device))
|
||||||
|
return false;
|
||||||
|
|
||||||
|
return device->device->requestTC10Sleep((Network::NetID)netid);
|
||||||
|
}
|
||||||
|
|
||||||
|
bool icsneo_getTC10Status(const neodevice_t* device, neonetid_t netid, neotc10status_t* status) {
|
||||||
|
if(!icsneo_isValidNeoDevice(device))
|
||||||
|
return false;
|
||||||
|
|
||||||
|
const auto statusMsg = device->device->getTC10Status((Network::NetID)netid);
|
||||||
|
|
||||||
|
if(!statusMsg)
|
||||||
|
return false;
|
||||||
|
|
||||||
|
status->wakeStatus = (neotc10wakestatus_t)statusMsg->wakeStatus;
|
||||||
|
status->sleepStatus = (neotc10sleepstatus_t)statusMsg->sleepStatus;
|
||||||
|
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -4,24 +4,13 @@
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
|
|
||||||
#include "icsneo/communication/message/message.h"
|
#include "icsneo/communication/message/message.h"
|
||||||
|
#include "icsneo/communication/tc10.h"
|
||||||
|
|
||||||
#include <memory>
|
#include <memory>
|
||||||
|
|
||||||
namespace icsneo
|
namespace icsneo
|
||||||
{
|
{
|
||||||
|
|
||||||
enum class TC10WakeStatus : uint8_t {
|
|
||||||
NoWakeReceived,
|
|
||||||
WakeReceived,
|
|
||||||
};
|
|
||||||
|
|
||||||
enum class TC10SleepStatus : uint8_t {
|
|
||||||
NoSleepReceived,
|
|
||||||
SleepReceived,
|
|
||||||
SleepFailed,
|
|
||||||
SleepAborted,
|
|
||||||
};
|
|
||||||
|
|
||||||
class TC10StatusMessage : public Message {
|
class TC10StatusMessage : public Message {
|
||||||
public:
|
public:
|
||||||
static std::shared_ptr<TC10StatusMessage> DecodeToMessage(const std::vector<uint8_t>& bytestream);
|
static std::shared_ptr<TC10StatusMessage> DecodeToMessage(const std::vector<uint8_t>& bytestream);
|
||||||
|
|
|
||||||
|
|
@ -0,0 +1,47 @@
|
||||||
|
#ifndef __ICSNEO_TC10_H_
|
||||||
|
#define __ICSNEO_TC10_H_
|
||||||
|
|
||||||
|
#ifdef __cplusplus
|
||||||
|
|
||||||
|
#include <cstdint>
|
||||||
|
|
||||||
|
namespace icsneo {
|
||||||
|
|
||||||
|
enum class TC10WakeStatus : uint8_t {
|
||||||
|
NoWakeReceived,
|
||||||
|
WakeReceived,
|
||||||
|
};
|
||||||
|
|
||||||
|
enum class TC10SleepStatus : uint8_t {
|
||||||
|
NoSleepReceived,
|
||||||
|
SleepReceived,
|
||||||
|
SleepFailed,
|
||||||
|
SleepAborted,
|
||||||
|
};
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
#endif // __cplusplus
|
||||||
|
|
||||||
|
#ifdef __ICSNEOC_H_
|
||||||
|
|
||||||
|
typedef enum _neotc10wakestatus_t {
|
||||||
|
ICSNEO_TC10_NO_WAKE_RECEIVED = 0,
|
||||||
|
ICSNEO_TC10_WAKE_RECEIVED = 1,
|
||||||
|
} neotc10wakestatus_t;
|
||||||
|
|
||||||
|
typedef enum _neotc10sleepstatus_t {
|
||||||
|
ICSNEO_TC10_NO_SLEEP_RECEIVED = 0,
|
||||||
|
ICSNEO_TC10_SLEEP_RECEIVED = 1,
|
||||||
|
ICSNEO_TC10_SLEEP_FAILED = 1,
|
||||||
|
ICSNEO_TC10_SLEEP_ABORTED = 1,
|
||||||
|
} neotc10sleepstatus_t;
|
||||||
|
|
||||||
|
typedef struct _neotc10status_t {
|
||||||
|
neotc10wakestatus_t wakeStatus;
|
||||||
|
neotc10sleepstatus_t sleepStatus;
|
||||||
|
} neotc10status_t;
|
||||||
|
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#endif // __ICSNEO_TC10_H_
|
||||||
|
|
@ -13,7 +13,12 @@ struct DeviceAppVersion {
|
||||||
uint8_t major = 0;
|
uint8_t major = 0;
|
||||||
uint8_t minor = 0;
|
uint8_t minor = 0;
|
||||||
|
|
||||||
|
DeviceAppVersion() = default;
|
||||||
|
DeviceAppVersion(const uint8_t major, const uint8_t minor)
|
||||||
|
: major(major), minor(minor) {}
|
||||||
|
|
||||||
bool operator!=(const DeviceAppVersion& rhs) const { return major != rhs.major || minor != rhs.minor; }
|
bool operator!=(const DeviceAppVersion& rhs) const { return major != rhs.major || minor != rhs.minor; }
|
||||||
|
bool operator==(const DeviceAppVersion& rhs) const { return major == rhs.major && minor == rhs.minor; }
|
||||||
};
|
};
|
||||||
|
|
||||||
} // namespace icsneo
|
} // namespace icsneo
|
||||||
|
|
|
||||||
|
|
@ -9,6 +9,7 @@
|
||||||
#include "icsneo/platform/dynamiclib.h" // Dynamic library loading and exporting
|
#include "icsneo/platform/dynamiclib.h" // Dynamic library loading and exporting
|
||||||
#include "icsneo/communication/network.h" // Network type and netID defines
|
#include "icsneo/communication/network.h" // Network type and netID defines
|
||||||
#include "icsneo/communication/io.h" // IO enum defines
|
#include "icsneo/communication/io.h" // IO enum defines
|
||||||
|
#include "icsneo/communication/tc10.h"
|
||||||
#include "icsneo/api/version.h" // For version info
|
#include "icsneo/api/version.h" // For version info
|
||||||
#include "icsneo/api/event.h" // For event and error info
|
#include "icsneo/api/event.h" // For event and error info
|
||||||
|
|
||||||
|
|
@ -845,6 +846,34 @@ extern bool DLLExport icsneo_setRTC(const neodevice_t* device, uint64_t input);
|
||||||
*/
|
*/
|
||||||
extern bool DLLExport icsneo_isOnlineSupported(const neodevice_t* device);
|
extern bool DLLExport icsneo_isOnlineSupported(const neodevice_t* device);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* \brief Request TC10 wake
|
||||||
|
* \param[in] device A pointer to the neodevice_t structure specifying the device to operate on.
|
||||||
|
* \param[in] netid The interface to request the TC10 wake on.
|
||||||
|
|
||||||
|
* \returns True if the device successfully sent the TC10 wake request.
|
||||||
|
*/
|
||||||
|
extern bool DLLExport icsneo_requestTC10Wake(const neodevice_t* device, neonetid_t netid);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* \brief Request TC10 sleep
|
||||||
|
* \param[in] device A pointer to the neodevice_t structure specifying the device to operate on.
|
||||||
|
* \param[in] netid The interface to request the TC10 sleep on.
|
||||||
|
|
||||||
|
* \returns True if the device successfully sent the TC10 sleep request.
|
||||||
|
*/
|
||||||
|
extern bool DLLExport icsneo_requestTC10Sleep(const neodevice_t* device, neonetid_t netid);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* \brief Query TC10 status
|
||||||
|
* \param[in] device A pointer to the neodevice_t structure specifying the device to operate on.
|
||||||
|
* \param[in] netid The interface to request the TC10 status for.
|
||||||
|
* \param[out] status The TC10 status for the given interface
|
||||||
|
|
||||||
|
* \returns True if the device successfully retreieved the TC10 status.
|
||||||
|
*/
|
||||||
|
extern bool DLLExport icsneo_getTC10Status(const neodevice_t* device, neonetid_t netid, neotc10status_t* status);
|
||||||
|
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
} // extern "C"
|
} // extern "C"
|
||||||
#endif
|
#endif
|
||||||
|
|
@ -1028,6 +1057,15 @@ fn_icsneo_setRTC icsneo_setRTC;
|
||||||
typedef bool(*fn_icsneo_isOnlineSupported)(const neodevice_t* device);
|
typedef bool(*fn_icsneo_isOnlineSupported)(const neodevice_t* device);
|
||||||
fn_icsneo_isOnlineSupported icsneo_isOnlineSupported;
|
fn_icsneo_isOnlineSupported icsneo_isOnlineSupported;
|
||||||
|
|
||||||
|
typedef bool(*fn_icsneo_requestTC10Wake)(const neodevice_t* device, neonetid_t netid);
|
||||||
|
fn_icsneo_requestTC10Wake icsneo_requestTC10Wake;
|
||||||
|
|
||||||
|
typedef bool(*fn_icsneo_requestTC10Sleep)(const neodevice_t* device, neonetid_t netid);
|
||||||
|
fn_icsneo_requestTC10Sleep icsneo_requestTC10Sleep;
|
||||||
|
|
||||||
|
typedef bool(*fn_icsneo_getTC10Status)(const neodevice_t* device, neonetid_t netid, neotc10status_t* status);
|
||||||
|
fn_icsneo_getTC10Status icsneo_getTC10Status;
|
||||||
|
|
||||||
#define ICSNEO_IMPORT(func) func = (fn_##func)icsneo_dynamicLibraryGetFunction(icsneo_libraryHandle, #func)
|
#define ICSNEO_IMPORT(func) func = (fn_##func)icsneo_dynamicLibraryGetFunction(icsneo_libraryHandle, #func)
|
||||||
#define ICSNEO_IMPORTASSERT(func) if((ICSNEO_IMPORT(func)) == NULL) return 3
|
#define ICSNEO_IMPORTASSERT(func) if((ICSNEO_IMPORT(func)) == NULL) return 3
|
||||||
void* icsneo_libraryHandle = NULL;
|
void* icsneo_libraryHandle = NULL;
|
||||||
|
|
@ -1101,6 +1139,9 @@ int icsneo_init() {
|
||||||
ICSNEO_IMPORTASSERT(icsneo_getRTC);
|
ICSNEO_IMPORTASSERT(icsneo_getRTC);
|
||||||
ICSNEO_IMPORTASSERT(icsneo_setRTC);
|
ICSNEO_IMPORTASSERT(icsneo_setRTC);
|
||||||
ICSNEO_IMPORTASSERT(icsneo_isOnlineSupported);
|
ICSNEO_IMPORTASSERT(icsneo_isOnlineSupported);
|
||||||
|
ICSNEO_IMPORTASSERT(icsneo_requestTC10Wake);
|
||||||
|
ICSNEO_IMPORTASSERT(icsneo_requestTC10Sleep);
|
||||||
|
ICSNEO_IMPORTASSERT(icsneo_getTC10Status);
|
||||||
|
|
||||||
icsneo_initialized = true;
|
icsneo_initialized = true;
|
||||||
return 0;
|
return 0;
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue