Field |
Type |
Description |
missedPackets |
int |
The number of missed packets over the UART, as determined by the packet counter in the header. Derived using the packetCounter field. |
packetsInLastConnection |
int |
The number of packets which were sniffed in the last BLE connection. From CONNECT_REQ until link loss/termination. |
connectEventPacketCounterValue |
int |
The packet counter value of the last received connect request. |
inConnection |
bool |
A boolean indicating whether the sniffed device is in a connection. |
currentConnectRequest |
Packet |
A Packet object containing the last received connect request. |
state |
int |
The internal state of the sniffer. States are defined in SnifferCollector module. Valid values are 0-2. |
portnum |
int or string |
The COM port of the sniffer hardware. During initialization, this value is a preset. |
swversion |
int |
The version number of the API software. |
fwversion |
int |
The version number of the sniffer firmware. |
Function |
Type |
Description |
__init__(portnum) |
Sniffer |
Constructor for the Sniffer class. The optional argument "portnum" is a string with the name of the port the sniffer board is at, e.g. "COM17". If not provided, the API will locate it automatically, but this takes more time. |
start() |
void |
Starts the Sniffer thread. This call must be made (once and only once) before using the sniffer object. |
getPackets(number) |
List<Packet> |
Get [number] number of packets since last fetch (-1 means all). Note that the packet buffer is limited to about 80000 packets. |
getDevices() |
DeviceList |
Get a list of devices which are advertising in range of the Sniffer. |
follow(device, followOnlyAdvertisements) |
void |
Signal the Sniffer firmware to sniff a specific device. If followOnlyAdvertisements is True, the sniffer will not sniff a connection, only advertisements from the followed device. |
scan() |
void |
Signal the Sniffer to scan for advertising devices by sending the REQ_SCAN_CONT UART packet. This will cause it to stop sniffing any device it is sniffing at the moment. |
sendTK(TK) |
void |
Send a temporary key to the sniffer for use when decrypting encrypted connections. TK is a list of 16 ints, each representing a byte in the temporary key. TK is on big-endian form. |
setPortnum(portnum) |
void |
Set the preset COM port number. Only use this during startup. Set to None to search all ports. |
doExit() |
void |
Gracefully shut down the sniffer threads and connections. |
Field |
Type |
Description |
headerLength |
int |
The length of the UART header. |
UART header |
payloadLength |
int |
The length of the UART payload. |
protover |
int |
The UART protocol version used. |
packetCounter |
int |
Unique (16 bit) packet identifier which increments for each packet sent by the sniffer. |
id |
int |
Identifier telling what type of packet this is. See UART protocol document. |
bleHeaderLength |
int |
Length of the NRF_BLE_PACKET header. |
NRF_BLE_PACKET header |
crcOK |
bool |
Was the CRC received by the sniffer OK. |
micOK |
bool |
Is the message integriy check OK. Only relevant in encrypted state. |
direction |
bool |
Only relevant during connection. True -> Master to Slave, False -> Slave to Master |
encrypted |
bool |
has the packet been encrypted. |
channel |
int |
Which channel was the packet picked up from [0 - 39] |
RSSI |
int |
The RSSI value reported by the sniffer. NOT PRECISE. Real value is the negative of this value. |
eventCounter |
int |
The eventcounter of the packet in the connection. Only relevant for packets in a connection. |
timestamp |
int |
Microseconds from the end of the last packet to the start of this one. |
blePacket |
BlePacket |
The blePacket contained within this packet. |
Other |
packetList |
List< int > |
The entire UART packet as sent by the sniffer (with the exception of a padding byte which is removed). |
OK |
bool |
Is the error detection of the attached BLE packet OK? |
payload |
List< int > |
List containing the UART payload as bytes. |
txADD |
bool |
Is the address public or random? True -> Random, False -> Public. Only relevant for advertisement packets. |
version |
int |
The firmware version of the sniffer. Only sent in PING_RESP packets. |