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: TextLCD MbedJSONValue libMotiv picojson mbed-rtos mbed
Fork of Mbed_MotiVControllerBox by
library/Device.h@1:d54aed10ddf3, 2014-11-15 (annotated)
- Committer:
- TimWoo
- Date:
- Sat Nov 15 13:04:09 2014 +0000
- Revision:
- 1:d54aed10ddf3
- Parent:
- devices/Device.h@0:2279181caaa1
Dirty testing stage. Testing ethernet/internet connection
Who changed what in which revision?
| User | Revision | Line number | New contents of line |
|---|---|---|---|
| TimWoo | 0:2279181caaa1 | 1 | #ifndef MOTIV_DEVICE_H |
| TimWoo | 0:2279181caaa1 | 2 | #define MOTIV_DEVICE_H |
| TimWoo | 0:2279181caaa1 | 3 | |
| TimWoo | 0:2279181caaa1 | 4 | #include <string> |
| TimWoo | 0:2279181caaa1 | 5 | |
| TimWoo | 1:d54aed10ddf3 | 6 | #define DELIMITER ';' |
| TimWoo | 1:d54aed10ddf3 | 7 | |
| TimWoo | 1:d54aed10ddf3 | 8 | //a default constructor that takes no arguments |
| TimWoo | 1:d54aed10ddf3 | 9 | //a copy constructor ex: book(const &book b); |
| TimWoo | 1:d54aed10ddf3 | 10 | //an overloaded assignment operato |
| TimWoo | 1:d54aed10ddf3 | 11 | |
| TimWoo | 0:2279181caaa1 | 12 | class Device |
| TimWoo | 0:2279181caaa1 | 13 | { |
| TimWoo | 0:2279181caaa1 | 14 | public: |
| TimWoo | 1:d54aed10ddf3 | 15 | Device(); |
| TimWoo | 1:d54aed10ddf3 | 16 | Device(int id); |
| TimWoo | 0:2279181caaa1 | 17 | ~Device(); |
| TimWoo | 0:2279181caaa1 | 18 | |
| TimWoo | 1:d54aed10ddf3 | 19 | Device(const Device& d); |
| TimWoo | 1:d54aed10ddf3 | 20 | Device& operator=(const Device& d); |
| TimWoo | 1:d54aed10ddf3 | 21 | |
| TimWoo | 1:d54aed10ddf3 | 22 | int getId() const; |
| TimWoo | 0:2279181caaa1 | 23 | |
| TimWoo | 1:d54aed10ddf3 | 24 | //private: |
| TimWoo | 1:d54aed10ddf3 | 25 | struct mCommand { //3 chars to be sent to the hardware |
| TimWoo | 1:d54aed10ddf3 | 26 | char id; //device id |
| TimWoo | 1:d54aed10ddf3 | 27 | char cmd; //command number |
| TimWoo | 1:d54aed10ddf3 | 28 | char val; //command specific value |
| TimWoo | 1:d54aed10ddf3 | 29 | char delim; //delimiter |
| TimWoo | 1:d54aed10ddf3 | 30 | }; |
| TimWoo | 1:d54aed10ddf3 | 31 | mCommand makeCommand(int cmdId, int value); |
| TimWoo | 1:d54aed10ddf3 | 32 | |
| TimWoo | 0:2279181caaa1 | 33 | protected: |
| TimWoo | 1:d54aed10ddf3 | 34 | |
| TimWoo | 1:d54aed10ddf3 | 35 | int id; |
| TimWoo | 1:d54aed10ddf3 | 36 | |
| TimWoo | 1:d54aed10ddf3 | 37 | private: |
| TimWoo | 1:d54aed10ddf3 | 38 | |
| TimWoo | 1:d54aed10ddf3 | 39 | |
| TimWoo | 0:2279181caaa1 | 40 | }; |
| TimWoo | 0:2279181caaa1 | 41 | |
| TimWoo | 0:2279181caaa1 | 42 | #endif |
