# Process this file with autoconf to produce a configure script.
AC_PREREQ([2.68])
-AC_INIT([carsim], [0.0.1], [shibata@mac.tec.toyota.co.jp])
+AC_INIT([ico-vic-carsim], [0.0.9], [shibata@mac.tec.toyota.co.jp])
AM_INIT_AUTOMAKE([1.11 foreign])
AC_CONFIG_SRCDIR([config.h.in])
AC_CONFIG_HEADERS([config.h])
After=ambd.service
[Service]
-Type=oneshot
-ExecStart=/usr/bin/carsim
-
-[Install]
-WantedBy=multi-user.target
-
-
+ExecStart=/usr/bin/ico-vic-carsim
+* Thu Sep 26 2013 Shibata Makoto <shibata@mac.tec.toyota.co.jp> accepted/tizen/20130919.204144@1135dfb
+- 0.9.05 release.
+-- the program name is changed to "ico-vic-carsim" from "carsim".
+-- a service file is moved from systemd/system to systemd/user.
+-- the start method is changed to the Wants target of the service file of ico-uxf-homescreen
+-- internal bug fix
+
* Thu Sep 19 2013 Shibata Makoto <shibata@mac.tec.toyota.co.jp> accepted/tizen/20130917.224135@6e9f63d
- 0.9.04 release.
-- Coexistence with ico-uxf-device-input-controller(for GTForce).
Name: ico-vic-carsimulator
Summary: CarSimulator
-Version: 0.9.04
+Version: 0.9.05
Release: 1.1
Group: System Environment/Daemons
License: Apache 2.0
%make_install
# configurations
-%define carsim_conf /usr/bin/
-mkdir -p %{buildroot}/etc/carsim/
-mkdir -p %{buildroot}/usr/lib/systemd/system/
-#install -m 0644 src/CarSim_Daemon.conf %{buildroot}%{carsim_conf}
-install -m 0644 G25.conf %{buildroot}/etc/carsim/
-install -m 0644 G27.conf %{buildroot}/etc/carsim/
-install -m 0644 carsim.service %{buildroot}/usr/lib/systemd/system/
+mkdir -p %{buildroot}/etc/ico-vic-carsim/
+mkdir -p %{buildroot}/usr/lib/systemd/user/
+install -m 0644 G25.conf %{buildroot}/etc/ico-vic-carsim/
+install -m 0644 G27.conf %{buildroot}/etc/ico-vic-carsim/
+install -m 0644 ico-vic-carsim.service %{buildroot}%{_unitdir_user}/ico-vic-carsim.service
%post -p /sbin/ldconfig
%postun -p /sbin/ldconfig
%files
+%attr(4755root,root,-) %{_bindir}/ico-vic-carsim
%defattr(-,root,root,-)
%{_bindir}/*
-/etc/carsim/*
-/usr/lib/systemd/system/carsim.service
-#%{carsim_conf}/CarSim_Daemon.conf
+/etc/ico-vic-carsim/*
+/usr/lib/systemd/user/ico-vic-carsim.service
/*
* Copyright (c) 2013, TOYOTA MOTOR CORPORATION.
*
- * This program is licensed under the terms and conditions of the
+ * This program is licensed under the terms and conditions of the
* Apache License, version 2.0. The full text of the Apache License is at
* http://www.apache.org/licenses/LICENSE-2.0
*
bool g_bSentInMileage = true;
bool g_bSentInChgLngLat = true;
double g_SentInMileage = 3.0; // 3 meter
-double g_StartLatitude = 35.47945;
-double g_StartLongitude = 139.40026;
+double g_StartLatitude = 35.47945;
+double g_StartLongitude = 139.40026;
double g_GoalLatitude = 35.49746;
double g_GoalLongitude = 139.40504;
m_stVehicleInfo.bHeadLight = false; // HEAD LIGHT OFF(false)
m_bFirstOpen = true;
-
if (true == gbDevJs) {
myJS = new CJoyStick;
int nRet = myJS->Open();
break;
}
delete myJS;
+ myJS = NULL;
} while ((++i) < g_JoyStickTypeNum);
if (myJS == NULL) {
return false;
}
if (true == bLIGHTSTATUS) {
- const size_t LSsz = 8;
+ const size_t LSsz = 8;
char data[LSsz];
// 0:LIGHT HEAD STATUS ON(1)/OFF(0)
// 1:LEFT WINKER STATUS ON(1)/OFF(0)
* SHIFT
*/
if (nShiftPosBK != m_stVehicleInfo.nShiftPos) {
- const size_t ShiftSz = 3;
- int data[ShiftSz];
+ const size_t ShiftSz = 3;
+ int data[ShiftSz];
int val = pmCar.getValue();
data[0] = pmCar.getSelectGear();
if (data[0] > 10) {
* @return bool true:success,false:failure
*/
/*--------------------------------------------------------------------------*/
-bool CGtCtrl::sendVehicleInfo( /*int & send_id, long priority, */
+bool CGtCtrl::sendVehicleInfo( /*int & send_id, long priority, */
ProtocolType type, const char *key, void *data,
unsigned int unit_size, int unit_cnt)
{
const useconds_t g_sleeptime = 10000; // = 10milli sec = 0.01 sec
const int g_JoyStickTypeNum = 3;
-const std::string g_ConfPathG25 = "/etc/carsim/G25.conf";
-const std::string g_ConfPathG27 = "/etc/carsim/G27.conf";
+const std::string g_ConfPathG25 = "/etc/ico-vic-carsim/G25.conf";
+const std::string g_ConfPathG27 = "/etc/ico-vic-carsim/G27.conf";
#define D_RUNLOOP_INTERVAL_COUNT 5
#define D_RUNLOOP_INTERVAL_COUNT2 50
/*
* Copyright (c) 2013, TOYOTA MOTOR CORPORATION.
*
- * This program is licensed under the terms and conditions of the
+ * This program is licensed under the terms and conditions of the
* Apache License, version 2.0. The full text of the Apache License is at
* http://www.apache.org/licenses/LICENSE-2.0
*
ioctl(m_nJoyStickID, JSIOCGAXES, &m_ucAxes);
ioctl(m_nJoyStickID, JSIOCGBUTTONS, &m_ucButtons);
ioctl(m_nJoyStickID, JSIOCGNAME(sizeof(m_strDevName)),
- &m_strDevName);
+ m_strDevName);
printf
("JoyStick ID[%d], JoyStick Name[%s], Axis[%d], Buttons[%d]\n",
}
int r = -1;
for (size_t i = 0; i < sz; i++) {
- int fd = open(files[i].c_str(), O_RDWR | O_NONBLOCK);
+ int fd = open(files[i].c_str(), O_RDONLY | O_NONBLOCK);
if (0 > fd) { /* open error */
+ fprintf(stderr,"CJoyStick::deviceOpen: Event Device.%d(%s) Open Error<%d>\n",
+ i, files[i].c_str(), errno);
continue; /* next device */
}
char sDevNm[128];
do {
dent = readdir(dp);
if (dent != NULL) {
- bool bMatching = true;
+ bool bMatching = false;
for (int i = 0; i < mssz; i++) {
- if (0 == strstr(dent->d_name, matching[i].c_str())) {
- bMatching = false;
+ if (strstr(dent->d_name, matching[i].c_str())) {
+ bMatching = true;
break; /* break of for */
}
}
{
// TODO Auto-generated constructor stub
memset(m_absInf, 0, sizeof(m_absInf));
- m_grab = false;
m_devName = std::string(D_DEV_NAME_G27);
}
/**
* get device file
*/
- printf("Open Device Name is %s\n", m_devName.c_str());
+ printf("Open Device Name is <%s>\n", m_devName.c_str());
int rfd = deviceOpen(dirpath, nameparts, m_devName, devPath);
if (0 > rfd) {
printf("Can't open device.\n");
return rfd;
}
m_nJoyStickID = rfd;
- /**
- * set grab
- */
- printf("Check Grab is %s(%d)\n", m_devName.c_str(), rfd);
- if (false == deviceGrab(rfd)) {
- printf("Can't get grab.\n");
- Close();
- return -1;
- }
fds.fd = m_nJoyStickID;
return m_nJoyStickID;
if (0 > m_nJoyStickID) {
return 0;
}
- if (true == m_grab) {
- if (false == deviceGrabRelese(m_nJoyStickID)) {
- cerr << "EVENT device GRAB Relese Fail" << endl;
- }
- }
return CJoyStick::Close();
}
}
/**
- * @brief device grab
- */
-bool CJoyStickEV::deviceGrab(int fd)
-{
- if (0 > fd) {
- return false;
- }
-#if 0 /* no need grab on weston-1.2.x */
- if (0 > ioctl(fd, EVIOCGRAB, 1)) {
- return false;
- }
-#endif
- m_grab = true;
- return true;
-}
-
-/**
- * @brief device grab relese
- */
-bool CJoyStickEV::deviceGrabRelese(int fd)
-{
- if (0 > fd) {
- return false;
- }
- if (false == m_grab) {
- return false;
- }
-#if 0 /* no need grab on weston-1.2.x */
- if (0 > ioctl(fd, EVIOCGRAB, 0)) {
- return false;
- }
-#endif
- m_grab = false;
- return true;
-}
-
-/**
* End of File.(CJoyStickEV.cpp)
*/
virtual int Read(int *number, int *value);
virtual int ReadData();
virtual bool getDeviceName(int fd, char* devNM, size_t sz);
- bool deviceGrab(int fd);
- bool deviceGrabRelese(int fd);
int getJS_EVENT_BUTTON(int& num, int& val, const struct input_event& s);
int getJS_EVENT_AXIS(int& num, int& val, const struct input_event& s);
int calc1pm32767(int val, const struct input_absinfo& ai);
E_ABSMAX /* */
};
struct input_absinfo m_absInf[E_ABSMAX];
- bool m_grab;
std::string m_devName;
private:
};
/*
* Copyright (c) 2013, TOYOTA MOTOR CORPORATION.
*
- * This program is licensed under the terms and conditions of the
+ * This program is licensed under the terms and conditions of the
* Apache License, version 2.0. The full text of the Apache License is at
* http://www.apache.org/licenses/LICENSE-2.0
*
* @brief main entry point
*/
-
+#include <sys/types.h>
#include <iostream>
#include <unistd.h>
#include <getopt.h>
int main(int argc, char **argv)
{
-
// parse cmd line
int result = 0;
bool bUseGps = false;
}
}
else {
+ // change to super user
+ if (setuid(0) < 0) {
+ printf("can not set super user\n");
+ }
+
CGtCtrl myGtCtrl;
b = myGtCtrl.Initialize();
myGtCtrl.m_bUseGps = bUseGps;
myGtCtrl.Run();
-
- myGtCtrl.Terminate();
- }
- else {
- myGtCtrl.Terminate();
}
+ myGtCtrl.Terminate();
}
+ return 0;
}
/**
-bin_PROGRAMS = carsim
+bin_PROGRAMS = ico-vic-carsim
-carsim_SOURCES = AmbpiComm.h AmbpiComm.cpp CJoyStick.h CJoyStick.cpp CJoyStickEV.h CJoyStickEV.cpp CJoyStickG25.h CJoyStickG25.cpp CJoyStickG27.h CJoyStickG27.cpp CConf.h CConf.cpp CGtCtrl.h CGtCtrl.cpp CCalc.h CCalc.cpp CAvgCar.h CAvgCar.cpp CarSim_Daemon.cpp
-carsim_LDADD = -lpthread -ljson-glib-1.0 -lgobject-2.0 -lglib-2.0 -lrt -lico-util
-carsim_CPPFLAGS = -I/usr/include/glib-2.0 -I/usr/include/json-glib-1.0 -I/usr/lib/glib-2.0/include -std=c++0x
-carsim_LDFLAGS =
+ico_vic_carsim_SOURCES = AmbpiComm.h AmbpiComm.cpp CJoyStick.h CJoyStick.cpp CJoyStickEV.h CJoyStickEV.cpp CJoyStickG25.h CJoyStickG25.cpp CJoyStickG27.h CJoyStickG27.cpp CConf.h CConf.cpp CGtCtrl.h CGtCtrl.cpp CCalc.h CCalc.cpp CAvgCar.h CAvgCar.cpp CarSim_Daemon.cpp
+ico_vic_carsim_LDADD = -lpthread -ljson-glib-1.0 -lgobject-2.0 -lglib-2.0 -lrt -lico-util
+ico_vic_carsim_CPPFLAGS = -I/usr/include/glib-2.0 -I/usr/include/json-glib-1.0 -I/usr/lib/glib-2.0/include -std=c++0x
+ico_vic_carsim_LDFLAGS =