From 32815943d58cb77c98e6e96abb0722d23bb0f84c Mon Sep 17 00:00:00 2001 From: David Rebbe Date: Mon, 25 Nov 2024 22:16:45 -0500 Subject: [PATCH] add icsneo_get_message_count --- api/icsneo/icsneo.cpp | 10 ++++++++++ include/icsneo/icsneo.h | 9 +++++++++ 2 files changed, 19 insertions(+) diff --git a/api/icsneo/icsneo.cpp b/api/icsneo/icsneo.cpp index c6f7119..3c0ec97 100644 --- a/api/icsneo/icsneo.cpp +++ b/api/icsneo/icsneo.cpp @@ -288,5 +288,15 @@ ICSNEO_API icsneo_error_t icsneo_get_message_polling_limit(icsneo_device_t* devi auto dev = device->device; *limit = static_cast(dev->getPollingMessageLimit()); + return icsneo_error_success; +} + +ICSNEO_API icsneo_error_t icsneo_get_message_count(icsneo_device_t* device, uint32_t* count) { + if (!device || !count) { + return icsneo_error_invalid_parameters; + } + auto dev = device->device; + *count = static_cast(dev->getCurrentMessageCount()); + return icsneo_error_success; } \ No newline at end of file diff --git a/include/icsneo/icsneo.h b/include/icsneo/icsneo.h index 6178685..d94f7c2 100644 --- a/include/icsneo/icsneo.h +++ b/include/icsneo/icsneo.h @@ -234,6 +234,15 @@ ICSNEO_API icsneo_error_t icsneo_set_message_polling_limit(icsneo_device_t* devi */ ICSNEO_API icsneo_error_t icsneo_get_message_polling_limit(icsneo_device_t* device, uint32_t* limit); +/** @brief Get the message count of a device + * + * @param[in] icsneo_device_t device The device to get the message count of. + * @param[out] uint32_t* count Pointer to a uint32_t to copy the message count into. + * + * @return icsneo_error_t icsneo_error_success if successful, icsneo_error_invalid_parameters otherwise. + */ +ICSNEO_API icsneo_error_t icsneo_get_message_count(icsneo_device_t* device, uint32_t* count); + #ifdef __cplusplus }