Public Member Functions | Static Public Member Functions | Static Public Attributes | Protected Member Functions | Protected Attributes | Friends | List of all members
YMessageBox Class Reference

#include <yocto_messagebox.h>

Inheritance diagram for YMessageBox:
Inheritance graph
[legend]

Public Member Functions

virtual int _invokeValueCallback (string value)
 
virtual int checkNewMessages (void)
 
virtual int clearPduCounters (void)
 
virtual int clearSIMSlot (int slot)
 
string command (void)
 
virtual YSms fetchPdu (int slot)
 
string get_command (void)
 
virtual vector< YSmsget_messages (void)
 
int get_pduReceived (void)
 
virtual vector< YSmsget_pdus (void)
 
int get_pduSent (void)
 
string get_slotsBitmap (void)
 
int get_slotsCount (void)
 
int get_slotsInUse (void)
 
virtual string gsm2str (string gsm)
 
virtual vector< int > gsm2unicode (string gsm)
 
virtual int initGsm2Unicode (void)
 
virtual YSms newMessage (string recipient)
 
YMessageBoxnext (void)
 
YMessageBoxnextMessageBox (void)
 
virtual int nextMsgRef (void)
 
int pduReceived (void)
 
int pduSent (void)
 
virtual int registerValueCallback (YMessageBoxValueCallback callback)
 
virtual int sendFlashMessage (string recipient, string message)
 
virtual int sendTextMessage (string recipient, string message)
 
int set_command (const string &newval)
 
int set_pduReceived (int newval)
 
int set_pduSent (int newval)
 
int setCommand (const string &newval)
 
int setPduReceived (int newval)
 
int setPduSent (int newval)
 
string slotsBitmap (void)
 
int slotsCount (void)
 
int slotsInUse (void)
 
virtual string str2gsm (string msg)
 
 ~YMessageBox ()
 
- 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)
 
YModuleget_module (void)
 
void * get_userData (void)
 
bool isOnline (void)
 
YRETCODE load (int msValidity)
 
virtual string loadAttribute (string attrName)
 
string logicalName (void)
 
YModulemodule (void)
 
virtual int muteValueCallbacks (void)
 
YFunctionnext (void)
 
