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 Vincent Wochnik

Committer:
xinlei
Date:
Fri Mar 20 13:55:21 2015 +0000
Revision:
91:423177e8a401
Parent:
74:ca3001991fdc
Code refactoring to ease coupling

Who changed what in which revision?

UserRevisionLine numberNew contents of line
vwochnik 65:a62dbef2f924 1 #include "DeviceIO.h"
xinlei 72:c5709ae7b193 2 #include "logging.h"
vwochnik 65:a62dbef2f924 3
vwochnik 65:a62dbef2f924 4 #define DEF "\033[39m"
vwochnik 65:a62dbef2f924 5 #define GRE "\033[32m"
vwochnik 65:a62dbef2f924 6 #define CYA "\033[36m"
vwochnik 65:a62dbef2f924 7
vwochnik 65:a62dbef2f924 8 DeviceIO::DeviceIO(GPSI2C& gps) :
vwochnik 65:a62dbef2f924 9 _resetButton(D4), // fire button on arduino app shield
vwochnik 65:a62dbef2f924 10 _lcd(D11, D13, D12, D7, D10),
vwochnik 65:a62dbef2f924 11 _gpsTracker(gps),
xinlei 91:423177e8a401 12 _deviceFeedback()
vwochnik 65:a62dbef2f924 13 {
vwochnik 65:a62dbef2f924 14 }
vwochnik 65:a62dbef2f924 15
vwochnik 65:a62dbef2f924 16 bool DeviceIO::resetButtonPressed()
vwochnik 65:a62dbef2f924 17 {
vwochnik 65:a62dbef2f924 18 return _resetButton;
vwochnik 65:a62dbef2f924 19 }
vwochnik 65:a62dbef2f924 20
vwochnik 65:a62dbef2f924 21 GPSTracker& DeviceIO::gpsTracker()
vwochnik 65:a62dbef2f924 22 {
vwochnik 65:a62dbef2f924 23 return _gpsTracker;
vwochnik 65:a62dbef2f924 24 }
vwochnik 65:a62dbef2f924 25
vwochnik 65:a62dbef2f924 26 DeviceFeedback& DeviceIO::deviceFeedback()
vwochnik 65:a62dbef2f924 27 {
vwochnik 65:a62dbef2f924 28 return _deviceFeedback;
vwochnik 65:a62dbef2f924 29 }
vwochnik 65:a62dbef2f924 30
vwochnik 65:a62dbef2f924 31 void DeviceIO::lcdPrint(const char *line1, const char *line2, const char *line3)
vwochnik 65:a62dbef2f924 32 {
xinlei 74:ca3001991fdc 33 aDebug(GRE "io::lcdPrint" DEF "\r\n");
vwochnik 65:a62dbef2f924 34 _lcd.cls();
vwochnik 65:a62dbef2f924 35 _lcd.locate(0, 0);
vwochnik 65:a62dbef2f924 36
vwochnik 65:a62dbef2f924 37 _lcd.printf("%s\n", line1);
xinlei 74:ca3001991fdc 38 aDebug(GRE "> " CYA "%s\r\n" DEF, line1);
vwochnik 65:a62dbef2f924 39
vwochnik 65:a62dbef2f924 40 if (line2 != NULL) {
vwochnik 65:a62dbef2f924 41 _lcd.printf("%s\n", line2);
xinlei 74:ca3001991fdc 42 aDebug(GRE "> " CYA "%s\r\n" DEF, line2);
vwochnik 65:a62dbef2f924 43
vwochnik 65:a62dbef2f924 44 if (line3 != NULL) {
vwochnik 65:a62dbef2f924 45 _lcd.printf("%s\n", line3);
xinlei 74:ca3001991fdc 46 aDebug(GRE "> " CYA "%s\r\n" DEF, line3);
vwochnik 65:a62dbef2f924 47 }
vwochnik 65:a62dbef2f924 48 }
vwochnik 65:a62dbef2f924 49 }