Public Member Functions | Static Public Member Functions | Static Public Attributes | Private Member Functions | Private Attributes | Friends | List of all members
YWireless Class Reference

#include <yocto_wireless.h>

Inheritance diagram for YWireless:
Inheritance graph
[legend]

Public Member Functions

virtual int _invokeValueCallback (string value)
 
virtual int adhocNetwork (string ssid, string securityKey)
 
int channel (void)
 
int get_channel (void)
 
virtual vector< YWlanRecordget_detectedWlans (void)
 
int get_linkQuality (void)
 
string get_message (void)
 
Y_SECURITY_enum get_security (void)
 
string get_ssid (void)
 
string get_wlanConfig (void)
 
Y_WLANSTATE_enum get_wlanState (void)
 
virtual int joinNetwork (string ssid, string securityKey)
 
int linkQuality (void)
 
string message (void)
 
YWirelessnext (void)
 
YWirelessnextWireless (void)
 
virtual int registerValueCallback (YWirelessValueCallback callback)
 
Y_SECURITY_enum security (void)
 
int set_wlanConfig (const string &newval)
 
int setWlanConfig (const string &newval)
 
virtual int softAPNetwork (string ssid, string securityKey)
 
string ssid (void)
 
virtual int startWlanScan (void)
 
string wlanConfig (void)
 
Y_WLANSTATE_enum wlanState (void)
 
 ~YWireless ()
 
- 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 YWirelessFind (string func)
 
static YWirelessFindWireless (string func)
 
static YWirelessFirst (void)
 
static YWirelessFirstWireless (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 int CHANNEL_INVALID = YAPI_INVALID_UINT
 
static const int LINKQUALITY_INVALID = YAPI_INVALID_UINT
 
static const string MESSAGE_INVALID = YAPI_INVALID_STRING
 
static const Y_SECURITY_enum SECURITY_INVALID = Y_SECURITY_INVALID
 
static const Y_SECURITY_enum SECURITY_OPEN = Y_SECURITY_OPEN
 
static const Y_SECURITY_enum SECURITY_UNKNOWN = Y_SECURITY_UNKNOWN
 
static const Y_SECURITY_enum SECURITY_WEP = Y_SECURITY_WEP
 
static const Y_SECURITY_enum SECURITY_WPA = Y_SECURITY_WPA
 
static const Y_SECURITY_enum SECURITY_WPA2 = Y_SECURITY_WPA2
 
static const string SSID_INVALID = YAPI_INVALID_STRING
 
static const string WLANCONFIG_INVALID = YAPI_INVALID_STRING
 
static const Y_WLANSTATE_enum WLANSTATE_CONNECTED = Y_WLANSTATE_CONNECTED
 
static const Y_WLANSTATE_enum WLANSTATE_DOWN = Y_WLANSTATE_DOWN
 
static const Y_WLANSTATE_enum WLANSTATE_INVALID = Y_WLANSTATE_INVALID
 
static const Y_WLANSTATE_enum WLANSTATE_REJECTED = Y_WLANSTATE_REJECTED
 
static const Y_WLANSTATE_enum WLANSTATE_SCANNING = Y_WLANSTATE_SCANNING
 
- 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
 

Private Member Functions

virtual int _parseAttr (YJSONObject *json_val)
 
 YWireless (const string &func)
 

Private Attributes

int _channel
 
int _linkQuality
 
string _message
 
Y_SECURITY_enum _security
 
string _ssid
 
YWirelessValueCallback _valueCallbackWireless
 
string _wlanConfig
 
Y_WLANSTATE_enum _wlanState
 

Friends

YWirelessyFindWireless (const string &func)
 
YWirelessyFirstWireless (void)
 

Additional Inherited Members

- 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)
 
- 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)
 
- 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
 
- Static Protected Attributes inherited from YFunction
static std::map< string, YFunction * > _cache
 

Detailed Description

YWireless Class: Wireless function interface

YWireless functions provides control over wireless network parameters and status for devices that are wireless-enabled.

Definition at line 137 of file yocto_wireless.h.

Constructor & Destructor Documentation

YWireless::YWireless ( const string &  func)
private

Definition at line 126 of file yocto_wireless.cpp.

YWireless::~YWireless ( )

Definition at line 141 of file yocto_wireless.cpp.

Member Function Documentation

int YWireless::_invokeValueCallback ( string  value)
virtual

