41 #define _CRT_SECURE_NO_DEPRECATE //do not use windows secure crt 48 #define __FILE_ID__ "wireless" 68 if (!strcmp(j.
token,
"ssid")) {
76 }
else if (!strcmp(j.
token,
"sec")) {
84 }
else if(!strcmp(j.
token,
"channel")) {
89 }
else if(!strcmp(j.
token,
"rssi")) {
128 ,_linkQuality(LINKQUALITY_INVALID)
131 ,_security(SECURITY_INVALID)
132 ,_message(MESSAGE_INVALID)
133 ,_wlanConfig(WLANCONFIG_INVALID)
134 ,_wlanState(WLANSTATE_INVALID)
135 ,_valueCallbackWireless(NULL)
154 if(json_val->
has(
"linkQuality")) {
157 if(json_val->
has(
"ssid")) {
160 if(json_val->
has(
"channel")) {
163 if(json_val->
has(
"security")) {
166 if(json_val->
has(
"message")) {
169 if(json_val->
has(
"wlanConfig")) {
172 if(json_val->
has(
"wlanState")) {
200 }
catch (std::exception) {
229 }
catch (std::exception) {
259 }
catch (std::exception) {
289 }
catch (std::exception) {
318 }
catch (std::exception) {
340 }
catch (std::exception) {
355 res =
_setAttr(
"wlanConfig", rest_val);
356 }
catch (std::exception) {
399 }
catch (std::exception) {
447 }
catch (std::exception) {
469 if (callback != NULL) {
476 if (callback != NULL && this->
isOnline()) {
592 vector<string> wlanlist;
593 vector<YWlanRecord> res;
595 json = this->
_download(
"wlan.json?by=name");
598 for (
unsigned ii = 0; ii < wlanlist.size(); ii++) {
616 vector<YFUN_DESCR> v_fundescr;
618 string serial, funcId, funcName, funcVal, errmsg;
621 v_fundescr.size() == 0 ||
Y_SECURITY_enum _security
yCRITICAL_SECTION _this_cs
YRETCODE _load_unsafe(int msValidity)
static const int LINKQUALITY_INVALID
virtual string get_ssid(void)
static const string SSID_INVALID
YWirelessValueCallback _valueCallbackWireless
static const string MESSAGE_INVALID
Y_SECURITY_enum get_security(void)
virtual int registerValueCallback(YWirelessValueCallback callback)
static int DefaultCacheValidity
string getString(const string &key)
int get_linkQuality(void)
Y_WLANSTATE_enum _wlanState
yJsonRetCode yJsonParse(yJsonStateMachine *j)
void yLeaveCriticalSection(yCRITICAL_SECTION *cs)
virtual string get_security(void)
static const string WLANCONFIG_INVALID
string _download(const string &url)
static YRETCODE getFunctionInfo(YFUN_DESCR fundesc, YDEV_DESCR &devdescr, string &serial, string &funcId, string &funcName, string &funcVal, string &errmsg)
virtual int _invokeValueCallback(string value)
void yJsonSkip(yJsonStateMachine *j, int nitems)
YWireless(const string &func)
virtual int adhocNetwork(string ssid, string securityKey)
static const int CHANNEL_INVALID
#define YAPI_INVALID_STRING
virtual int _parseAttr(YJSONObject *json_val)
virtual vector< YWlanRecord > get_detectedWlans(void)
virtual int get_channel(void)
int getInt(const string &key)
static u64 GetTickCount(void)
static void _AddToCache(const string &classname, const string &func, YFunction *obj)
static YFunction * _FindFromCache(const string &classname, const string &func)
int set_wlanConfig(const string &newval)
vector< string > _json_get_array(const string &json)
static const Y_SECURITY_enum SECURITY_INVALID
static string ysprintf(const char *fmt,...)
static const Y_WLANSTATE_enum WLANSTATE_INVALID
void yEnterCriticalSection(yCRITICAL_SECTION *cs)
static yCRITICAL_SECTION _global_cs
YWireless * nextWireless(void)
static YWireless * FirstWireless(void)
static int getFunctionsByClass(const string &class_str, YFUN_DESCR prevfundesc, vector< YFUN_DESCR > &buffer, int maxsize, string &errmsg)
virtual int joinNetwork(string ssid, string securityKey)
virtual int startWlanScan(void)
virtual int get_linkQuality(void)
static bool _apiInitialized
YRETCODE _nextFunction(string &hwId)
virtual int _parseAttr(YJSONObject *json_val)
static void _UpdateValueCallbackList(YFunction *func, bool add)
virtual int softAPNetwork(string ssid, string securityKey)
Y_WLANSTATE_enum get_wlanState(void)
YWlanRecord(const string &json)
bool has(const string &key)
YRETCODE _setAttr(string attrname, string newvalue)
void(* YWirelessValueCallback)(YWireless *func, const string &functionValue)
static YWireless * FindWireless(string func)
string get_wlanConfig(void)
virtual int _invokeValueCallback(string value)