This directory contains aliases to example applications demonstrating the S-CORE Communication middleware API.
- COM-API-Example: Rust-based producer-consumer pattern demonstrating the Communication API with tire pressure data
- IPC Bridge: C++/Rust application demonstrating IPC communication with skeleton/proxy pattern
bazel build //examples/com-api-example:com-api-examplebazel build --config=x86_64-qnx //examples/com-api-example:com-api-exampleAfter building, the binary will be in bazel-bin/score/mw/com/example/com-api-example/com-api-example.
To see the COM API in action, run the example from the repo root:
./bazel-bin/score/mw/com/example/com-api-example/com-api-exampleThe application demonstrates a producer-consumer pattern where:
- A
VehicleOfferedProducerpublishes tire pressure data - A
VehicleConsumersubscribes to and receives tire pressure updates - Five samples are sent with incrementing tire pressure values (5.0, 6.0, 7.0, 8.0, 9.0)
- Each sample is read back and validated
You should see output showing tire data being sent and received, demonstrating the complete publish-subscribe workflow.
The example demonstrates several key patterns:
A composite structure that combines:
VehicleConsumer: Subscribes to vehicle dataVehicleOfferedProducer: Publishes vehicle dataSubscription: Active subscription to tire data
// Create producer
let producer = create_producer(runtime, service_id.clone());
// Create consumer
let consumer = create_consumer(runtime, service_id);
// Create monitor combining both
let monitor = VehicleMonitor::new(consumer, producer).unwrap();
// Write data
monitor.write_tire_data(Tire { pressure: 5.0 }).unwrap();
// Read data
let tire_data = monitor.read_tire_data().unwrap();bazel build //examples:ipc_bridge_cppbazel build --config=x86_64-qnx //examples:ipc_bridge_cppAfter building the binary will be in bazel-bin/score/mw/com/example/ipc_bridge/ipc_bridge_cpp.
To see the IPC communication in action, open two terminals in the repo root:
Terminal 1 - Start Skeleton (Publisher):
./bazel-bin/score/mw/com/example/ipc_bridge/ipc_bridge_cpp \
--mode skeleton \
--cycle-time 1000 \
--num-cycles 10 \
--service_instance_manifest score/mw/com/example/ipc_bridge/etc/mw_com_config.jsonTerminal 2 - Start Proxy (Subscriber):
./bazel-bin/score/mw/com/example/ipc_bridge/ipc_bridge_cpp \
--mode proxy \
--cycle-time 500 \
--num-cycles 20 \
--service_instance_manifest score/mw/com/example/ipc_bridge/etc/mw_com_config.jsonYou should see the proxy discover the skeleton service, subscribe, and receive MapApiLanesStamped samples. The proxy validates data integrity and ordering for each received sample.
| Option | Description | Required |
|---|---|---|
--mode, -m |
Operation mode: skeleton/send or proxy/recv |
Yes |
--cycle-time, -t |
Cycle time in milliseconds for sending/polling | Yes |
--num-cycles, -n |
Number of cycles to execute (0 = infinite) | Yes |
--service_instance_manifest, -s |
Path to communication config JSON | Optional |
--disable-hash-check, -d |
Skip sample hash validation in proxy mode | Optional |
The communication behavior is configured via score/mw/com/example/ipc_bridge/etc/mw_com_config.json:
- Service type definitions and bindings
- Event definitions with IDs
- Instance-specific configuration (shared memory settings, subscriber limits)
- ASIL level and process ID restrictions