Esempio n. 1
0
def setEthState(state):
    data = Parcel()
    reply = Parcel()
    data.writeInterfaceToken(DESCRIPTOR)
    data.writeInt(state)
    mRemote.transact(TRANSACTION_setEthState, data, reply, 0)
    reply.readExceptionCode()
Esempio n. 2
0
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()
Esempio n. 3
0
def isEthDeviceAdded():
    data = Parcel()
    reply = Parcel()
    data.writeInterfaceToken(DESCRIPTOR)
    mRemote.transact(TRANSACTION_isEthDeviceAdded, data, reply, 0)
    reply.readExceptionCode()
    return 0 != reply.readInt32()
Esempio n. 4
0
def getEthState():
    data = Parcel()
    reply = Parcel()
    data.writeInterfaceToken(DESCRIPTOR)
    mRemote.transact(TRANSACTION_getEthState, data, reply, 0)
    reply.readExceptionCode()
    return reply.readInt32()
Esempio n. 5
0
def pingSupplicant():
    _data = Parcel()
    _reply = Parcel()
    _data.writeInterfaceToken(DESCRIPTOR)
    mRemote.transact(TRANSACTION_pingSupplicant, _data, _reply, 0)
    _reply.readExceptionCode()
    return _reply.readInt32() != 0
Esempio n. 6
0
def getConfigFile():
    _data = Parcel()
    _reply = Parcel()
    _data.writeInterfaceToken(DESCRIPTOR)
    mRemote.transact(TRANSACTION_getConfigFile, _data,_reply,0)
    _reply.readExceptionCode()
    return _reply.readString16()
Esempio n. 7
0
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
Esempio n. 8
0
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
Esempio n. 9
0
def setEthState(state):
    data = Parcel()
    reply = Parcel()
    data.writeInterfaceToken(DESCRIPTOR)
    data.writeInt(state)
    mRemote.transact(TRANSACTION_setEthState, data,reply,0)
    reply.readExceptionCode()
Esempio n. 10
0
def isEthConfigured():
    data = Parcel()
    reply = Parcel()
    data.writeInterfaceToken(DESCRIPTOR)
    mRemote.transact(TRANSACTION_isEthConfigured, data,reply,0)
    reply.readExceptionCode()
    return 0 != reply.readInt32()
Esempio n. 11
0
def getEthState():
    data = Parcel()
    reply = Parcel()
    data.writeInterfaceToken(DESCRIPTOR)
    mRemote.transact(TRANSACTION_getEthState, data,reply,0)
    reply.readExceptionCode()
    return reply.readInt32()
Esempio n. 12
0
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
Esempio n. 13
0
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
Esempio n. 14
0
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
Esempio n. 15
0
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
Esempio n. 16
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
Esempio n. 17
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;
Esempio n. 18
0
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
Esempio n. 19
0
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()
Esempio n. 20
0
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;