#include <yocto_cellular.h>
Public Member Functions | |
virtual string | _AT (string cmd) |
virtual int | _invokeValueCallback (string value) |
Y_AIRPLANEMODE_enum | airplaneMode (void) |
string | apn (void) |
string | apnSecret (void) |
string | cellIdentifier (void) |
string | cellOperator (void) |
Y_CELLTYPE_enum | cellType (void) |
virtual int | clearDataCounters (void) |
string | command (void) |
int | dataReceived (void) |
int | dataSent (void) |
Y_ENABLEDATA_enum | enableData (void) |
Y_AIRPLANEMODE_enum | get_airplaneMode (void) |
string | get_apn (void) |
string | get_apnSecret (void) |
virtual vector< string > | get_availableOperators (void) |
string | get_cellIdentifier (void) |
string | get_cellOperator (void) |
Y_CELLTYPE_enum | get_cellType (void) |
string | get_command (void) |
int | get_dataReceived (void) |
int | get_dataSent (void) |
Y_ENABLEDATA_enum | get_enableData (void) |
string | get_imsi (void) |
int | get_linkQuality (void) |
string | get_lockedOperator (void) |
string | get_message (void) |
string | get_pin (void) |
int | get_pingInterval (void) |
string | imsi (void) |
int | linkQuality (void) |
string | lockedOperator (void) |
string | message (void) |
YCellular * | next (void) |
YCellular * | nextCellular (void) |
string | pin (void) |
int | pingInterval (void) |
virtual vector< YCellRecord > | quickCellSurvey (void) |
virtual int | registerValueCallback (YCellularValueCallback callback) |
virtual int | sendPUK (string puk, string newPin) |
int | set_airplaneMode (Y_AIRPLANEMODE_enum newval) |
int | set_apn (const string &newval) |
virtual int | set_apnAuth (string username, string password) |
int | set_apnSecret (const string &newval) |
int | set_command (const string &newval) |
int | set_dataReceived (int newval) |
int | set_dataSent (int newval) |
int | set_enableData (Y_ENABLEDATA_enum newval) |
int | set_lockedOperator (const string &newval) |
int | set_pin (const string &newval) |
int | set_pingInterval (int newval) |
int | setAirplaneMode (Y_AIRPLANEMODE_enum newval) |
int | setApn (const string &newval) |
int | setApnSecret (const string &newval) |
int | setCommand (const string &newval) |
int | setDataReceived (int newval) |
int | setDataSent (int newval) |
int | setEnableData (Y_ENABLEDATA_enum newval) |
int | setLockedOperator (const string &newval) |
int | setPin (const string &newval) |
int | setPingInterval (int newval) |
~YCellular () | |
Public Member Functions inherited from YFunction | |
void | _clearDataStreamCache () |
string | _decode_json_string (const string &json) |
string | _download (const string &url) |
YDataStream * | _findDataStream (YDataSet &dataset, const string &def) |
string | _get_json_path (const string &json, const string &path) |
vector< string > | _json_get_array (const string &json) |
string | _json_get_key (const string &json, const string &data) |
string | _json_get_string (const string &json) |
int | _parseEx (yJsonStateMachine &j) |
virtual int | _parserHelper (void) |
string | _parseString (yJsonStateMachine &j) |
string | _request (const string &request) |
string | _requestEx (int tcpchan, const string &request, yapiRequestProgressCallback callback, void *context) |
void | _throw (YRETCODE errType, string errMsg) |
YRETCODE | _upload (const string &path, const string &content) |
YRETCODE | _uploadWithProgress (const string &path, const string &content, yapiRequestProgressCallback callback, void *context) |
string | advertisedValue (void) |
void | clearCache () |
string | describe (void) |
string | errMessage (void) |
string | errorMessage (void) |
YRETCODE | errorType (void) |
YRETCODE | errType (void) |
YFUN_DESCR | functionDescriptor (void) |
string | get_advertisedValue (void) |
string | get_errorMessage (void) |
YRETCODE | get_errorType (void) |
virtual string | get_friendlyName (void) |
YFUN_DESCR | get_functionDescriptor (void) |
string | get_functionId (void) |
string | get_hardwareId (void) |
string | get_hubSerial () |
string | get_logicalName (void) |
YModule * | get_module (void) |
void * | get_userData (void) |
bool | isOnline (void) |
YRETCODE | load (int msValidity) |
virtual string | loadAttribute (string attrName) |
string | logicalName (void) |
YModule * | module (void) |
virtual int | muteValueCallbacks (void) |
YFunction * | next (void) |
YFunction * | nextFunction (void) |
virtual int | registerValueCallback (YFunctionValueCallback callback) |
int | set_advertisedValue (const string &newval) |
int | set_logicalName (const string &newval) |
void | set_userData (void *data) |
int | setAdvertisedValue (const string &newval) |
int | setLogicalName (const string &newval) |
void | setUserData (void *data) |
virtual int | unmuteValueCallbacks (void) |
void * | userData (void) |
virtual | ~YFunction () |
Static Public Member Functions | |
static YCellular * | Find (string func) |
static YCellular * | FindCellular (string func) |
static YCellular * | First (void) |
static YCellular * | FirstCellular (void) |
Static Public Member Functions inherited from YFunction | |
static void | _ClearCache (void) |
static YFunction * | Find (string func) |
static YFunction * | FindFunction (string func) |
static YFunction * | First (void) |
static YFunction * | FirstFunction (void) |
Protected Member Functions | |
virtual int | _parseAttr (YJSONObject *json_val) |
YCellular (const string &func) | |
Protected Member Functions inherited from YFunction | |
YRETCODE | _buildSetRequest (const string &changeattr, const string *changeval, string &request, string &errmsg) |
string | _escapeAttr (const string &changeval) |
YRETCODE | _getDescriptor (YFUN_DESCR &fundescr, string &errMsg) |
YRETCODE | _getDevice (YDevice *&dev, string &errMsg) |
YRETCODE | _load_unsafe (int msValidity) |
YRETCODE | _nextFunction (string &hwId) |
int | _parse (YJSONObject *j) |
YRETCODE | _setAttr (string attrname, string newvalue) |
YFunction (const string &func) | |
Protected Attributes | |
Y_AIRPLANEMODE_enum | _airplaneMode |
string | _apn |
string | _apnSecret |
string | _cellIdentifier |
string | _cellOperator |
Y_CELLTYPE_enum | _cellType |
string | _command |
int | _dataReceived |
int | _dataSent |
Y_ENABLEDATA_enum | _enableData |
string | _imsi |
int | _linkQuality |
string | _lockedOperator |
string | _message |
string | _pin |
int | _pingInterval |
YCellularValueCallback | _valueCallbackCellular |
Protected Attributes inherited from YFunction | |
string | _advertisedValue |
u64 | _cacheExpiration |
string | _className |
std::map< string, YDataStream * > | _dataStreams |
string | _func |
YFUN_DESCR | _fundescr |
string | _funId |
string | _hwId |
string | _lastErrorMsg |
YRETCODE | _lastErrorType |
string | _logicalName |
string | _serial |
yCRITICAL_SECTION | _this_cs |
void * | _userData |
YFunctionValueCallback | _valueCallbackFunction |
Friends | |
YCellular * | yFindCellular (const string &func) |
YCellular * | yFirstCellular (void) |
Additional Inherited Members | |
Static Protected Member Functions inherited from YFunction | |
static void | _AddToCache (const string &classname, const string &func, YFunction *obj) |
static YFunction * | _FindFromCache (const string &classname, const string &func) |
static void | _UpdateTimedReportCallbackList (YFunction *func, bool add) |
static void | _UpdateValueCallbackList (YFunction *func, bool add) |
Static Protected Attributes inherited from YFunction | |
static std::map< string, YFunction * > | _cache |
YCellular Class: Cellular function interface
YCellular functions provides control over cellular network parameters and status for devices that are GSM-enabled.
Definition at line 163 of file yocto_cellular.h.
|
protected |
Definition at line 114 of file yocto_cellular.cpp.
YCellular::~YCellular | ( | ) |
Definition at line 138 of file yocto_cellular.cpp.
|
virtual |
Sends an AT command to the GSM module and returns the command output. The command will only execute when the GSM module is in standard command state, and should leave it in the exact same state. Use this function with great care !
cmd | : the AT command to execute, like for instance: "+CCLK?". |
Definition at line 1101 of file yocto_cellular.cpp.
|
virtual |
Reimplemented from YFunction.
Definition at line 1017 of file yocto_cellular.cpp.
|
protectedvirtual |
Reimplemented from YFunction.
Definition at line 155 of file yocto_cellular.cpp.
|
inline |
Definition at line 390 of file yocto_cellular.h.
|
inline |
Definition at line 450 of file yocto_cellular.h.
|
inline |
Definition at line 479 of file yocto_cellular.h.
|
inline |
Definition at line 266 of file yocto_cellular.h.
|
inline |
Definition at line 253 of file yocto_cellular.h.
|
inline |
Definition at line 279 of file yocto_cellular.h.
|
virtual |
Clear the transmitted data counters.
On failure, throws an exception or returns a negative error code.
Definition at line 1078 of file yocto_cellular.cpp.
|
inline |
Definition at line 563 of file yocto_cellular.h.
|
inline |
Definition at line 545 of file yocto_cellular.h.
|
inline |
Definition at line 520 of file yocto_cellular.h.
|
inline |
Definition at line 418 of file yocto_cellular.h.
|
inlinestatic |
Definition at line 688 of file yocto_cellular.h.
|
static |
Retrieves a cellular interface for a given identifier. The identifier can be specified using several formats:
This function does not require that the cellular interface is online at the time it is invoked. The returned object is nevertheless valid. Use the method YCellular.isOnline() to test if the cellular interface is indeed online at a given time. In case of ambiguity when looking for a cellular interface by logical name, no error is notified: the first instance found is returned. The search is performed first by hardware name, then by logical name.
If a call to this object's is_online() method returns FALSE although you are certain that the matching device is plugged, make sure that you did call registerHub() at application initialization time.
func | : a string that uniquely characterizes the cellular interface |
Definition at line 966 of file yocto_cellular.cpp.
|
inlinestatic |
Definition at line 712 of file yocto_cellular.h.
|
static |
Starts the enumeration of cellular interfaces currently accessible. Use the method YCellular.nextCellular() to iterate on next cellular interfaces.
Definition at line 1285 of file yocto_cellular.cpp.
Y_AIRPLANEMODE_enum YCellular::get_airplaneMode | ( | void | ) |
Returns true if the airplane mode is active (radio turned off).
On failure, throws an exception or returns Y_AIRPLANEMODE_INVALID.
Definition at line 525 of file yocto_cellular.cpp.
string YCellular::get_apn | ( | void | ) |
Returns the Access Point Name (APN) to be used, if needed. When left blank, the APN suggested by the cell operator will be used.
On failure, throws an exception or returns Y_APN_INVALID.
Definition at line 643 of file yocto_cellular.cpp.
string YCellular::get_apnSecret | ( | void | ) |
Returns an opaque string if APN authentication parameters have been configured in the device, or an empty string otherwise. To configure these parameters, use set_apnAuth().
On failure, throws an exception or returns Y_APNSECRET_INVALID.
Definition at line 701 of file yocto_cellular.cpp.
|
virtual |
Returns the list detected cell operators in the neighborhood. This function will typically take between 30 seconds to 1 minute to return. Note that any SIM card can usually only connect to specific operators. All networks returned by this function might therefore not be available for connection.
Definition at line 1170 of file yocto_cellular.cpp.
string YCellular::get_cellIdentifier | ( | void | ) |
Returns the unique identifier of the cellular antenna in use: MCC, MNC, LAC and Cell ID.
On failure, throws an exception or returns Y_CELLIDENTIFIER_INVALID.
Definition at line 275 of file yocto_cellular.cpp.
string YCellular::get_cellOperator | ( | void | ) |
Returns the name of the cell operator currently in use.
On failure, throws an exception or returns Y_CELLOPERATOR_INVALID.
Definition at line 245 of file yocto_cellular.cpp.
Y_CELLTYPE_enum YCellular::get_cellType | ( | void | ) |
Active cellular connection type.
On failure, throws an exception or returns Y_CELLTYPE_INVALID.
Definition at line 305 of file yocto_cellular.cpp.
string YCellular::get_command | ( | void | ) |
Definition at line 901 of file yocto_cellular.cpp.
int YCellular::get_dataReceived | ( | void | ) |
Returns the number of bytes received so far.
On failure, throws an exception or returns Y_DATARECEIVED_INVALID.
Definition at line 854 of file yocto_cellular.cpp.
int YCellular::get_dataSent | ( | void | ) |
Returns the number of bytes sent so far.
On failure, throws an exception or returns Y_DATASENT_INVALID.
Definition at line 800 of file yocto_cellular.cpp.
Y_ENABLEDATA_enum YCellular::get_enableData | ( | void | ) |
Returns the condition for enabling IP data services (GPRS). When data services are disabled, SMS are the only mean of communication.
On failure, throws an exception or returns Y_ENABLEDATA_INVALID.
Definition at line 582 of file yocto_cellular.cpp.
string YCellular::get_imsi | ( | void | ) |
Returns an opaque string if a PIN code has been configured in the device to access the SIM card, or an empty string if none has been configured or if the code provided was rejected by the SIM card.
On failure, throws an exception or returns Y_IMSI_INVALID.
Definition at line 338 of file yocto_cellular.cpp.
int YCellular::get_linkQuality | ( | void | ) |
Returns the link quality, expressed in percent.
On failure, throws an exception or returns Y_LINKQUALITY_INVALID.
Definition at line 216 of file yocto_cellular.cpp.
string YCellular::get_lockedOperator | ( | void | ) |
Returns the name of the only cell operator to use if automatic choice is disabled, or an empty string if the SIM card will automatically choose among available cell operators.
On failure, throws an exception or returns Y_LOCKEDOPERATOR_INVALID.
Definition at line 468 of file yocto_cellular.cpp.
string YCellular::get_message | ( | void | ) |
Returns the latest status message from the wireless interface.
On failure, throws an exception or returns Y_MESSAGE_INVALID.
Definition at line 367 of file yocto_cellular.cpp.
string YCellular::get_pin | ( | void | ) |
Returns an opaque string if a PIN code has been configured in the device to access the SIM card, or an empty string if none has been configured or if the code provided was rejected by the SIM card.
On failure, throws an exception or returns Y_PIN_INVALID.
Definition at line 400 of file yocto_cellular.cpp.
int YCellular::get_pingInterval | ( | void | ) |
Returns the automated connectivity check interval, in seconds.
On failure, throws an exception or returns Y_PINGINTERVAL_INVALID.
Definition at line 746 of file yocto_cellular.cpp.
|
inline |
Definition at line 295 of file yocto_cellular.h.
|
inline |
Definition at line 241 of file yocto_cellular.h.
|
inline |
Definition at line 362 of file yocto_cellular.h.
|
inline |
Definition at line 307 of file yocto_cellular.h.
|
inline |
Definition at line 699 of file yocto_cellular.h.
YCellular * YCellular::nextCellular | ( | void | ) |
Continues the enumeration of cellular interfaces started using yFirstCellular().
Definition at line 1275 of file yocto_cellular.cpp.
|
inline |
Definition at line 323 of file yocto_cellular.h.
|
inline |
Definition at line 495 of file yocto_cellular.h.
|
virtual |
Returns a list of nearby cellular antennas, as required for quick geolocation of the device. The first cell listed is the serving cell, and the next ones are the neighboor cells reported by the serving cell.
Definition at line 1206 of file yocto_cellular.cpp.
|
virtual |
Registers the callback function that is invoked on every change of advertised value. The callback is invoked only during the execution of ySleep or yHandleEvents. This provides control over the time when the callback is triggered. For good responsiveness, remember to call one of these two functions periodically. To unregister a callback, pass a NULL pointer as argument.
callback | : the callback function to call, or a NULL pointer. The callback function should take two arguments: the function object of which the value has changed, and the character string describing the new advertised value. |
Definition at line 998 of file yocto_cellular.cpp.
|
virtual |
Sends a PUK code to unlock the SIM card after three failed PIN code attempts, and setup a new PIN into the SIM card. Only ten consecutives tentatives are permitted: after that, the SIM card will be blocked permanently without any mean of recovery to use it again. Note that after calling this method, you have usually to invoke method set_pin() to tell the YoctoHub which PIN to use in the future.
puk | : the SIM PUK code |
newPin | : new PIN code to configure into the SIM card |
On failure, throws an exception or returns a negative error code.
Definition at line 1041 of file yocto_cellular.cpp.
int YCellular::set_airplaneMode | ( | Y_AIRPLANEMODE_enum | newval | ) |
Changes the activation state of airplane mode (radio turned off).
newval | : either Y_AIRPLANEMODE_OFF or Y_AIRPLANEMODE_ON, according to the activation state of airplane mode (radio turned off) |
On failure, throws an exception or returns a negative error code.
Definition at line 557 of file yocto_cellular.cpp.
int YCellular::set_apn | ( | const string & | newval | ) |
Returns the Access Point Name (APN) to be used, if needed. When left blank, the APN suggested by the cell operator will be used.
newval | : a string |
On failure, throws an exception or returns a negative error code.
Definition at line 675 of file yocto_cellular.cpp.
|
virtual |
Configure authentication parameters to connect to the APN. Both PAP and CHAP authentication are supported.
username | : APN username |
password | : APN password |
On failure, throws an exception or returns a negative error code.
Definition at line 1066 of file yocto_cellular.cpp.
int YCellular::set_apnSecret | ( | const string & | newval | ) |
Definition at line 723 of file yocto_cellular.cpp.
int YCellular::set_command | ( | const string & | newval | ) |
Definition at line 923 of file yocto_cellular.cpp.
int YCellular::set_dataReceived | ( | int | newval | ) |
Changes the value of the incoming data counter.
newval | : an integer corresponding to the value of the incoming data counter |
On failure, throws an exception or returns a negative error code.
Definition at line 885 of file yocto_cellular.cpp.
int YCellular::set_dataSent | ( | int | newval | ) |
Changes the value of the outgoing data counter.
newval | : an integer corresponding to the value of the outgoing data counter |
On failure, throws an exception or returns a negative error code.
Definition at line 831 of file yocto_cellular.cpp.
int YCellular::set_enableData | ( | Y_ENABLEDATA_enum | newval | ) |
Changes the condition for enabling IP data services (GPRS). The service can be either fully deactivated, or limited to the SIM home network, or enabled for all partner networks (roaming). Caution: enabling data services on roaming networks may cause prohibitive communication costs !
When data services are disabled, SMS are the only mean of communication.
newval | : a value among Y_ENABLEDATA_HOMENETWORK, Y_ENABLEDATA_ROAMING, Y_ENABLEDATA_NEVER and Y_ENABLEDATA_NEUTRALITY corresponding to the condition for enabling IP data services (GPRS) |
On failure, throws an exception or returns a negative error code.
Definition at line 619 of file yocto_cellular.cpp.
int YCellular::set_lockedOperator | ( | const string & | newval | ) |
Changes the name of the cell operator to be used. If the name is an empty string, the choice will be made automatically based on the SIM card. Otherwise, the selected operator is the only one that will be used.
newval | : a string corresponding to the name of the cell operator to be used |
On failure, throws an exception or returns a negative error code.
Definition at line 501 of file yocto_cellular.cpp.
int YCellular::set_pin | ( | const string & | newval | ) |
Changes the PIN code used by the module to access the SIM card. This function does not change the code on the SIM card itself, but only changes the parameter used by the device to try to get access to it. If the SIM code does not work immediately on first try, it will be automatically forgotten and the message will be set to "Enter SIM PIN". The method should then be invoked again with right correct PIN code. After three failed attempts in a row, the message is changed to "Enter SIM PUK" and the SIM card PUK code must be provided using method sendPUK.
Remember to call the saveToFlash() method of the module to save the new value in the device flash.
newval | : a string corresponding to the PIN code used by the module to access the SIM card |
On failure, throws an exception or returns a negative error code.
Definition at line 441 of file yocto_cellular.cpp.
int YCellular::set_pingInterval | ( | int | newval | ) |
Changes the automated connectivity check interval, in seconds.
newval | : an integer corresponding to the automated connectivity check interval, in seconds |
On failure, throws an exception or returns a negative error code.
Definition at line 777 of file yocto_cellular.cpp.
|
inline |
Definition at line 404 of file yocto_cellular.h.
|
inline |
Definition at line 464 of file yocto_cellular.h.
|
inline |
Definition at line 483 of file yocto_cellular.h.
|
inline |
Definition at line 567 of file yocto_cellular.h.
|
inline |
Definition at line 558 of file yocto_cellular.h.
|
inline |
Definition at line 533 of file yocto_cellular.h.
|
inline |
Definition at line 437 of file yocto_cellular.h.
|
inline |
Definition at line 377 of file yocto_cellular.h.
|
inline |
Definition at line 346 of file yocto_cellular.h.
|
inline |
Definition at line 508 of file yocto_cellular.h.
|
friend |
Retrieves a cellular interface for a given identifier. The identifier can be specified using several formats:
This function does not require that the cellular interface is online at the time it is invoked. The returned object is nevertheless valid. Use the method YCellular.isOnline() to test if the cellular interface is indeed online at a given time. In case of ambiguity when looking for a cellular interface by logical name, no error is notified: the first instance found is returned. The search is performed first by hardware name, then by logical name.
If a call to this object's is_online() method returns FALSE although you are certain that the matching device is plugged, make sure that you did call registerHub() at application initialization time.
func | : a string that uniquely characterizes the cellular interface |
Definition at line 749 of file yocto_cellular.h.
|
friend |
Starts the enumeration of cellular interfaces currently accessible. Use the method YCellular.nextCellular() to iterate on next cellular interfaces.
Definition at line 760 of file yocto_cellular.h.
|
protected |
Definition at line 179 of file yocto_cellular.h.
|
protected |
Definition at line 181 of file yocto_cellular.h.
|
protected |
Definition at line 182 of file yocto_cellular.h.
|
protected |
Definition at line 173 of file yocto_cellular.h.
|
protected |
Definition at line 172 of file yocto_cellular.h.
|
protected |
Definition at line 174 of file yocto_cellular.h.
|
protected |
Definition at line 186 of file yocto_cellular.h.
|
protected |
Definition at line 185 of file yocto_cellular.h.
|
protected |
Definition at line 184 of file yocto_cellular.h.
|
protected |
Definition at line 180 of file yocto_cellular.h.
|
protected |
Definition at line 175 of file yocto_cellular.h.
|
protected |
Definition at line 171 of file yocto_cellular.h.
|
protected |
Definition at line 178 of file yocto_cellular.h.
|
protected |
Definition at line 176 of file yocto_cellular.h.
|
protected |
Definition at line 177 of file yocto_cellular.h.
|
protected |
Definition at line 183 of file yocto_cellular.h.
|
protected |
Definition at line 187 of file yocto_cellular.h.
|
static |
Definition at line 219 of file yocto_cellular.h.
|
static |
Definition at line 217 of file yocto_cellular.h.
|
static |
Definition at line 218 of file yocto_cellular.h.
|
static |
Definition at line 225 of file yocto_cellular.h.
|
static |
Definition at line 226 of file yocto_cellular.h.
|
static |
Definition at line 205 of file yocto_cellular.h.
|
static |
Definition at line 204 of file yocto_cellular.h.
|
static |
Definition at line 211 of file yocto_cellular.h.
|
static |
Definition at line 207 of file yocto_cellular.h.
|
static |
Definition at line 206 of file yocto_cellular.h.
|
static |
Definition at line 209 of file yocto_cellular.h.
|
static |
Definition at line 212 of file yocto_cellular.h.
|
static |
Definition at line 210 of file yocto_cellular.h.
|
static |
Definition at line 208 of file yocto_cellular.h.
|
static |
Definition at line 230 of file yocto_cellular.h.
|
static |
Definition at line 229 of file yocto_cellular.h.
|
static |
Definition at line 228 of file yocto_cellular.h.
|
static |
Definition at line 220 of file yocto_cellular.h.
|
static |
Definition at line 224 of file yocto_cellular.h.
|
static |
Definition at line 223 of file yocto_cellular.h.
|
static |
Definition at line 222 of file yocto_cellular.h.
|
static |
Definition at line 221 of file yocto_cellular.h.
|
static |
Definition at line 213 of file yocto_cellular.h.
|
static |
Definition at line 203 of file yocto_cellular.h.
|
static |
Definition at line 216 of file yocto_cellular.h.
|
static |
Definition at line 214 of file yocto_cellular.h.
|
static |
Definition at line 215 of file yocto_cellular.h.
|
static |
Definition at line 227 of file yocto_cellular.h.