Own fork of MbedSmartRestMain

Dependencies:   C027_Support C12832 LM75B MMA7660 MbedSmartRest mbed-rtos mbed

Fork of MbedSmartRestMain by Cumulocity Official

Committer:
xinlei
Date:
Wed May 13 13:03:20 2015 +0000
Revision:
107:f1ee3e1eb126
Parent:
96:ea056f6be2e8
Child:
116:5de54f09f754
ConfigSync is now singleton

Who changed what in which revision?

UserRevisionLine numberNew contents of line
Cumulocity 41:804f6a0bda26 1 #include <stdlib.h>
Cumulocity 41:804f6a0bda26 2 #include <string.h>
xinlei 74:ca3001991fdc 3 #include "DeviceInfo.h"
xinlei 74:ca3001991fdc 4 #include "logging.h"
Cumulocity 41:804f6a0bda26 5
xinlei 107:f1ee3e1eb126 6 extern MDMSerial *pMdm;
Cumulocity 41:804f6a0bda26 7
Cumulocity 41:804f6a0bda26 8 const char * DeviceInfo::cellId()
Cumulocity 41:804f6a0bda26 9 {
xinlei 107:f1ee3e1eb126 10 if (!pMdm->checkNetStatus(&_netStatus)) {
Cumulocity 41:804f6a0bda26 11 return NULL;
xinlei 107:f1ee3e1eb126 12 }
Cumulocity 41:804f6a0bda26 13 if (snprintf(_cellId, sizeof(_cellId), "%X", _netStatus.ci) < 1)
Cumulocity 41:804f6a0bda26 14 return NULL;
Cumulocity 41:804f6a0bda26 15 return _cellId;
Cumulocity 41:804f6a0bda26 16 }
Cumulocity 41:804f6a0bda26 17
xinlei 107:f1ee3e1eb126 18 DeviceInfo::SignalQuality* DeviceInfo::signalQuality(bool realTime)
Cumulocity 41:804f6a0bda26 19 {
xinlei 77:f6717e4eccc4 20 if (!realTime && _signalQuality.rssi)
xinlei 77:f6717e4eccc4 21 return &_signalQuality;
xinlei 77:f6717e4eccc4 22
Cumulocity 41:804f6a0bda26 23 memset(&_signalQuality, 0, sizeof(DeviceInfo::SignalQuality));
xinlei 107:f1ee3e1eb126 24 if (!pMdm->checkNetStatus(&_netStatus)) {
xinlei 107:f1ee3e1eb126 25 aError("Check network status!\n");
Cumulocity 41:804f6a0bda26 26 return NULL;
xinlei 74:ca3001991fdc 27 }
Cumulocity 41:804f6a0bda26 28 _signalQuality.rssi = _netStatus.rssi;
Cumulocity 41:804f6a0bda26 29 _signalQuality.ber = _netStatus.ber;
Cumulocity 41:804f6a0bda26 30 return &_signalQuality;
xinlei 107:f1ee3e1eb126 31 }