Examples - Rylan-Meilutis/SEDSnet GitHub Wiki
Examples (Easy)
This page points to runnable examples and suggests a learning path. For protocol details and role behavior, see Time-Sync.
C/C++ example
- C example directory
- Main router example
- Time-sync example
- Load-balancing example
- Managed-variable and E2E C example
- Managed-variable and E2E C++ example
What it demonstrates:
- Building and linking the staticlib.
- Creating and sending packets.
- Receiving and dispatching to handlers.
- Time sync announce/request/response and offset math.
- Managed-variable latest-value resync, bounded packed sides, and E2E policy configuration.
- Runtime memory, tuning, device identity, time-sync role, and address configuration through the C ABI.
Suggested first steps:
- Build the library with build.py or CMake.
- Compile the example and run it locally.
- Watch the output to see packet creation and handling.
Python example
- Python example directory
- Main example
- Time-sync example
- Load-balancing example
- Typed-routing example
- Managed-variable and E2E example
- P2P service example
- Manual system-suite entry point
- System-suite implementation
- Shared schema helpers
What it demonstrates:
- Installing the Python package.
- Logging packets and decoding values.
- Looking up runtime schema names and using the returned IDs.
- Type-specific routing to two dedicated command links without weighted or failover path selection.
- Time sync announce/request/response and offset math.
- P2P service delivery by hostname and assigned address.
- A manual Python system suite covering runtime schema, discovery, route weights, side replacement, P2P, network variables, and memory-budget reporting.
- Managed-variable latest-value resync and E2E router/type policy settings.
- Runtime tuning, device identifier, memory budget, time-sync role, and address configuration.
Suggested first steps:
- Build Python bindings with
./build.py pythonor./build.py maturin-install; see build.py. - Run the example script.
- Inspect printed packets to see decoded values.
Rust example (minimal)
If you want a minimal Rust example, start with Usage-Rust and build a small router with one endpoint handler. The files are standalone sources to copy or register as Cargo examples; see the Rust example index for the complete inventory and run instructions.
The runtime-config example shows how to configure active device identity, process-wide tuning,
router/relay memory budgets, time-sync roles, and address assignment without rebuilding the crate.
The typed-routing example shows one practical pattern: ordinary telemetry stays on its normal link,
while a command-like packet type is manually fanned out to two dedicated sides that both reach the
same remote destination. It uses set_typed_route(...) only, so there is no load balancing or
failover policy involved.
RTOS time sync examples
Recommended structure:
- Define one
EndpointHandlerfor a singleDataEndpoint. - Create a router with no remote sides for local-only logging, or add sides and control forwarding with runtime route rules.
- Call
log_*with a typed payload. - Call
rx_packedwith the bytes you just sent (loopback).
Recommended path
- Read Overview.
- Read Concepts.
- Try one example in your target language.
- Read Technical-Architecture for the implementation details.