Skip to content
Snippets Groups Projects

iqrfpy-tcp-transport

An extension for iqrfpy for TCP communication with IQRF TR module or emulator.

Quick start

Before installing the library, it is recommended to first create a virtual environment. Virtual environments help isolate python installations as well as pip packages independent of the operating system.

A virtual environment can be created and launched using the following commands:

python3 -m venv <dir>
source <dir>/bin/activate

iqrfpy can be installed using the pip utility:

python3 -m pip install -U iqrfpy-tcp-transport

Example use:

from iqrfpy.ext.tcp_transport import TcpTransport, TcpTransportParams
from iqrfpy.peripherals.coordinator.requests.bonded_devices import BondedDevicesRequest
from iqrfpy.peripherals.coordinator.responses.bonded_devices import BondedDevicesResponse

params = TcpTransportParams(
    address=..., # IP Address
    port=..., # TCP Port
)
transport = TcpTransport(params=params, auto_init=True)

request = BondedDevicesRequest()
response: BondedDevicesResponse = transport.send_and_receive(request=request, timeout=10)

print(response.bonded)

Documentation

For more information, check out our API reference.