return;
}
- const char* a_role = afb_req_value(req, "role");
- if(!a_role){
- a_role = "";
- }
-
- g_afb_instance->app.allocateWindowResource("activate", a_drawing_name,
- a_drawing_area, a_role,
+ g_afb_instance->app.allocateWindowResource("activate",
+ a_drawing_name, a_drawing_area,
[&req](const char* errmsg){
if (errmsg != nullptr) {
HMI_ERROR("wm", errmsg);
return;
}
- const char* a_role = afb_req_value(req, "role");
- if(!a_role){
- a_role = "";
- }
-
- g_afb_instance->app.allocateWindowResource("deactivate", a_drawing_name,
- nullptr, a_role,
+ g_afb_instance->app.allocateWindowResource("deactivate",
+ a_drawing_name, nullptr,
[&req](const char* errmsg){
if (errmsg != nullptr) {
HMI_ERROR("wm", errmsg);
// If receive low can signal
if (strstr(event, "low-can")) {
+ wm::LowCanClient *lcc = &(g_afb_instance->lcc_);
+ wm::App *app = &(g_afb_instance->app);
+
// Analyze low can signal
- g_afb_instance->lcc_.analyzeCanSignal(object);
+ const char* signal_name = lcc->analyzeCanSignal(object);
- if (g_afb_instance->lcc_.isChangedParkingBrakeState()) {
- // If parking brake state is changed
+ // If car info is updated, set event name
+ const char *can_event = nullptr;
+ if (strstr(signal_name, lcc->kSignalName_[lcc->SignalNoParkingBrake])) {
HMI_DEBUG("wm", "Parking Brake state is changed");
- // Get parking brake state
- const char* parking_brake_state = g_afb_instance->lcc_.getCurrentParkingBrakeState();
-
- // Allocate window resource
- g_afb_instance->app.allocateWindowResource(parking_brake_state, nullptr,
- nullptr, nullptr,
- [](const char* errmsg){
- if (errmsg != nullptr) {
- HMI_ERROR("wm", errmsg);
- }
- });
+ // Set event
+ if (lcc->getCurrentParkingBrakeState()) {
+ can_event = "parking_brake_on";
+ }
+ else {
+ can_event = "parking_brake_off";
+ }
}
- if (g_afb_instance->lcc_.isChangedAccelPedalState()) {
- // If accelerator pedal state is changed
- HMI_DEBUG("wm", "Accelerator Pedal state is changed");
+ else if (strstr(signal_name, lcc->kSignalName_[lcc->SignalNoAccelPedalPos])) {
+ // Update accel pedal position
+ app->setAccelPedalPos(lcc->getCurrentAccelPedalPosition());
- // Get parking brake state
- const char* accel_pedal_state = g_afb_instance->lcc_.getCurrentAccelPedalState();
+ if (lcc->isChangedAccelPedalState()) {
+ HMI_DEBUG("wm", "Accelerator Pedal state is changed");
- // Allocate window resource
- g_afb_instance->app.allocateWindowResource(accel_pedal_state, nullptr,
- nullptr, nullptr,
- [](const char* errmsg){
- if (errmsg != nullptr) {
- HMI_ERROR("wm", errmsg);
+ // Set event
+ if (lcc->getCurrentAccelPedalState()) {
+ can_event = "accel_pedal_on";
}
- });
- }
- else if (g_afb_instance->lcc_.isChangedCarState()) {
- // If car state is changed
- HMI_DEBUG("wm", "Car state is changed");
-
- // Get car state
- const char* car_state = g_afb_instance->lcc_.getCurrentCarState();
-
- // Allocate window resource
- g_afb_instance->app.allocateWindowResource(car_state, nullptr,
- nullptr, nullptr,
- [](const char* errmsg){
- if (errmsg != nullptr) {
- HMI_ERROR("wm", errmsg);
+ else {
+ can_event = "accel_pedal_off";
}
- });
+ }
+ }
+ else if (strstr(signal_name, lcc->kSignalName_[lcc->SignalNoHeadlame])) {
+ HMI_DEBUG("wm", "Headlamp state is changed");
+
+ // Set event
+ if (lcc->getCurrentHeadlampState()) {
+ can_event = "headlamp_on";
+ }
+ else {
+ can_event = "headlamp_off";
+ }
+ }
+ else if (strstr(signal_name, lcc->kSignalName_[lcc->SignalNoLightstatusBrake])) {
+ HMI_DEBUG("wm", "Lightstatus Brake state is changed");
+
+ // Set event
+ if (lcc->getCurrentLightstatusBrakeState()) {
+ can_event = "lightstatus_brake_on";
+ }
+ else {
+ can_event = "lightstatus_brake_off";
+ }
}
- else if (g_afb_instance->lcc_.isChangedLampState()) {
- // If lamp state is changed
- HMI_DEBUG("wm", "Lamp state is changed");
-
- // Get lamp state
- const char* lamp_state = g_afb_instance->lcc_.getCurrentLampState();
- // Allocate window resource
- g_afb_instance->app.allocateWindowResource(lamp_state, nullptr,
+ // Allocate window resource
+ if (nullptr != can_event) {
+ g_afb_instance->app.allocateWindowResource(can_event,
nullptr, nullptr,
[](const char* errmsg){
if (errmsg != nullptr) {