network.py 1.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657
  1. import _network
  2. STA_IF = _network.STA_IF
  3. AP_IF = _network.AP_IF
  4. STAT_IDLE = _network.STAT_IDLE
  5. STAT_CONNECTING = _network.STAT_CONNECTING
  6. STAT_WRONG_PASSWORD = _network.STAT_WRONG_PASSWORD
  7. STAT_NO_AP_FOUND = _network.STAT_NO_AP_FOUND
  8. STAT_CONNECT_FAIL = _network.STAT_CONNECT_FAIL
  9. STAT_GOT_IP = _network.STAT_GOT_IP
  10. class WLAN(_network.WLAN):
  11. def __init__(self, interface_id: int):
  12. super().__init__(interface_id)
  13. def active(self, is_active=None):
  14. if is_active is None:
  15. return super().checkActive()
  16. else:
  17. return super().active(is_active)
  18. def connect(self, ssid=None, key=None, bssid=None):
  19. if bssid is None:
  20. return super().connect(ssid, key)
  21. else:
  22. return super().connectWithBssid(ssid, key, bssid)
  23. def disconnect(self):
  24. return super().disconnect()
  25. def status(self, param=None):
  26. if param is None:
  27. return super().status()
  28. else:
  29. return super().statusWithParam(param)
  30. def isconnected(self) -> int:
  31. return super().isconnected()
  32. def config(self, *para, **kwargs):
  33. if len(para) == 1:
  34. return super().checkConfig(para[0])
  35. else:
  36. return super().config(**kwargs)
  37. def ifconfig(self, config=None):
  38. if config is None:
  39. t = super().checkIfconfig()
  40. return (t[0], t[1], t[2], t[3])
  41. else:
  42. return super().ifconfig(
  43. config[0], config[1], config[2], config[3])
  44. def scan(self):
  45. return super().scan()