chore: move led-simulator in from its submodule
Merges led-simulator (sim-bridge, 4d8aeb5) under led-simulator/ with its history,
in place of the submodule.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
commit
698c1463c0
41 files changed
+4369
-4
No files matched your search
@@ -0,0 +1,57 @@
|
||||
"""Minimal ``network`` stub so imports succeed (led-simulator).
|
||||
|
||||
Each simulated driver gets its own MAC from ``LED_SIM_MAC`` (12 hex digits).
|
||||
"""
|
||||
|
||||
import os
|
||||
|
||||
STA_IF = 0
|
||||
AP_IF = 1
|
||||
|
||||
_SIM_MAC = bytes.fromhex(os.environ.get("LED_SIM_MAC", "aabbccddeeff"))
|
||||
_channel = 1
|
||||
|
||||
|
||||
class WLAN:
|
||||
PM_NONE = 0
|
||||
PM_PERFORMANCE = 1
|
||||
PM_POWERSAVE = 2
|
||||
|
||||
def __init__(self, interface=STA_IF):
|
||||
self._interface = interface
|
||||
self._active = False
|
||||
|
||||
def active(self, is_active=None):
|
||||
if is_active is None:
|
||||
return self._active
|
||||
self._active = bool(is_active)
|
||||
return None
|
||||
|
||||
def config(self, param=None, **kwargs):
|
||||
global _channel
|
||||
if "channel" in kwargs:
|
||||
_channel = int(kwargs["channel"])
|
||||
if param == "mac":
|
||||
return _SIM_MAC
|
||||
if param == "channel":
|
||||
return _channel
|
||||
if param == "essid":
|
||||
return ""
|
||||
return None
|
||||
|
||||
def connect(self, *args, **kwargs):
|
||||
return None
|
||||
|
||||
def disconnect(self):
|
||||
return None
|
||||
|
||||
def isconnected(self):
|
||||
return True
|
||||
|
||||
def status(self, param=None):
|
||||
return 1010 # STAT_GOT_IP
|
||||
|
||||
def ifconfig(self, config_tuple=None):
|
||||
if config_tuple is None:
|
||||
return ("192.168.4.%d" % (10 + _SIM_MAC[-1] % 200), "255.255.255.0", "192.168.4.1", "8.8.8.8")
|
||||
return None
|
||||
Reference in new issue
Block a user