Primary Transmitter (PTX) connector

This module provides the whad.esb.connector.ptx.PTX connector class that implements Nordic Semiconductor’s Enhanced ShockBurst Primary transmitter role.

The primary transmitter (PTX) role consists in sending packets to another Enhanced ShockBurst device in primary receiver (PRX) role and determine if they have correctly been received. Correct packet reception is checked through acknowledgements packets sent by the device in PRX mode, if required by the device in PTX mode.

The whad.esb.connector.ptx.PTX connector embeds a custom stack to provide this behaviour and exposes some methods to send data.

class whad.esb.connector.ptx.PTX(device: WhadDevice)[source]

Enhanced ShockBurst Primary Transmitter Role (PTX) implementation for compatible WHAD device.

property address

Return current address.

Returns:

Current target address

Return type:

str

property channel: int

Channel getter.

Returns:

current channel

Return type:

int

on_pdu(packet: Packet)[source]

ESB packet callback.

This function feeds the stack with the received packet.

Parameters:

packet (scapy.packet.Packet) – Received ESB packet

send_data(data: bytes, waiting_ack: bool = False) bool[source]

Send an ESB payload.

Parameters:
  • data (bytes) – Data/payload to send

  • waiting_ack (bool, optional) – If set to True, will wait for the acknowledgement packet to be received

Returns:

True if the packet has been correctly sent, False otherwise

Return type:

bool

property stack: ESBStack

Return the current ESB stack instance.

start()[source]

Start PTX mode. A call to this method is required before calling send_data().

stop()[source]

Stop PTX mode.

synchronize(timeout: float = 10.0) bool[source]

Synchronize with the target ESB device.

Parameters:

timeout (float) – Timeout in seconds

Returns:

True if synchronization succeeded, False otherwise

Return type:

bool