From 95bf5c1071a84696cc0e15abf9a01102764caaca Mon Sep 17 00:00:00 2001 From: "Robin.Mueller" Date: Wed, 27 May 2020 21:33:34 +0200 Subject: [PATCH] improved const correctness --- osal/FreeRTOS/BinSemaphUsingTask.cpp | 2 +- osal/FreeRTOS/BinSemaphUsingTask.h | 2 +- osal/FreeRTOS/BinarySemaphore.cpp | 2 +- osal/FreeRTOS/BinarySemaphore.h | 2 +- osal/FreeRTOS/CountingSemaphUsingTask.cpp | 5 ++--- osal/FreeRTOS/CountingSemaphUsingTask.h | 2 +- tasks/SemaphoreIF.h | 2 +- 7 files changed, 8 insertions(+), 9 deletions(-) diff --git a/osal/FreeRTOS/BinSemaphUsingTask.cpp b/osal/FreeRTOS/BinSemaphUsingTask.cpp index 8cdcbc33..2a5ca3bd 100644 --- a/osal/FreeRTOS/BinSemaphUsingTask.cpp +++ b/osal/FreeRTOS/BinSemaphUsingTask.cpp @@ -63,7 +63,7 @@ TaskHandle_t BinarySemaphoreUsingTask::getTaskHandle() { return handle; } -uint8_t BinarySemaphoreUsingTask::getSemaphoreCounter() { +uint8_t BinarySemaphoreUsingTask::getSemaphoreCounter() const { uint32_t notificationValue; xTaskNotifyAndQuery(handle, 0, eNoAction, ¬ificationValue); return notificationValue; diff --git a/osal/FreeRTOS/BinSemaphUsingTask.h b/osal/FreeRTOS/BinSemaphUsingTask.h index e44b838c..b65d4d80 100644 --- a/osal/FreeRTOS/BinSemaphUsingTask.h +++ b/osal/FreeRTOS/BinSemaphUsingTask.h @@ -26,7 +26,7 @@ public: ReturnValue_t acquire(uint32_t timeoutMs = SemaphoreIF::NO_TIMEOUT) override; ReturnValue_t release() override; - uint8_t getSemaphoreCounter() override; + uint8_t getSemaphoreCounter() const override; /** * Take the binary semaphore. diff --git a/osal/FreeRTOS/BinarySemaphore.cpp b/osal/FreeRTOS/BinarySemaphore.cpp index e6bb8dca..0d8d415c 100644 --- a/osal/FreeRTOS/BinarySemaphore.cpp +++ b/osal/FreeRTOS/BinarySemaphore.cpp @@ -82,7 +82,7 @@ ReturnValue_t BinarySemaphore::release() { } } -uint8_t BinarySemaphore::getSemaphoreCounter() { +uint8_t BinarySemaphore::getSemaphoreCounter() const { return uxSemaphoreGetCount(handle); } diff --git a/osal/FreeRTOS/BinarySemaphore.h b/osal/FreeRTOS/BinarySemaphore.h index 0c2fe3bf..b883f801 100644 --- a/osal/FreeRTOS/BinarySemaphore.h +++ b/osal/FreeRTOS/BinarySemaphore.h @@ -43,7 +43,7 @@ public: //! @brief Destructor virtual ~BinarySemaphore(); - uint8_t getSemaphoreCounter() override; + uint8_t getSemaphoreCounter() const override; /** * Take the binary semaphore. diff --git a/osal/FreeRTOS/CountingSemaphUsingTask.cpp b/osal/FreeRTOS/CountingSemaphUsingTask.cpp index eecd986b..d08a549e 100644 --- a/osal/FreeRTOS/CountingSemaphUsingTask.cpp +++ b/osal/FreeRTOS/CountingSemaphUsingTask.cpp @@ -16,8 +16,7 @@ CountingSemaphoreUsingTask::CountingSemaphoreUsingTask(uint8_t maxCount, } } -ReturnValue_t CountingSemaphoreUsingTask::acquire( - uint32_t timeoutMs) { +ReturnValue_t CountingSemaphoreUsingTask::acquire(uint32_t timeoutMs) { return HasReturnvaluesIF::RETURN_OK; } @@ -25,6 +24,6 @@ ReturnValue_t CountingSemaphoreUsingTask::release() { return HasReturnvaluesIF::RETURN_OK; } -uint8_t CountingSemaphoreUsingTask::getSemaphoreCounter() { +uint8_t CountingSemaphoreUsingTask::getSemaphoreCounter() const { return 0; } diff --git a/osal/FreeRTOS/CountingSemaphUsingTask.h b/osal/FreeRTOS/CountingSemaphUsingTask.h index 8c881d69..877a975e 100644 --- a/osal/FreeRTOS/CountingSemaphUsingTask.h +++ b/osal/FreeRTOS/CountingSemaphUsingTask.h @@ -15,7 +15,7 @@ public: ReturnValue_t acquire(uint32_t timeoutMs) override; ReturnValue_t release() override; - uint8_t getSemaphoreCounter() override; + uint8_t getSemaphoreCounter() const override; private: TaskHandle_t handle; diff --git a/tasks/SemaphoreIF.h b/tasks/SemaphoreIF.h index fb181cca..044e03a8 100644 --- a/tasks/SemaphoreIF.h +++ b/tasks/SemaphoreIF.h @@ -55,7 +55,7 @@ public: * is returned if the semaphore is available, and 0 is returned if the * semaphore is not available. */ - virtual uint8_t getSemaphoreCounter() = 0; + virtual uint8_t getSemaphoreCounter() const = 0; }; #endif /* FRAMEWORK_TASKS_SEMAPHOREIF_H_ */