DaaS-IoT SDK for Python
The DaaS-IoT SDK for Python offers a high-level interface for integrating the DaaS protocol into Python-based applications. It exposes a native extension module (pydaasiot) that bridges Python and the precompiled libdaas.a core library using pybind11.
This SDK enables Python developers to:
- Initialize and shut down DaaS nodes
- Enable and configure network drivers (e.g., INET4, BLUETOOTH)
- Map and manage logical addresses (DINs)
- Send and receive structured data (DDOs)
- Handle asynchronous protocol events using Python callback classes
Python-Specific Enhancements #
Compared to the C++ Linux SDK, the Python binding introduces productivity-focused and Python-native improvements:
Native Event Callbacks #
Python classes can override all protocol events (e.g., ddoReceivedEvent, nodeStateReceivedEvent)
Ready-to-use CLI #
A typer-based command-line interface is included for rapid prototyping and manual testing
Virtual Environment Support #
Fully compatible with venv, pip, and typical Python development workflows
No Manual Compilation Required #
Once built, the .so extension is directly importable into any Python script or shell
System Requirements #
Build Environment #
Component | Version | Purpose |
Python | 3.9+ | Runtime and CLI interpreter |
C++ Compiler | GCC 9+ or Clang 11+ | Must support C++17 and static linking |
CMake | 3.15+ | Build configuration and orchestration |
Make | Any recent version | Used to compile targets |
libbluetooth-dev | Optional | Required if using the Bluetooth driver |
Dependencies #
- pybind11 – Will be detected automatically if installed system-wide, or via FetchContent
- libbluetooth – Only if Bluetooth driver is used
Supported Architectures #
- x86_64
- aarch64 (ARM64)
Portability and Compatibility #
Supported Platforms #
- Python 3.9+ compatible
- x86_64 and ARM64 architectures (e.g., Raspberry Pi 3/4)
- Virtual environments – Fully usable inside venv or pipx
- Linux-based systems – Desktop machines, edge computing devices, embedded boards
Current Limitations #
- Windows and macOS – Not tested in current release
- Linux-only support in current release
Python API Architecture #
Core Classes #
- DaasWrapper: High-level bridge between Python applications and the underlying DaaS protocol
- IDaasApiEvent: Base class for handling asynchronous protocol events
Data Handling #
- DDOs (Distributed Data Objects): Treated as bytes objects in Python
- DINs (Device ID Numbers): Integer identifiers for logical addressing
Integration Features #
- Object-oriented interface mirroring the C++ API
- Python-specific improvements like dynamic typing and idiomatic error handling
- Thread-safe callback execution with Python’s GIL protection
- Non-blocking asynchronous event handling
Development Workflow #
Build Process #
- Build the Python extension module pydaasiot using CMake
- C++17-compliant compiler wraps the libdaas.a static library
- Resulting .so file is exposed to Python via pybind11
Usage Pattern #
- cd build
- PYTHONPATH=. python3 ../examples/receiver.py
Integration Model #
- Console-based, script-driven, or service-based integration
- No interpreter-specific frameworks (Tkinter, Qt) required
- Designed for headless operation and containerized environments
Last updated: Ottobre 13, 2025 at 11:27 AM