// ara::com Adaptive AUTOSAR: subscribe and receive VehicleSpeed event
#include "ara/com/sample/speed_service_proxy.h"
#include
using namespace ara::com::sample;
int main() {
// Create proxy for SpeedService instance
SpeedServiceProxy::HandleType handle = SpeedServiceProxy::FindService(
ara::com::InstanceIdentifier("SpeedService_0x5678")
).GetResult()[0];
SpeedServiceProxy proxy(handle);
// Subscribe to VehicleSpeed event (N=1: receive 1 sample per call)
proxy.VehicleSpeed.Subscribe(1);
// Poll for new samples (called every 10 ms by application task)
while (true) {
proxy.VehicleSpeed.GetNewSamples([](auto sample) {
float speed_kmh = sample->speed_kmh;
std::cout << "VehicleSpeed = " << speed_kmh << " km/h" << std::endl;
});
std::this_thread::sleep_for(std::chrono::milliseconds(10));
}
return 0;
} Events: Unsolicited Notifications
Methods: Request/Response
// ara::com: call GetDiagInfo method on DiagnosticService
#include "ara/com/sample/diagnostic_service_proxy.h"
using namespace ara::com::sample;
void RequestDiagnostics() {
DiagnosticServiceProxy proxy(handle);
// Async method call — returns future
auto future = proxy.GetDiagInfo(
GetDiagInfoRequest{.ecu_id = 0x01, .dtc_filter = 0xFF}
);
// Wait for response (blocks up to timeout)
auto result = future.get();
if (result.HasValue()) {
auto response = result.Value();
std::cout << "DTCs: " << response.dtc_count << std::endl;
for (auto& dtc : response.dtc_list) {
std::cout << " DTC 0x" << std::hex << dtc.code
<< " status=0x" << dtc.status << std::endl;
}
} else {
// Error response or timeout
std::cerr << "GetDiagInfo failed: " << result.Error().Message() << std::endl;
}
}Fields: Getter + Setter + Change Notifier
| Field Operation | API Call | SOME/IP Message Type |
|---|---|---|
| Get current value | field.Get().get() | REQUEST (Method ID = getter method) + RESPONSE |
| Set new value | field.Set(newValue).get() | REQUEST (Method ID = setter method) + RESPONSE |
| Subscribe to changes | field.Subscribe(N) + GetNewSamples() | SD SubscribeEventgroup + NOTIFICATION events |
// ara::com Field: CabinTemperature (getter + setter + notifier)
#include "ara/com/sample/climate_service_proxy.h"
ClimateServiceProxy proxy(handle);
// Read current cabin temperature
auto get_future = proxy.CabinTempSetpoint.Get();
float current_temp = get_future.get().Value().temperature_degC;
std::cout << "Current setpoint: " << current_temp << " °C" << std::endl;
// Update setpoint to 22°C
CabinTempValue new_val;
new_val.temperature_degC = 22.0f;
proxy.CabinTempSetpoint.Set(new_val).get();
// Subscribe to temperature change notifications
proxy.CabinTempSetpoint.Subscribe(1);
// Now GetNewSamples() will return whenever the server updates the field valueQoS and Safety: E2E Protection for Events
| E2E Profile | CRC | Counter Width | Use Case |
|---|---|---|---|
| E2E P01 | CRC8 | 4-bit counter in payload | CAN signals bridged to SOME/IP; backward-compatible |
| E2E P04 | CRC32 | 32-bit counter | Safety-critical SOME/IP events on Ethernet; ASIL D capable |
| E2E P07 | CRC64 | 32-bit counter | High-integrity SOME/IP on Ethernet (PRS_E2E_00363) |
/Services/SpeedService/VehicleSpeedEvent
/Transformers/E2EProfile07_Config
Summary
Events, Methods, and Fields map to three distinct communication patterns: events (one-way push), methods (two-way call/return), and fields (stateful value with get/set/notify). The ara::com C++ API provides a uniform interface for all three. For safety-critical events, E2E Protection (Profile P04 or P07) appends a CRC and counter to each SOME/IP payload — the receiver rejects stale, corrupted, or replayed events, meeting ASIL D requirements for Ethernet-based functional safety communication.
🔬 Deep Dive — Core Concepts Expanded
This section builds on the foundational concepts covered above with additional technical depth, edge cases, and configuration nuances that separate competent engineers from experts. When working on production ECU projects, the details covered here are the ones most commonly responsible for integration delays and late-phase defects.
Key principles to reinforce:
- Configuration over coding: In AUTOSAR and automotive middleware environments, correctness is largely determined by ARXML configuration, not application code. A correctly implemented algorithm can produce wrong results due to a single misconfigured parameter.
- Traceability as a first-class concern: Every configuration decision should be traceable to a requirement, safety goal, or architecture decision. Undocumented configuration choices are a common source of regression defects when ECUs are updated.
- Cross-module dependencies: In tightly integrated automotive software stacks, changing one module's configuration often requires corresponding updates in dependent modules. Always perform a dependency impact analysis before submitting configuration changes.
🏭 How This Topic Appears in Production Projects
- Project integration phase: The concepts covered in this lesson are most commonly encountered during ECU integration testing — when multiple software components from different teams are combined for the first time. Issues that were invisible in unit tests frequently surface at this stage.
- Supplier/OEM interface: This is a topic that frequently appears in technical discussions between Tier-1 ECU suppliers and OEM system integrators. Engineers who can speak fluently about these details earn credibility and are often brought into critical design review meetings.
- Automotive tool ecosystem: Vector CANoe/CANalyzer, dSPACE tools, and ETAS INCA are the standard tools used to validate and measure the correct behaviour of the systems described in this lesson. Familiarity with these tools alongside the conceptual knowledge dramatically accelerates debugging in real projects.
⚠️ Common Mistakes and How to Avoid Them
- Assuming default configuration is correct: Automotive software tools ship with default configurations that are designed to compile and link, not to meet project-specific requirements. Every configuration parameter needs to be consciously set. 'It compiled' is not the same as 'it is correctly configured'.
- Skipping documentation of configuration rationale: In a 3-year ECU project with team turnover, undocumented configuration choices become tribal knowledge that disappears when engineers leave. Document why a parameter is set to a specific value, not just what it is set to.
- Testing only the happy path: Automotive ECUs must behave correctly under fault conditions, voltage variations, and communication errors. Always test the error handling paths as rigorously as the nominal operation. Many production escapes originate in untested error branches.
- Version mismatches between teams: In a multi-team project, the BSW team, SWC team, and system integration team may use different versions of the same ARXML file. Version management of all ARXML files in a shared repository is mandatory, not optional.
📊 Industry Note
Engineers who master both the theoretical concepts and the practical toolchain skills covered in this course are among the most sought-after professionals in the automotive software industry. The combination of AUTOSAR standards knowledge, safety engineering understanding, and hands-on configuration experience commands premium salaries at OEMs and Tier-1 suppliers globally.