YFunctionnextFunction (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 YMessageBoxFind (string func)
 
static YMessageBoxFindMessageBox (string func)
 
static YMessageBoxFirst (void)
 
static YMessageBoxFirstMessageBox (void)
 
- Static Public Member Functions inherited from YFunction
static void _ClearCache (void)
 
static YFunctionFind (string func)
 
static YFunctionFindFunction (string func)
 
static YFunctionFirst (void)
 
static YFunctionFirstFunction (void)
 

Static Public Attributes

static const string COMMAND_INVALID = YAPI_INVALID_STRING
 
static const int PDURECEIVED_INVALID = YAPI_INVALID_UINT
 
static const int PDUSENT_INVALID = YAPI_INVALID_UINT
 
static const string SLOTSBITMAP_INVALID = YAPI_INVALID_STRING
 
static const int SLOTSCOUNT_INVALID = YAPI_INVALID_UINT
 
static const int SLOTSINUSE_INVALID = YAPI_INVALID_UINT
 
- Static Public Attributes inherited from YFunction
static const string ADVERTISEDVALUE_INVALID = YAPI_INVALID_STRING
 
static const string FRIENDLYNAME_INVALID = YAPI_INVALID_STRING
 
static const YFUN_DESCR FUNCTIONDESCRIPTOR_INVALID = Y_FUNCTIONDESCRIPTOR_INVALID
 
static const string FUNCTIONID_INVALID = YAPI_INVALID_STRING
 
static const string HARDWAREID_INVALID = YAPI_INVALID_STRING
 
static const string LOGICALNAME_INVALID = YAPI_INVALID_STRING
 

Protected Member Functions

virtual int _parseAttr (YJSONObject *json_val)
 
 YMessageBox (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

string _command
 
vector< int > _gsm2unicode
 
bool _gsm2unicodeReady
 
string _iso2gsm
 
vector< YSms_messages
 
int _nextMsgRef
 
int _pduReceived
 
vector< YSms_pdus
 
int _pduSent
 
string _prevBitmapStr
 
string _slotsBitmap
 
int _slotsCount
 
int _slotsInUse
 
YMessageBoxValueCallback _valueCallbackMessageBox
 
- 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

YMessageBoxyFindMessageBox (const string &func)
 
YMessageBoxyFirstMessageBox (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
 

Detailed Description

YMessageBox Class: MessageBox function interface

YMessageBox functions provides SMS sending and receiving capability to GSM-enabled Yoctopuce devices.

Definition at line 226 of file yocto_messagebox.h.

Constructor & Destructor Documentation

YMessageBox::YMessageBox ( const string &  func)
protected

Definition at line 1273 of file yocto_messagebox.cpp.

YMessageBox::~YMessageBox ( )

Definition at line 1289 of file yocto_messagebox.cpp.

Member Function Documentation

int YMessageBox::_invokeValueCallback ( string  value)
virtual

Reimplemented from YFunction.

Definition at line 1627 of file yocto_messagebox.cpp.

int YMessageBox::_parseAttr ( YJSONObject json_val)
protectedvirtual

Reimplemented from YFunction.

Definition at line 1299 of file yocto_messagebox.cpp.

int YMessageBox::checkNewMessages ( void  )
virtual

Definition at line 2000 of file yocto_messagebox.cpp.

int YMessageBox::clearPduCounters ( void  )
virtual

Clear the SMS units counters.

Returns
YAPI_SUCCESS when the call succeeds.

On failure, throws an exception or returns a negative error code.

Definition at line 2140 of file yocto_messagebox.cpp.

int YMessageBox::clearSIMSlot ( int  slot)
virtual

Definition at line 1643 of file yocto_messagebox.cpp.

string YMessageBox::command ( void  )
inline

Definition at line 351 of file yocto_messagebox.h.

YSms YMessageBox::fetchPdu ( int  slot)
virtual

Definition at line 1649 of file yocto_messagebox.cpp.

static YMessageBox* YMessageBox::Find ( string  func)
inlinestatic

Definition at line 488 of file yocto_messagebox.h.

YMessageBox * YMessageBox::FindMessageBox ( string  func)
static

Retrieves a MessageBox interface for a given identifier. The identifier can be specified using several formats:

  • FunctionLogicalName
  • ModuleSerialNumber.FunctionIdentifier
  • ModuleSerialNumber.FunctionLogicalName
  • ModuleLogicalName.FunctionIdentifier
  • ModuleLogicalName.FunctionLogicalName

This function does not require that the MessageBox interface is online at the time it is invoked. The returned object is nevertheless valid. Use the method YMessageBox.isOnline() to test if the MessageBox interface is indeed online at a given time. In case of ambiguity when looking for a MessageBox 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.

Parameters
func: a string that uniquely characterizes the MessageBox interface
Returns
a YMessageBox object allowing you to drive the MessageBox interface.

Definition at line 1576 of file yocto_messagebox.cpp.

static YMessageBox* YMessageBox::First ( void  )
inlinestatic

Definition at line 512 of file yocto_messagebox.h.

YMessageBox * YMessageBox::FirstMessageBox ( void  )
static

Starts the enumeration of MessageBox interfaces currently accessible. Use the method YMessageBox.nextMessageBox() to iterate on next MessageBox interfaces.

Returns
a pointer to a YMessageBox object, corresponding to the first MessageBox interface currently online, or a NULL pointer if there are none.

Definition at line 2246 of file yocto_messagebox.cpp.

string YMessageBox::get_command ( void  )

Definition at line 1511 of file yocto_messagebox.cpp.

vector< YSms > YMessageBox::get_messages ( void  )
virtual

Returns the list of messages received and not deleted. This function will automatically decode concatenated SMS.

Returns
an YSms object list.

On failure, throws an exception or returns an empty list.

Definition at line 2230 of file yocto_messagebox.cpp.

int YMessageBox::get_pduReceived ( void  )

Returns the number of SMS units received so far.

Returns
an integer corresponding to the number of SMS units received so far

On failure, throws an exception or returns Y_PDURECEIVED_INVALID.

Definition at line 1464 of file yocto_messagebox.cpp.

vector< YSms > YMessageBox::get_pdus ( void  )
virtual

Definition at line 2127 of file yocto_messagebox.cpp.

int YMessageBox::get_pduSent ( void  )

Returns the number of SMS units sent so far.

Returns
an integer corresponding to the number of SMS units sent so far

On failure, throws an exception or returns Y_PDUSENT_INVALID.

Definition at line 1410 of file yocto_messagebox.cpp.

string YMessageBox::get_slotsBitmap ( void  )

Definition at line 1381 of file yocto_messagebox.cpp.

int YMessageBox::get_slotsCount ( void  )

Returns the total number of message storage slots on the SIM card.

Returns
an integer corresponding to the total number of message storage slots on the SIM card

On failure, throws an exception or returns Y_SLOTSCOUNT_INVALID.

Definition at line 1359 of file yocto_messagebox.cpp.

int YMessageBox::get_slotsInUse ( void  )

Returns the number of message storage slots currently in use.

Returns
an integer corresponding to the number of message storage slots currently in use

On failure, throws an exception or returns Y_SLOTSINUSE_INVALID.

Definition at line 1330 of file yocto_messagebox.cpp.

string YMessageBox::gsm2str ( string  gsm)
virtual

Definition at line 1833 of file yocto_messagebox.cpp.

vector< int > YMessageBox::gsm2unicode ( string  gsm)
virtual

Definition at line 1749 of file yocto_messagebox.cpp.

int YMessageBox::initGsm2Unicode ( void  )
virtual

Definition at line 1665 of file yocto_messagebox.cpp.

YSms YMessageBox::newMessage ( string  recipient)
virtual

Creates a new empty SMS message, to be configured and sent later on.

Parameters
recipient: a text string with the recipient phone number, either as a national number, or in international format starting with a plus sign
Returns
YAPI_SUCCESS when the call succeeds.

On failure, throws an exception or returns a negative error code.

Definition at line 2214 of file yocto_messagebox.cpp.

YMessageBox* YMessageBox::next ( void  )
inline

Definition at line 499 of file yocto_messagebox.h.

YMessageBox * YMessageBox::nextMessageBox ( void  )

Continues the enumeration of MessageBox interfaces started using yFirstMessageBox().

Returns
a pointer to a YMessageBox object, corresponding to a MessageBox interface currently online, or a NULL pointer if there are no more MessageBox interfaces to enumerate.

Definition at line 2236 of file yocto_messagebox.cpp.

int YMessageBox::nextMsgRef ( void  )
virtual

Definition at line 1637 of file yocto_messagebox.cpp.

int YMessageBox::pduReceived ( void  )
inline

Definition at line 333 of file yocto_messagebox.h.

int YMessageBox::pduSent ( void  )
inline

Definition at line 308 of file yocto_messagebox.h.

int YMessageBox::registerValueCallback ( YMessageBoxValueCallback  callback)
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.

Parameters
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 1608 of file yocto_messagebox.cpp.

int YMessageBox::sendFlashMessage ( string  recipient,
string  message 
)
virtual

Sends a Flash SMS (class 0 message). Flash messages are displayed on the handset immediately and are usually not saved on the SIM card. This function can send messages of more than 160 characters, using SMS concatenation. ISO-latin accented characters are supported. For sending messages with special unicode characters such as asian characters and emoticons, use newMessage to create a new message and define the content of using methods addText et addUnicodeData.

Parameters
recipient: a text string with the recipient phone number, either as a national number, or in international format starting with a plus sign
message: the text to be sent in the message
Returns
YAPI_SUCCESS when the call succeeds.

On failure, throws an exception or returns a negative error code.

Definition at line 2193 of file yocto_messagebox.cpp.

int YMessageBox::sendTextMessage ( string  recipient,
string  message 
)
virtual

Sends a regular text SMS, with standard parameters. This function can send messages of more than 160 characters, using SMS concatenation. ISO-latin accented characters are supported. For sending messages with special unicode characters such as asian characters and emoticons, use newMessage to create a new message and define the content of using methods addText and addUnicodeData.

Parameters
recipient: a text string with the recipient phone number, either as a national number, or in international format starting with a plus sign
message: the text to be sent in the message
Returns
YAPI_SUCCESS when the call succeeds.

On failure, throws an exception or returns a negative error code.

Definition at line 2167 of file yocto_messagebox.cpp.

int YMessageBox::set_command ( const string &  newval)

Definition at line 1533 of file yocto_messagebox.cpp.

int YMessageBox::set_pduReceived ( int  newval)

Changes the value of the incoming SMS units counter.

Parameters
newval: an integer corresponding to the value of the incoming SMS units counter
Returns
YAPI_SUCCESS if the call succeeds.

On failure, throws an exception or returns a negative error code.

Definition at line 1495 of file yocto_messagebox.cpp.

int YMessageBox::set_pduSent ( int  newval)

Changes the value of the outgoing SMS units counter.

Parameters
newval: an integer corresponding to the value of the outgoing SMS units counter
Returns
YAPI_SUCCESS if the call succeeds.

On failure, throws an exception or returns a negative error code.

Definition at line 1441 of file yocto_messagebox.cpp.

int YMessageBox::setCommand ( const string &  newval)
inline

Definition at line 355 of file yocto_messagebox.h.

int YMessageBox::setPduReceived ( int  newval)
inline

Definition at line 346 of file yocto_messagebox.h.

int YMessageBox::setPduSent ( int  newval)
inline

Definition at line 321 of file yocto_messagebox.h.

string YMessageBox::slotsBitmap ( void  )
inline

Definition at line 296 of file yocto_messagebox.h.

int YMessageBox::slotsCount ( void  )
inline

Definition at line 291 of file yocto_messagebox.h.

int YMessageBox::slotsInUse ( void  )
inline

Definition at line 279 of file yocto_messagebox.h.

string YMessageBox::str2gsm ( string  msg)
virtual

Definition at line 1924 of file yocto_messagebox.cpp.

Friends And Related Function Documentation

YMessageBox* yFindMessageBox ( const string &  func)
friend

Retrieves a MessageBox interface for a given identifier. The identifier can be specified using several formats:

  • FunctionLogicalName
  • ModuleSerialNumber.FunctionIdentifier
  • ModuleSerialNumber.FunctionLogicalName
  • ModuleLogicalName.FunctionIdentifier
  • ModuleLogicalName.FunctionLogicalName

This function does not require that the MessageBox interface is online at the time it is invoked. The returned object is nevertheless valid. Use the method YMessageBox.isOnline() to test if the MessageBox interface is indeed online at a given time. In case of ambiguity when looking for a MessageBox 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.

Parameters
func: a string that uniquely characterizes the MessageBox interface
Returns
a YMessageBox object allowing you to drive the MessageBox interface.

Definition at line 549 of file yocto_messagebox.h.

YMessageBox* yFirstMessageBox ( void  )
friend

Starts the enumeration of MessageBox interfaces currently accessible. Use the method YMessageBox.nextMessageBox() to iterate on next MessageBox interfaces.

Returns
a pointer to a YMessageBox object, corresponding to the first MessageBox interface currently online, or a NULL pointer if there are none.

Definition at line 560 of file yocto_messagebox.h.

Member Data Documentation

string YMessageBox::_command
protected

Definition at line 239 of file yocto_messagebox.h.

vector<int> YMessageBox::_gsm2unicode
protected

Definition at line 246 of file yocto_messagebox.h.

bool YMessageBox::_gsm2unicodeReady
protected

Definition at line 245 of file yocto_messagebox.h.

string YMessageBox::_iso2gsm
protected

Definition at line 247 of file yocto_messagebox.h.

vector<YSms> YMessageBox::_messages
protected

Definition at line 244 of file yocto_messagebox.h.

int YMessageBox::_nextMsgRef
protected

Definition at line 241 of file yocto_messagebox.h.

int YMessageBox::_pduReceived
protected

Definition at line 238 of file yocto_messagebox.h.

vector<YSms> YMessageBox::_pdus
protected

Definition at line 243 of file yocto_messagebox.h.

int YMessageBox::_pduSent
protected

Definition at line 237 of file yocto_messagebox.h.

string YMessageBox::_prevBitmapStr
protected

Definition at line 242 of file yocto_messagebox.h.

string YMessageBox::_slotsBitmap
protected

Definition at line 236 of file yocto_messagebox.h.

int YMessageBox::_slotsCount
protected

Definition at line 235 of file yocto_messagebox.h.

int YMessageBox::_slotsInUse
protected

Definition at line 234 of file yocto_messagebox.h.

YMessageBoxValueCallback YMessageBox::_valueCallbackMessageBox
protected

Definition at line 240 of file yocto_messagebox.h.

const string YMessageBox::COMMAND_INVALID = YAPI_INVALID_STRING
static

Definition at line 268 of file yocto_messagebox.h.

const int YMessageBox::PDURECEIVED_INVALID = YAPI_INVALID_UINT
static

Definition at line 267 of file yocto_messagebox.h.

const int YMessageBox::PDUSENT_INVALID = YAPI_INVALID_UINT
static

Definition at line 266 of file yocto_messagebox.h.

const string YMessageBox::SLOTSBITMAP_INVALID = YAPI_INVALID_STRING
static

Definition at line 265 of file yocto_messagebox.h.

const int YMessageBox::SLOTSCOUNT_INVALID = YAPI_INVALID_UINT
static

Definition at line 264 of file yocto_messagebox.h.

const int YMessageBox::SLOTSINUSE_INVALID = YAPI_INVALID_UINT
static

Definition at line 263 of file yocto_messagebox.h.


The documentation for this class was generated from the following files:


yoctopuce_altimeter
Author(s): Anja Sheppard
autogenerated on Mon Jun 10 2019 15:49:13