add raw ftm message
This commit is contained in:
parent
14fddccdb5
commit
6abdd6d959
2 changed files with 22 additions and 3 deletions
|
@ -138,11 +138,22 @@ class LocationPCBRev0Dot2BoardConfig(BoardConfig, board=BoardType.C3NAV_LOCATION
|
||||||
|
|
||||||
|
|
||||||
@dataclass
|
@dataclass
|
||||||
class RangeItemType(StructType):
|
class RangeResultItem(StructType):
|
||||||
address: str = field(metadata={"format": MacAddressFormat()})
|
address: str = field(metadata={"format": MacAddressFormat()})
|
||||||
distance: int = field(metadata={"format": SimpleFormat('H')})
|
distance: int = field(metadata={"format": SimpleFormat('H')})
|
||||||
|
|
||||||
|
|
||||||
|
@dataclass
|
||||||
|
class RawFTMEntry(StructType, existing_c_struct="wifi_ftm_report_entry_t"):
|
||||||
|
dlog_token: int = field(metadata={"format": SimpleFormat('B')})
|
||||||
|
rssi: int = field(metadata={"format": SimpleFormat('b')})
|
||||||
|
rtt: int = field(metadata={"format": SimpleFormat('I')})
|
||||||
|
t1: int = field(metadata={"format": SimpleFormat('Q')})
|
||||||
|
t2: int = field(metadata={"format": SimpleFormat('Q')})
|
||||||
|
t3: int = field(metadata={"format": SimpleFormat('Q')})
|
||||||
|
t4: int = field(metadata={"format": SimpleFormat('Q')})
|
||||||
|
|
||||||
|
|
||||||
@dataclass
|
@dataclass
|
||||||
class FirmwareAppDescription(StructType, existing_c_struct="esp_app_desc_t"):
|
class FirmwareAppDescription(StructType, existing_c_struct="esp_app_desc_t"):
|
||||||
magic_word: int = field(metadata={"format": SimpleFormat('I')}, repr=False)
|
magic_word: int = field(metadata={"format": SimpleFormat('I')}, repr=False)
|
||||||
|
|
|
@ -8,7 +8,7 @@ from asgiref.sync import async_to_sync
|
||||||
from c3nav.mesh.baseformats import (BoolFormat, EnumFormat, FixedStrFormat, SimpleFormat, StructType, VarArrayFormat,
|
from c3nav.mesh.baseformats import (BoolFormat, EnumFormat, FixedStrFormat, SimpleFormat, StructType, VarArrayFormat,
|
||||||
VarBytesFormat, VarStrFormat, normalize_name)
|
VarBytesFormat, VarStrFormat, normalize_name)
|
||||||
from c3nav.mesh.dataformats import (BoardConfig, FirmwareAppDescription, MacAddressesListFormat, MacAddressFormat,
|
from c3nav.mesh.dataformats import (BoardConfig, FirmwareAppDescription, MacAddressesListFormat, MacAddressFormat,
|
||||||
RangeItemType)
|
RangeResultItem, RawFTMEntry)
|
||||||
from c3nav.mesh.utils import get_mesh_comm_group
|
from c3nav.mesh.utils import get_mesh_comm_group
|
||||||
|
|
||||||
MESH_ROOT_ADDRESS = '00:00:00:00:00:00'
|
MESH_ROOT_ADDRESS = '00:00:00:00:00:00'
|
||||||
|
@ -53,6 +53,7 @@ class MeshMessageType(IntEnum):
|
||||||
|
|
||||||
LOCATE_REQUEST_RANGE = 0x30
|
LOCATE_REQUEST_RANGE = 0x30
|
||||||
LOCATE_RANGE_RESULTS = 0x31
|
LOCATE_RANGE_RESULTS = 0x31
|
||||||
|
LOCATE_RAW_FTM_RESULTS = 0x32
|
||||||
|
|
||||||
@property
|
@property
|
||||||
def pretty_name(self):
|
def pretty_name(self):
|
||||||
|
@ -340,4 +341,11 @@ class LocateRequestRangeMessage(MeshMessage, msg_type=MeshMessageType.LOCATE_REQ
|
||||||
@dataclass
|
@dataclass
|
||||||
class LocateRangeResults(MeshMessage, msg_type=MeshMessageType.LOCATE_RANGE_RESULTS):
|
class LocateRangeResults(MeshMessage, msg_type=MeshMessageType.LOCATE_RANGE_RESULTS):
|
||||||
""" reports distance to given nodes """
|
""" reports distance to given nodes """
|
||||||
ranges: list[RangeItemType] = field(metadata={"format": VarArrayFormat(RangeItemType)})
|
ranges: list[RangeResultItem] = field(metadata={"format": VarArrayFormat(RangeResultItem)})
|
||||||
|
|
||||||
|
|
||||||
|
@dataclass
|
||||||
|
class LocateRawFTMResults(MeshMessage, msg_type=MeshMessageType.LOCATE_RAW_FTM_RESULTS):
|
||||||
|
""" reports distance to given nodes """
|
||||||
|
distribute_to: str = field(metadata={"format": MacAddressFormat()})
|
||||||
|
results: list[RawFTMEntry] = field(metadata={"format": VarArrayFormat(RawFTMEntry)})
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue