Default callback for get_wififirmware
353924
def resp_set_wififirmware(self, resp):
        
        if resp:
            self.wifi_firmware_version = float(str(str(resp.version >> 16) + "." + str(resp.version & 0xff)))
            self.wifi_firmware_build_timestamp = resp.build
112884
function getFirmware (dataBuffer) {
  const regexPattern = /v\d.\d*.\d*/;
  const ret = dataBuffer.toString().match(regexPattern);
  if (ret) {
    const elems = ret[0].split('.');
    return {
      major: Number(elems[0][1]),
      minor: Number(elems[1]),
      patch: Number(elems[2]),
      raw: ret[0]
    };
  } else return ret;
}
1328111
def get_wifi_state(self):
        
        log.debug("getting wifi state...")
        cmd, url = DEVICE_URLS["get_wifi_state"]
        return self._exec(cmd, url)
1223428
def menu_callback(self, m):
        ''''''
        if m.returnkey.startswith('# '):
            cmd = m.returnkey[2:]
            if m.handler is not None:
                if m.handler_result is None:
                    return
                cmd += m.handler_result
            self.mpstate.functions.process_stdin(cmd)
        if m.returnkey == 'menuSettings':
            wxsettings.WXSettings(self.settings)
680254
def set_wifi_setting(self, ssid, psk, isenable, isusewifi, nettype,
                            encryptype, authmode, keyformat, defaultkey,
                            key1='', key2='', key3='', key4='',
                            key1len=64, key2len=64, key3len=64, key4len=64,
                            callback=None):
        '''
        
        '''
        params = {'isEnable'   : isenable,
                  'isUseWifi'  : isusewifi,
                  'ssid'       : ssid,
                  'netType'    : nettype,
                  'encryptType': encryptype,
                  'psk'        : psk,
                  'authMode'   : authmode,
                  'keyFormat'  : keyformat,
                  'defaultKey' : defaultkey,
                  'key1'       : key1,
                  'key2'       : key2,
                  'key3'       : key3,
                  'key4'       : key4,
                  'key1Len'    : key1len,
                  'key2Len'    : key2len,
                  'key3Len'    : key3len,
                  'key4Len'    : key4len,
                  }
        return self.execute_command('setWifiSetting', params, callback=callback)
1223319
def getWifiState(self):
        '''
        
        '''

        result = self.device.shell('dumpsys wifi')
        if result:
            state = result.splitlines()[0]
            if self.WIFI_IS_ENABLED_RE.match(state):
                return self.WIFI_STATE_ENABLED
            elif self.WIFI_IS_DISABLED_RE.match(state):
                return self.WIFI_STATE_DISABLED
        print >> sys.stderr, "UNKNOWN WIFI STATE:", state
        return self.WIFI_STATE_UNKNOWN
729941
def menu_callback(m):
    ''''''
    if m.returnkey.startswith('# '):
        cmd = m.returnkey[2:]
        if m.handler is not None:
            if m.handler_result is None:
                return
            cmd += m.handler_result
        process_stdin(cmd)
    elif m.returnkey == 'menuSettings':
        wxsettings.WXSettings(mestate.settings)
    elif m.returnkey.startswith("mode-"):
        idx = int(m.returnkey[5:])
        mestate.flightmode_selections[idx] = m.IsChecked()
    else:
        print('Unknown menu selection: %s' % m.returnkey)
1232572
def setmonitor(self, enable=True):
        """"""
        # We must reset the monitor cache
        if enable:
            res = self.setmode('monitor')
        else:
            res = self.setmode('managed')
        if not res:
            log_runtime.error("Npcap WlanHelper returned with an error code !")
        self.cache_mode = None
        tmp = self.cache_mode = self.ismonitor()
        return tmp if enable else (not tmp)
932645
@TargetApi(Build.VERSION_CODES.ICE_CREAM_SANDWICH)
    public static WifiP2pManager getWifiP2pManager(Context context) {
        return (WifiP2pManager) context.getSystemService(Context.WIFI_P2P_SERVICE);
    }
948825
def SSL_CTX_set_info_callback(ctx, app_info_cb):
    
    def py_info_callback(ssl, where, ret):
        try:
            app_info_cb(SSL(ssl), where, ret)
        except:
            pass
        return

    global _info_callback
    _info_callback[ctx] = _rvoid_voidp_int_int(py_info_callback)
    _SSL_CTX_set_info_callback(ctx, _info_callback[ctx])
466119
public static function getWxIpList()
    {
        $module   = 'getcallbackip';
        $queryStr = [];
        $res      = self::_get($module, '', $queryStr);
        if (!$res) {
            exit(self::getError());
        }

        return $res;
    }
720525
def scan_results(self):
        """"""
        
        bsses = self._wifi_ctrl.scan_results(self._raw_obj)

        if self._logger.isEnabledFor(logging.INFO):
            for bss in bsses:
                self._logger.info("Find bss:")
                self._logger.info("\tbssid: %s", bss.bssid)
                self._logger.info("\tssid: %s", bss.ssid)
                self._logger.info("\tfreq: %d", bss.freq)
                self._logger.info("\tauth: %s", bss.auth)
                self._logger.info("\takm: %s", bss.akm)
                self._logger.info("\tsignal: %d", bss.signal)

        return bsses
584130
private static boolean isWifiStatePermissionGranted(@NonNull Context context) {
        int res = context.checkCallingOrSelfPermission(Manifest.permission.ACCESS_WIFI_STATE);
        return (res == PackageManager.PERMISSION_GRANTED);
    }
1050989
def resp_set_hostfirmware(self, resp):
        
        if resp:
            self.host_firmware_version = float(str(str(resp.version >> 16) + "." + str(resp.version & 0xff)))
            self.host_firmware_build_timestamp = resp.build
1224285
def get_device_status(self, t):
        ''''''
        data = {}
        for name, (func, _, _) in self.addons.iteritems():
            data[name] = func(t)
        return data
999885
def callback(newstate):
    """"""
    print('callback: ', newstate)
    if newstate == modem.STATE_RING:
        if state == modem.STATE_IDLE:
            att = {"cid_time": modem.get_cidtime,
                   "cid_number": modem.get_cidnumber,
                   "cid_name": modem.get_cidname}
            print('Ringing', att)
    elif newstate == modem.STATE_CALLERID:
        att = {"cid_time": modem.get_cidtime,
               "cid_number": modem.get_cidnumber,
               "cid_name": modem.get_cidname}
        print('CallerID', att)
    elif newstate == modem.STATE_IDLE:
        print('idle')
    return
174906
private static String getMacAddress(@NonNull Context context) {

        if (isWifiStatePermissionGranted(context)) {
            WifiManager wifiManager = (WifiManager) context.getApplicationContext().getSystemService(Context.WIFI_SERVICE);
            if (wifiManager != null) {
                WifiInfo wifiInfo = wifiManager.getConnectionInfo();
                if (wifiInfo != null) {
                    return wifiInfo.getMacAddress();
                }
            }
        }

        return null;
    }