Own fork of MbedSmartRestMain

Dependencies:   C027_Support C12832 LM75B MMA7660 MbedSmartRest mbed-rtos mbed

Fork of MbedSmartRestMain by Cumulocity Official

DeviceInfo.cpp

Committer:
xinlei
Date:
2015-05-20
Revision:
116:5de54f09f754
Parent:
107:f1ee3e1eb126

File content as of revision 116:5de54f09f754:

#include <string.h>
#include "DeviceInfo.h"
#include "logging.h"

extern MDMSerial *pMdm;

const char * DeviceInfo::cellId()
{
    if (!pMdm->checkNetStatus(&_netStatus)) {
        return NULL;
    }
    if (snprintf(_cellId, sizeof(_cellId), "%X", _netStatus.ci) < 1)
        return NULL;
    return _cellId;
}

DeviceInfo::SignalQuality* DeviceInfo::signalQuality(bool realTime)
{
    if (!realTime && _signalQuality.rssi)
        return &_signalQuality;

    memset(&_signalQuality, 0, sizeof(DeviceInfo::SignalQuality));
    if (!pMdm->checkNetStatus(&_netStatus)) {
        aError("Check network status!\n");
        return NULL;
    }
    _signalQuality.rssi = _netStatus.rssi;
    _signalQuality.ber = _netStatus.ber;
    return &_signalQuality;
}