Skip to content

Commit

Permalink
added NotImplementedError for FreeBSD backend
Browse files Browse the repository at this point in the history
  • Loading branch information
citruz committed Oct 26, 2020
1 parent b9770b4 commit 51076ff
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 3 deletions.
4 changes: 4 additions & 0 deletions beacontools/backend/freebsd.py
Original file line number Diff line number Diff line change
Expand Up @@ -55,3 +55,7 @@ def send_cmd(sock, group_field, command_field, data):
"""Send hci command to device."""
opcode = (((group_field & 0x3f) << 10) | (command_field & 0x3ff))
sock.send(struct.pack('<BHB', 1, opcode, len(data)) + data)

def send_req(_socket, _group_field, _command_field, _event, _rlen, _params, _timeout):
"""Support for HCI 5 has not been implemented yet for FreeBSD, pull requests are wellcome"""
raise NotImplementedError("send_req has not been implemented yet for FreeBSD")
6 changes: 3 additions & 3 deletions beacontools/scanner.py
Original file line number Diff line number Diff line change
Expand Up @@ -167,11 +167,11 @@ def get_hci_version(self):
"lmp_subversion" / Bytes(2),
)

resp = self.backend.send_req(self.socket, OGF_INFO_PARAM, OCF_READ_LOCAL_VERSION,
EVT_CMD_COMPLETE, local_version.sizeof(), bytes(), 0)
try:
resp = self.backend.send_req(self.socket, OGF_INFO_PARAM, OCF_READ_LOCAL_VERSION,
EVT_CMD_COMPLETE, local_version.sizeof(), bytes(), 0)
return HCIVersion(GreedyRange(local_version).parse(resp)[0]["hci_version"])
except ConstructError:
except (ConstructError, NotImplementedError):
return HCIVersion.BT_CORE_SPEC_1_0

def set_scan_parameters(self, scan_type=ScanType.ACTIVE, interval_ms=10, window_ms=10,
Expand Down

0 comments on commit 51076ff

Please sign in to comment.