Skip to content

Commit

Permalink
Minor fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
bkerler committed Oct 17, 2024
2 parents 851fbc4 + d69e47d commit 795a70c
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 4 deletions.
1 change: 1 addition & 0 deletions python_cli/sniff_receiver.py
Original file line number Diff line number Diff line change
Expand Up @@ -176,6 +176,7 @@ def log(*msg):
smsg = msg.to_dict()
smsg = json.dumps(smsg)
socket.send_string(smsg)
print_message(msg, args.quiet, args.decode)
else:
print_message(msg, args.quiet, args.decode)
except SourceDone:
Expand Down
23 changes: 19 additions & 4 deletions python_cli/sniffle/packet_decoder.py
Original file line number Diff line number Diff line change
Expand Up @@ -115,6 +115,10 @@ def to_dict(self):
return {"ts": self.ts, "aa": self.aa, "rssi": self.rssi, "chan": self.chan,
"phy": self.phy, "event": self.event, "body": self.body.hex()}

def to_dict(self):
return {"ts": self.ts, "aa": self.aa, "rssi": self.rssi, "chan": self.chan,
"phy": self.phy, "event": self.event, "body": self.body.hex()}

def str_header(self):
phy_names = ["1M", "2M", "Coded (S=8)", "Coded (S=2)"]
if self.crc_err:
Expand Down Expand Up @@ -302,7 +306,6 @@ class LlDataMessage(DataMessage):
class LlDataContMessage(DataMessage):
pdutype = "LL DATA CONT"


control_opcodes = [
"LL_CONNECTION_UPDATE_IND",
"LL_CHANNEL_MAP_IND",
Expand Down Expand Up @@ -331,8 +334,6 @@ class LlDataContMessage(DataMessage):
"LL_PHY_UPDATE_IND",
"LL_MIN_USED_CHANNELS_IND"
]


class LlControlMessage(DataMessage):
pdutype = "LL CONTROL"

Expand Down Expand Up @@ -361,7 +362,6 @@ def to_dict(self):
return {self.pdutype: self.pkt, "DataType": self.dict_datatype(),
"Opcode": self.dict_opcode()}


class AdvaMessage(AdvertMessage):
def __init__(self, pkt: PacketMessage):
super().__init__(pkt)
Expand Down Expand Up @@ -479,6 +479,12 @@ def dict_aia(self):
"aa": self.aa_conn,
"CRCInit": self.CRCInit}

def dict_aia(self):
return {"InitA":str_mac2(self.InitA, self.TxAdd),
"AdvA":str_mac2(self.AdvA, self.RxAdd),
"aa": self.aa_conn,
"CRCInit": self.CRCInit}

def str_conn_params(self):
return "WinSize: %d WinOffset: %d Interval: %d Latency: %d Timeout: %d Hop: %d SCA: %d" % (
self.WinSize, self.WinOffset, self.Interval, self.Latency, self.Timeout,
Expand All @@ -493,6 +499,15 @@ def dict_conn_params(self):
"Hop": self.Hop,
"SCA": self.SCA}

def dict_conn_params(self):
return {"WinSize": self.WinSize,
"WinOffset": self.WinOffset,
"Interval": self.Interval,
"Latency": self.Latency,
"Timeout": self.Timeout,
"Hop": self.Hop,
"SCA": self.SCA}

def str_chm(self):
if self.ChM == b'\xFF\xFF\xFF\xFF\x1F':
descstr = "all channels"
Expand Down

0 comments on commit 795a70c

Please sign in to comment.