Reimplemented from YFunction.

Definition at line 485 of file yocto_wireless.cpp.

int YWireless::_parseAttr ( YJSONObject json_val)
privatevirtual

Reimplemented from YFunction.

Definition at line 152 of file yocto_wireless.cpp.

int YWireless::adhocNetwork ( string  ssid,
string  securityKey 
)
virtual

Changes the configuration of the wireless lan interface to create an ad-hoc wireless network, without using an access point. On the YoctoHub-Wireless-g, it is best to use softAPNetworkInstead(), which emulates an access point (Soft AP) which is more efficient and more widely supported than ad-hoc networks.

When a security key is specified for an ad-hoc network, the network is protected by a WEP40 key (5 characters or 10 hexadecimal digits) or WEP128 key (13 characters or 26 hexadecimal digits). It is recommended to use a well-randomized WEP128 key using 26 hexadecimal digits to maximize security. Remember to call the saveToFlash() method and then to reboot the module to apply this setting.

Parameters
ssid: the name of the network to connect to
securityKey: the network key, as a character string
Returns
YAPI_SUCCESS when the call succeeds.

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

Definition at line 550 of file yocto_wireless.cpp.

int YWireless::channel ( void  )
inline

Definition at line 220 of file yocto_wireless.h.

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

Definition at line 410 of file yocto_wireless.h.

YWireless * YWireless::FindWireless ( string  func)
static

Retrieves a wireless lan 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 wireless lan interface is online at the time it is invoked. The returned object is nevertheless valid. Use the method YWireless.isOnline() to test if the wireless lan interface is indeed online at a given time. In case of ambiguity when looking for a wireless lan 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 wireless lan interface
Returns
a YWireless object allowing you to drive the wireless lan interface.

Definition at line 434 of file yocto_wireless.cpp.

static YWireless* YWireless::First ( void  )
inlinestatic

Definition at line 434 of file yocto_wireless.h.

YWireless * YWireless::FirstWireless ( void  )
static

Starts the enumeration of wireless lan interfaces currently accessible. Use the method YWireless.nextWireless() to iterate on next wireless lan interfaces.

Returns
a pointer to a YWireless object, corresponding to the first wireless lan interface currently online, or a NULL pointer if there are none.

Definition at line 614 of file yocto_wireless.cpp.

int YWireless::get_channel ( void  )

Returns the 802.11 channel currently used, or 0 when the selected network has not been found.

Returns
an integer corresponding to the 802.11 channel currently used, or 0 when the selected network has not been found

On failure, throws an exception or returns Y_CHANNEL_INVALID.

Definition at line 245 of file yocto_wireless.cpp.

vector< YWlanRecord > YWireless::get_detectedWlans ( void  )
virtual

Returns a list of YWlanRecord objects that describe detected Wireless networks. This list is not updated when the module is already connected to an acces point (infrastructure mode). To force an update of this list, startWlanScan() must be called. Note that an languages without garbage collections, the returned list must be freed by the caller.

Returns
a list of YWlanRecord objects, containing the SSID, channel, link quality and the type of security of the wireless network.

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

Definition at line 589 of file yocto_wireless.cpp.

int YWireless::get_linkQuality ( void  )

Returns the link quality, expressed in percent.

Returns
an integer corresponding to the link quality, expressed in percent

On failure, throws an exception or returns Y_LINKQUALITY_INVALID.

Definition at line 186 of file yocto_wireless.cpp.

string YWireless::get_message ( void  )

Returns the latest status message from the wireless interface.

Returns
a string corresponding to the latest status message from the wireless interface

On failure, throws an exception or returns Y_MESSAGE_INVALID.

Definition at line 304 of file yocto_wireless.cpp.

Y_SECURITY_enum YWireless::get_security ( void  )

Returns the security algorithm used by the selected wireless network.

Returns
a value among Y_SECURITY_UNKNOWN, Y_SECURITY_OPEN, Y_SECURITY_WEP, Y_SECURITY_WPA and Y_SECURITY_WPA2 corresponding to the security algorithm used by the selected wireless network

On failure, throws an exception or returns Y_SECURITY_INVALID.

Definition at line 275 of file yocto_wireless.cpp.

string YWireless::get_ssid ( void  )

Returns the wireless network name (SSID).

Returns
a string corresponding to the wireless network name (SSID)

