RTE sự kiện AUTOSAR
Ngoài các API giao tiếp, RTE còn cung cấp các API cho việc quản lý sự kiện trong SWC(RTE sự kiện AUTOSAR), chẳng hạn như:
a. Rte_Trigger_<PortName>_<EventName>
• Mục đích: Kích hoạt một sự kiện (Event) trong một SWC.
• Cú pháp:
Std_ReturnType Rte_Trigger_<PortName>_<EventName>();
• Tham số:
o PortName: Tên của Port.
o EventName: Tên của sự kiện cần kích hoạt.
• Ví dụ:
Rte_Trigger_AlarmControl_AlarmEvent();
Ví dụ này kích hoạt một sự kiện AlarmEvent trong SWC qua Port AlarmControl.
b. Rte_IrvWrite_<VariableName>
• Mục đích: Ghi dữ liệu vào một biến cục bộ của SWC (Inter-Runnable Variable).
• Cú pháp:
void Rte_IrvWrite_<RunnableName>_<VariableName>(DataType value);
• Ví dụ:
Rte_IrvWrite_RunMotorControl_MotorSpeed(speed);
Trong ví dụ này, tốc độ của motor được lưu vào một biến cục bộ có tên MotorSpeed của runnable RunMotorControl.
c. Rte_IrvRead_<VariableName>
• Mục đích: Đọc giá trị từ một biến cục bộ của SWC.
• Cú pháp:
DataType Rte_IrvRead_<RunnableName>_<VariableName>();
• Ví dụ:
motorSpeed = Rte_IrvRead_RunMotorControl_MotorSpeed();
Trong ví dụ này, SWC đọc giá trị MotorSpeed từ runnable RunMotorControl






