Official reference client implementation for Cumulocity SmartREST on u-blox C027.
Dependencies: C027_Support C12832 LM75B MMA7660 MbedSmartRest mbed-rtos mbed
Fork of MbedSmartRestMain by
util/RtosSmartRest.h@67:c360a2b2c948, 2014-11-30 (annotated)
- Committer:
- vwochnik
- Date:
- Sun Nov 30 19:34:49 2014 +0000
- Revision:
- 67:c360a2b2c948
- Parent:
- 55:a0f7295ed6b6
- Child:
- 77:f6717e4eccc4
refactor credentials persistence, add factory reset upon fire press button
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
vwochnik | 55:a0f7295ed6b6 | 1 | #ifndef RTOSSMARTREST_H |
vwochnik | 55:a0f7295ed6b6 | 2 | #define RTOSSMARTREST_H |
vwochnik | 55:a0f7295ed6b6 | 3 | |
vwochnik | 55:a0f7295ed6b6 | 4 | #include "AbstractSmartRest.h" |
vwochnik | 55:a0f7295ed6b6 | 5 | #include "MbedSmartRest.h" |
vwochnik | 55:a0f7295ed6b6 | 6 | #include "rtos.h" |
vwochnik | 55:a0f7295ed6b6 | 7 | |
vwochnik | 55:a0f7295ed6b6 | 8 | #define RTOS_SMARTREST_SLOTS 8 |
vwochnik | 55:a0f7295ed6b6 | 9 | |
vwochnik | 55:a0f7295ed6b6 | 10 | class RtosSmartRest : public AbstractSmartRest |
vwochnik | 55:a0f7295ed6b6 | 11 | { |
vwochnik | 55:a0f7295ed6b6 | 12 | public: |
vwochnik | 55:a0f7295ed6b6 | 13 | RtosSmartRest(const char*, uint16_t, const char*, uint8_t = MBEDSMARTREST_TRIES); |
vwochnik | 55:a0f7295ed6b6 | 14 | ~RtosSmartRest(); |
vwochnik | 55:a0f7295ed6b6 | 15 | |
vwochnik | 55:a0f7295ed6b6 | 16 | struct Slot { |
vwochnik | 55:a0f7295ed6b6 | 17 | osThreadId tid; |
vwochnik | 55:a0f7295ed6b6 | 18 | MbedSmartRest *inst; |
vwochnik | 55:a0f7295ed6b6 | 19 | }; |
vwochnik | 55:a0f7295ed6b6 | 20 | |
vwochnik | 55:a0f7295ed6b6 | 21 | uint8_t setAuthorization(const char*, const char*); |
vwochnik | 55:a0f7295ed6b6 | 22 | uint8_t bootstrap(const DataGenerator&); |
vwochnik | 55:a0f7295ed6b6 | 23 | uint8_t send(const DataGenerator&, const char* = NULL); |
vwochnik | 67:c360a2b2c948 | 24 | uint8_t stream(const char*, const Record&, const char* = NULL); |
vwochnik | 55:a0f7295ed6b6 | 25 | uint8_t receive(ParsedRecord&); |
vwochnik | 55:a0f7295ed6b6 | 26 | void stop(); |
vwochnik | 55:a0f7295ed6b6 | 27 | const char * getIdentifier(); |
vwochnik | 55:a0f7295ed6b6 | 28 | |
vwochnik | 55:a0f7295ed6b6 | 29 | protected: |
vwochnik | 55:a0f7295ed6b6 | 30 | MbedSmartRest * instance(); |
vwochnik | 55:a0f7295ed6b6 | 31 | |
vwochnik | 55:a0f7295ed6b6 | 32 | private: |
vwochnik | 55:a0f7295ed6b6 | 33 | const char *_host, *_identifier; |
vwochnik | 55:a0f7295ed6b6 | 34 | uint8_t _port, _tries; |
vwochnik | 55:a0f7295ed6b6 | 35 | const char *_username, *_password; |
vwochnik | 55:a0f7295ed6b6 | 36 | |
vwochnik | 55:a0f7295ed6b6 | 37 | Slot _slots[RTOS_SMARTREST_SLOTS]; |
vwochnik | 55:a0f7295ed6b6 | 38 | size_t _count; |
vwochnik | 55:a0f7295ed6b6 | 39 | }; |
vwochnik | 55:a0f7295ed6b6 | 40 | |
vwochnik | 55:a0f7295ed6b6 | 41 | #endif |