From 3ce6dfb1a250ee230b4e74ad5654b77e4f74c274 Mon Sep 17 00:00:00 2001 From: Masayuki Sasaki Date: Mon, 27 Jan 2014 10:31:04 +0900 Subject: [PATCH] update ambinterface.cc and controlwebsocket.cc Change-Id: Ic6e83271e8b7b595d445258d3bd3f29e2d72aac9 Signed-off-by: Masayuki Sasaki --- packaging/ico-vic-amb-plugin.changes | 3 +++ src/ambinterface.cc | 14 +++++++++----- src/controlwebsocket.cc | 28 +++++++++++++++++++--------- 3 files changed, 31 insertions(+), 14 deletions(-) diff --git a/packaging/ico-vic-amb-plugin.changes b/packaging/ico-vic-amb-plugin.changes index f6a13e4..4ac40d7 100644 --- a/packaging/ico-vic-amb-plugin.changes +++ b/packaging/ico-vic-amb-plugin.changes @@ -1,3 +1,6 @@ +* Mon Jan 27 2014 Shibata Makoto submit/tizen_ivi_release/20140108.221004@92d36e8 +- update ambinterface.cc and controlwebsocket.cc + * Thu Dec 26 2013 Shibata Makoto submit/tizen/20131219.042044@419946f - 0.9.05 release -- modified: Add vehicle property to ico_set_vehicleinfo tool. diff --git a/src/ambinterface.cc b/src/ambinterface.cc index e9275a5..bdf6fdd 100644 --- a/src/ambinterface.cc +++ b/src/ambinterface.cc @@ -278,13 +278,17 @@ AMBIF::updateProperty(AMBVehicleInfo *vehicleinfo) { if (vehicleinfo->name == VehicleProperty::VehicleSpeed) { static uint16_t prevspd = -1; - static uint16_t spdmax = -1; + static const uint16_t unusablespd = -1; uint16_t spd = vehicleinfo->value->value(); - if ((prevspd == spdmax && spd > 0) || (prevspd == 0 && spd > 0)) { - DebugOut(3) << "PERF CHG_VIC_INF VIC-Plugin notify Code of update " << vehicleinfo->name << ". VehicleSpeed is 1km/h or more.\n"; + if ((prevspd == unusablespd && spd > 0) || (prevspd == 0 && spd > 0)) { + DebugOut(3) << "PERF CHG_VIC_INF VIC-Plugin notify Code of update " + << vehicleinfo->name + << ". VehicleSpeed is 1km/h or more.\n"; } - else if ((prevspd == spdmax && spd == 0) || (prevspd > 0 && spd == 0)) { - DebugOut(3) << "PERF CHG_VIC_INF VIC-Plugin notify Code of update " << vehicleinfo->name << ". VehicleSpeed is 0km/h.\n"; + else if ((prevspd == unusablespd && spd == 0) || + (prevspd > 0 && spd == 0)) { + DebugOut(3) << "PERF CHG_VIC_INF VIC-Plugin notify Code of update " + << vehicleinfo->name << ". VehicleSpeed is 0km/h.\n"; } prevspd = spd; } diff --git a/src/controlwebsocket.cc b/src/controlwebsocket.cc index 9aff9d4..6d1b0a1 100644 --- a/src/controlwebsocket.cc +++ b/src/controlwebsocket.cc @@ -398,26 +398,36 @@ ControlWebsocket::callback_receive(const struct ico_uws_context *context, break; case ICO_UWS_EVT_RECEIVE: { - DebugOut(10) << "ControlWebsocket Start callback_recevie Receive message.\n"; + DebugOut(10) << "ControlWebsocket Start callback_recevie" + << " Receive message.\n"; GenerateCommID *idserver = GenerateCommID::getInstance(); int commid = idserver->getID(const_cast(id), -1); StandardMessage msg; char *buf = reinterpret_cast(detail->_ico_uws_message.recv_data); if (strcmp(&buf[0], "VELOCITY") == 0) { static uint16_t prevspd = -1; - static uint16_t spdmax = -1; + static const uint16_t unusablespd = -1; uint16_t spd = 0; - memcpy(&spd, buf + StandardMessage::KEYEVENTTYPESIZE + sizeof(struct timeval) + sizeof(int), sizeof(uint16_t)); - if ((prevspd == spdmax && spd > 0) || (prevspd == 0 && spd > 0)) { - DebugOut(3) << "PERF CHG_VIC_INF Receive from VIC. Message is " << &buf[0] << ". VELOCITY is 1km/h or more.\n"; + memcpy(&spd, + buf + StandardMessage::KEYEVENTTYPESIZE + + sizeof(struct timeval) + sizeof(int), + sizeof(uint16_t)); + if ((prevspd == unusablespd && spd > 0) || + (prevspd == 0 && spd > 0)) { + DebugOut(3) << "PERF CHG_VIC_INF Receive from VIC. Message is " + << &buf[0] << ". VELOCITY is 1km/h or more.\n"; } - else if ((prevspd == spdmax && spd == 0) || (prevspd > 0 && spd == 0)) { - DebugOut(3) << "PERF CHG_VIC_INF Receive from VIC. Message is " << &buf[0] << ". VELOCITY is 0km/h.\n"; + else if ((prevspd == unusablespd && spd == 0) || + (prevspd > 0 && spd == 0)) { + DebugOut(3) << "PERF CHG_VIC_INF Receive from VIC. Message is " + << &buf[0] << ". VELOCITY is 0km/h.\n"; } prevspd = spd; } - container->ctrlws->receive(commid, buf, detail->_ico_uws_message.recv_len); - DebugOut(10) << "ControlWebsocket End callback_recevie Receive message.\n"; + container->ctrlws->receive(commid, buf, + detail->_ico_uws_message.recv_len); + DebugOut(10) << "ControlWebsocket End " + << "callback_recevie Receive message.\n"; break; } case ICO_UWS_EVT_ADD_FD: -- 2.7.4