On failure, throws an exception or returns Y_SSID_INVALID.

Definition at line 215 of file yocto_wireless.cpp.

string YWireless::get_wlanConfig ( void  )

Definition at line 326 of file yocto_wireless.cpp.

Y_WLANSTATE_enum YWireless::get_wlanState ( void  )

Returns the current state of the wireless interface. The state Y_WLANSTATE_DOWN means that the network interface is not connected to a network. The state Y_WLANSTATE_SCANNING means that the network interface is scanning available frequencies. During this stage, the device is not reachable, and the network settings are not yet applied. The state Y_WLANSTATE_CONNECTED means that the network settings have been successfully applied ant that the device is reachable from the wireless network. If the device is configured to use ad-hoc or Soft AP mode, it means that the wireless network is up and that other devices can join the network. The state Y_WLANSTATE_REJECTED means that the network interface has not been able to join the requested network. The description of the error can be obtain with the get_message() method.

Returns
a value among Y_WLANSTATE_DOWN, Y_WLANSTATE_SCANNING, Y_WLANSTATE_CONNECTED and Y_WLANSTATE_REJECTED corresponding to the current state of the wireless interface

On failure, throws an exception or returns Y_WLANSTATE_INVALID.

Definition at line 385 of file yocto_wireless.cpp.

int YWireless::joinNetwork ( string  ssid,
string  securityKey 
)
virtual

Changes the configuration of the wireless lan interface to connect to an existing access point (infrastructure mode). Remember to call the saveToFlash() method and then to reboot the module to apply this setting.

Parameters
ssid: the name of the network to connect to
securityKey: the network key, as a character string
Returns
YAPI_SUCCESS when the call succeeds.

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

Definition at line 525 of file yocto_wireless.cpp.

int YWireless::linkQuality ( void  )
inline

Definition at line 195 of file yocto_wireless.h.

string YWireless::message ( void  )
inline

Definition at line 245 of file yocto_wireless.h.

YWireless* YWireless::next ( void  )
inline

Definition at line 421 of file yocto_wireless.h.

YWireless * YWireless::nextWireless ( void  )

Continues the enumeration of wireless lan interfaces started using yFirstWireless().

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

Definition at line 604 of file yocto_wireless.cpp.

