Compare commits

...

3 Commits

Author SHA1 Message Date
Francesco Valla c31d883b51
Merge 31d4a750d8 into 19df557b4a 2025-07-15 16:53:07 +02:00
Nicholas Zamora 19df557b4a DeviceAppVersion: Add operator== 2025-07-09 20:48:22 +00:00
Kyle Schwarz 7afa41bf2a API: C: Add TC10 2025-07-03 09:30:29 -04:00
5 changed files with 124 additions and 12 deletions

View File

@ -757,3 +757,33 @@ bool icsneo_isOnlineSupported(const neodevice_t* device) {
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;
}

View File

@ -4,24 +4,13 @@
#ifdef __cplusplus
#include "icsneo/communication/message/message.h"
#include "icsneo/communication/tc10.h"
#include <memory>
namespace icsneo
{
enum class TC10WakeStatus : uint8_t {
NoWakeReceived,
WakeReceived,
};
enum class TC10SleepStatus : uint8_t {
NoSleepReceived,
SleepReceived,
SleepFailed,
SleepAborted,
};
class TC10StatusMessage : public Message {
public:
static std::shared_ptr<TC10StatusMessage> DecodeToMessage(const std::vector<uint8_t>& bytestream);

View File

@ -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_

View File

@ -13,7 +13,12 @@ struct DeviceAppVersion {
uint8_t major = 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; }
};
} // namespace icsneo

View File

@ -9,6 +9,7 @@
#include "icsneo/platform/dynamiclib.h" // Dynamic library loading and exporting
#include "icsneo/communication/network.h" // Network type and netID 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/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);
/**
* \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
} // extern "C"
#endif
@ -1028,6 +1057,15 @@ fn_icsneo_setRTC icsneo_setRTC;
typedef bool(*fn_icsneo_isOnlineSupported)(const neodevice_t* device);
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_IMPORTASSERT(func) if((ICSNEO_IMPORT(func)) == NULL) return 3
void* icsneo_libraryHandle = NULL;
@ -1101,6 +1139,9 @@ int icsneo_init() {
ICSNEO_IMPORTASSERT(icsneo_getRTC);
ICSNEO_IMPORTASSERT(icsneo_setRTC);
ICSNEO_IMPORTASSERT(icsneo_isOnlineSupported);
ICSNEO_IMPORTASSERT(icsneo_requestTC10Wake);
ICSNEO_IMPORTASSERT(icsneo_requestTC10Sleep);
ICSNEO_IMPORTASSERT(icsneo_getTC10Status);
icsneo_initialized = true;
return 0;