mirror of
https://github.com/intrepidcs/libicsneo.git
synced 2026-08-05 01:18:36 +02:00
icsneolegacy: Implemented get() and set() RTC functions
This commit is contained in:
@@ -12,6 +12,8 @@ enum class Command : uint8_t {
|
||||
NeoWriteMemory = 0x41,
|
||||
ClearCoreMini = 0x42,
|
||||
LoadCoreMini = 0x43,
|
||||
GetRTC = 0x49,
|
||||
SetRTC = 0x50,
|
||||
RequestSerialNumber = 0xA1,
|
||||
GetMainVersion = 0xA3, // Previously known as RED_CMD_APP_VERSION_REQ
|
||||
SetSettings = 0xA4, // Previously known as RED_CMD_SET_BAUD_REQ, follow up with SaveSettings to write to EEPROM
|
||||
|
||||
@@ -146,6 +146,7 @@ public:
|
||||
DWCAN16 = 541,
|
||||
LIN7 = 542,
|
||||
LIN8 = 543,
|
||||
RED_SET_RTC = 544,
|
||||
Any = 0xfffe, // Never actually set as type, but used as flag for filtering
|
||||
Invalid = 0xffff
|
||||
};
|
||||
@@ -325,6 +326,8 @@ public:
|
||||
case NetID::ExtendedCommand:
|
||||
case NetID::NeoMemorySDRead:
|
||||
case NetID::NeoMemoryWriteDone:
|
||||
case NetID::RED_GET_RTC:
|
||||
case NetID::RED_SET_RTC:
|
||||
return Type::Internal;
|
||||
case NetID::Invalid:
|
||||
case NetID::Any:
|
||||
@@ -453,6 +456,8 @@ public:
|
||||
return "RED_HARDWARE_EXCEP";
|
||||
case NetID::RED_GET_RTC:
|
||||
return "RED_GET_RTC";
|
||||
case NetID::RED_SET_RTC:
|
||||
return "RED_SET_RTC";
|
||||
case NetID::ISO9141_3:
|
||||
return "ISO 9141 3";
|
||||
case NetID::HSCAN2:
|
||||
|
||||
@@ -50,7 +50,6 @@
|
||||
#define ICSNEO_FINDABLE_DEVICE_BY_PID(className, type, pid) \
|
||||
static constexpr const uint16_t PRODUCT_ID = pid; \
|
||||
ICSNEO_FINDABLE_DEVICE_BASE(className, type)
|
||||
|
||||
namespace icsneo {
|
||||
|
||||
class DeviceExtension;
|
||||
@@ -545,6 +544,10 @@ public:
|
||||
*/
|
||||
virtual bool getEthPhyRegControlSupported() const { return false; }
|
||||
|
||||
//RTC declarations
|
||||
std::optional<std::chrono::time_point<std::chrono::system_clock>> getRTC();
|
||||
bool setRTC(const std::chrono::time_point<std::chrono::system_clock>& time);
|
||||
|
||||
/**
|
||||
* Returns true if this device supports the Wireless neoVI featureset
|
||||
*/
|
||||
|
||||
@@ -2442,6 +2442,16 @@ typedef struct
|
||||
uint8_t bIPV4_Address[4]; // The Ipv4 address assigned to the Network interface. If not available, all bytes are set to zero.
|
||||
} NETWORK_ADAPTER_INFO;
|
||||
|
||||
typedef struct
|
||||
{
|
||||
unsigned char sec;// --- Seconds (00-59)
|
||||
unsigned char min;// --- (00-59)
|
||||
unsigned char hour;// --- (00-23)
|
||||
unsigned char day;// --- (01-31)
|
||||
unsigned char month;// --- (01-12)
|
||||
unsigned char year;// --- (00-99)
|
||||
} icsSpyTime;
|
||||
|
||||
#ifndef INTREPID_NO_CHECK_STRUCT_SIZE
|
||||
|
||||
#if defined(__cplusplus) && (__cplusplus > 199711L)
|
||||
|
||||
@@ -808,6 +808,24 @@ extern bool DLLExport icsneo_isTerminationEnabledFor(const neodevice_t* device,
|
||||
*/
|
||||
extern bool DLLExport icsneo_setTerminationFor(const neodevice_t* device, neonetid_t netid, bool enabled);
|
||||
|
||||
/**
|
||||
* \brief Get the real-time clock for the given device.
|
||||
* \param[out] device A pointer to the neodevice_t structure specifying the device to read the RTC from.
|
||||
* \param[out] output A pointer to a uint64_t where the RTC will be stored. This value is in seconds.
|
||||
|
||||
* \returns True if the RTC was successfully retrieved.
|
||||
*/
|
||||
extern bool icsneo_getRTC(const neodevice_t* device, uint64_t* output);
|
||||
|
||||
/**
|
||||
* \brief Set the real-time clock for the given device.
|
||||
* \param[out] device A pointer to the neodevice_t structure specifying the device to write the RTC to.
|
||||
* \param[in] input A uint64_t object holding the RTC value. This value is in seconds.
|
||||
|
||||
* \returns True if the RTC was successfully set.
|
||||
*/
|
||||
extern bool icsneo_setRTC(const neodevice_t* device, uint64_t input);
|
||||
|
||||
#ifdef __cplusplus
|
||||
} // extern "C"
|
||||
#endif
|
||||
|
||||
@@ -40,6 +40,10 @@ extern void LegacyDLLExport icsneoGetISO15765Status(void* hObject, int lNetwork,
|
||||
extern void LegacyDLLExport icsneoSetISO15765RxParameters(void* hObject, int lNetwork, int lEnable, spyFilterLong* pFF_CFMsgFilter, icsSpyMessage* pTxMsg,
|
||||
int lCFTimeOutMs, int lFlowCBlockSize, int lUsesExtendedAddressing, int lUseHardwareIfPresent);
|
||||
|
||||
//RTC Functions
|
||||
extern int LegacyDLLExport icsneoGetRTC(void* hObject, icsSpyTime* time);
|
||||
extern int LegacyDLLExport icsneoSetRTC(void* hObject, const icsSpyTime* time);
|
||||
|
||||
//Device Functions
|
||||
extern int LegacyDLLExport icsneoGetConfiguration(void* hObject, unsigned char* pData, int* lNumBytes);
|
||||
extern int LegacyDLLExport icsneoSendConfiguration(void* hObject, unsigned char* pData, int lNumBytes);
|
||||
|
||||
Reference in New Issue
Block a user