diff --git a/src/TaskScheduler.h b/src/TaskScheduler.h index 2f3377d..2067540 100644 --- a/src/TaskScheduler.h +++ b/src/TaskScheduler.h @@ -390,10 +390,10 @@ void StatusRequest::setWaiting(unsigned int aCount) { #endif // #ifdef _TASK_TIMEOUT } -bool StatusRequest::pending() { return (iCount != 0); } -bool StatusRequest::completed() { return (iCount == 0); } -int StatusRequest::getStatus() { return iStatus; } -int StatusRequest::getCount() { return iCount; } +bool StatusRequest::pending() const { return (iCount != 0); } +bool StatusRequest::completed() const { return (iCount == 0); } +int StatusRequest::getStatus() const { return iStatus; } +int StatusRequest::getCount() const { return iCount; } StatusRequest* Task::getStatusRequest() { return iStatusRequest; } StatusRequest* Task::getInternalStatusRequest() { return &iMyStatusRequest; } @@ -481,13 +481,13 @@ long StatusRequest::untilTimeout() { #endif // _TASK_TIMEOUT #endif // _TASK_STATUS_REQUEST -bool Task::isEnabled() { return iStatus.enabled; } +bool Task::isEnabled() const { return iStatus.enabled; } -unsigned long Task::getInterval() { return iInterval; } +unsigned long Task::getInterval() const { return iInterval; } -long Task::getIterations() { return iIterations; } +long Task::getIterations() const { return iIterations; } -unsigned long Task::getRunCounter() { return iRunCounter; } +unsigned long Task::getRunCounter() const { return iRunCounter; } #ifdef _TASK_OO_CALLBACKS @@ -784,18 +784,18 @@ void Task::resetTimeout() { #endif // _TASK_THREAD_SAFE } -unsigned long Task::getTimeout() { +unsigned long Task::getTimeout() const { return iTimeout; } -long Task::untilTimeout() { +long Task::untilTimeout() const { if ( iTimeout ) { return ( (long) (iStarttime + iTimeout) - (long) _TASK_TIME_FUNCTION() ); } return -1; } -bool Task::timedOut() { +bool Task::timedOut() const { return iStatus.timeout; } @@ -940,7 +940,7 @@ void Task::cancel() { disable(); } -bool Task::canceled() { +bool Task::canceled() const { return iStatus.canceled; } @@ -961,14 +961,14 @@ bool Task::restartDelayed(unsigned long aDelay) { return enableDelayed(aDelay); } -bool Task::isFirstIteration() { return (iRunCounter <= 1); } +bool Task::isFirstIteration() const { return (iRunCounter <= 1); } -bool Task::isLastIteration() { return (iIterations == 0); } +bool Task::isLastIteration() const { return (iIterations == 0); } #ifdef _TASK_TIMECRITICAL -long Task::getOverrun() { return iOverrun; } -long Task::getStartDelay() { return iStartDelay; } +long Task::getOverrun() const { return iOverrun; } +long Task::getStartDelay() const { return iStartDelay; } #endif // _TASK_TIMECRITICAL @@ -976,16 +976,16 @@ long Task::getStartDelay() { return iStartDelay; } #ifdef _TASK_WDT_IDS void Task::setId(unsigned int aID) { iTaskID = aID; } -unsigned int Task::getId() { return iTaskID; } +unsigned int Task::getId() const { return iTaskID; } void Task::setControlPoint(unsigned int aPoint) { iControlPoint = aPoint; } -unsigned int Task::getControlPoint() { return iControlPoint; } +unsigned int Task::getControlPoint() const { return iControlPoint; } #endif // _TASK_WDT_IDS #ifdef _TASK_LTS_POINTER void Task::setLtsPointer(void *aPtr) { iLTS = aPtr; } -void* Task::getLtsPointer() { return iLTS; } +void* Task::getLtsPointer() const { return iLTS; } #endif // _TASK_LTS_POINTER @@ -1240,7 +1240,7 @@ void* Scheduler::currentLts() { return iCurrent->iLTS; } #endif // _TASK_LTS_POINTER #ifdef _TASK_TIMECRITICAL -bool Scheduler::isOverrun() { return (iCurrent->iOverrun < 0); } +bool Scheduler::isOverrun() const { return (iCurrent->iOverrun < 0); } void Scheduler::cpuLoadReset() { iCPUStart = micros(); @@ -1249,7 +1249,7 @@ void Scheduler::cpuLoadReset() { } -unsigned long Scheduler::getCpuLoadTotal() { +unsigned long Scheduler::getCpuLoadTotal() const { return (micros() - iCPUStart); } #endif // _TASK_TIMECRITICAL diff --git a/src/TaskSchedulerDeclarations.h b/src/TaskSchedulerDeclarations.h index 7d646aa..99d9e47 100644 --- a/src/TaskSchedulerDeclarations.h +++ b/src/TaskSchedulerDeclarations.h @@ -99,10 +99,10 @@ class StatusRequest { INLINE void setWaiting(unsigned int aCount = 1); INLINE bool signal(int aStatus = 0); INLINE void signalComplete(int aStatus = 0); - INLINE bool pending(); - INLINE bool completed(); - INLINE int getStatus(); - INLINE int getCount(); + INLINE bool pending() const; + INLINE bool completed() const; + INLINE int getStatus() const; + INLINE int getCount() const; #ifdef _TASK_TIMEOUT INLINE void setTimeout(unsigned long aTimeout) { iTimeout = aTimeout; }; @@ -195,9 +195,9 @@ class Task { #ifdef _TASK_TIMEOUT INLINE void setTimeout(unsigned long aTimeout, bool aReset=false); INLINE void resetTimeout(); - INLINE unsigned long getTimeout(); - INLINE long untilTimeout(); - INLINE bool timedOut(); + INLINE unsigned long getTimeout() const; + INLINE long untilTimeout() const; + INLINE bool timedOut() const; #endif INLINE bool enable(); @@ -212,11 +212,11 @@ class Task { INLINE bool disable(); INLINE void abort(); INLINE void cancel(); - INLINE bool isEnabled(); - INLINE bool canceled(); + INLINE bool isEnabled() const; + INLINE bool canceled() const; #ifdef _TASK_SCHEDULING_OPTIONS - INLINE unsigned int getSchedulingOption() { return iOption; } + INLINE unsigned int getSchedulingOption() const { return iOption; } INLINE void setSchedulingOption(unsigned int aOption) { iOption = aOption; } #endif //_TASK_SCHEDULING_OPTIONS @@ -226,14 +226,14 @@ class Task { INLINE void set(unsigned long aInterval, long aIterations, TaskCallback aCallback,TaskOnEnable aOnEnable=NULL, TaskOnDisable aOnDisable=NULL); #endif // _TASK_OO_CALLBACKS INLINE void setInterval(unsigned long aInterval); - INLINE unsigned long getInterval(); + INLINE unsigned long getInterval() const; INLINE void setIterations(long aIterations); - INLINE long getIterations(); - INLINE unsigned long getRunCounter(); + INLINE long getIterations() const; + INLINE unsigned long getRunCounter() const; #ifdef _TASK_SELF_DESTRUCT INLINE void setSelfDestruct(bool aSelfDestruct=true) { iStatus.selfdestruct = aSelfDestruct; } - INLINE bool getSelfDestruct() { return iStatus.selfdestruct; } + INLINE bool getSelfDestruct() const { return iStatus.selfdestruct; } #endif // #ifdef _TASK_SELF_DESTRUCT #ifdef _TASK_OO_CALLBACKS @@ -248,12 +248,12 @@ class Task { INLINE void yieldOnce(TaskCallback aCallback); #endif // _TASK_OO_CALLBACKS - INLINE bool isFirstIteration() ; - INLINE bool isLastIteration() ; + INLINE bool isFirstIteration() const; + INLINE bool isLastIteration() const; #ifdef _TASK_TIMECRITICAL - INLINE long getOverrun() ; - INLINE long getStartDelay() ; + INLINE long getOverrun() const ; + INLINE long getStartDelay() const ; #endif // _TASK_TIMECRITICAL #ifdef _TASK_STATUS_REQUEST @@ -265,14 +265,14 @@ class Task { #ifdef _TASK_WDT_IDS INLINE void setId(unsigned int aID) ; - INLINE unsigned int getId() ; + INLINE unsigned int getId() const; INLINE void setControlPoint(unsigned int aPoint) ; - INLINE unsigned int getControlPoint() ; + INLINE unsigned int getControlPoint() const ; #endif // _TASK_WDT_IDS #ifdef _TASK_LTS_POINTER INLINE void setLtsPointer(void *aPtr) ; - INLINE void* getLtsPointer() ; + INLINE void* getLtsPointer(); #endif // _TASK_LTS_POINTER #ifdef _TASK_EXPOSE_CHAIN @@ -372,11 +372,11 @@ class Scheduler { #endif // _TASK_LTS_POINTER #ifdef _TASK_TIMECRITICAL - INLINE bool isOverrun(); + INLINE bool isOverrun() const; INLINE void cpuLoadReset(); - INLINE unsigned long getCpuLoadCycle(){ return iCPUCycle; }; - INLINE unsigned long getCpuLoadIdle() { return iCPUIdle; }; - INLINE unsigned long getCpuLoadTotal(); + INLINE unsigned long getCpuLoadCycle() const { return iCPUCycle; }; + INLINE unsigned long getCpuLoadIdle() const { return iCPUIdle; }; + INLINE unsigned long getCpuLoadTotal() const; #endif // _TASK_TIMECRITICAL #ifdef _TASK_PRIORITY