Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
Dependencies: mbed SDFileSystem
Diff: include/DeviceRepeater.h
- Revision:
- 7:9ab8809f9693
- Child:
- 10:db2be22bc2f9
diff -r 81a3d517fd56 -r 9ab8809f9693 include/DeviceRepeater.h
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/include/DeviceRepeater.h Sat May 11 04:03:33 2019 +0000
@@ -0,0 +1,50 @@
+#ifndef _DEVICEREPEATER_H_
+#define _DEVICEREPEATER_H_
+
+#include "DeviceDriverInterface.h"
+
+class DeviceRepeater
+{
+public:
+ typedef enum device_attr_status {
+ DEV_FATAL = -2,
+ DEV_NOT_INIT = -1,
+ DEV_READY = 0,
+ DEV_RUNNING,
+ DEV_REQ_STOP,
+ } DevStatus;
+private:
+ static const int DEFAULT_REPEAT_MAX_COUNT = 1;
+ static const int DEFAULT_REPEAT_STRIDE = 5;
+ static const int NOT_ID_SELECTED = -1;
+private:
+ int selected_id;
+ DevStatus stat;
+ DeviceDriver *pDriver;
+
+ /* Tick base class */
+ Ticker *pClock;
+ /* members for repeating */
+ int repeat_max_count;
+ int repeat_stride_sec;
+ int repeat_remain_cnt;
+ int repeat_remain_sec;
+private:
+ DeviceRepeater(void);
+public:
+ DeviceRepeater(DeviceDriver *setDriver);
+ bool setRepeatCount(int maxcount);
+ bool setRepeatStride(int sec);
+ bool setConfigId(int id);
+ bool setConfigValue(int setValue);
+ bool getConfigValue(int *retValue);
+ bool start();
+ bool stop();
+ bool readyToStart();
+ void tick();
+ bool resetAllStatus(void);
+private:
+ bool init();
+};
+
+#endif /* _DEVICEREPEATER_H_ */
\ No newline at end of file