From a68001e8f5c61d0ca57f4b6312aa655c543f8340 Mon Sep 17 00:00:00 2001 From: Masayuki Sasaki Date: Thu, 26 Dec 2013 16:28:23 +0900 Subject: [PATCH] Revise: add manifest file for SMACK label setting. Change-Id: Ic91abd40c5d44236010bf616529e82e2d57f7d2a Signed-off-by: Masayuki Sasaki --- ico-vic-carsimulator.manifest | 5 + packaging/ico-vic-carsimulator.changes | 4 + packaging/ico-vic-carsimulator.spec | 5 +- src/CConf.cpp | 6 +- src/CConf.h | 2 +- src/CGtCtrl.cpp | 392 ++++++++++++++++----------------- src/CGtCtrl.h | 2 +- src/CarSim_Daemon.cpp | 12 +- 8 files changed, 219 insertions(+), 209 deletions(-) create mode 100644 ico-vic-carsimulator.manifest diff --git a/ico-vic-carsimulator.manifest b/ico-vic-carsimulator.manifest new file mode 100644 index 0000000..017d22d --- /dev/null +++ b/ico-vic-carsimulator.manifest @@ -0,0 +1,5 @@ + + + + + diff --git a/packaging/ico-vic-carsimulator.changes b/packaging/ico-vic-carsimulator.changes index 6ffb221..076b9ad 100644 --- a/packaging/ico-vic-carsimulator.changes +++ b/packaging/ico-vic-carsimulator.changes @@ -1,3 +1,7 @@ +* Thu Dec 26 2013 Shibata Makoto accepted/tizen/ivi/20131217.231400@acfe75b +- 0.9.08 release +-- revise: add manifest file for SMACK label setting. + * Fri Nov 29 2013 Shibata Makoto ivi_oct_m2@67d1f89 - 0.9.07 release -- Abolition:Check the neutral gear and the parking gear of the engine ignition diff --git a/packaging/ico-vic-carsimulator.spec b/packaging/ico-vic-carsimulator.spec index 0e256dd..dd9dd28 100644 --- a/packaging/ico-vic-carsimulator.spec +++ b/packaging/ico-vic-carsimulator.spec @@ -1,7 +1,7 @@ Name: ico-vic-carsimulator Summary: CarSimulator -Version: 0.9.07 -Release: 2.3 +Version: 0.9.08 +Release: 1.1 Group: System Environment/Daemons License: Apache 2.0 Source0: %{name}-%{version}.tar.bz2 @@ -46,6 +46,7 @@ install -m 0644 ico-vic-carsim.service %{buildroot}%{_unitdir_user}/ico-vic-cars %postun -p /sbin/ldconfig %files +%manifest %{name}.manifest %attr(4755,root,root) %{_bindir}/ico-vic-carsim %defattr(-,root,root,-) %{_bindir}/* diff --git a/src/CConf.cpp b/src/CConf.cpp index 62aeb5a..aa22de0 100644 --- a/src/CConf.cpp +++ b/src/CConf.cpp @@ -63,9 +63,9 @@ void CConf::LoadConfig(const char*filePath) memset(devname, 0, sizeof(devname)); CConf::GetConfig(m_strConfPath, "DEVICE", "NAME", "Driving Force GT", devname, sizeof(devname)); m_sDeviceName = std::string(devname); - char ambconfig[64]; - memset(ambconfig, 0, sizeof(ambconfig)); - CConf::GetConfig(m_strConfPath, "AMBCONFIG", "NAME", "/etc/ambd/config", ambconfig, sizeof(ambconfig)); + char ambconfig[64]; + memset(ambconfig, 0, sizeof(ambconfig)); + CConf::GetConfig(m_strConfPath, "AMBCONFIG", "NAME", "/etc/ambd/config", ambconfig, sizeof(ambconfig)); m_sAmbConfigName = std::string(ambconfig); printf("Configuration[%s]:\n",m_sDeviceName.c_str()); diff --git a/src/CConf.h b/src/CConf.h index 12f8ffb..4f71efa 100644 --- a/src/CConf.h +++ b/src/CConf.h @@ -70,7 +70,7 @@ class CConf double m_fLng; double m_fLat; std::string m_sDeviceName; - std::string m_sAmbConfigName; + std::string m_sAmbConfigName; }; diff --git a/src/CGtCtrl.cpp b/src/CGtCtrl.cpp index b49fb4a..7f0e226 100644 --- a/src/CGtCtrl.cpp +++ b/src/CGtCtrl.cpp @@ -198,10 +198,10 @@ bool CGtCtrl::Initialize() double location[] = { myConf.m_fLat, myConf.m_fLng, 0 }; SendVehicleInfo(dataport_def, vi, &location[0], 3); - if (m_bDemoRunning) { - std::cout << "Demo Mode." << std::endl; - LoadRouteList(); - } + if (m_bDemoRunning) { + std::cout << "Demo Mode." << std::endl; + LoadRouteList(); + } return true; } @@ -259,9 +259,9 @@ void CGtCtrl::Run() int nShiftPosBK = -1; char shiftpos = 255; - bool nextPointFlg = false; - geoData next; - double dx, dy, rad, theta; + bool nextPointFlg = false; + geoData next; + double dx, dy, rad, theta; while (g_bStopFlag) { @@ -272,31 +272,31 @@ void CGtCtrl::Run() switch (type) { case JS_EVENT_AXIS: if (number == myConf.m_nSteering) { - int angle = 0; + int angle = 0; if (value != 0) { m_stVehicleInfo.nSteeringAngle += (value * 10 / 65536 - m_stVehicleInfo.nSteeringAngle); } - if (value < 0) { - angle = (((double)value / 32768) * 450) + 450 + 270; - angle %= 360; - //std:: cout << "value * (450 / 32768) = " << ((double)value / 32768) * 450 << "\n"; - //std:: cout << "value * (450 / 32768) + 450 = " << (double)value * (450 / 32768) + 450 << "\n"; - //std:: cout << "value * (450 / 32768) + 450 + 270 = " << (double)value * (450 / 32768) + 450 + 270 << "\n"; - } - else { - angle = ((double)value / 32768) * 450; - angle %= 360; - //std:: cout << "value * (450 / 32768) = " << ((double)value / 32768) * 450 << "\n"; - } - //std::cout << "Steering value = " << value << " -> angle = " << angle << std::endl; + if (value < 0) { + angle = (((double)value / 32768) * 450) + 450 + 270; + angle %= 360; + //std:: cout << "value * (450 / 32768) = " << ((double)value / 32768) * 450 << "\n"; + //std:: cout << "value * (450 / 32768) + 450 = " << (double)value * (450 / 32768) + 450 << "\n"; + //std:: cout << "value * (450 / 32768) + 450 + 270 = " << (double)value * (450 / 32768) + 450 + 270 << "\n"; + } + else { + angle = ((double)value / 32768) * 450; + angle %= 360; + //std:: cout << "value * (450 / 32768) = " << ((double)value / 32768) * 450 << "\n"; + } + //std::cout << "Steering value = " << value << " -> angle = " << angle << std::endl; { const char *vi = "STEERING"; - /* + /* SendVehicleInfo(dataport_def, vi, m_stVehicleInfo.nSteeringAngle); - */ + */ SendVehicleInfo(dataport_def, vi, angle); } @@ -558,9 +558,9 @@ void CGtCtrl::Run() * VELOCITY (SPEED) */ int speedNew = (int)pmCar.getSpeed(); - if (speedNew > 180) { - speedNew = 180; - } + if (speedNew > 180) { + speedNew = 180; + } if (speedNew != nSpeed) { SendVehicleInfo(dataport_def, sVELOCITY, speedNew); m_stVehicleInfo.nVelocity = speedNew; @@ -587,123 +587,123 @@ void CGtCtrl::Run() } if (iwc == 0) { - if (m_bDemoRunning) { - next = routeList.front(); - dy = next.lat - m_stVehicleInfo.fLat; - dx = next.lng - m_stVehicleInfo.fLng; - theta = (double) atan2(dy, dx) * 180.0 / (atan(1.0) * 4.0); - if (theta < 0) { - theta = 360.0 + theta; - } - - rad = (theta / 180.0) * PIE; - - m_stVehicleInfo.nDirection = 90 - theta; - if (m_stVehicleInfo.nDirection < 0) { - m_stVehicleInfo.nDirection = 360 + m_stVehicleInfo.nDirection; - } - SendVehicleInfo(dataport_def, sDIRECTION, m_stVehicleInfo.nDirection); - - dir = static_cast(m_stVehicleInfo.nDirection); - double runMeters = pmCar.getTripmeter(); - pmCar.tripmeterReset(); - double tmpLat = m_stVehicleInfo.fLat; - double tmpLng = m_stVehicleInfo.fLng; - POINT pNEW = CalcDest(tmpLat, tmpLng, dir, runMeters); - double tmpLct[] = { pNEW.lat, pNEW.lng, 0 }; - SendVehicleInfo(dataport_def, sLOCATION, &tmpLct[0], 3); - m_stVehicleInfo.fLat = pNEW.lat; - m_stVehicleInfo.fLng = pNEW.lng; - - if (rad == 0) { - if (m_stVehicleInfo.fLng >= next.lng) { - nextPointFlg = true; - } - } - else if (rad > 0 && rad < 0.5 * PIE) { - if (m_stVehicleInfo.fLng >= next.lng - && m_stVehicleInfo.fLat >= next.lat) { - nextPointFlg = true; - } - } - else if (rad == 0.5 * PIE) { - if (m_stVehicleInfo.fLat >= next.lat) { - nextPointFlg = true; - } - } - else if (rad > 0.5 * PIE && rad < PIE) { - if (m_stVehicleInfo.fLng <= next.lng - && m_stVehicleInfo.fLat >= next.lat) { - nextPointFlg = true; - } - } - else if (rad == PIE) { - if (m_stVehicleInfo.fLng <= next.lng) { - nextPointFlg = true; - } - } - else if (rad > PIE && rad < 1.5 * PIE) { - if (m_stVehicleInfo.fLng <= next.lng - && m_stVehicleInfo.fLat <= next.lat) { - nextPointFlg = true; - } - } - else if (rad == 1.5 * PIE) { - if (m_stVehicleInfo.fLat <= next.lat) { - nextPointFlg = true; - } - } - else { - if (m_stVehicleInfo.fLng >= next.lng - && m_stVehicleInfo.fLat <= next.lat) { - nextPointFlg = true; - } - } - - if (nextPointFlg) { - std::cout << "routeList.size() = " << routeList.size() << std::endl; - routeList.pop(); - if (routeList.empty()) { - LoadRouteList(); - m_stVehicleInfo.fLng = myConf.m_fLng; - m_stVehicleInfo.fLat = myConf.m_fLat; - } - next = routeList.front(); - nextPointFlg = false; - } - } - else { - /** - * DIRECTION (AZIMUTH) - * Front wheel steering angle - */ - double runMeters = pmCar.getTripmeter(); - pmCar.tripmeterReset(); - if (0 != runMeters) { - double stear = (double)m_stVehicleInfo.nSteeringAngle; - double dirNEW = CalcAzimuth(dir, stear, runMeters); - int nDir = (int)dirNEW; - dir = dirNEW; - if (nDir != m_stVehicleInfo.nDirection) { - SendVehicleInfo(dataport_def, sDIRECTION, nDir); - m_stVehicleInfo.nDirection = nDir; - } - } - /** - * LOCATION - */ - if ((!m_bUseGps) && (0 != runMeters)) { - double tmpLat = m_stVehicleInfo.fLat; - double tmpLng = m_stVehicleInfo.fLng; - POINT pNEW = CalcDest(tmpLat, tmpLng, dir, runMeters); - if ((tmpLat != pNEW.lat) || (tmpLng != pNEW.lng)){ - double tmpLct[] = { pNEW.lat, pNEW.lng, 0 }; - SendVehicleInfo(dataport_def, sLOCATION, &tmpLct[0], 3); - m_stVehicleInfo.fLat = pNEW.lat; - m_stVehicleInfo.fLng = pNEW.lng; - } - } - } + if (m_bDemoRunning) { + next = routeList.front(); + dy = next.lat - m_stVehicleInfo.fLat; + dx = next.lng - m_stVehicleInfo.fLng; + theta = (double) atan2(dy, dx) * 180.0 / (atan(1.0) * 4.0); + if (theta < 0) { + theta = 360.0 + theta; + } + + rad = (theta / 180.0) * PIE; + + m_stVehicleInfo.nDirection = 90 - theta; + if (m_stVehicleInfo.nDirection < 0) { + m_stVehicleInfo.nDirection = 360 + m_stVehicleInfo.nDirection; + } + SendVehicleInfo(dataport_def, sDIRECTION, m_stVehicleInfo.nDirection); + + dir = static_cast(m_stVehicleInfo.nDirection); + double runMeters = pmCar.getTripmeter(); + pmCar.tripmeterReset(); + double tmpLat = m_stVehicleInfo.fLat; + double tmpLng = m_stVehicleInfo.fLng; + POINT pNEW = CalcDest(tmpLat, tmpLng, dir, runMeters); + double tmpLct[] = { pNEW.lat, pNEW.lng, 0 }; + SendVehicleInfo(dataport_def, sLOCATION, &tmpLct[0], 3); + m_stVehicleInfo.fLat = pNEW.lat; + m_stVehicleInfo.fLng = pNEW.lng; + + if (rad == 0) { + if (m_stVehicleInfo.fLng >= next.lng) { + nextPointFlg = true; + } + } + else if (rad > 0 && rad < 0.5 * PIE) { + if (m_stVehicleInfo.fLng >= next.lng + && m_stVehicleInfo.fLat >= next.lat) { + nextPointFlg = true; + } + } + else if (rad == 0.5 * PIE) { + if (m_stVehicleInfo.fLat >= next.lat) { + nextPointFlg = true; + } + } + else if (rad > 0.5 * PIE && rad < PIE) { + if (m_stVehicleInfo.fLng <= next.lng + && m_stVehicleInfo.fLat >= next.lat) { + nextPointFlg = true; + } + } + else if (rad == PIE) { + if (m_stVehicleInfo.fLng <= next.lng) { + nextPointFlg = true; + } + } + else if (rad > PIE && rad < 1.5 * PIE) { + if (m_stVehicleInfo.fLng <= next.lng + && m_stVehicleInfo.fLat <= next.lat) { + nextPointFlg = true; + } + } + else if (rad == 1.5 * PIE) { + if (m_stVehicleInfo.fLat <= next.lat) { + nextPointFlg = true; + } + } + else { + if (m_stVehicleInfo.fLng >= next.lng + && m_stVehicleInfo.fLat <= next.lat) { + nextPointFlg = true; + } + } + + if (nextPointFlg) { + std::cout << "routeList.size() = " << routeList.size() << std::endl; + routeList.pop(); + if (routeList.empty()) { + LoadRouteList(); + m_stVehicleInfo.fLng = myConf.m_fLng; + m_stVehicleInfo.fLat = myConf.m_fLat; + } + next = routeList.front(); + nextPointFlg = false; + } + } + else { + /** + * DIRECTION (AZIMUTH) + * Front wheel steering angle + */ + double runMeters = pmCar.getTripmeter(); + pmCar.tripmeterReset(); + if (0 != runMeters) { + double stear = (double)m_stVehicleInfo.nSteeringAngle; + double dirNEW = CalcAzimuth(dir, stear, runMeters); + int nDir = (int)dirNEW; + dir = dirNEW; + if (nDir != m_stVehicleInfo.nDirection) { + SendVehicleInfo(dataport_def, sDIRECTION, nDir); + m_stVehicleInfo.nDirection = nDir; + } + } + /** + * LOCATION + */ + if ((!m_bUseGps) && (0 != runMeters)) { + double tmpLat = m_stVehicleInfo.fLat; + double tmpLng = m_stVehicleInfo.fLng; + POINT pNEW = CalcDest(tmpLat, tmpLng, dir, runMeters); + if ((tmpLat != pNEW.lat) || (tmpLng != pNEW.lng)){ + double tmpLct[] = { pNEW.lat, pNEW.lng, 0 }; + SendVehicleInfo(dataport_def, sLOCATION, &tmpLct[0], 3); + m_stVehicleInfo.fLat = pNEW.lat; + m_stVehicleInfo.fLng = pNEW.lng; + } + } + } } if (0 == iwc) { iwc = D_RUNLOOP_INTERVAL_COUNT; @@ -1077,13 +1077,13 @@ void CGtCtrl::Run2() if (nextPointFlg) { if (routeList.empty()) { - LoadRouteList(); - m_stVehicleInfo.fLng = myConf.m_fLng; - m_stVehicleInfo.fLat = myConf.m_fLat; + LoadRouteList(); + m_stVehicleInfo.fLng = myConf.m_fLng; + m_stVehicleInfo.fLat = myConf.m_fLat; } - next = routeList.front(); - routeList.pop(); - nextPointFlg = false; + next = routeList.front(); + routeList.pop(); + nextPointFlg = false; } } } @@ -1769,53 +1769,53 @@ void CGtCtrl::CheckSendResult(int mqid) } void CGtCtrl::LoadRouteList() { - std::cout << "LoadRouteList:orgmsgQueue[" << orgmsgQueue << "]\n"; - if (orgmsgQueue == "") { - std::ifstream fin; - fin.open(g_RouteListFile.c_str()); - if (!fin) { - std::cerr << "Can't read " << g_RouteListFile << std::endl; - } - std::string line; - while (fin && getline(fin, line)) { - orgmsgQueue.append(line); - orgmsgQueue.append("\n"); - } - msgQueue = orgmsgQueue; - fin.close(); - } - else { - msgQueue = orgmsgQueue; - } - if (msgQueue.size() > 0) { - char buf[32]; - int pos = 0; - int lastidx = 0; - geoData tmpGeo; - int i = 0; - - tmpGeo.lat = GEORESET; - tmpGeo.lng = GEORESET; - - for (i = 0; i < (int) msgQueue.size(); i++) { - if (msgQueue[i] == ',') { - tmpGeo.lat = atof(buf); - pos = 0; - } - else if (msgQueue[i] == '\n') { - tmpGeo.lng = atof(buf); - pos = 0; - - routeList.push(tmpGeo); - lastidx = i; - tmpGeo.lat = GEORESET; - tmpGeo.lng = GEORESET; - } - else { - buf[pos++] = msgQueue[i]; - } - } - } + std::cout << "LoadRouteList:orgmsgQueue[" << orgmsgQueue << "]\n"; + if (orgmsgQueue == "") { + std::ifstream fin; + fin.open(g_RouteListFile.c_str()); + if (!fin) { + std::cerr << "Can't read " << g_RouteListFile << std::endl; + } + std::string line; + while (fin && getline(fin, line)) { + orgmsgQueue.append(line); + orgmsgQueue.append("\n"); + } + msgQueue = orgmsgQueue; + fin.close(); + } + else { + msgQueue = orgmsgQueue; + } + if (msgQueue.size() > 0) { + char buf[32]; + int pos = 0; + int lastidx = 0; + geoData tmpGeo; + int i = 0; + + tmpGeo.lat = GEORESET; + tmpGeo.lng = GEORESET; + + for (i = 0; i < (int) msgQueue.size(); i++) { + if (msgQueue[i] == ',') { + tmpGeo.lat = atof(buf); + pos = 0; + } + else if (msgQueue[i] == '\n') { + tmpGeo.lng = atof(buf); + pos = 0; + + routeList.push(tmpGeo); + lastidx = i; + tmpGeo.lat = GEORESET; + tmpGeo.lng = GEORESET; + } + else { + buf[pos++] = msgQueue[i]; + } + } + } } /** diff --git a/src/CGtCtrl.h b/src/CGtCtrl.h index c74d318..e608524 100644 --- a/src/CGtCtrl.h +++ b/src/CGtCtrl.h @@ -323,7 +323,7 @@ class CGtCtrl void SetMQKeyData(char *buf, unsigned int bufsize, long &mtype, const char *key, char status[], unsigned int size); void CheckSendResult(int mqid); - void LoadRouteList(); + void LoadRouteList(); }; #endif /* CGTCTRL_H_ */ diff --git a/src/CarSim_Daemon.cpp b/src/CarSim_Daemon.cpp index 5ad305f..719b341 100644 --- a/src/CarSim_Daemon.cpp +++ b/src/CarSim_Daemon.cpp @@ -31,7 +31,7 @@ int main(int argc, char **argv) bool bTestMode = false; bool b; bool comFlg = false; - bool bDemoRunning = false; + bool bDemoRunning = false; // parse command line while ((result = getopt(argc, argv, "jhvgctr")) != -1) { @@ -58,9 +58,9 @@ int main(int argc, char **argv) case 'j': gbDevJs = true; break; - case 'r': - bDemoRunning = true; - break; + case 'r': + bDemoRunning = true; + break; } } @@ -112,8 +112,8 @@ int main(int argc, char **argv) } CGtCtrl myGtCtrl; - myGtCtrl.m_bUseGps = bUseGps; - myGtCtrl.m_bDemoRunning = bDemoRunning; + myGtCtrl.m_bUseGps = bUseGps; + myGtCtrl.m_bDemoRunning = bDemoRunning; b = myGtCtrl.Initialize(); if (b) { -- 2.7.4