C2: Add TC10 APIs

This commit is contained in:
David Rebbe
2026-05-06 11:04:44 -04:00
committed by Kyle Schwarz
parent a68b64c641
commit 0d2bbed7d5
11 changed files with 598 additions and 8 deletions
+9 -8
View File
@@ -4,19 +4,20 @@
#ifdef __cplusplus
#include <cstdint>
#include "icsneo/icsneoc2types.h"
namespace icsneo {
enum class TC10WakeStatus : uint8_t {
NoWakeReceived,
WakeReceived,
enum class TC10WakeStatus : icsneoc2_tc10_wake_status_t {
NoWakeReceived = icsneoc2_tc10_wake_status_no_wake_received,
WakeReceived = icsneoc2_tc10_wake_status_wake_received,
};
enum class TC10SleepStatus : uint8_t {
NoSleepReceived,
SleepReceived,
SleepFailed,
SleepAborted,
enum class TC10SleepStatus : icsneoc2_tc10_sleep_status_t {
NoSleepReceived = icsneoc2_tc10_sleep_status_no_sleep_received,
SleepReceived = icsneoc2_tc10_sleep_status_sleep_received,
SleepFailed = icsneoc2_tc10_sleep_status_sleep_failed,
SleepAborted = icsneoc2_tc10_sleep_status_sleep_aborted,
};
}
+31
View File
@@ -473,6 +473,37 @@ icsneoc2_error_t icsneoc2_device_rtc_set(const icsneoc2_device_t* device, int64_
*/
icsneoc2_error_t icsneoc2_device_supports_tc10(const icsneoc2_device_t* device, bool* supported);
/**
* Send a TC10 wake request to the device on a specific network. This is used to wake up ECUs that support TC10 wake on the specified network.
*
* @param[in] device The device to send the wake request from.
* @param[in] netid The network to send the wake request on.
*
* @return icsneoc2_error_t icsneoc2_error_success if successful, icsneoc2_error_invalid_parameters or icsneoc2_error_transmit_message_failed otherwise.
*/
icsneoc2_error_t icsneoc2_device_tc10_wake_request(const icsneoc2_device_t* device, icsneoc2_netid_t netid);
/**
* Send a TC10 sleep request to the device on a specific network. This is used to put ECUs that support TC10 sleep on the specified network to sleep.
*
* @param[in] device The device to send the sleep request from.
* @param[in] netid The network to send the sleep request on.
*
* @return icsneoc2_error_t icsneoc2_error_success if successful, icsneoc2_error_invalid_parameters or icsneoc2_error_transmit_message_failed otherwise.
*/
icsneoc2_error_t icsneoc2_device_tc10_sleep_request(const icsneoc2_device_t* device, icsneoc2_netid_t netid);
/**
* Get the current TC10 sleep/wake status of a specific network.
*
* @param[in] device The device to query.
* @param[in] netid The network to query the TC10 status of.
* @param[out] sleep_status Pointer to a icsneoc2_tc10_sleep_status_t to copy the sleep status into. May be NULL if sleep status is not needed.
* @param[out] wake_status Pointer to a icsneoc2_tc10_wake_status_t to copy the wake status into. May be NULL if wake status is not needed.
*
* @return icsneoc2_error_t icsneoc2_error_success if successful, icsneoc2_error_invalid_parameters otherwise.
*/
icsneoc2_error_t icsneoc2_device_tc10_status_get(const icsneoc2_device_t* device, icsneoc2_netid_t netid, icsneoc2_tc10_sleep_status_t* sleep_status, icsneoc2_tc10_wake_status_t* wake_status);
/**
* Get the current state of a digital I/O pin.
*
+12
View File
@@ -75,6 +75,18 @@ icsneoc2_error_t icsneoc2_message_netid_get(icsneoc2_message_t* message, icsneoc
*/
icsneoc2_error_t icsneoc2_netid_name_get(icsneoc2_netid_t netid, char* value, size_t* value_length);
/**
* Get the network type for a icsneoc2_netid_t.
*
* @param[in] netid The network id to get the type of.
* @param[out] network_type Pointer to a icsneoc2_network_type_t to copy the network type into.
*
* @return icsneoc2_error_t icsneoc2_error_success if successful, icsneoc2_error_invalid_parameters otherwise.
*
* @see icsneoc2_network_type_t, icsneoc2_network_type_name_get
*/
icsneoc2_error_t icsneoc2_netid_network_type_get(icsneoc2_netid_t netid, icsneoc2_network_type_t* network_type);
/**
* Set the Network ID (netid) of a bus message
*
+22
View File
@@ -422,6 +422,28 @@ typedef uint8_t icsneoc2_can_error_code_t;
typedef uint64_t icsneoc2_message_can_error_flags_t;
typedef enum _icsneoc2_tc10_wake_status_t {
icsneoc2_tc10_wake_status_no_wake_received = 0, // No wake signal received
icsneoc2_tc10_wake_status_wake_received = 1, // Wake signal received
// Must be last entry. Don't use as a TC10 wake status.
icsneoc2_tc10_wake_status_maxsize
} _icsneoc2_tc10_wake_status_t;
typedef uint8_t icsneoc2_tc10_wake_status_t;
typedef enum _icsneoc2_tc10_sleep_status_t {
icsneoc2_tc10_sleep_status_no_sleep_received = 0, // No sleep signal received
icsneoc2_tc10_sleep_status_sleep_received = 1, // Sleep signal received
icsneoc2_tc10_sleep_status_sleep_failed = 2, // Sleep attempt failed
icsneoc2_tc10_sleep_status_sleep_aborted = 3, // Sleep attempt aborted
// Must be last entry. Don't use as a TC10 sleep status.
icsneoc2_tc10_sleep_status_maxsize
} _icsneoc2_tc10_sleep_status_t;
typedef uint8_t icsneoc2_tc10_sleep_status_t;
#ifdef __cplusplus
}
#endif