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 20 09:55:49 2015 +0000
Revision:
116:5de54f09f754
Parent:
107:f1ee3e1eb126
device bootstrap revamp

Who changed what in which revision?

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