def setEthState(state): data = Parcel() reply = Parcel() data.writeInterfaceToken(DESCRIPTOR) data.writeInt(state) mRemote.transact(TRANSACTION_setEthState, data, reply, 0) reply.readExceptionCode()
def addToBlacklist(bssid): _data = Parcel() _reply = Parcel() _data.writeInterfaceToken(DESCRIPTOR) if isinstance(bssid,str): bssid = unicode(bssid) _data.writeString16(bssid) mRemote.transact(TRANSACTION_addToBlacklist, _data,_reply,0) _reply.readExceptionCode()
def isEthDeviceAdded(): data = Parcel() reply = Parcel() data.writeInterfaceToken(DESCRIPTOR) mRemote.transact(TRANSACTION_isEthDeviceAdded, data, reply, 0) reply.readExceptionCode() return 0 != reply.readInt32()
def getEthState(): data = Parcel() reply = Parcel() data.writeInterfaceToken(DESCRIPTOR) mRemote.transact(TRANSACTION_getEthState, data, reply, 0) reply.readExceptionCode() return reply.readInt32()
def pingSupplicant(): _data = Parcel() _reply = Parcel() _data.writeInterfaceToken(DESCRIPTOR) mRemote.transact(TRANSACTION_pingSupplicant, _data, _reply, 0) _reply.readExceptionCode() return _reply.readInt32() != 0
def getConfigFile(): _data = Parcel() _reply = Parcel() _data.writeInterfaceToken(DESCRIPTOR) mRemote.transact(TRANSACTION_getConfigFile, _data,_reply,0) _reply.readExceptionCode() return _reply.readString16()
def getDeviceNameList(): data = Parcel() reply = Parcel() data.writeInterfaceToken(DESCRIPTOR) mRemote.transact(TRANSACTION_getDeviceNameList, data, reply, 0) reply.readExceptionCode() result = reply.readInt32() arr = [] for i in range(result): arr.append(reply.readString16()) return arr
def getScanResults(): _data = Parcel.obtain() _reply = Parcel.obtain() _result = None try: _data.writeInterfaceToken(DESCRIPTOR) mRemote.transact(TRANSACTION_getScanResults, _data, _reply, 0) if 0 != _reply.readExceptionCode(): return None _result = _reply.createTypedArrayList(ScanResult) finally: _reply.recycle() _data.recycle() return _result
def setEthState(state): data = Parcel() reply = Parcel() data.writeInterfaceToken(DESCRIPTOR) data.writeInt(state) mRemote.transact(TRANSACTION_setEthState, data,reply,0) reply.readExceptionCode()
def isEthConfigured(): data = Parcel() reply = Parcel() data.writeInterfaceToken(DESCRIPTOR) mRemote.transact(TRANSACTION_isEthConfigured, data,reply,0) reply.readExceptionCode() return 0 != reply.readInt32()
def getEthState(): data = Parcel() reply = Parcel() data.writeInterfaceToken(DESCRIPTOR) mRemote.transact(TRANSACTION_getEthState, data,reply,0) reply.readExceptionCode() return reply.readInt32()
def getDeviceNameList(): data = Parcel() reply = Parcel() data.writeInterfaceToken(DESCRIPTOR) mRemote.transact(TRANSACTION_getDeviceNameList, data,reply,0) reply.readExceptionCode() result = reply.readInt32() arr = [] for i in range(result): arr.append(reply.readString16()) return arr
def getDhcpInfo(): _data = Parcel() _reply = Parcel() _data.writeInterfaceToken(DESCRIPTOR) mRemote.transact(TRANSACTION_getDhcpInfo, _data,_reply,0) _reply.readExceptionCode() if 0 == _reply.readInt32(): return None ipAddress = get_readable_address(reply.readInt32()); gateway = get_readable_address(reply.readInt32()); netmask = get_readable_address(reply.readInt32()); dns1 = get_readable_address(reply.readInt32()); dns2 = get_readable_address(reply.readInt32()); serverAddress = get_readable_address(reply.readInt32()); leaseDuration = get_readable_address(reply.readInt32()); info = (ipAddress,gateway,netmask,dns1,dns2,serverAddress,leaseDuration) print "ipAddress %s,\ngateway %s,\nnetmask %s,\ndns1 %s,\ndns2 %s,\nserverAddress %s,\nleaseDuration %s"%info return info
def getDhcpInfo(): data = Parcel() reply = Parcel() data.writeInterfaceToken(DESCRIPTOR) mRemote.transact(TRANSACTION_getDhcpInfo, data,reply,0) reply.readExceptionCode() result = reply.readInt32() def get_readable_address(addr): return "%d:%d:%d:%d"%(addr&0xff,(addr>>8)&0xff,(addr>>16)&0xff,(addr>>24)&0xff) if not result: return None ipAddress = get_readable_address(reply.readInt32()) gateway = get_readable_address(reply.readInt32()) netmask = get_readable_address(reply.readInt32()) dns1 = get_readable_address(reply.readInt32()) dns2 = get_readable_address(reply.readInt32()) serverAddress = get_readable_address(reply.readInt32()) leaseDuration = get_readable_address(reply.readInt32()) info = (ipAddress,gateway,netmask,dns1,dns2,serverAddress,leaseDuration) print "ipAddress %s,\ngateway %s,\nnetmask %s,\ndns1 %s,\ndns2 %s,\nserverAddress %s,\nleaseDuration %s"%info return info
def startScan(forceActive): _data = Parcel() _reply = Parcel() ret = 0 try: _data.writeInterfaceToken(DESCRIPTOR) if forceActive: _data.writeInt(1) else: _data.writeInt(0) mRemote.transact(TRANSACTION_startScan, _data, _reply, 0) ret = _reply.readExceptionCode() finally: _reply.recycle() _data.recycle() return ret == 0
def disableNetwork(netId): _data = Parcel() _reply = Parcel() _data.writeInterfaceToken(DESCRIPTOR) _data.writeInt32(netId) mRemote.transact(TRANSACTION_disableNetwork, _data, _reply, 0) _reply.readExceptionCode() return _reply.readInt32() != 0
def setWifiEnabled(enable): _data = Parcel() _reply = Parcel() _data.writeInterfaceToken(DESCRIPTOR) if enable: _data.writeInt32(1) else: _data.writeInt32(0) mRemote.transact(TRANSACTION_setWifiEnabled, _data,_reply,0) _reply.readExceptionCode() _result = (0!=_reply.readInt32()) return _result;
def getDhcpInfo(): data = Parcel() reply = Parcel() data.writeInterfaceToken(DESCRIPTOR) mRemote.transact(TRANSACTION_getDhcpInfo, data, reply, 0) reply.readExceptionCode() result = reply.readInt32() def get_readable_address(addr): return "%d:%d:%d:%d" % (addr & 0xff, (addr >> 8) & 0xff, (addr >> 16) & 0xff, (addr >> 24) & 0xff) if not result: return None ipAddress = get_readable_address(reply.readInt32()) gateway = get_readable_address(reply.readInt32()) netmask = get_readable_address(reply.readInt32()) dns1 = get_readable_address(reply.readInt32()) dns2 = get_readable_address(reply.readInt32()) serverAddress = get_readable_address(reply.readInt32()) leaseDuration = get_readable_address(reply.readInt32()) info = (ipAddress, gateway, netmask, dns1, dns2, serverAddress, leaseDuration) print "ipAddress %s,\ngateway %s,\nnetmask %s,\ndns1 %s,\ndns2 %s,\nserverAddress %s,\nleaseDuration %s" % info return info
def setWifiApEnabled(wifiConfig,enable): _data = Parcel() _reply = Parcel() _data.writeInterfaceToken(DESCRIPTOR) if wifiConfig: _data.writeInt32(1) wifiConfig.writeToParcel(_data) else: _data.writeInt32(0) if enable: _data.writeInt32(1) else: _data.writeInt32(0) mRemote.transact(TRANSACTION_setWifiApEnabled, _data,_reply,0) _reply.readExceptionCode()
def setFrequencyBand(band, persist): _data = Parcel() _reply = Parcel() _data.writeInterfaceToken(DESCRIPTOR) if isinstance(country,str): country = unicode(contry) _data.writeInt32(band) if persist: _data.writeInt32(1) else: _data.writeInt32(0) mRemote.transact(TRANSACTION_setFrequencyBand, _data,_reply,0) _reply.readExceptionCode() _result = (0!=_reply.readInt32()) return _result;