int YWireless::registerValueCallback ( YWirelessValueCallback  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 466 of file yocto_wireless.cpp.

Y_SECURITY_enum YWireless::security ( void  )
inline

Definition at line 233 of file yocto_wireless.h.

int YWireless::set_wlanConfig ( const string &  newval)

Definition at line 348 of file yocto_wireless.cpp.

int YWireless::setWlanConfig ( const string &  newval)
inline

Definition at line 254 of file yocto_wireless.h.

int YWireless::softAPNetwork ( string  ssid,
string  securityKey 
)
virtual

Changes the configuration of the wireless lan interface to create a new wireless network by emulating a WiFi access point (Soft AP). This function can only be used with the YoctoHub-Wireless-g.

When a security key is specified for a SoftAP network, the network is protected by a WEP40 key (5 characters or 10 hexadecimal digits) or WEP128 key (13 characters or 26 hexadecimal digits). It is recommended to use a well-randomized WEP128 key using 26 hexadecimal digits to maximize security. Remember to call the saveToFlash() method and then to reboot the module to apply this setting.

Parameters
ssid: the name of the network to connect to
securityKey: the network key, as a character string
Returns
YAPI_SUCCESS when the call succeeds.

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

Definition at line 573 of file yocto_wireless.cpp.

string YWireless::ssid ( void  )
inline

Definition at line 207 of file yocto_wireless.h.

int YWireless::startWlanScan ( void  )
virtual

Triggers a scan of the wireless frequency and builds the list of available networks. The scan forces a disconnection from the current network. At then end of the process, the the network interface attempts to reconnect to the previous network. During the scan, the wlanState switches to Y_WLANSTATE_DOWN, then to Y_WLANSTATE_SCANNING. When the scan is completed, get_wlanState() returns either Y_WLANSTATE_DOWN or Y_WLANSTATE_SCANNING. At this point, the list of detected network can be retrieved with the get_detectedWlans() method.

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

Definition at line 505 of file yocto_wireless.cpp.

string YWireless::wlanConfig ( void  )
inline

Definition at line 250 of file yocto_wireless.h.

Y_WLANSTATE_enum YWireless::wlanState ( void  )
inline

Definition at line 280 of file yocto_wireless.h.

Friends And Related Function Documentation

YWireless* yFindWireless ( const string &  func)
friend

Retrieves a wireless lan 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 wireless lan interface is online at the time it is invoked. The returned object is nevertheless valid. Use the method YWireless.isOnline() to test if the wireless lan interface is indeed online at a given time. In case of ambiguity when looking for a wireless lan 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 wireless lan interface
Returns
a YWireless object allowing you to drive the wireless lan interface.

Definition at line 471 of file yocto_wireless.h.

YWireless* yFirstWireless ( void  )
friend

Starts the enumeration of wireless lan interfaces currently accessible. Use the method YWireless.nextWireless() to iterate on next wireless lan interfaces.

Returns
a pointer to a YWireless object, corresponding to the first wireless lan interface currently online, or a NULL pointer if there are none.

Definition at line 482 of file yocto_wireless.h.

Member Data Documentation

int YWireless::_channel
private

Definition at line 146 of file yocto_wireless.h.

int YWireless::_linkQuality
private

Definition at line 144 of file yocto_wireless.h.

string YWireless::_message
private

Definition at line 148 of file yocto_wireless.h.

Y_SECURITY_enum YWireless::_security
private

Definition at line 147 of file yocto_wireless.h.

string YWireless::_ssid
private

Definition at line 145 of file yocto_wireless.h.

YWirelessValueCallback YWireless::_valueCallbackWireless
private

Definition at line 151 of file yocto_wireless.h.

string YWireless::_wlanConfig
private

Definition at line 149 of file yocto_wireless.h.

Y_WLANSTATE_enum YWireless::_wlanState
private

Definition at line 150 of file yocto_wireless.h.

const int YWireless::CHANNEL_INVALID = YAPI_INVALID_UINT
static

Definition at line 171 of file yocto_wireless.h.

const int YWireless::LINKQUALITY_INVALID = YAPI_INVALID_UINT
static

Definition at line 169 of file yocto_wireless.h.

const string YWireless::MESSAGE_INVALID = YAPI_INVALID_STRING
static

Definition at line 178 of file yocto_wireless.h.

const Y_SECURITY_enum YWireless::SECURITY_INVALID = Y_SECURITY_INVALID
static

Definition at line 177 of file yocto_wireless.h.

const Y_SECURITY_enum YWireless::SECURITY_OPEN = Y_SECURITY_OPEN
static

Definition at line 173 of file yocto_wireless.h.

const Y_SECURITY_enum YWireless::SECURITY_UNKNOWN = Y_SECURITY_UNKNOWN
static

Definition at line 172 of file yocto_wireless.h.

const Y_SECURITY_enum YWireless::SECURITY_WEP = Y_SECURITY_WEP
static

Definition at line 174 of file yocto_wireless.h.

const Y_SECURITY_enum YWireless::SECURITY_WPA = Y_SECURITY_WPA
static

Definition at line 175 of file yocto_wireless.h.

const Y_SECURITY_enum YWireless::SECURITY_WPA2 = Y_SECURITY_WPA2
static

Definition at line 176 of file yocto_wireless.h.

const string YWireless::SSID_INVALID = YAPI_INVALID_STRING
static

Definition at line 170 of file yocto_wireless.h.

const string YWireless::WLANCONFIG_INVALID = YAPI_INVALID_STRING
static

Definition at line 179 of file yocto_wireless.h.

const Y_WLANSTATE_enum YWireless::WLANSTATE_CONNECTED = Y_WLANSTATE_CONNECTED
static

Definition at line 182 of file yocto_wireless.h.

const Y_WLANSTATE_enum YWireless::WLANSTATE_DOWN = Y_WLANSTATE_DOWN
static

Definition at line 180 of file yocto_wireless.h.

const Y_WLANSTATE_enum YWireless::WLANSTATE_INVALID = Y_WLANSTATE_INVALID
static

Definition at line 184 of file yocto_wireless.h.

const Y_WLANSTATE_enum YWireless::WLANSTATE_REJECTED = Y_WLANSTATE_REJECTED
static

Definition at line 183 of file yocto_wireless.h.

const Y_WLANSTATE_enum YWireless::WLANSTATE_SCANNING = Y_WLANSTATE_SCANNING
static

Definition at line 181 of file yocto_wireless.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:14