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.
senml_string_actuator.h@0:a9259748d982, 2018-05-19 (annotated)
- Committer:
- kpniot
- Date:
- Sat May 19 17:35:20 2018 +0000
- Revision:
- 0:a9259748d982
first commit
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
kpniot | 0:a9259748d982 | 1 | /* _ __ ____ _ _ |
kpniot | 0:a9259748d982 | 2 | * | |/ / | _ \ | \ | | |
kpniot | 0:a9259748d982 | 3 | * | ' / | |_) | | \| | |
kpniot | 0:a9259748d982 | 4 | * | . \ | __/ | |\ | |
kpniot | 0:a9259748d982 | 5 | * |_|\_\ |_| |_| \_| |
kpniot | 0:a9259748d982 | 6 | * |
kpniot | 0:a9259748d982 | 7 | * (c) 2018 KPN |
kpniot | 0:a9259748d982 | 8 | * License: MIT License. |
kpniot | 0:a9259748d982 | 9 | * Author: Jan Bogaerts |
kpniot | 0:a9259748d982 | 10 | * |
kpniot | 0:a9259748d982 | 11 | * support for string actuators |
kpniot | 0:a9259748d982 | 12 | */ |
kpniot | 0:a9259748d982 | 13 | |
kpniot | 0:a9259748d982 | 14 | #ifndef SENMLSTRINGACTUATOR |
kpniot | 0:a9259748d982 | 15 | #define SENMLSTRINGACTUATOR |
kpniot | 0:a9259748d982 | 16 | |
kpniot | 0:a9259748d982 | 17 | #include <senml_string_record.h> |
kpniot | 0:a9259748d982 | 18 | |
kpniot | 0:a9259748d982 | 19 | #define STRING_ACTUATOR_SIGNATURE void (*callback)(const char*) |
kpniot | 0:a9259748d982 | 20 | |
kpniot | 0:a9259748d982 | 21 | /** |
kpniot | 0:a9259748d982 | 22 | * A SenMLRecord that stores text data and supports actuation. |
kpniot | 0:a9259748d982 | 23 | */ |
kpniot | 0:a9259748d982 | 24 | class SenMLStringActuator: public SenMLStringRecord |
kpniot | 0:a9259748d982 | 25 | { |
kpniot | 0:a9259748d982 | 26 | public: |
kpniot | 0:a9259748d982 | 27 | SenMLStringActuator(const char* name, STRING_ACTUATOR_SIGNATURE): SenMLStringRecord(name, SENML_UNIT_NONE, NULL), callback(callback) {}; |
kpniot | 0:a9259748d982 | 28 | SenMLStringActuator(const char* name, SenMLUnit unit, STRING_ACTUATOR_SIGNATURE): SenMLStringRecord(name, unit, NULL), callback(callback) {}; |
kpniot | 0:a9259748d982 | 29 | SenMLStringActuator(const char* name, SenMLUnit unit, const char* value, STRING_ACTUATOR_SIGNATURE): SenMLStringRecord(name, unit, value), callback(callback) {}; |
kpniot | 0:a9259748d982 | 30 | ~SenMLStringActuator(){}; |
kpniot | 0:a9259748d982 | 31 | |
kpniot | 0:a9259748d982 | 32 | protected: |
kpniot | 0:a9259748d982 | 33 | |
kpniot | 0:a9259748d982 | 34 | /** |
kpniot | 0:a9259748d982 | 35 | * called while parsing a senml message, when the parser found the value for an SenMLJsonListener |
kpniot | 0:a9259748d982 | 36 | */ |
kpniot | 0:a9259748d982 | 37 | virtual void actuate(const void* value, int dataLength, SenMLDataType dataType); |
kpniot | 0:a9259748d982 | 38 | |
kpniot | 0:a9259748d982 | 39 | private: |
kpniot | 0:a9259748d982 | 40 | STRING_ACTUATOR_SIGNATURE; |
kpniot | 0:a9259748d982 | 41 | }; |
kpniot | 0:a9259748d982 | 42 | |
kpniot | 0:a9259748d982 | 43 | #endif // SENMLSTRINGACTUATOR |
kpniot | 0:a9259748d982 | 44 | |
kpniot | 0:a9259748d982 | 45 | |
kpniot | 0:a9259748d982 | 46 | |
kpniot | 0:a9259748d982 | 47 | |
kpniot | 0:a9259748d982 | 48 | |
kpniot | 0:a9259748d982 | 49 | |
kpniot | 0:a9259748d982 | 50 |