CellularHelper
|
Used to hold the results for one cell (service or neighbor) from the AT+CGED command. More...
#include <CellularHelper.h>
Public Member Functions | |
bool | isValid (bool ignoreCI=false) const |
Returns true if this object looks valid. More... | |
void | parse (const char *str) |
Parses the output from the modem (used internally) More... | |
void | addKeyValue (const char *key, const char *value) |
Add a key-value pair (used internally) More... | |
String | toString () const |
Returns a readable representation of this object as a String. More... | |
int | getBand () const |
Calculated field to determine the cellular frequency band. More... | |
String | getBandString () const |
Returns a readable string that identifies the cellular frequency band. More... | |
int | getRSSI () const |
Get the RSSI (received signal strength indication) More... | |
int | getBars () const |
Get the RSSI as "bars" of signal strength (0-5) More... | |
Data Fields | |
int | mcc = 65535 |
Mobile Country Code. More... | |
int | mnc = 255 |
Mobile Network Code. More... | |
int | lac |
Location Area Code. More... | |
int | ci |
Cell Identity. More... | |
int | bsic |
Base Station Identify Code. More... | |
int | arfcn |
Absolute Radio Frequency Channel Number. More... | |
int | rxlev |
Received signal level on the cell. More... | |
bool | isUMTS = false |
RAT is GSM (false) or UMTS (true) | |
int | dlf |
Downlink frequency. More... | |
int | ulf |
Uplink frequency. Range 0 - 16383 [3G only]. | |
int | rscpLev = 255 |
Received signal level [3G]. More... | |
Used to hold the results for one cell (service or neighbor) from the AT+CGED command.
You will normally use CellularHelperEnvironmentResponseStatic<> or CellularHelperEnvironmentResponse which includes this as a member.
void CellularHelperEnvironmentCellData::addKeyValue | ( | const char * | key, |
const char * | value | ||
) |
Add a key-value pair (used internally)
The AT+CGED response contains key-value pairs. This parses out the ones we care about and stores them in the specific fields of this structure.
int CellularHelperEnvironmentCellData::getBand | ( | ) | const |
Calculated field to determine the cellular frequency band.
Values are frequency in MHz, such as: 700, 800, 850, 900, 1700, 1800, 1900, 2100
Not all bands are used by existing hardware.
Note that for 2G, 1800 is returned for the 1900 MHz band. This is because they use the same arfcn values. So 1800 really means 1800 or 1900 MHz for 2G.
String CellularHelperEnvironmentCellData::getBandString | ( | ) | const |
Returns a readable string that identifies the cellular frequency band.
Example 3G: rat=UMTS mcc=310, mnc=410, lac=1af7 ci=817b57f band=UMTS 850 rssi=0 dlf=4384 ulf=4159
Example 2G: rat=GSM mcc=310, mnc=260, lac=ab22 ci=a78a band=DCS 1800 or 1900 rssi=-97 bsic=23 arfcn=596 rxlev=24
int CellularHelperEnvironmentCellData::getBars | ( | ) | const |
Get the RSSI as "bars" of signal strength (0-5)
RSSI | Bars |
---|---|
>= -57 | 5 |
> -68 | 4 |
> -80 | 3 |
> -92 | 2 |
> -104 | 1 |
<= -104 | 0 |
This is simlar to the bar graph display on phones.
int CellularHelperEnvironmentCellData::getRSSI | ( | ) | const |
Get the RSSI (received signal strength indication)
This only available on 3G devices, and even then is not always returned. It may be 0 or 255 if not known.
bool CellularHelperEnvironmentCellData::isValid | ( | bool | ignoreCI = false | ) | const |
Returns true if this object looks valid.
ignoreCI | (bool, default false) Sometimes the cell identifier (CI) valid is not returned by the towers but other fields are set. Passing true in this parameter causes the CI to be ignored. |
void CellularHelperEnvironmentCellData::parse | ( | const char * | str | ) |
Parses the output from the modem (used internally)
Some classes use postprocess() to process the + response, but the AT+CGED response is sufficiently complicated that we parse each response as it comes in using the parse() method rather than waiting until all responses have come in.
str | The comma separated response from the modem to parse |
String CellularHelperEnvironmentCellData::toString | ( | ) | const |
Returns a readable representation of this object as a String.
int CellularHelperEnvironmentCellData::arfcn |
Absolute Radio Frequency Channel Number.
arfcn
is 0x2CD (717) and belongs to 1900 band). int CellularHelperEnvironmentCellData::bsic |
Base Station Identify Code.
int CellularHelperEnvironmentCellData::ci |
Cell Identity.
int CellularHelperEnvironmentCellData::dlf |
Downlink frequency.
int CellularHelperEnvironmentCellData::lac |
Location Area Code.
int CellularHelperEnvironmentCellData::mcc = 65535 |
Mobile Country Code.
int CellularHelperEnvironmentCellData::mnc = 255 |
Mobile Network Code.
int CellularHelperEnvironmentCellData::rscpLev = 255 |
Received signal level [3G].
Received Signal Code Power expressed in dBm levels. Range 0 - 91.
Value | RSCP | Note |
---|---|---|
0 | RSCP < -115 dBm | Weak |
1 | -115 <= RSCP < -114 dBm | |
90 | -26 <= RSCP < -25 dBm | |
91 | RSCP == -25 dBm | Strong |
int CellularHelperEnvironmentCellData::rxlev |
Received signal level on the cell.