BugFix:TIVI-1991 36/13236/2 accepted/tizen/ivi/20131217.231225 accepted/tizen/ivi/20131219.041641 submit/tizen/20131217.094152 submit/tizen/20131219.042044
authorHayato Nakamura <hayato.nakamura@mail.toyota-td.jp>
Fri, 29 Nov 2013 11:16:38 +0000 (20:16 +0900)
committerHayato Nakamura <hayato.nakamura@mail.toyota-td.jp>
Mon, 2 Dec 2013 04:55:57 +0000 (13:55 +0900)
Change-Id: Idf7a7d9b87a7fa22d49544209ee21081229a6855
Signed-off-by: Hayato Nakamura <hayato.nakamura@mail.toyota-td.jp>
78 files changed:
CMakeLists.txt
packaging/ico-vic-amb-plugin.changes
packaging/ico-vic-amb-plugin.spec
src/AMBformat.conf
src/CMakeLists.txt
src/abstractconfig.cc
src/ambconfig.cc
src/ambconfig.h
src/ambinterface.cc
src/ambinterface.h
src/config.cc
src/controlwebsocket.cc
src/controlwebsocket.h
src/convert.cc
src/convert.h
src/messageformat.h
src/mwinterface.cc
src/mwinterface.h
src/viccommunicator.cc
tests/AMBformat.conf [new file with mode: 0644]
tests/CMakeLists.txt
tests/app1.cc [new file with mode: 0644]
tests/checkinterspace.awk [new file with mode: 0644]
tests/checkresult.sh [new file with mode: 0755]
tests/configamb.cc [deleted file]
tests/configamb.h [deleted file]
tests/controlwebsocketclient.cc
tests/controlwebsocketclient.h
tests/controlwebsocketclientapp.cc [deleted file]
tests/controlwebsocketclientapp.h [deleted file]
tests/dbustest1.cc [new file with mode: 0644]
tests/dbustest3.cc [new file with mode: 0644]
tests/etc/ambd/AMBformat.conf [new file with mode: 0644]
tests/etc/ambd/AMBformat_wrong1.conf [new file with mode: 0644]
tests/etc/ambd/AMBformat_wrong10.conf [new file with mode: 0644]
tests/etc/ambd/AMBformat_wrong11.conf [new file with mode: 0644]
tests/etc/ambd/AMBformat_wrong12.conf [new file with mode: 0644]
tests/etc/ambd/AMBformat_wrong13.conf [new file with mode: 0644]
tests/etc/ambd/AMBformat_wrong14.conf [new file with mode: 0644]
tests/etc/ambd/AMBformat_wrong2.conf [new file with mode: 0644]
tests/etc/ambd/AMBformat_wrong3.conf [new file with mode: 0644]
tests/etc/ambd/AMBformat_wrong4.conf [new file with mode: 0644]
tests/etc/ambd/AMBformat_wrong5.conf [new file with mode: 0644]
tests/etc/ambd/AMBformat_wrong6.conf [new file with mode: 0644]
tests/etc/ambd/AMBformat_wrong7.conf [new file with mode: 0644]
tests/etc/ambd/AMBformat_wrong8.conf [new file with mode: 0644]
tests/etc/ambd/AMBformat_wrong9.conf [new file with mode: 0644]
tests/etc/ambd/config [new file with mode: 0644]
tests/etc/ambd/config.wrong [new file with mode: 0644]
tests/etc/ambd/config.wrong10 [new file with mode: 0644]
tests/etc/ambd/config.wrong11 [new file with mode: 0644]
tests/etc/ambd/config.wrong12 [new file with mode: 0644]
tests/etc/ambd/config.wrong13 [new file with mode: 0644]
tests/etc/ambd/config.wrong14 [new file with mode: 0644]
tests/etc/ambd/config.wrong15 [new file with mode: 0644]
tests/etc/ambd/config.wrong2 [new file with mode: 0644]
tests/etc/ambd/config.wrong3 [new file with mode: 0644]
tests/etc/ambd/config.wrong4 [new file with mode: 0644]
tests/etc/ambd/config.wrong5 [new file with mode: 0644]
tests/etc/ambd/config.wrong6 [new file with mode: 0644]
tests/etc/ambd/config.wrong7 [new file with mode: 0644]
tests/etc/ambd/config.wrong8 [new file with mode: 0644]
tests/etc/ambd/config.wrong9 [new file with mode: 0644]
tests/logresult.cc [new file with mode: 0644]
tests/logresult.h [new file with mode: 0644]
tests/mwscenario.cc [deleted file]
tests/scenarioengine.cc [deleted file]
tests/scenarioengine.h [deleted file]
tests/standardjsonmessage.cc [deleted file]
tests/standardjsonmessage.h [deleted file]
tests/standardvehicleinfo.txt [new file with mode: 0644]
tests/startTestSuite.sh [deleted file]
tests/vic1.cc [new file with mode: 0644]
tests/vic3.cc [new file with mode: 0644]
tests/vicreset.cc [new file with mode: 0644]
tests/vicseq.cc [new file with mode: 0644]
tests/websocketscenario.cc [deleted file]
tool/ico_set_vehicleinfo.c

index 1329d96..3e2c50c 100644 (file)
@@ -13,6 +13,7 @@ set (CONF_INSTALL_DIR "/etc/ambd" CACHE PATH "The directory the config will be i
 
 add_definitions(-DPROJECT_VERSION="${PROJECT_VERSION}")
 add_definitions(-DPROJECT_NAME="${PROJECT_NAME}")
+add_definitions(-DLATER1024)
 
 set (LIB_SUFFIX "" CACHE STRING "Define suffix of directory name (32/64)" )
 set (LIB_INSTALL_DIR "${CMAKE_INSTALL_PREFIX}/lib${LIB_SUFFIX}/${CMAKE_LIBRARY_ARCHITECTURE}" CACHE STRING "Directory where lib will install")
@@ -36,11 +37,15 @@ pkg_check_modules(glib REQUIRED glib-2.0 gobject-2.0)
 pkg_check_modules(gio REQUIRED gio-2.0)
 pkg_check_modules(json REQUIRED json)
 pkg_check_modules(ambd REQUIRED automotive-message-broker)
-
-add_definitions(-std=c++0x)
+pkg_check_modules(elementary REQUIRED elementary)
+pkg_check_modules(ecore REQUIRED ecore)
+pkg_check_modules(appcore-efl REQUIRED appcore-efl)
+pkg_check_modules(dbus REQUIRED dbus-1)
+pkg_check_modules(edbus REQUIRED edbus)
 
 set(include_dirs ${libtool_INCLUDE_DIR} ${Boost_INCLUDE_DIRS} ${json_INCLUDE_DIRS} ${CMAKE_CURRENT_SOURCE_DIR}/lib ${ambd_INCLUDE_DIRS})
-set(link_libraries ${ambd_LIBRARIES} ${libtool_LIBRARY} ${json_LIBRARIES} -L${CMAKE_CURRENT_BINARY_DIR}/lib)
+#set(link_libraries ${ambd_LIBRARIES} ${libtool_LIBRARY} ${json_LIBRARIES} -L${CMAKE_CURRENT_BINARY_DIR}/lib)
+set(link_libraries -lamb ${libtool_LIBRARY} ${json_LIBRARIES} -L${CMAKE_CURRENT_BINARY_DIR}/lib)
 
 set(ARCHIVE_NAME ${CMAKE_PROJECT_NAME}-${PROJECT_VERSION})
 add_custom_target(dist COMMAND git archive --prefix=${ARCHIVE_NAME}/ HEAD | bzip2 > ${CMAKE_BINARY_DIR}/${ARCHIVE_NAME}.tar.bz2 WORKING_DIRECTORY ${CMAKE_SOURCE_DIR})
index 44a94ca..47a7dd3 100644 (file)
@@ -1,3 +1,8 @@
+* Fri Nov 29 2013 Shibata Makoto <shibata@mac.tec.toyota.co.jp> accepted/tizen_ivi_stable/20131116.012220@47cc4e3
+- 0.9.04 release
+-- BugFix:TIVI-1991
+-- Modify:test suite.
+
 * Thu Sep 19 2013 Shibata Makoto <shibata@mac.tec.toyota.co.jp> accepted/tizen/20130910.205130@cf82076
 - 0.9.02 release.
 -- Support for ico-uxf-utilities-0.2.04.
index 02f62eb..da1263f 100644 (file)
@@ -1,7 +1,7 @@
 Name:       ico-vic-amb-plugin
 Summary:    Automotive Message Broker is a vehicle network abstraction system.
-Version:    0.9.2
-Release:    1.1
+Version:    0.9.4
+Release:    2.1
 Group:      System Environment/Daemons
 License:    LGPL v2.1
 URL:        ""
@@ -14,8 +14,13 @@ BuildRequires:  cmake
 BuildRequires:  boost-devel
 BuildRequires:  libjson-devel
 BuildRequires:  automotive-message-broker-devel >= 0.10.0
-BuildRequires:  ico-uxf-utilities-devel
-BuildRequires:  ico-uxf-utilities
+BuildRequires:  ico-uxf-utilities-devel >= 0.9.04
+BuildRequires:  ico-uxf-utilities >= 0.9.04
+BuildRequires:  pkgconfig(ecore)
+BuildRequires:  pkgconfig(elementary)
+BuildRequires:  pkgconfig(edbus)
+BuildRequires:  pkgconfig(dbus-1)
+BuildRequires:  pkgconfig(appcore-efl)
 
 %description 
 Collection of plugins for automotive-message-broker
index 92b95db..124bdd0 100644 (file)
                                        [
                                                {
                                                        "AMBPropertyName":"VehicleSpeed",
-                                                       "Type":"int",
+                                                       "Type":"uint16",
                                                        "AccessControl":"R",
                                                        "Default":"0",
-                                                       "DBusProperty":"VehicleSpeed"
+                                                       "DBusProperty":"VehicleSpeed",
+                                                       "DBusObjectName":"VehicleSpeed",
+                                                       "Zone":"None"
                                                }
                                        ],
                                        "sense":
@@ -25,7 +27,7 @@
                                        ],
                                        "Priority":1,
                                        "DBusInterface":"org.automotive.vehicleSpeed",
-                    "DBusObject":"/org/automotive/runningstatus/vehicleSpeed"
+                    "DBusObject":"VehicleSpeed"
                                },
                                {
                                        "KeyEventType":"ENGINE_SPEED",
                                        [
                                                {
                             "AMBPropertyName":"EngineSpeed",
-                            "Type":"int",
+                            "Type":"uint16",
                             "AccessControl":"R",
                             "Default":"0",
-                            "DBusProperty":"EngineSpeed"
+                            "DBusProperty":"EngineSpeed",
+                            "DBusObjectName":"EngineSpeed",
+                                                       "Zone":"None"
                                                }
                                        ],
                                        "sense":
@@ -47,7 +51,7 @@
                                        ],
                                        "Priority":1,
                                        "DBusInterface":"org.automotive.engineSpeed",
-                    "DBusObject":"/org/automotive/runningstatus/engineSpeed"
+                    "DBusObject":"EngineSpeed"
                 },
                                {
                                        "KeyEventType":"SHIFT",
                             "Type":"int",
                             "AccessControl":"R",
                             "Default":"0",
-                            "DBusProperty":"ShiftPosition"
+                            "DBusProperty":"ShiftPosition",
+                            "DBusObjectName":"Transmission",
+                                                       "Zone":"None"
                                                },
                                                {
                                                        "AMBPropertyName":"TransmissionGearPostion",
                                                        "Type":"int",
                                                        "AccessControl":"R",
                                                        "Default":"0",
-                                                       "DBusProperty":"GearPosition"
+                                                       "DBusProperty":"GearPosition",
+                                                       "DBusObjectName":"Transmission",
+                                                       "Zone":"None"
                                                },
                                                {
                                                        "AMBPropertyName":"TransmissionMode",
                                                        "Type":"int",
                                                        "AccessControl":"R",
                                                        "Default":"0",
-                                                       "DBusProperty":"Mode"
+                                                       "DBusProperty":"Mode",
+                                                       "DBusObjectName":"Transmission",
+                                                       "Zone":"None"
                                                }
                                        ],
                                        "sense":
@@ -83,7 +93,7 @@
                                        ],
                                        "Priority":1,
                                        "DBusInterface":"org.automotive.transmission",
-                    "DBusObject":"/org/automotive/runningstatus/transmission"
+                    "DBusObject":"Transmission"
                 },
                                {
                                        "KeyEventType":"ACCPEDAL_OPEN",
                                        [
                                                {
                             "AMBPropertyName":"ThrottlePosition",
-                            "Type":"int",
+                            "Type":"uint16",
                             "AccessControl":"R",
                             "Default":"0",
-                            "DBusProperty":"Undefined"
+                            "DBusProperty":"ThrottlePosition",
+                            "DBusObjectName":"ThrottlePosition",
+                                                       "Zone":"None"
                                                }
                                        ],
                                        "sense":
                                        ],
                                        "Priority":1,
                                        "DBusInterface":"Undefined",
-                    "DBusObject":"Undefined"
+                    "DBusObject":"ThrottlePosition"
                 },
                                {
                                        "KeyEventType":"BRAKE_SIGNAL",
                             "Type":"bool",
                             "AccessControl":"R",
                             "Default":"0",
-                            "DBusProperty":"Undefined"
+                            "DBusProperty":"Engaged",
+                            "DBusObjectName":"WheelBrake",
+                                                       "Zone":"None"
                                                }
                                        ],
                                        "sense":
                                        ],
                                        "Priority":1,
                                        "DBusInterface":"Undefined",
-                    "DBusObject":"Undefined"
+                    "DBusObject":"WheelBrake"
                 },
                                {
                                        "KeyEventType":"BRAKE_PRESSURE",
                                        [
                                                {
                             "AMBPropertyName":"WheelBrakePressure",
-                            "Type":"int",
+                            "Type":"uint16",
                             "AccessControl":"R",
                             "Default":"0",
-                            "DBusProperty":"WheelBrakePressure"
+                            "DBusProperty":"WheelBrakePressure",
+                            "DBusObjectName":"WheelBrakePressure",
+                                                       "Zone":"None"
                                                }
                                        ],
                                        "sense":
                                        ],
                                        "Priority":1,
                                        "DBusInterface":"org.automotive.WheelBrakePressure",
-                    "DBusObject":"/org/automotive/custom/WheelBrakePressure"
+                    "DBusObject":"WheelBrakePressure"
                 },
                                {
                                        "KeyEventType":"STEERING",
                                        [
                                                {
                             "AMBPropertyName":"SteeringWheelAngle",
-                            "Type":"int",
+                            "Type":"uint16",
                             "AccessControl":"R",
                             "Default":"0",
-                            "DBusProperty":"Undefined"
+                            "DBusProperty":"SteeringWheelAngle",
+                            "DBusObjectName":"SteeringWheelAngle",
+                                                       "Zone":"None"
                                                }
                                        ],
                                        "sense":
                                        ],
                                        "Priority":1,
                                        "DBusInterface":"Undefined",
-                    "DBusObject":"Undefined"
+                    "DBusObject":"SteeringWheelAngle"
                 },
                                {
                                        "KeyEventType":"TURN_SIGNAL",
                             "Type":"int",
                             "AccessControl":"R",
                             "Default":"0",
-                            "DBusProperty":"Undefined"
+                            "DBusProperty":"TurnSignal",
+                            "DBusObjectName":"TurnSignal",
+                                                       "Zone":"None"
                                                }
                                        ],
                                        "sense":
                                        ],
                                        "Priority":1,
                                        "DBusInterface":"Undefined",
-                    "DBusObject":"Undefined"
+                    "DBusObject":"TurnSignal"
                 },
                                {
                                        "KeyEventType":"CLUTCH",
                             "Type":"bool",
                             "AccessControl":"R",
                             "Default":"0",
-                            "DBusProperty":"Undefined"
+                            "DBusProperty":"ClutchStatus",
+                            "DBusObjectName":"ClutchStatus",
+                                                       "Zone":"None"
                                                }
                                        ],
                                        "sense":
                                        ],
                                        "Priority":1,
                                        "DBusInterface":"Undefined",
-                    "DBusObject":"Undefined"
+                    "DBusObject":"ClutchStatus"
                 },
                                {
                                        "KeyEventType":"OIL",
                                        [
                                                {
                             "AMBPropertyName":"EngineOilPressure",
-                            "Type":"int",
+                            "Type":"uint16",
                             "AccessControl":"R",
                             "Default":"0",
-                            "DBusProperty":"Undefined"
+                            "DBusProperty":"Pressure",
+                            "DBusObjectName":"EngineOil",
+                                                       "Zone":"None"
                                                },
                                                {
                                                        "AMBPropertyName":"EngineOilLevel",
                                                        "Type":"int",
                                                        "AccessControl":"R",
                                                        "Default":"0",
-                                                       "DBusProperty":"EngineOilLevel"
+                                                       "DBusProperty":"EngineOilLevel",
+                                                       "DBusObjectName":"EngineOilLevel",
+                                                       "Zone":"None"
                                                }
                                        ],
                                        "sense":
                                        ],
                                        "Priority":1,
                                        "DBusInterface":"org.automotive.EngineOilLevel",
-                    "DBusObject":"/org/automotive/custom/EngineOilLevel"
+                    "DBusObject":"EngineOil"
                 },
                                {
                                        "KeyEventType":"WATER_TEMP",
                             "Type":"int",
                             "AccessControl":"R",
                             "Default":"0",
-                            "DBusProperty":"Undefinde"
+                            "DBusProperty":"EngineCoolantTemperature",
+                            "DBusObjectName":"EngineCoolantTemperature",
+                                                       "Zone":"None"
                                                }
                                        ],
                                        "sense":
                                        ],
                                        "Priority":1,
                                        "DBusInterface":"Undefined",
-                    "DBusObject":"Undefined"
+                    "DBusObject":"EngineCoolantTemperature"
                 },
                                {
                                        "KeyEventType":"MACHINEGUNTURRET",
                         "Type":"bool",
                         "AccessControl":"R",
                         "Default":"0",
-                        "DBusProperty":"Undefined"
+                        "DBusProperty":"MachineGunTurretStatus",
+                        "DBusObjectName":"MachineGunTurretStatus",
+                                               "Zone":"None"
                                                }
                                        ],
                                        "sense":
                                        ],
                                        "Priority":1,
                                        "DBusInterface":"Undefined",
-                    "DBusObject":"Undefined"
+                    "DBusObject":"MachineGunTurretStatus"
                 },
                                {
                                        "KeyEventType":"ACCELERATION",
                                        [
                                                {
                                                        "AMBPropertyName":"AccelerationX",
-                                                       "Type":"int",
+                                                       "Type":"uint16",
                                                        "AccessControl":"R",
                                                        "Default":"0",
-                                                       "DBusProperty":"X"
+                                                       "DBusProperty":"X",
+                                                       "DBusObjectName":"Acceleration",
+                                                       "Zone":"None"
                                                },
                                                {
                                                        "AMBPropertyName":"AccelerationY",
-                                                       "Type":"int",
+                                                       "Type":"uint16",
                                                        "AccessControl":"R",
                                                        "Default":"0",
-                                                       "DBusProperty":"Y"
+                                                       "DBusProperty":"Y",
+                                                       "DBusObjectName":"Acceleration",
+                                                       "Zone":"None"
                                                },
                                                {
                                                        "AMBPropertyName":"AccelerationZ",
-                                                       "Type":"int",
+                                                       "Type":"uint16",
                                                        "AccessControl":"R",
                                                        "Default":"0",
-                                                       "DBusProperty":"Z"
+                                                       "DBusProperty":"Z",
+                                                       "DBusObjectName":"Acceleration",
+                                                       "Zone":"None"
                                                }
                                        ],
                                        "sense":
                                        ],
                                        "Priority":1,
                                        "DBusInterface":"org.automotive.acceleration",
-                    "DBusObject":"/org/automotive/runningstatus/acceleration"
+                    "DBusObject":"Acceleration"
                 },
                                {
                                        "KeyEventType":"MASSAIRFLOW",
                             "Type":"uint16_t",
                             "AccessControl":"R",
                             "Default":"0",
-                            "DBusProperty":"Undefined"
+                            "DBusProperty":"MassAirFlow",
+                            "DBusObjectName":"MassAirFlow",
+                                                       "Zone":"None"
                                                }
                                        ],
                                        "sense":
                                        ],
                                        "Priority":1,
                                        "DBusInterface":"Undefined",
-                    "DBusObject":"Undefined"
+                    "DBusObject":"MassAirFlow"
                 },
                                {
                                        "KeyEventType":"BUTTON",
                             "Type":"char",
                             "AccessControl":"R",
                             "Default":"0",
-                            "DBusProperty":"Undefined"
+                            "DBusProperty":"ButtonEvent",
+                            "DBusObjectName":"ButtonEvent",
+                                                       "Zone":"None"
                                                }
                                        ],
                                        "sense":
                                        ],
                                        "Priority":1,
                                        "DBusInterface":"Undefined",
-                    "DBusObject":"Undefined"
+                    "DBusObject":"ButtonEvent"
                 },
                                {
                                        "KeyEventType":"OUTSIDE",
                             "Type":"int",
                             "AccessControl":"R",
                             "Default":"0",
-                            "DBusProperty":"Undefined"
+                            "DBusProperty":"AirIntakeTemperature",
+                            "DBusObjectName":"AirIntakeTemperature",
+                                                       "Zone":"None"
                                                }
                                        ],
                                        "sense":
                                        ],
                                        "Priority":1,
                                        "DBusInterface":"Undefined",
-                    "DBusObject":"Undefined"
+                    "DBusObject":"AirIntakeTemperature"
                 },
                                {
                                        "KeyEventType":"BATTERY",
                                        [
                                                {
                             "AMBPropertyName":"ButteryVoltage",
-                            "Type":"int",
+                            "Type":"double",
                             "AccessControl":"R",
                             "Default":"0",
-                            "DBusProperty":"Undefined"
+                            "DBusProperty":"ButteryVoltage",
+                            "DBusObjectName":"ButteryVoltage",
+                                                       "Zone":"None"
                                                }
                                        ],
                                        "sense":
                                        ],
                                        "Priority":1,
                                        "DBusInterface":"Undefined",
-                    "DBusObject":"Undefined"
+                    "DBusObject":"ButteryVoltage"
                 },
                                {
                                        "KeyEventType":"INSIDE",
                             "Type":"int",
                             "AccessControl":"R",
                             "Default":"0",
-                            "DBusProperty":"Undefined"
+                            "DBusProperty":"Interior",
+                            "DBusObjectName":"InteriorTemperature",
+                                                       "Zone":"None"
                                                }
                                        ],
                                        "sense":
                                        ],
                                        "Priority":1,
                                        "DBusInterface":"Undefined",
-                    "DBusObject":"Undefined"
+                    "DBusObject":"InteriorTemperature"
                 },
                                {
                                        "KeyEventType":"ENGINEOIL",
                             "Type":"int",
                             "AccessControl":"R",
                             "Default":"0",
-                            "DBusProperty":"Temperature"
+                            "DBusProperty":"Temperature",
+                            "DBusObjectName":"EngineOil",
+                                                       "Zone":"None"
                                                },
                                                {
                             "AMBPropertyName":"EngineOilRemaining",
                             "Type":"uint16_t",
                             "AccessControl":"R",
                             "Default":"0",
-                            "DBusProperty":"Remaining"
+                            "DBusProperty":"Remaining",
+                            "DBusObjectName":"EngineOil",
+                                                       "Zone":"None"
                                                }
                                        ],
                                        "sense":
                                        ],
                                        "Priority":1,
                                        "DBusInterface":"org.automotive.engineOil",
-                    "DBusObject":"/org/automotive/runningstatus/engineOil"
+                    "DBusObject":"EngineOil"
                 },
                                {
                                        "KeyEventType":"TIREPRESSURE",
                             "Type":"double",
                             "AccessControl":"R",
                             "Default":"0",
-                            "DBusProperty":"LeftFront"
+                            "DBusProperty":"LeftFront",
+                            "DBusObjectName":"TirePressure",
+                                                       "Zone":"None"
                                                },
                                                {
                             "AMBPropertyName":"TirePressureRightFront",
                             "Type":"double",
                             "AccessControl":"R",
                             "Default":"0",
-                            "DBusProperty":"RightFront"
+                            "DBusProperty":"RightFront",
+                            "DBusObjectName":"TirePressure",
+                                                       "Zone":"None"
                                                },
                                                {
                             "AMBPropertyName":"TirePressureLeftRear",
                             "Type":"double",
                             "AccessControl":"R",
                             "Default":"0",
-                            "DBusProperty":"LeftRear"
+                            "DBusProperty":"LeftRear",
+                            "DBusObjectName":"TirePressure",
+                                                       "Zone":"None"
                                                },
                                                {
                         "AMBPropertyName":"TirePressureRightRear",
                         "Type":"double",
                         "AccessControl":"R",
                         "Default":"0",
-                        "DBusProperty":"RightRear"
+                        "DBusProperty":"RightRear",
+                        "DBusObjectName":"TirePressure",
+                                               "Zone":"None"
                                                }
                                        ],
                                        "sense":
                                        ],
                                        "Priority":1,
                                        "DBusInterface":"org.automotive.tirePressure",
-                    "DBusObject":"/org/automotive/maintainance/tirePressure"
+                    "DBusObject":"TirePressure"
                 },
                                {
                                        "KeyEventType":"TIRETEMPERATURE",
                                                        "Type":"double",
                                                        "AccessControl":"R",
                                                        "Default":"0",
-                                                       "DBusProperty":"LeftFront"
+                                                       "DBusProperty":"LeftFront",
+                                                       "DBusObjectName":"TireTemperature",
+                                                       "Zone":"None"
                                                },
                                                {
                                                        "AMBPropertyName":"TireTemperatureRightFront",
                                                        "Type":"double",
                                                        "AccessControl":"R",
                                                        "Default":"0",
-                                                       "DBusProperty":"RightFront"
+                                                       "DBusProperty":"RightFront",
+                                                       "DBusObjectName":"TireTemperature",
+                                                       "Zone":"None"
                                                },
                                                {
                                                        "AMBPropertyName":"TireTemperatureLeftRear",
                                                        "Type":"double",
                                                        "AccessControl":"R",
                                                        "Default":"0",
-                                                       "DBusProperty":"LeftRear"
+                                                       "DBusProperty":"LeftRear",
+                                                       "DBusObjectName":"TireTemperature",
+                                                       "Zone":"None"
                                                },
                                                {
                                                        "AMBPropertyName":"TireTemperatureRightRear",
                                                        "Type":"double",
                                                        "AccessControl":"R",
                                                        "Default":"0",
-                                                       "DBusProperty":"RightRear"
+                                                       "DBusProperty":"RightRear",
+                                                       "DBusObjectName":"TireTemperature",
+                                                       "Zone":"None"
                                                }
                                        ],
                                        "sense":
                                        ],
                                        "Priority":1,
                                        "DBusInterface":"org.automotive.tireTemperature",
-                    "DBusObject":"/org/automotive/maintainance/tireTemperature"
+                    "DBusObject":"TireTemperature"
                                },
                                {
                                        "KeyEventType":"POWERMODE",
                                                        "Type":"char",
                                                        "AccessControl":"R",
                                                        "Default":"0",
-                                                       "DBusProperty":"VehiclePowerMode"
+                                                       "DBusProperty":"VehiclePowerMode",
+                                                       "DBusObjectName":"VehiclePowerMode",
+                                                       "Zone":"None"
                                                }
                                        ],
                                        "sense":
                                        ],
                                        "Priority":1,
                                        "DBusInterface":"org.automotive.vehiclePowerMode",
-                    "DBusObject":"/org/automotive/runningstatus/vehiclePowerMode"
-                               },
-                               {
-                                       "KeyEventType":"TRIPMETER",
-                                       "Status":
-                                       [
-                                               {
-                                                       "AMBPropertyName":"TripMeterA",
-                                                       "Type":"uint16_t",
-                                                       "AccessControl":"R",
-                                                       "Default":"0",
-                                                       "DBusProperty":"A"
-                                               },
-                                               {
-                                                       "AMBPropertyName":"TripMeterB",
-                                                       "Type":"uint16_t",
-                                                       "AccessControl":"R",
-                                                       "Default":"0",
-                                                       "DBusProperty":"B"
-                                               },
-                                               {
-                                                       "AMBPropertyName":"TripMeterC",
-                                                       "Type":"uint16_t",
-                                                       "AccessControl":"R",
-                                                       "Default":"0",
-                                                       "DBusProperty":"C"
-                                               }
-                                       ],
-                                       "sense":
-                                       [
-                                       ],
-                                       "event_mask":
-                                       [
-                                       ],
-                                       "Priority":1,
-                                       "DBusInterface":"org.automotive.tripMeter",
-                    "DBusObject":"/org/automotive/runningstatus/tripMeter"
+                    "DBusObject":"VehiclePowerMode"
                                },
                                {
                                        "KeyEventType":"CRUISECONTROL",
                                                        "Type":"bool",
                                                        "AccessControl":"R",
                                                        "Default":"0",
-                                                       "DBusProperty":"Undefined"
+                                                       "DBusProperty":"Activated",
+                                                       "DBusObjectName":"CruiseControlStatus",
+                                                       "Zone":"None"
                                                },
                                                {
                                                        "AMBPropertyName":"CruiseControlSpeed",
                                                        "Type":"uint16_t",
                                                        "AccessControl":"R",
                                                        "Default":"0",
-                                                       "DBusProperty":"Undefined"
+                                                       "DBusProperty":"Speed",
+                                                       "DBusObjectName":"CruiseControlStatus",
+                                                       "Zone":"None"
                                                }
                                        ],
                                        "sense":
                                        ],
                                        "Priority":1,
                                        "DBusInterface":"Undefined",
-                    "DBusObject":"Undefined"
+                    "DBusObject":"CruiseControlStatus"
                                },
                                {
                                        "KeyEventType":"LIGHTSTATUS",
                                                        "Type":"bool",
                                                        "AccessControl":"R",
                                                        "Default":"0",
-                                                       "DBusProperty":"Undefined"
+                                                       "DBusProperty":"Head",
+                                                       "DBusObjectName":"LightStatus",
+                                                       "Zone":"None"
                                                },
                                                {
                                                        "AMBPropertyName":"LightLeftTurn",
                                                        "Type":"bool",
                                                        "AccessControl":"R",
                                                        "Default":"0",
-                                                       "DBusProperty":"Undefined"
+                                                       "DBusProperty":"LeftTurn",
+                                                       "DBusObjectName":"LightStatus",
+                                                       "Zone":"None"
                                                },
                                                {
                                                        "AMBPropertyName":"LightRightTurn",
                                                        "Type":"bool",
                                                        "AccessControl":"R",
                                                        "Default":"0",
-                                                       "DBusProperty":"Undefined"
+                                                       "DBusProperty":"RightTurn",
+                                                       "DBusObjectName":"LightStatus",
+                                                       "Zone":"None"
                                                },
                                                {
                                                        "AMBPropertyName":"LightParking",
                                                        "Type":"bool",
                                                        "AccessControl":"R",
                                                        "Default":"0",
-                                                       "DBusProperty":"ParkingLightStatus"
+                                                       "DBusProperty":"Parking",
+                                                       "DBusObjectName":"LightStatus",
+                                                       "Zone":"None"
                                                },
                                                {
                                                        "AMBPropertyName":"LightFog",
                                                        "Type":"bool",
                                                        "AccessControl":"R",
                                                        "Default":"0",
-                                                       "DBusProperty":"Undefined"
+                                                       "DBusProperty":"Fog",
+                                                       "DBusObjectName":"LightStatus",
+                                                       "Zone":"None"
                                                },
                                                {
                                                        "AMBPropertyName":"LightHazard",
                                                        "Type":"bool",
                                                        "AccessControl":"R",
                                                        "Default":"0",
-                                                       "DBusProperty":"Undefined"
+                                                       "DBusProperty":"Hazard",
+                                                       "DBusObjectName":"LightStatus",
+                                                       "Zone":"None"
                                                },
                                                {
                                                        "AMBPropertyName":"LightBrake",
                                                        "Type":"bool",
                                                        "AccessControl":"R",
                                                        "Default":"0",
-                                                       "DBusProperty":"Undefined"
+                                                       "DBusProperty":"Brake",
+                                                       "DBusObjectName":"LightStatus",
+                                                       "Zone":"None"
                                                },
                                                {
                                                        "AMBPropertyName":"LightHighBeam",
                                                        "Type":"bool",
                                                        "AccessControl":"R",
                                                        "Default":"0",
-                                                       "DBusProperty":"Undefined"
+                                                       "DBusProperty":"HighBeam",
+                                                       "DBusObjectName":"LightStatus",
+                                                       "Zone":"None"
                                                }
                                        ],
                                        "sense":
                                        ],
                                        "Priority":1,
                                        "DBusInterface":"org.automotive.ParkingLightStatus",
-                    "DBusObject":"/org/automotive/custom/ParkingLightStatus"
-                               },
-                               {
-                                       "KeyEventType":"INTERIORLIGHT",
-                                       "Status":
-                                       [
-                                               {
-                                                       "AMBPropertyName":"InteriorLightDriver",
-                                                       "Type":"bool",
-                                                       "AccessControl":"R",
-                                                       "Default":"0",
-                                                       "DBusProperty":"Undefined"
-                                               },
-                                               {
-                                                       "AMBPropertyName":"InteriorLightCenter",
-                                                       "Type":"bool",
-                                                       "AccessControl":"R",
-                                                       "Default":"0",
-                                                       "DBusProperty":"Undefined"
-                                               },
-                                               {
-                                                       "AMBPropertyName":"InteriorLightPassenger",
-                                                       "Type":"bool",
-                                                       "AccessControl":"R",
-                                                       "Default":"0",
-                                                       "DBusProperty":"Undefined"
-                                               }
-                                       ],
-                                       "sense":
-                                       [
-                                       ],
-                                       "event_mask":
-                                       [
-                                       ],
-                                       "Priority":1,
-                                       "DBusInterface":"Undefined",
-                    "DBusObject":"Undefined"
+                    "DBusObject":"LightStatus"
                                },
                                {
                                        "KeyEventType":"ENGINELOAD",
                                        [
                                                {
                                                        "AMBPropertyName":"EngineLoad",
-                                                       "Type":"bool",
+                                                       "Type":"uint16",
                                                        "AccessControl":"R",
                                                        "Default":"0",
-                                                       "DBusProperty":"Undefined"
+                                                       "DBusProperty":"EngineLoad",
+                                                       "DBusObjectName":"EngineLoad",
+                                                       "Zone":"None"
                                                }
                                        ],
                                        "sense":
                                        ],
                                        "Priority":1,
                                        "DBusInterface":"Undefined",
-                    "DBusObject":"Undefined"
+                    "DBusObject":"EngineLoad"
                                },
                                {
                                        "KeyEventType":"HORN",
                                                        "Type":"bool",
                                                        "AccessControl":"R",
                                                        "Default":"0",
-                                                       "DBusProperty":"Undefined"
+                                                       "DBusProperty":"On",
+                                                       "DBusObjectName":"Horn",
+                                                       "Zone":"None"
                                                }
                                        ],
                                        "sense":
                                        ],
                                        "Priority":1,
                                        "DBusInterface":"Undefined",
-                    "DBusObject":"Undefined"
+                    "DBusObject":"Horn"
                                },
                                {
                                        "KeyEventType":"FUEL_LEVEL",
                                        [
                                                {
                                                        "AMBPropertyName":"FuelLevel",
-                                                       "Type":"int",
+                                                       "Type":"uint16",
                                                        "AccessControl":"R",
                                                        "Default":"0",
-                                                       "DBusProperty":"Level"
+                                                       "DBusProperty":"Level",
+                                                       "DBusObjectName":"Fuel",
+                                                       "Zone":"None"
                                                }
                                        ],
                                        "sense":
                                        ],
                                        "Priority":1,
                                        "DBusInterface":"org.automotive.fuel",
-                    "DBusObject":"/org/automotive/runningstatus/fuel"
+                    "DBusObject":"Fuel"
                                },
                                {
                                        "KeyEventType":"FUEL",
                                                        "Type":"uint16_t",
                                                        "AccessControl":"R",
                                                        "Default":"0",
-                                                       "DBusProperty":"InstantConsumption"
+                                                       "DBusProperty":"InstantConsumption",
+                                                       "DBusObjectName":"Fuel",
+                                                       "Zone":"None"
                                                },
                                                {
                                                        "AMBPropertyName":"FuelRange",
                                                        "Type":"uint16_t",
                                                        "AccessControl":"R",
                                                        "Default":"0",
-                                                       "DBusProperty":"Range"
+                                                       "DBusProperty":"Range",
+                                                       "DBusObjectName":"Fuel",
+                                                       "Zone":"None"
                                                },
                                                {
                                                        "AMBPropertyName":"FuelEconomy",
                                                        "Type":"uint16_t",
                                                        "AccessControl":"R",
                                                        "Default":"0",
-                                                       "DBusProperty":"InstantEconomy"
+                                                       "DBusProperty":"InstantEconomy",
+                                                       "DBusObjectName":"Fuel",
+                                                       "Zone":"None"
                                                },
                                                {
                                                        "AMBPropertyName":"FuelAverageEconomy",
                                                        "Type":"uint16_t",
                                                        "AccessControl":"R",
                                                        "Default":"0",
-                                                       "DBusProperty":"AverageEconomy"
+                                                       "DBusProperty":"AverageEconomy",
+                                                       "DBusObjectName":"Fuel",
+                                                       "Zone":"None"
                                                },
                                                {
                                                        "AMBPropertyName":"FuelType",
                                                        "Type":"char",
                                                        "AccessControl":"R",
                                                        "Default":"0",
-                                                       "DBusProperty":"FuelType"
+                                                       "DBusProperty":"Type",
+                                                       "DBusObjectName":"FuelInfo",
+                                                       "Zone":"None"
                                                },
                                                {
                                                        "AMBPropertyName":"FuelPositionSide",
                                                        "Type":"char",
                                                        "AccessControl":"R",
                                                        "Default":"0",
-                                                       "DBusProperty":"FuelPositionSide"
+                                                       "DBusProperty":"RefuelPosition",
+                                                       "DBusObjectName":"FuelInfo",
+                                                       "Zone":"None"
                                                }
                                        ],
                                        "sense":
                                        ],
                                        "Priority":1,
                                        "DBusInterface":"org.automotive.fuel",
-                    "DBusObject":"/org/automotive/runningstatus/fuel"
+                    "DBusObject":"Fuel"
                                },
                                {
                                        "KeyEventType":"EXTERIORBRIGHTNESS",
                                                        "Type":"uint16_t",
                                                        "AccessControl":"R",
                                                        "Default":"0",
-                                                       "DBusProperty":"ExteriorBrightness"
+                                                       "DBusProperty":"ExteriorBrightness",
+                                                       "DBusObjectName":"ExteriorBrightness",
+                                                       "Zone":"None"
                                                }
                                        ],
                                        "sense":
                                        ],
                                        "Priority":1,
                                        "DBusInterface":"org.automotive.exteriorBrightness",
-                    "DBusObject":"/org/automotive/environment/exteriorBrightness"
+                    "DBusObject":"ExteriorBrightness"
                                },
                                {
                                        "KeyEventType":"LOCATION",
                                                        "Type":"double",
                                                        "AccessControl":"R",
                                                        "Default":"0",
-                                                       "DBusProperty":"Latitude"
+                                                       "DBusProperty":"Latitude",
+                                                       "DBusObjectName":"Location",
+                                                       "Zone":"None"
                                                },
                                                {
                                                        "AMBPropertyName":"Longitude",
                                                        "Type":"double",
                                                        "AccessControl":"R",
                                                        "Default":"0",
-                                                       "DBusProperty":"Longitude"
+                                                       "DBusProperty":"Longitude",
+                                                       "DBusObjectName":"Location",
+                                                       "Zone":"None"
                                                },
                                                {
                                                        "AMBPropertyName":"Altitude",
                                                        "Type":"double",
                                                        "AccessControl":"R",
                                                        "Default":"0",
-                                                       "DBusProperty":"Altitude"
+                                                       "DBusProperty":"Altitude",
+                                                       "DBusObjectName":"Location",
+                                                       "Zone":"None"
                                                }
                                        ],
                                        "sense":
                                        ],
                                        "Priority":1,
                                        "DBusInterface":"org.automotive.Latitude",
-                    "DBusObject":"/org/automotive/custom/Latitude"
+                    "DBusObject":"Location"
                                },
                                {
                                        "KeyEventType":"DIRECTION",
                                                        "Type":"uint16_t",
                                                        "AccessControl":"R",
                                                        "Default":"0",
-                                                       "DBusProperty":"Direction"
+                                                       "DBusProperty":"Direction",
+                                                       "DBusObjectName":"Location",
+                                                       "Zone":"None"
+                                               }
+                                       ],
+                                       "sense":
+                                       [
+                                       ],
+                                       "event_mask":
+                                       [
+                                       ],
+                                       "Priority":1,
+                                       "DBusInterface":"org.automotive.Direction",
+                    "DBusObject":"Location"
+                               },
+                               {
+                                       "KeyEventType":"CUSTOM1",
+                                       "Status":
+                                       [
+                                               {
+                                                       "AMBPropertyName":"CustomA",
+                                                       "Type":"uint16_t",
+                                                       "AccessControl":"R",
+                                                       "Default":"0",
+                                                       "DBusProperty":"CustomA",
+                                                       "DBusObjectName":"CustomA",
+                                                       "Zone":"None"
+                                               }
+                                       ],
+                                       "sense":
+                                       [
+                                       ],
+                                       "event_mask":
+                                       [
+                                       ],
+                                       "Priority":1,
+                                       "DBusInterface":"org.automotive.Direction",
+                    "DBusObject":"CustomA"
+                               },
+                               {
+                                       "KeyEventType":"CUSTOM2",
+                                       "Status":
+                                       [
+                                               {
+                                                       "AMBPropertyName":"CustomB",
+                                                       "Type":"uint16_t",
+                                                       "AccessControl":"R",
+                                                       "Default":"0",
+                                                       "DBusProperty":"CustomB",
+                                                       "DBusObjectName":"CustomB",
+                                                       "Zone":"None"
+                                               }
+                                       ],
+                                       "sense":
+                                       [
+                                       ],
+                                       "event_mask":
+                                       [
+                                       ],
+                                       "Priority":1,
+                                       "DBusInterface":"org.automotive.Direction",
+                    "DBusObject":"CustomB"
+                               },
+                               {
+                                       "KeyEventType":"CUSTOM3",
+                                       "Status":
+                                       [
+                                               {
+                                                       "AMBPropertyName":"CustomC",
+                                                       "Type":"uint16_t",
+                                                       "AccessControl":"R",
+                                                       "Default":"0",
+                                                       "DBusProperty":"CustomC",
+                                                       "DBusObjectName":"CustomC",
+                                                       "Zone":"None"
+                                               }
+                                       ],
+                                       "sense":
+                                       [
+                                       ],
+                                       "event_mask":
+                                       [
+                                       ],
+                                       "Priority":1,
+                                       "DBusInterface":"org.automotive.Direction",
+                    "DBusObject":"CustomC"
+                               },
+                               {
+                                       "KeyEventType":"CUSTOM4",
+                                       "Status":
+                                       [
+                                               {
+                                                       "AMBPropertyName":"CustomD",
+                                                       "Type":"uint16_t",
+                                                       "AccessControl":"R",
+                                                       "Default":"0",
+                                                       "DBusProperty":"CustomD",
+                                                       "DBusObjectName":"CustomD",
+                                                       "Zone":"None"
                                                }
                                        ],
                                        "sense":
                                        ],
                                        "Priority":1,
                                        "DBusInterface":"org.automotive.Direction",
-                    "DBusObject":"/org/automotive/custom/Direction"
+                    "DBusObject":"CustomD"
                                }
                        ],
             "DefaultInfoPort":
index 61c8d77..f6e8137 100644 (file)
@@ -1,7 +1,7 @@
 include(CheckIncludeFiles)
 
 include_directories(${CMAKE_SOURCE_DIR}/lib ${include_dirs} ${gio_INCLUDE_DIRS} ${gio-unix_INCLUDE_DIRS} /usr/include/amb /usr/include/dbus-1.0)
-set(CMAKE_CXX_FLAGS "-g -Wall")
+set(CMAKE_CXX_FLAGS "-g -Wall -std=c++11 -O3")
 set(vehicleplugin_headers common.h abstractconfig.h ambconfig.h convert.h standardmessage.h datamessage.h eventmessage.h messageformat.h controlwebsocket.h mwinterface.h viccommunicator.h ambinterface.h)
 set(vehicleplugin_sources abstractconfig.cc ambconfig.cc convert.cc standardmessage.cc eventmessage.cc datamessage.cc mwinterface.cc controlwebsocket.cc viccommunicator.cc ambinterface.cc)
 add_library(vehicleplugin MODULE ${vehicleplugin_sources})
index 39a16af..ec07f91 100644 (file)
@@ -39,5 +39,10 @@ AbstractConfig::readConfig(std::string confpath)
         getline(in, line);
         output.append(line);
     }
-    return parseJson(output);
+    if (output.empty()) {
+        return false;
+    }
+    else {
+        return parseJson(output);
+    }
 }
index d2a4376..93cb56d 100644 (file)
@@ -64,16 +64,17 @@ AMBConfig::parseJson(std::string config)
 
     if (err != json_tokener_success) {
         std::cerr << "Error: " << json_tokener_error_desc(err) << "\n";
+        DebugOut(DebugOut::Error) << json_tokener_error_desc(err) << "\n";
         return ret;
     }
     json_object *configobject = json_object_object_get(rootobject, "Config");
     if (!configobject) {
-        DebugOut() << "Error getting Config\n";
+        DebugOut(DebugOut::Error) << "Can't find key[\"Config\"].\n";
         return ret;
     }
     array_list *configlist = json_object_get_array(configobject);
     if (configlist == NULL) {
-        DebugOut() << "Config is not Array.\n";
+        DebugOut(DebugOut::Error) << "\"Config\" is not array.\n";
         return ret;
     }
     for (int i = 0; i < array_list_length(configlist); i++) {
@@ -96,10 +97,12 @@ AMBConfig::parseJson(std::string config)
         }
         array_list *definelist = json_object_get_array(defineobj);
         if (definelist == NULL) {
+            DebugOut(DebugOut::Error) << "\"VehicleInfoDefine\" "
+                                      << "is not array.\n";
             break;
         }
         for (int j = 0; j < array_list_length(definelist); j++) {
-            DebugOut() << "VehicleInfoDefine : " << j << "/"
+            DebugOut(10) << "VehicleInfoDefine : " << j << "/"
                        << array_list_length(definelist) << "\n";
             json_object *obj_vi =
                     reinterpret_cast<json_object*>(array_list_get_idx(
@@ -111,8 +114,15 @@ AMBConfig::parseJson(std::string config)
             json_object *keyeventtypeobj = json_object_object_get(
                     obj_vi, "KeyEventType");
             if (keyeventtypeobj == NULL) {
+                DebugOut(DebugOut::Warning) << "\"KeyEventType\" "
+                                            << "is not defined.\n";
                 continue;
             }
+            if (std::string(json_object_get_string(keyeventtypeobj)).size() > 63) {
+                DebugOut(DebugOut::Warning) << "Don't allow length of "
+                                            << "\"KeyEventType\"'s value.\n";
+                break;
+            }
             strcpy(vid.KeyEventType, json_object_get_string(keyeventtypeobj));
             json_object *statusobj = json_object_object_get(obj_vi, "Status");
             if (statusobj == NULL) {
@@ -133,12 +143,16 @@ AMBConfig::parseJson(std::string config)
                 json_object *statuschildobj = json_object_object_get(
                         obj_sts, "AMBPropertyName");
                 if (statuschildobj == NULL) {
+                    DebugOut(DebugOut::Warning) << "\"AMBPropertyName\" "
+                                                << "is not defined.\n";
                     continue;
                 }
                 status.ambPropertyName = string(
                         json_object_get_string(statuschildobj));
                 statuschildobj = json_object_object_get(obj_sts, "Type");
                 if (statuschildobj == NULL) {
+                    DebugOut(DebugOut::Warning) << "\"Type\" "
+                                                << "is not defined.\n";
                     continue;
                 }
                 status.type =
@@ -146,6 +160,8 @@ AMBConfig::parseJson(std::string config)
                                 statuschildobj)),
                                 &status.typesize);
                 if (status.type == NONE) {
+                    DebugOut(DebugOut::Warning) << "\"Type\"'s value "
+                                                << "is not defined.\n";
                     continue;
                 }
                 statuschildobj = json_object_object_get(obj_sts,
@@ -166,6 +182,18 @@ AMBConfig::parseJson(std::string config)
                     status.dbusPropertyName = string(
                             json_object_get_string(statuschildobj));
                 }
+                statuschildobj = json_object_object_get(obj_sts,
+                                                        "DBusObjectName");
+                if (statuschildobj != NULL) {
+                    status.dbusObjectName = string(
+                            json_object_get_string(statuschildobj));
+                }
+                statuschildobj = json_object_object_get(obj_sts,
+                                                        "Zone");
+                if (statuschildobj != NULL) {
+                    status.zone = getZone(string(
+                            json_object_get_string(statuschildobj)));
+                }
                 vid.status.push_back(status);
             }
             /* ToDo */
@@ -190,37 +218,57 @@ AMBConfig::parseJson(std::string config)
         json_object *defaultportobj = json_object_object_get(obj,
                                                              "DefaultInfoPort");
         if (defaultportobj == NULL) {
+            DebugOut(DebugOut::Error) << "\"DefaultInfoPort\" "
+                                      << "is not defined.\n";
             break;
         }
         json_object *portobj = json_object_object_get(defaultportobj,
                                                       "DataPort");
         if (portobj == NULL) {
+            DebugOut(DebugOut::Error) << "\"DefaultInfoPort\"->"
+                                      << "\"DataPort\" "
+                                      << "is not defined.\n";
             break;
         }
         portinfo.standard.dataPort = json_object_get_int(portobj);
         portobj = json_object_object_get(defaultportobj, "CtrlPort");
         if (portobj == NULL) {
+            DebugOut(DebugOut::Error) << "\"DefaultInfoPort\"->"
+                                      << "\"CtrlPort\" "
+                                      << "is not defined.\n";
             break;
         }
         portinfo.standard.controlPort = json_object_get_int(portobj);
         json_object *customportobj = json_object_object_get(
                 obj, "CustomizeInfoPort");
         if (customportobj == NULL) {
+            DebugOut(DebugOut::Error) << "\"CustomeizeInfoPort\"->"
+                                      << "is not defined.\n";
             break;
         }
         portobj = json_object_object_get(customportobj, "DataPort");
         if (portobj == NULL) {
+            DebugOut(DebugOut::Error) << "\"CustomeizeInfoPort\"->"
+                                      << "\"DataPort\" "
+                                      << "is not defined.\n";
             break;
         }
         portinfo.custom.dataPort = json_object_get_int(portobj);
         portobj = json_object_object_get(customportobj, "CtrlPort");
         if (portobj == NULL) {
+            DebugOut(DebugOut::Error) << "\"CustomeizeInfoPort\"->"
+                                      << "\"CtrlPort\" "
+                                      << "is not defined.\n";
             break;
         }
         portinfo.custom.controlPort = json_object_get_int(portobj);
         ret = true;
         break;
     }
+    if (vehicleinfoList.empty()) {
+        ret = false;
+        DebugOut(DebugOut::Error) << "Can't load vehicle information.\n";
+    }
 
     return ret;
 }
@@ -267,3 +315,50 @@ AMBConfig::getType(char *type, int *size)
     *size = 0;
     return NONE;
 }
+
+Zone::Type 
+AMBConfig::getZone(const std::string& zonestr) {
+    DebugOut(50) << "Zone string = " << zonestr << "\n";
+#if LATER1024
+    if (zonestr == "None") {
+        return Zone::None;
+    }
+    else if (zonestr == "Front") {
+        return Zone::Front;
+    }
+    else if (zonestr == "Middle") {
+        return Zone::Middle;
+    }
+    else if (zonestr == "Right") {
+        return Zone::Right;
+    }
+    else if (zonestr == "Left") {
+        return Zone::Left;
+    }
+    else if (zonestr == "Rear") {
+        return Zone::Rear;
+    }
+    else if (zonestr == "Center") {
+        return Zone::Center;
+    }
+    else if (zonestr == "FrontRight") {
+        return Zone::FrontRight;
+    }
+    else if (zonestr == "FrontLeft") {
+        return Zone::FrontLeft;
+    }
+    else if (zonestr == "MiddleRight") {
+        return Zone::MiddleRight;
+    }
+    else if (zonestr == "MiddleLeft") {
+        return Zone::MiddleLeft;
+    }
+    else if (zonestr == "RearRight") {
+        return Zone::RearRight;
+    }
+    else if (zonestr == "RearLeft") {
+        return Zone::RearLeft;
+    }
+#endif
+    return Zone::None;
+}
index 5554d96..50a3c28 100644 (file)
@@ -21,6 +21,8 @@
 
 #include <vector>
 
+#include <abstractpropertytype.h>
+
 #include "abstractconfig.h"
 #include "common.h"
 
@@ -36,6 +38,8 @@ struct VehicleInfoDefine {
         std::string accessControl;
         std::string defaultvalue;
         std::string dbusPropertyName;
+        std::string dbusObjectName;
+        Zone::Type zone;
     };
     /* ToDo */
     //undefine data structure;
@@ -107,6 +111,9 @@ private:
     DataType
     getType(char *type, int *size);
 
+    Zone::Type
+    getZone(const std::string& zonestr);
+
     std::vector<VehicleInfoDefine> vehicleinfoList;
     PortInfo portinfo;
 };
index 80e8e6a..bdf6fdd 100644 (file)
@@ -33,12 +33,17 @@ create(AbstractRoutingEngine* routingengine, map<string, string> config)
 {
     AMBIF *ambif = new AMBIF(routingengine, config);
     AMBConfig *conf = new AMBConfig();
-    conf->readConfig(config["configfile"]);
+    if (!conf->readConfig(config["configfile"])) {
+        DebugOut(DebugOut::Error) << "Failed to Load Configfile for VIC-Plugin.\n";
+        delete ambif;
+        delete conf;
+        return NULL;
+    }
     VICCommunicator *communicator = new VICCommunicator();
     MWIF *mwif = new MWIF();
     Converter *converter = new Converter();
     if (!ambif->initialize(communicator, conf)) {
-        DebugOut() << "Failed to initialize AMBIF\n";
+        DebugOut(DebugOut::Error) << "Failed to initialize AMBIF\n";
         delete ambif;
         delete conf;
         delete communicator;
@@ -46,7 +51,7 @@ create(AbstractRoutingEngine* routingengine, map<string, string> config)
         return NULL;
     }
     if (!communicator->initialize(ambif, mwif, converter)) {
-        DebugOut() << "Failed to initialize VICCommunicator\n";
+        DebugOut(DebugOut::Error) << "Failed to initialize VICCommunicator\n";
         delete ambif;
         delete conf;
         delete communicator;
@@ -54,7 +59,7 @@ create(AbstractRoutingEngine* routingengine, map<string, string> config)
         return NULL;
     }
     if (!mwif->initialize(communicator, conf)) {
-        DebugOut() << "Failed to initialize MWIF\n";
+        DebugOut(DebugOut::Error) << "Failed to initialize MWIF\n";
         delete ambif;
         delete conf;
         delete communicator;
@@ -62,7 +67,7 @@ create(AbstractRoutingEngine* routingengine, map<string, string> config)
         return NULL;
     }
     if (!converter->initialize(conf)) {
-        DebugOut() << "Failed to initialize Converter\n";
+        DebugOut(DebugOut::Error) << "Failed to initialize Converter\n";
         delete ambif;
         delete conf;
         delete communicator;
@@ -89,11 +94,11 @@ void
 AMBIF::getPropertyAsync(AsyncPropertyReply *reply)
 {
     reply->success = false;
-    DebugOut() << "AMBIF " << "Get Request property : " << reply->property
+    DebugOut(10) << "AMBIF " << "Get Request property : " << reply->property
             << std::endl;
     lock();
     AMBVehicleInfo *vehicleinfo = find(reply->property);
-    DebugOut() << "AMBIF " << "Find Data : " << reply->property << std::endl;
+    DebugOut(50) << "AMBIF " << "Find Data : " << reply->property << std::endl;
     if (vehicleinfo != NULL) {
         reply->value = vehicleinfo->value;
         reply->success = true;
@@ -105,7 +110,7 @@ AMBIF::getPropertyAsync(AsyncPropertyReply *reply)
 AsyncPropertyReply *
 AMBIF::setProperty(AsyncSetPropertyRequest request)
 {
-    DebugOut() << "AMBIF" << "Set Request propety : " << request.property
+    DebugOut(10) << "AMBIF" << "Set Request propety : " << request.property
                << std::endl;
     lock();
     AMBVehicleInfo *vehicleinfo = find(request.property);
@@ -115,16 +120,19 @@ AMBIF::setProperty(AsyncSetPropertyRequest request)
     }
     AsyncPropertyReply *reply = new AsyncPropertyReply(request);
     reply->success = true;
-    DebugOut(10) << "AMBIF" << "Update Value!" << std::endl;
+    DebugOut(50) << "AMBIF" << "Update Value!" << std::endl;
     delete vehicleinfo->value;
     vehicleinfo->value = request.value->copy();
     reply->value = vehicleinfo->value;
     communicator->setMWVehicleInfo(vehicleinfo);
-    DebugOut() << "AMBIF setProperty " << "Set Value(" << request.property
+    DebugOut(50) << "AMBIF setProperty " << "Set Value(" << request.property
                << "," << reply->value->toString() << ")" << std::endl;
     reply->completed(reply);
-    routingEngine->updateProperty(vehicleinfo->name, vehicleinfo->value,
-                                  uuid());
+    #if LATER1024
+    routingEngine->updateProperty(vehicleinfo->value, uuid());
+    #else
+    routingEngine->updateProperty(vehicleinfo->name, vehicleinfo->value, uuid());
+    #endif
     unLock();
     return reply;
 }
@@ -141,7 +149,11 @@ AMBIF::supportedOperations()
     return Get | Set;
 }
 
+#if LATER1024
 const string
+#else
+string
+#endif
 AMBIF::uuid()
 {
     return "f68f8b9a-fafb-4284-8ced-b45b5d720185";
@@ -151,6 +163,7 @@ void
 AMBIF::propertyChanged(VehicleProperty::Property property,
                        AbstractPropertyType *value, std::string uuid)
 {
+    DebugOut(1) << "INFO CHG_VIC_INF Receive notification from Core. Property is " << property << ".\n";
     AMBVehicleInfo *vehicleinfo = find(property);
     lock();
     if (vehicleinfo != NULL) {
@@ -168,7 +181,7 @@ AMBIF::setConfiguratin(std::map<std::string, std::string> config)
 bool
 AMBIF::initialize(VICCommunicator *comm, AMBConfig *conf)
 {
-    DebugOut() << "AMBIF Initialize\n";
+    DebugOut(50) << "AMBIF Initialize\n";
     communicator = comm;
     mutex = PTHREAD_MUTEX_INITIALIZER;
 
@@ -185,7 +198,7 @@ AMBIF::initialize(VICCommunicator *comm, AMBConfig *conf)
             if (vi.value == nullptr) {
                 if (!registVehicleInfo(vi.name, (*itr2).type,
                                        (*itr2).defaultvalue)) {
-                    DebugOut() << "AMBIF Initialize Couldn't regist property["
+                    DebugOut(50) << "AMBIF Initialize Couldn't regist property["
                                << vi.name << "]\n";
                     continue;
                 }
@@ -193,28 +206,30 @@ AMBIF::initialize(VICCommunicator *comm, AMBConfig *conf)
                         vi.name, (*itr2).defaultvalue);
                 vi.isCustom = true;
             }
+            vi.zone = (*itr2).zone;
             vehicleinfoArray.push_back(vi);
             propertylist.push_back(vi.name);
-            DebugOut() << "AMBIF Initialize regist propertyname = " << vi.name
+            DebugOut(50) << "AMBIF Initialize regist propertyname = " << vi.name
                        << "\n";
         }
     }
     routingEngine->setSupported(supported(), this);
+    DebugOut(1) << "INFO CHG_VIC_INF The number of AMB vehicle info is " << vehicleinfoArray.size() << ".\n";
     return true;
 }
 
 AMBVehicleInfo *
 AMBIF::getPropertyRequest(std::string propertyname)
 {
-    DebugOut() << "AMBIF getPropertyRequest(" << propertyname << ")\n";
+    DebugOut(50) << "AMBIF getPropertyRequest(" << propertyname << ")\n";
     AsyncPropertyRequest request;
     request.property = propertyname;
     request.completed = [](AsyncPropertyReply *reply) {
         if (reply->success) {
-            DebugOut() << "AMBIF getPropertyRequest completed success!!.\n";
+            DebugOut(50) << "AMBIF getPropertyRequest completed success!!.\n";
         }
         else {
-            DebugOut() << "AMBIF getPropertyRequest completed false!!.\n";
+            DebugOut(50) << "AMBIF getPropertyRequest completed false!!.\n";
         }
     };
 
@@ -232,7 +247,7 @@ AMBIF::getPropertyRequest(std::string propertyname)
     }
     delete reply;
     unLock();
-    DebugOut() << "AMBIF getPropertyRequest after call "
+    DebugOut(50) << "AMBIF getPropertyRequest after call "
                << vehicleinfo->value->toString() << std::endl;
     return vehicleinfo;
 }
@@ -246,10 +261,10 @@ AMBIF::setPropertyRequest(AMBVehicleInfo *vehicleinfo)
     request.completed =
             [](AsyncPropertyReply *reply) {
                 if (reply->success) {
-                    DebugOut()<<"AMBIF" << reply->property << ":" << reply->value->toString() << std::endl;
+                    DebugOut(50)<<"AMBIF" << reply->property << ":" << reply->value->toString() << std::endl;
                 }
                 else {
-                    DebugOut()<<"AMBIF" << reply->property << " isn't registered." << std::endl;
+                    DebugOut(50)<<"AMBIF" << reply->property << " isn't registered." << std::endl;
                 }
             };
     AsyncPropertyReply *reply = routingEngine->setProperty(request);
@@ -261,8 +276,27 @@ AMBIF::setPropertyRequest(AMBVehicleInfo *vehicleinfo)
 void
 AMBIF::updateProperty(AMBVehicleInfo *vehicleinfo)
 {
-    routingEngine->updateProperty(vehicleinfo->name, vehicleinfo->value,
-                                  uuid());
+    if (vehicleinfo->name == VehicleProperty::VehicleSpeed) {
+        static uint16_t prevspd = -1;
+        static const uint16_t unusablespd = -1;
+        uint16_t spd = vehicleinfo->value->value<uint16_t>();
+        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 == 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;
+    }
+    #if LATER1024
+    routingEngine->updateProperty(vehicleinfo->value, uuid());
+    #else
+    routingEngine->updateProperty(vehicleinfo->name, vehicleinfo->value, uuid());
+    #endif
     AMBVehicleInfo *ambvehicleinfo = find(vehicleinfo->name);
     lock();
     if (ambvehicleinfo != NULL) {
@@ -287,9 +321,12 @@ AMBIF::unLock()
 void
 AMBIF::requestUpdate(AMBVehicleInfo *vehicleinfo)
 {
-    DebugOut() << "AMBIF requestUpdate request property name is "
+    DebugOut(50) << "AMBIF requestUpdate request property name is "
                << vehicleinfo->name << "\n";
     if (find(vehicleinfo->name) != NULL) {
+        vehicleinfo->value->zone = vehicleinfo->zone;
+        DebugOut(50) << "AMBIF requestUpdate request property name is "
+                   << vehicleinfo->name << ", zone is " << vehicleinfo->zone << "\n";
         updateProperty(vehicleinfo);
     }
     else {
@@ -300,7 +337,7 @@ AMBIF::requestUpdate(AMBVehicleInfo *vehicleinfo)
 bool
 AMBIF::registVehicleInfo(std::string propertyName, DataType type, string value)
 {
-    DebugOut() << "AMBIF registVehicleInfo(" << propertyName << ")\n";
+    DebugOut(50) << "AMBIF registVehicleInfo(" << propertyName << ")\n";
     VehicleProperty::PropertyTypeFactoryCallback factory;
     switch (type) {
     case INT:
@@ -377,11 +414,38 @@ AMBIF::registVehicleInfo(std::string propertyName, DataType type, string value)
 AMBVehicleInfo *
 AMBIF::find(std::string propertyName)
 {
-    for (auto itr = vehicleinfoArray.begin(); itr != vehicleinfoArray.end();
-            itr++) {
-        if ((*itr).name == propertyName) {
-            return &(*itr);
-        }
+    AMBVehicleInfo vi;
+    vi.name = propertyName;
+    std::vector<AMBVehicleInfo>::iterator itr;
+    if ((itr = std::find(vehicleinfoArray.begin(), vehicleinfoArray.end(), vi)) 
+        != vehicleinfoArray.end()) {
+        return &(*itr);
     }
     return NULL;
 }
+
+#if LATER1024
+PropertyInfo AMBIF::getPropertyInfo(VehicleProperty::Property property) {
+    if (propertyInfoMap.find(property) != propertyInfoMap.end()) {
+        return propertyInfoMap[property];
+    }
+    std::list<Zone::Type> zones;
+    AMBVehicleInfo vi;
+    vi.name = property;
+    std::vector<AMBVehicleInfo>::iterator itr, itr_idx, itr_end;
+    itr_idx = vehicleinfoArray.begin();
+    itr_end = vehicleinfoArray.end();
+    while ((itr = std::find(itr_idx, itr_end, vi)) != itr_end) {
+        zones.push_back((*itr).zone);
+        itr_idx = (++itr);
+    }
+    if (zones.empty()) {
+        return PropertyInfo::invalid();
+    }
+    else {
+        PropertyInfo info(0, zones);
+        propertyInfoMap[vi.name] = info;
+        return propertyInfoMap[vi.name];
+    }
+}
+#endif
index 4ee41e9..516f712 100644 (file)
 #include <string>
 #include <vector>
 
-#include "abstractsource.h"
+#include <abstractpropertytype.h>
+#include <abstractsource.h>
+#if LATER1024
+#include <propertyinfo.hpp>
+#endif
 #include "ambconfig.h"
 
 /**
 struct AMBVehicleInfo {
     std::string name;
     AbstractPropertyType *value;
+    Zone::Type zone;
     bool isCustom;
+
+    bool operator==(const AMBVehicleInfo &vi) {
+        return (this->name == vi.name);
+    }
 };
 
 class AMBConfig;
@@ -96,7 +105,11 @@ public:
      *
      * @return UUID
      */
+#if LATER1024
     const string
+#else
+    string
+#endif
     uuid();
     /**
      * AMBIF class is received the vehicle information that other plugin updated.
@@ -196,6 +209,10 @@ public:
     supportedChanged(PropertyList)
     {
     }
+
+#if LATER1024
+    PropertyInfo getPropertyInfo(VehicleProperty::Property property);
+#endif
 private:
     bool
     registVehicleInfo(std::string propertyName, DataType type,
@@ -205,6 +222,9 @@ private:
 
     PropertyList propertylist;
     vector<AMBVehicleInfo> vehicleinfoArray;
+#if LATER1024
+    std::map<VehicleProperty::Property, PropertyInfo> propertyInfoMap;
+#endif
     VICCommunicator *communicator;
     pthread_mutex_t mutex;
 };
index 109b28d..03572b2 100644 (file)
@@ -77,7 +77,7 @@ Config::parseJson(string config)
     if (!json_parser_load_from_data(parser, config.c_str(), config.length(),
                                     &error)) {
         cerr << "Failed to load config[" << error->message << "]." << endl;
-        DebugOut() << "Failed to load config[" << error->message << "]."
+        DebugOut(10) << "Failed to load config[" << error->message << "]."
                 << endl;
         return ret;
     }
@@ -85,14 +85,14 @@ Config::parseJson(string config)
     JsonNode *node = json_parser_get_root(parser);
     if (node == nullptr) {
         cerr << "Unable to get JSON root object." << endl;
-        DebugOut() << "Unable to get JSON root object." << endl;
+        DebugOut(10) << "Unable to get JSON root object." << endl;
         return ret;
     }
 
     JsonReader *reader = json_reader_new(node);
     if (reader == nullptr) {
         cerr << "Unable to create JSON reader." << endl;
-        DebugOut() << "Unable to create JSON reader." << endl;
+        DebugOut(10) << "Unable to create JSON reader." << endl;
         return ret;
     }
 
@@ -101,7 +101,7 @@ Config::parseJson(string config)
     if (configReadError != nullptr) {
         cerr << "Error getting sources member[" << configReadError->message
                 << "]." << endl;
-        DebugOut() << "Error getting sources member["
+        DebugOut(10) << "Error getting sources member["
                 << configReadError->message << "]." << endl;
         return ret;
     }
index c63fbc4..6d1b0a1 100644 (file)
@@ -160,7 +160,7 @@ bool
 ControlWebsocket::initialize(int port, enum ServerProtocol stype, MWIF *mwif_)
 {
     type = stype;
-    DebugOut() << "ControlWebsocket[" << type << "]" << " initialize.(" << port
+    DebugOut(10) << "ControlWebsocket[" << type << "]" << " initialize.(" << port
                << ")\n";
     stringstream address, protocol;
     address.str("");
@@ -196,23 +196,24 @@ ControlWebsocket::initialize(int port, enum ServerProtocol stype, MWIF *mwif_)
     context = ico_uws_create_context(address.str().c_str(),
                                      protocol.str().c_str());
     if (context == NULL) {
-        DebugOut() << "ControlWebsocket[" << type << "]"
+        DebugOut(10) << "ControlWebsocket[" << type << "]"
                    << " couldn't create libwebsockets_context." << std::endl;
         return false;
     }
     mwif = mwif_;
+    container.ctrlws = this;
     container.mwif = mwif;
     container.type = type;
     if (ico_uws_set_event_cb(context, ControlWebsocket::callback_receive,
                              (void*)&container) != 0) {
-        DebugOut() << "ControlWebsocket[" << type << "]"
+        DebugOut(10) << "ControlWebsocket[" << type << "]"
                    << " couldn't set callback function." << std::endl;
         return false;
     }
     if (pthread_create(&threadid, NULL, ControlWebsocket::run, (void*)this)
             == -1) {
         ico_uws_close(context);
-        DebugOut() << "ControlWebsocket[" << type << "]"
+        DebugOut(10) << "ControlWebsocket[" << type << "]"
                    << " couldn't create thread." << std::endl;
         return false;
     }
@@ -223,12 +224,12 @@ bool
 ControlWebsocket::send(int commid, char *keyeventtype, timeval time, void *data,
                        size_t len)
 {
-    DebugOut() << "ControlWebsocket[" << type << "]" << " send data(" << commid
+    DebugOut(10) << "ControlWebsocket[" << type << "]" << " send data(" << commid
                << "," << keyeventtype << ") len = " << len << std::endl;
     void *wsi = NULL;
     if (socketmap.find(commid) == socketmap.end()) {
         if (!registSocket(commid)) {
-            DebugOut() << "ControlWebsocket[" << type << "]"
+            DebugOut(10) << "ControlWebsocket[" << type << "]"
                        << " can't regist socket(" << commid << ")" << std::endl;
             return false;
         }
@@ -236,7 +237,7 @@ ControlWebsocket::send(int commid, char *keyeventtype, timeval time, void *data,
     wsi = socketmap[commid];
 
     if (wsi == NULL) {
-        DebugOut() << "ControlWebsocket Get websocket object is NULL."
+        DebugOut(10) << "ControlWebsocket Get websocket object is NULL."
                    << std::endl;
         return false;
     }
@@ -246,7 +247,7 @@ ControlWebsocket::send(int commid, char *keyeventtype, timeval time, void *data,
            datamsg.encode(keyeventtype, time,
                           *(reinterpret_cast<DataOpt*>(data))),
                           len);
-    DebugOut() << "ControlWebsocket Send Data[" << keyeventtype << "]"
+    DebugOut(10) << "ControlWebsocket Send Data[" << keyeventtype << "]"
                << std::endl;
     ico_uws_send(context, wsi, reinterpret_cast<unsigned char*>(buf), len);
     pthread_mutex_unlock(&mutex);
@@ -257,7 +258,7 @@ bool
 ControlWebsocket::receive(int commid, char *keyeventtype, timeval recordtime,
                           void *data, size_t len)
 {
-    DebugOut() << "ControlWebsocket[" << type << "]" << " receive message("
+    DebugOut(10) << "ControlWebsocket[" << type << "]" << " receive message("
                << commid << "," << keyeventtype << ")\n";
     switch (type) {
     case DATA_STANDARD:
@@ -292,6 +293,42 @@ ControlWebsocket::receive(int commid, char *keyeventtype, timeval recordtime,
     return true;
 }
 
+bool
+ControlWebsocket::receive(int commid, char *data, size_t len)
+{
+    switch (type) {
+    case DATA_STANDARD:
+    case DATA_CUSTOM:
+    {
+        datamsg.decode(data, len);
+        DataOpt dop = datamsg.getDataOpt();
+        mwif->recvMessage(SET, commid, datamsg.getKeyEventType(), datamsg.getRecordtime(), (void*)&dop,
+                          len);
+        break;
+    }
+    case CONTROL_STANDARD:
+    case CONTROL_CUSTOM:
+    {
+        eventmsg.decode(data, len);
+        EventOpt opt = eventmsg.getEventOpt();
+        if (opt.common == -1 && opt.sense == -1) {
+            mwif->recvMessage(GET, commid, eventmsg.getKeyEventType(), eventmsg.getRecordtime(),
+                              (void*)&opt, len);
+        }
+        else {
+            mwif->recvMessage(CALLBACK, commid, eventmsg.getKeyEventType(), eventmsg.getRecordtime(),
+                              (void*)&opt, len);
+        }
+        break;
+    }
+    default:
+    {
+        return false;
+    }
+    }
+    return true;
+}
+
 void
 ControlWebsocket::observation()
 {
@@ -299,9 +336,15 @@ ControlWebsocket::observation()
     while (true) {
         ret = poll(&pollfds[0], pollfds.size(), -1);
         if (ret < 0) {
-            DebugOut() << "Error: poll(" << strerror(errno) << ")\n";
+            DebugOut(10) << "Error: poll(" << strerror(errno) << ")\n";
             continue;
         }
+        for (int i = 0; i < static_cast<int>(pollfds.size()); i++) {
+            if (pollfds[i].revents & POLLERR) {
+                DebugOut(10) << "socket(" << pollfds[i].fd << ") is POLLERR.\n";
+                break;
+            }
+        }
         ico_uws_service(context);
     }
 }
@@ -309,7 +352,7 @@ ControlWebsocket::observation()
 bool
 ControlWebsocket::registSocket(int commid)
 {
-    DebugOut() << "socketmap[" << type << "]!!\n" << std::flush;
+    DebugOut(10) << "socketmap[" << type << "]!!\n" << std::flush;
     GenerateCommID<void*> *idserver = GenerateCommID<void*>::getInstance();
     if (idserver->getValue(commid) != NULL) {
         socketmap[commid] = idserver->getValue(commid);
@@ -355,27 +398,45 @@ ControlWebsocket::callback_receive(const struct ico_uws_context *context,
         break;
     case ICO_UWS_EVT_RECEIVE:
     {
+        DebugOut(10) << "ControlWebsocket Start callback_recevie"
+                     << " Receive message.\n";
         GenerateCommID<void*> *idserver = GenerateCommID<void*>::getInstance();
         int commid = idserver->getID(const_cast<void*>(id), -1);
         StandardMessage msg;
         char *buf = reinterpret_cast<char*>(detail->_ico_uws_message.recv_data);
-        msg.decode(buf, detail->_ico_uws_message.recv_len);
-        DebugOut() << "ControlWebsocket callback_receive Receive message["
-                   << detail->_ico_uws_message.recv_len << "] : "
-                   << msg.getKeyEventType() << "," << msg.getRecordtime().tv_sec
-                   << "\n";
-        container->mwif->recvRawdata(
-                commid, msg.getKeyEventType(), msg.getRecordtime(),
-                (buf + StandardMessage::KEYEVENTTYPESIZE + sizeof(timeval)),
-                detail->_ico_uws_message.recv_len);
+        if (strcmp(&buf[0], "VELOCITY") == 0) {
+            static uint16_t prevspd = -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 == 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 == 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";
         break;
     }
     case ICO_UWS_EVT_ADD_FD:
     {
+        DebugOut(1) << "INFO CHG_VIC_INF Connected to new VIC.\n";
         GenerateCommID<void*> *idserver = GenerateCommID<void*>::getInstance();
         int commid = idserver->getID(const_cast<void*>(id),
                                      detail->_ico_uws_fd.fd);
-        DebugOut() << "ControlWebsocket callback_receive Insert ID is "
+        DebugOut(10) << "ControlWebsocket callback_receive Insert ID is "
                    << commid << "\n";
         container->mwif->registDestination(container->type,
                                            detail->_ico_uws_fd.fd);
@@ -383,6 +444,7 @@ ControlWebsocket::callback_receive(const struct ico_uws_context *context,
     }
     case ICO_UWS_EVT_DEL_FD:
     {
+        DebugOut(1) << "INFO CHG_VIC_INF Disconnected to VIC.\n";
         container->mwif->unregistDestination(container->type,
                                              detail->_ico_uws_fd.fd);
         break;
index 9eeaf93..fa6df03 100644 (file)
@@ -48,6 +48,7 @@ public:
 
     struct user_datacontainer {
         enum ControlWebsocket::ServerProtocol type;
+        ControlWebsocket *ctrlws;
         MWIF *mwif;
     };
     /**
@@ -91,6 +92,9 @@ public:
     bool
     receive(int commid, char *keyeventtype, timeval recordtime, void *data,
             size_t len);
+
+    bool
+    receive(int commid, char *data, size_t len);
     /**
      * This function monitors the file descriptor for Websocket Server.
      */
index 5d38573..4ba2b66 100644 (file)
@@ -46,22 +46,24 @@ Converter::initialize(AMBConfig *conf)
 {
     vector<VehicleInfoDefine> dtableArray;
     dtableArray = conf->getVehicleInfoConfig();
-    for (auto itr = dtableArray.begin(); itr != dtableArray.end(); itr++) {
+    for (auto itr = dtableArray.begin(), itr_end = dtableArray.end(); itr != itr_end; itr++) {
         ConvertTable ctable;
         ctable.mwname = string((*itr).KeyEventType);
-        DebugOut() << "Converter initialize mwname = " << ctable.mwname << "\n";
+        DebugOut(10) << "Converter initialize mwname = " << ctable.mwname << "\n";
         for (auto itr2 = (*itr).status.begin(); itr2 != (*itr).status.end();
              itr2++) {
             ConvertTable::AmbVehicleInfoData ambdata;
             ambdata.ambname = (*itr2).ambPropertyName;
-            DebugOut() << "Converter initialize ambname = " << ambdata.ambname
+            DebugOut(10) << "Converter initialize ambname = " << ambdata.ambname
                        << "\n";
             ambdata.type = (*itr2).type;
             ambdata.typesize = (*itr2).typesize;
+            ambdata.zone = (*itr2).zone;
             ctable.ambdataarray.push_back(ambdata);
         }
         converttablelist.push_back(ctable);
     }
+    DebugOut(1) << "INFO CHG_VIC_INF ConvertTable size is " << converttablelist.size() << ".\n";
     return true;
 }
 
@@ -70,45 +72,48 @@ Converter::convertMWtoAMB(MWVehicleInfo *mwvehicleinfo,
                           AMBVehicleInfo *ambvehicleinfo, int arraysize)
 {
     int ret = 0;
-    for (auto itr = converttablelist.begin(); itr != converttablelist.end();
-         itr++) {
-        DebugOut(10) << "Converter convertMWtoAMB mwname = " << (*itr).mwname
-                     << "\n";
-        if ((*itr).mwname == mwvehicleinfo->name) {
-            int arrayidx = 0;
-            int statusidx = 0;
-            for (auto itr2 = (*itr).ambdataarray.begin();
-                 itr2 != (*itr).ambdataarray.end(); itr2++) {
-                ambvehicleinfo[arrayidx].name = (*itr2).ambname;
-                ambvehicleinfo[arrayidx].value =
-                        VehicleProperty::getPropertyTypeForPropertyNameValue(
-                                ambvehicleinfo[arrayidx].name, "0");
-                if (ambvehicleinfo[arrayidx].value == NULL) {
-                    continue;
-                }
-                ambvehicleinfo[arrayidx].value->timestamp = toDouble(
-                        mwvehicleinfo->recordtime);
-                char statusbuf[(*itr2).typesize];
-                memcpy(statusbuf, mwvehicleinfo->status + statusidx,
-                       sizeof(statusbuf));
-                ambvehicleinfo[arrayidx].value->fromString(
-                        toString((*itr2).ambname, statusbuf, sizeof(statusbuf),
-                                 (*itr2).type));
-                statusidx += sizeof(statusbuf);
-                DebugOut() << "Converter convertMWtoAMB ambname = "
-                           << (*itr2).ambname << "("
-                           << ambvehicleinfo[arrayidx].value->toString() << ")\n";
-                arrayidx++;
-                if (arrayidx == arraysize
-                        && arraysize
-                                < static_cast<int>((*itr).ambdataarray.size())) {
-                    ret = -1;
-                    break;
-                }
-                ret = arrayidx;
-            }
-            break;
-        }
+    ConvertTable ct;
+    ct.mwname = mwvehicleinfo->name;
+    auto itr = std::find(converttablelist.begin(), converttablelist.end(), ct);
+    if (itr == converttablelist.end()) {
+        return ret;
+    }
+    int arrayidx = 0;
+    int statusidx = 0;
+    for (auto itr2 = (*itr).ambdataarray.begin();
+         itr2 != (*itr).ambdataarray.end(); itr2++) {
+        ambvehicleinfo[arrayidx].name = (*itr2).ambname;
+        DebugOut(8) << "getPropertyTypeForPropertyNameValue Start\n";
+        ambvehicleinfo[arrayidx].value =
+                VehicleProperty::getPropertyTypeForPropertyNameValue(
+                        ambvehicleinfo[arrayidx].name, "0");
+        DebugOut(8) << "getPropertyTypeForPropertyNameValue End\n";
+        if (ambvehicleinfo[arrayidx].value == NULL) {
+            continue;
+        }
+        ambvehicleinfo[arrayidx].value->timestamp = toDouble(
+                mwvehicleinfo->recordtime);
+        char statusbuf[(*itr2).typesize];
+        memcpy(statusbuf, mwvehicleinfo->status + statusidx,
+               sizeof(statusbuf));
+        DebugOut(8) << "fromString, toSting Start\n";
+        ambvehicleinfo[arrayidx].value->fromString(
+                toString((*itr2).ambname, statusbuf, sizeof(statusbuf),
+                         (*itr2).type));
+        DebugOut(8) << "fromString, toSting End\n";
+        statusidx += sizeof(statusbuf);
+        DebugOut(8) << "Converter convertMWtoAMB ambname = "
+                   << (*itr2).ambname << "("
+                   << ambvehicleinfo[arrayidx].value->toString() << ")\n";
+        ambvehicleinfo[arrayidx].zone = (*itr2).zone;
+        arrayidx++;
+        if (arrayidx == arraysize
+                && arraysize
+                        < static_cast<int>((*itr).ambdataarray.size())) {
+            ret = -1;
+            break;
+        }
+        ret = arrayidx;
     }
     return ret;
 }
@@ -129,18 +134,18 @@ Converter::convertAMBtoMW(AMBVehicleInfo *ambvehicleinfo,
             DebugOut(10) << "Converter convertAMBtoMW ambname = "
                          << (*itr2).ambname << "\n";
             if ((*itr2).ambname == ambvehicleinfo->name) {
-                DebugOut() << "Converter convertAMBtoMW ambname = "
+                DebugOut(10) << "Converter convertAMBtoMW ambname = "
                            << (*itr2).ambname << "\n";
                 mwvehicleinfo->name = (*itr).mwname;
                 mwvehicleinfo->recordtime = toTimeval(
                         ambvehicleinfo->value->timestamp);
                 if (ambvehicleinfo->value == NULL) {
-                    DebugOut() << "Converter convertAMBtoMW "
+                    DebugOut(10) << "Converter convertAMBtoMW "
                                << "ambvehicleinfo->value is NULL\n";
                     ret = -1;
                 }
                 else {
-                    DebugOut() << "Converter check data "
+                    DebugOut(10) << "Converter check data "
                                << ambvehicleinfo->value->toString() << std::endl;
                     toBinary(ambvehicleinfo->name, ambvehicleinfo->value,
                              (*itr2).typesize, (*itr2).type,
@@ -226,7 +231,14 @@ Converter::toString(string ambname, char *data, int size, DataType type)
     {
         bool val;
         memcpy(&val, data, size);
-        sstr << val;
+        DebugOut(10) << "ToString(BOOL): Receive data(size = " << size << ")  is " << data << " ->(convert this function)(size = " << sizeof(bool) <<  ") " << val << "\n";
+        if (val) {
+            sstr << "true";
+        }
+        else {
+            sstr << "false";
+        }
+        //sstr << val;
         break;
     }
     default:
@@ -257,7 +269,7 @@ Converter::toBinary(string ambname, AbstractPropertyType *value, int size,
         int val;
         sstr >> val;
         memcpy(buf, &val, size);
-        DebugOut() << "Converter toBinary<int> " << val << "\n";
+        DebugOut(10) << "Converter toBinary<int> " << val << "\n";
         break;
     }
     case DOUBLE:
@@ -265,7 +277,7 @@ Converter::toBinary(string ambname, AbstractPropertyType *value, int size,
         double val;
         sstr >> val;
         memcpy(buf, &val, size);
-        DebugOut() << "Converter toBinary<double> " << val << "\n";
+        DebugOut(10) << "Converter toBinary<double> " << val << "\n";
         break;
     }
     case CHAR:
@@ -273,7 +285,7 @@ Converter::toBinary(string ambname, AbstractPropertyType *value, int size,
         char val;
         sstr >> val;
         memcpy(buf, &val, size);
-        DebugOut() << "Converter toBinary<char> " << val << "\n";
+        DebugOut(10) << "Converter toBinary<char> " << val << "\n";
         break;
     }
     case INT16:
@@ -281,7 +293,7 @@ Converter::toBinary(string ambname, AbstractPropertyType *value, int size,
         int16_t val;
         sstr >> val;
         memcpy(buf, &val, size);
-        DebugOut() << "Converter toBinary<int16_t> " << val << "\n";
+        DebugOut(10) << "Converter toBinary<int16_t> " << val << "\n";
         break;
     }
     case UINT16:
@@ -289,7 +301,7 @@ Converter::toBinary(string ambname, AbstractPropertyType *value, int size,
         uint16_t val;
         sstr >> val;
         memcpy(buf, &val, size);
-        DebugOut() << "Converter toBinary<uint16_t> " << val << "\n";
+        DebugOut(10) << "Converter toBinary<uint16_t> " << val << "\n";
         break;
     }
     case UINT32:
@@ -297,7 +309,7 @@ Converter::toBinary(string ambname, AbstractPropertyType *value, int size,
         uint32_t val;
         sstr >> val;
         memcpy(buf, &val, size);
-        DebugOut() << "Converter toBinary<uint32_t> " << val << "\n";
+        DebugOut(10) << "Converter toBinary<uint32_t> " << val << "\n";
         break;
     }
     case INT64:
@@ -305,7 +317,7 @@ Converter::toBinary(string ambname, AbstractPropertyType *value, int size,
         int64_t val;
         sstr >> val;
         memcpy(buf, &val, size);
-        DebugOut() << "Converter toBinary<int64_t> " << val << "\n";
+        DebugOut(10) << "Converter toBinary<int64_t> " << val << "\n";
         break;
     }
     case UINT64:
@@ -313,7 +325,7 @@ Converter::toBinary(string ambname, AbstractPropertyType *value, int size,
         uint64_t val;
         sstr >> val;
         memcpy(buf, &val, size);
-        DebugOut() << "Converter toBinary<uint64_t> " << val << "\n";
+        DebugOut(10) << "Converter toBinary<uint64_t> " << val << "\n";
         break;
     }
     case BOOL:
@@ -328,7 +340,7 @@ Converter::toBinary(string ambname, AbstractPropertyType *value, int size,
             val = false;
         }
         memcpy(buf, &val, sizeof(bool));
-        DebugOut() << "Converter toBinary<bool> " << val << "\n";
+        DebugOut(10) << "Converter toBinary<bool> " << val << "\n";
         break;
     }
     default:
@@ -343,7 +355,7 @@ Converter::toBinary(string ambname, AbstractPropertyType *value, int size,
 double
 Converter::toDouble(timeval time)
 {
-    return static_cast<double>(time.tv_sec + (time.tv_usec / 1000000));
+    return static_cast<double>(time.tv_sec + (time.tv_usec * (1.0 / 1000000)));
 }
 
 timeval
@@ -441,7 +453,7 @@ Converter::specialConvertAMBtoMW(std::string ambname,
             break;
         }
         }
-        DebugOut() << "Converter specialConvertAMBtoMW"
+        DebugOut(10) << "Converter specialConvertAMBtoMW"
                    << "(TransmissionShiftPosition): " << value->toString() << "->"
                    << retstr.str() << std::endl;
     }
@@ -493,7 +505,7 @@ Converter::specialConvertAMBtoMW(std::string ambname,
             break;
         }
         }
-        DebugOut() << "Converter specialConvertAMBtoMW"
+        DebugOut(10) << "Converter specialConvertAMBtoMW"
                    << "(TransmissionGearPosition): " << value->toString() << "->"
                    << retstr.str() << std::endl;
     }
@@ -599,7 +611,7 @@ Converter::specialConvertMWtoAMB(std::string ambname, char *data, int size,
             break;
         }
         }
-        DebugOut() << "Converter specialConvertMWtoAMB"
+        DebugOut(10) << "Converter specialConvertMWtoAMB"
                    << "(TransmissionShiftPosition): " << val << "->"
                    << retstr.str() << std::endl;
     }
@@ -642,7 +654,7 @@ Converter::specialConvertMWtoAMB(std::string ambname, char *data, int size,
             break;
         }
         }
-        DebugOut() << "Converter specialConvertMWtoAMB"
+        DebugOut(10) << "Converter specialConvertMWtoAMB"
                    << "(TransmissionGearPosition): " << val << "->" << retstr.str()
                    << std::endl;
     }
index 08f2225..d7bfc51 100644 (file)
@@ -89,8 +89,14 @@ private:
             std::string ambname;
             DataType type;
             int typesize;
+            Zone::Type zone;
         };
         std::vector<AmbVehicleInfoData> ambdataarray;
+
+        bool operator==(const ConvertTable &b) {
+            return (this->mwname == b.mwname);
+        }
+
     };
 
     std::vector<ConvertTable> converttablelist;
index d9977ca..dab047e 100644 (file)
@@ -40,6 +40,9 @@ enum CommonStatus {
 static const int STATUSSIZE = StandardMessage::BUFSIZE - 
                               StandardMessage::KEYEVENTTYPESIZE - 
                               sizeof(timeval) - sizeof(int);
+inline int getStatussize(size_t len) {
+    return (len - StandardMessage::KEYEVENTTYPESIZE - sizeof(timeval) - sizeof(int));
+}
 
 /**
  * The data portion of the data message.
index c1f7335..b3d1a80 100644 (file)
@@ -18,6 +18,7 @@
  */
 #include <string.h>
 
+#include <algorithm>
 #include <iostream>
 
 #include "debugout.h"
@@ -109,7 +110,7 @@ bool
 MWNotifyInfo::checkNotify(std::string name, char *olddata, char *newdata,
                           timeval newtime)
 {
-    DebugOut() << "MWNotiryInfo checkNotify(" << name << ")" << std::endl;
+    DebugOut(10) << "MWNotiryInfo checkNotify(" << name << ")" << std::endl;
     pthread_mutex_lock(&mutex);
     if (notifyMap.find(name) == notifyMap.end()) {
         pthread_mutex_unlock(&mutex);
@@ -126,7 +127,7 @@ MWNotifyInfo::checkNotify(std::string name, char *olddata, char *newdata,
     for (auto itr = notifyMap[name].begin(); itr != notifyMap[name].end();
          itr++) {
         for (int i = 0; i < STATUSSIZE; i++) {
-            DebugOut() << "checkDiff[" << i << "] = " << checkDiff[i]
+            DebugOut(10) << "checkDiff[" << i << "] = " << checkDiff[i]
                        << ", (*itr).mask[i] = " << (*itr).mask[i]
                        << " , checkDiff[i] & (*itr).mask[i] = "
                        << (int)(checkDiff[i] & (*itr).mask[i]) << std::endl;
@@ -147,6 +148,7 @@ MWIF::MWIF()
     for (int i = 0; i < SERVERNUM; i++) {
         websocketserver[i] = NULL;
     }
+    mutex_socketmap = PTHREAD_MUTEX_INITIALIZER;
 }
 
 MWIF::~MWIF()
@@ -159,6 +161,7 @@ MWIF::~MWIF()
     }
     websocketservermap.clear();
     mwnotifyinfomap.clear();
+    pthread_mutex_destroy(&mutex_socketmap);
 }
 
 bool
@@ -168,7 +171,7 @@ MWIF::initialize(VICCommunicator *com, AMBConfig *conf)
 
     vector<VehicleInfoDefine> table;
     table = conf->getVehicleInfoConfig();
-    for (auto itr = table.begin(); itr != table.end(); itr++) {
+    for (auto itr = table.begin(), itr_end = table.end(); itr != itr_end; itr++) {
         MWVehicleInfo vi;
         vi.name = string((*itr).KeyEventType);
         memset(&vi.status, 0, STATUSSIZE);
@@ -179,14 +182,15 @@ MWIF::initialize(VICCommunicator *com, AMBConfig *conf)
             vi.delimeterposition.push_back((*itr2).typesize);
         }
         vehicleinfoArray.push_back(vi);
-        DebugOut() << "MWIF initialize mwvehicleinfo name = " << vi.name
+        DebugOut(10) << "MWIF initialize mwvehicleinfo name = " << vi.name
                    << std::endl;
     }
+    DebugOut(1) << "INFO CHG_VIC_INF The number of VIC vehicle info is " << vehicleinfoArray.size() << ".\n";
     PortInfo portinfo = conf->getPort();
-    DebugOut() << "MWIF initialize portinfo (" << portinfo.standard.dataPort
-               << "," << portinfo.standard.controlPort << ","
-               << portinfo.custom.dataPort << "," << portinfo.custom.controlPort
-               << ")\n";
+    DebugOut(1) << "INFO CHG_VIC_INF Portinfo list is (" << portinfo.standard.dataPort
+                << "," << portinfo.standard.controlPort << ","
+                << portinfo.custom.dataPort << "," << portinfo.custom.controlPort
+                << ")\n";
     createThread(&portinfo);
     return true;
 }
@@ -225,7 +229,7 @@ void
 MWIF::recvRawdata(int commid, char *keyeventtype, timeval recordtime,
                   void *data, size_t len)
 {
-    DebugOut() << "MWIF recvRawdata(" << commid << "," << keyeventtype << ")\n";
+    DebugOut(10) << "MWIF recvRawdata(" << commid << "," << keyeventtype << ")\n";
     if (find(string(keyeventtype)) != NULL) {
         if (websocketservermap.find(commid) == websocketservermap.end()) {
             return;
@@ -235,7 +239,7 @@ MWIF::recvRawdata(int commid, char *keyeventtype, timeval recordtime,
     }
     // Error Message
     else {
-        DebugOut() << "MWIF recvRawdata " << "Error Data." << std::endl;
+        DebugOut(10) << "MWIF recvRawdata " << "Error Data." << std::endl;
         MWVehicleInfo errorvi;
         errorvi.name = string(keyeventtype);
         errorvi.recordtime = recordtime;
@@ -250,19 +254,32 @@ void
 MWIF::recvMessage(MessageType type, int commid, char *keyeventtype,
                   timeval recordtime, void *data, size_t len)
 {
+    MWVehicleInfo *vi;
+    if ((vi = find(string(keyeventtype))) == NULL) {
+        DebugOut(10) << "MWIF recvMessage " << "Error Data." << std::endl;
+        MWVehicleInfo errorvi;
+        errorvi.name = string(keyeventtype);
+        errorvi.recordtime = recordtime;
+        errorvi.statussize = len - StandardMessage::KEYEVENTTYPESIZE
+                - sizeof(timeval) - sizeof(int);
+        memset(errorvi.status, 0, STATUSSIZE);
+        sendMessage(commid, UNKNOWN, &errorvi);
+        return;
+    }
+
     DebugOut(10) << "MWIF recvMessage(" << commid << ")\n";
     switch (type) {
     case MessageType::SET:
     {
-        DebugOut() << "MWIF recvMessage(" << commid << ",SET) " << keyeventtype
+        DebugOut(8) << "MWIF recvMessage(" << commid << ",SET) " << keyeventtype
                    << "\n";
         DataOpt *opt = reinterpret_cast<DataOpt*>(data);
-        procSetMessage(commid, keyeventtype, recordtime, opt, len);
+        procSetMessage(commid, vi, keyeventtype, recordtime, opt, len);
         break;
     }
     case MessageType::GET:
     {
-        DebugOut() << "MWIF recvMessage(" << commid << ",GET) " << keyeventtype
+        DebugOut(8) << "MWIF recvMessage(" << commid << ",GET) " << keyeventtype
                    << "\n";
         EventOpt *opt = reinterpret_cast<EventOpt*>(data);
         procGetMessage(commid, keyeventtype, recordtime, opt, len);
@@ -270,7 +287,7 @@ MWIF::recvMessage(MessageType type, int commid, char *keyeventtype,
     }
     case MessageType::CALLBACK:
     {
-        DebugOut() << "MWIF recvMessage(" << commid << ",CALLBACK) "
+        DebugOut(8) << "MWIF recvMessage(" << commid << ",CALLBACK) "
                    << keyeventtype << "\n";
         EventOpt *opt = reinterpret_cast<EventOpt*>(data);
         procCallbackMessage(commid, keyeventtype, recordtime, opt, len);
@@ -286,24 +303,28 @@ MWIF::recvMessage(MessageType type, int commid, char *keyeventtype,
 void
 MWIF::registDestination(ControlWebsocket::ServerProtocol type, int commid)
 {
-    DebugOut() << "MWIF type = " << type << std::endl;
+    DebugOut(10) << "MWIF type = " << type << std::endl;
+    pthread_mutex_lock(&mutex_socketmap);
     if (websocketserver[type]->registSocket(commid)) {
-        DebugOut() << "MWIF registDestination insert(" << commid << "," << type
+        DebugOut(10) << "MWIF registDestination insert(" << commid << "," << type
                    << ")\n";
         websocketservermap.insert(make_pair(commid, type));
     }
+    pthread_mutex_unlock(&mutex_socketmap);
 }
 
 void
 MWIF::unregistDestination(ControlWebsocket::ServerProtocol type, int commid)
 {
+    pthread_mutex_lock(&mutex_socketmap);
     if (websocketservermap.find(commid) != websocketservermap.end()) {
         if (websocketserver[type]->unregistSocket(commid)) {
-            DebugOut() << "MWIF unregistDestination erase(" << commid << ","
+            DebugOut(10) << "MWIF unregistDestination erase(" << commid << ","
                        << type << ")\n";
             websocketservermap.erase(commid);
         }
     }
+    pthread_mutex_unlock(&mutex_socketmap);
 }
 
 void
@@ -319,7 +340,7 @@ MWIF::sendMessage(int commid, CommonStatus status, MWVehicleInfo *vehicleinfo)
     if (websocketservermap.find(commid) == websocketservermap.end()) {
         return;
     }
-    DebugOut() << "MWIF sendMessage controlwebsocket->send(" << commid << ","
+    DebugOut(10) << "MWIF sendMessage controlwebsocket->send(" << commid << ","
                << vehicleinfo->name << "),len = " << len << std::endl;
     websocketserver[websocketservermap[commid]]->send(
             commid, const_cast<char*>(vehicleinfo->name.c_str()),
@@ -347,32 +368,33 @@ MWIF::createThread(PortInfo *portinfo)
 MWVehicleInfo *
 MWIF::find(string name)
 {
-    for (auto itr = vehicleinfoArray.begin(); itr != vehicleinfoArray.end();
-            itr++) {
-        DebugOut(10) << "MWIF find" << (*itr).name << std::endl;
-        if ((*itr).name == name) {
-            return &(*itr);
-        }
+    MWVehicleInfo vi;
+    vi.name = name;
+    auto itr = std::find(vehicleinfoArray.begin(), vehicleinfoArray.end(), vi);
+    if (itr == vehicleinfoArray.end()) {
+        DebugOut(10) << "MWIF find can't find property = " << name << std::endl;
+        return NULL;
+    }
+    else {
+        return &(*itr);
     }
-    DebugOut() << "MWIF find can't find property = " << name << std::endl;
-    return NULL;
 }
 
 void
-MWIF::procSetMessage(int commid, char *keyeventtype, timeval recordtime,
+MWIF::procSetMessage(int commid, MWVehicleInfo *vi, char *keyeventtype, timeval recordtime,
                      DataOpt *data, size_t len)
 {
-    MWVehicleInfo *vehicleinfo = find(string(keyeventtype));
     MWVehicleInfo updatevehicleinfo;
-    updatevehicleinfo.name = vehicleinfo->name;
+    updatevehicleinfo.name = vi->name;
     updatevehicleinfo.recordtime = recordtime;
-    updatevehicleinfo.statussize = vehicleinfo->statussize;
-    memcpy(updatevehicleinfo.status, data->status, STATUSSIZE);
+    updatevehicleinfo.statussize = vi->statussize;
+
+    memcpy(updatevehicleinfo.status, data->status, getStatussize(len));
     // Update AMB Data
     communicator->setAMBVehicleInfo(&updatevehicleinfo);
     // Update MW Data
-    vehicleinfo->recordtime = recordtime;
-    memcpy(vehicleinfo->status, updatevehicleinfo.status, STATUSSIZE);
+    vi->recordtime = recordtime;
+    memcpy(vi->status, updatevehicleinfo.status, getStatussize(len));
 }
 
 void
index ee2e870..28ef287 100644 (file)
@@ -43,6 +43,10 @@ struct MWVehicleInfo {
     char status[STATUSSIZE];
     int statussize;
     vector<int> delimeterposition;
+
+    bool operator==(const MWVehicleInfo& b) {
+        return (this->name == b.name);
+    }
 };
 
 /**
@@ -195,7 +199,7 @@ private:
     MWVehicleInfo *
     find(std::string name);
     void
-    procSetMessage(int commid, char *keyeventtype, timeval recordtime,
+    procSetMessage(int commid, MWVehicleInfo *vi, char *keyeventtype, timeval recordtime,
                    DataOpt *data, size_t len);
     void
     procGetMessage(int commid, char *keyeventtype, timeval recordtime,
@@ -210,5 +214,6 @@ private:
     VICCommunicator *communicator;
     std::map<int, ControlWebsocket::ServerProtocol> websocketservermap;
     std::map<int, MWNotifyInfo> mwnotifyinfomap;
+    pthread_mutex_t mutex_socketmap;
 };
 #endif // MWINTERFACE_H
index 656fad9..19b95d6 100644 (file)
@@ -47,16 +47,16 @@ void
 VICCommunicator::setAMBVehicleInfo(MWVehicleInfo *vehicleinfo)
 {
     AMBVehicleInfo ambvehicleinfo[maxambdatasize];
-    DebugOut() << "VICCOMM" << " in setAMBVehicleInfo(" << vehicleinfo->name
-               << ")" << " status[0] = " << vehicleinfo->status[0] << "\n";
+    DebugOut(8) << "VICCOMM" << " in setAMBVehicleInfo(" << vehicleinfo->name
+                << ")" << " status[0] = " << vehicleinfo->status[0] << "\n";
     resetAmbBuf(&ambvehicleinfo[0], maxambdatasize);
     int ret = converter->convertMWtoAMB(vehicleinfo, &ambvehicleinfo[0],
                                         maxambdatasize);
     for (int i = 0; i < ret; i++) {
         ambif->requestUpdate(&ambvehicleinfo[i]);
-        DebugOut() << "VICCOMM" << " out setAMBVehicleInfo(AMBname = "
-                   << ambvehicleinfo[i].name << ","
-                   << ambvehicleinfo[i].value->toString() << ")\n";
+        DebugOut(8) << "VICCOMM" << " out setAMBVehicleInfo(AMBname = "
+                    << ambvehicleinfo[i].name << ","
+                    << ambvehicleinfo[i].value->toString() << ")\n";
     }
     for (int i = 0; i < maxambdatasize; i++) {
         if (ambvehicleinfo[i].value != NULL) {
@@ -64,7 +64,7 @@ VICCommunicator::setAMBVehicleInfo(MWVehicleInfo *vehicleinfo)
         }
     }
     DebugOut(10) << "VICCOMM" << " out setAMBVehicleInfo(MWname = "
-            << vehicleinfo->name << ")";
+            << vehicleinfo->name << ")\n";
 }
 
 void
@@ -73,8 +73,8 @@ VICCommunicator::getAMBVehicleInfo(MWVehicleInfo *vehicleinfo)
     AMBVehicleInfo *ambvehicleinfo[maxambdatasize];
     AMBVehicleInfo tempambvehicleinfo[maxambdatasize];
 
-    DebugOut() << "VICCOMM" << " in getAMBVehicleInfo(" << vehicleinfo->name
-            << "," << vehicleinfo->status[0] << ")\n";
+    DebugOut(8) << "VICCOMM" << " in getAMBVehicleInfo(" << vehicleinfo->name
+                << "," << vehicleinfo->status[0] << ")\n";
     resetAmbBuf(&tempambvehicleinfo[0], maxambdatasize);
     int ret = converter->convertMWtoAMB(vehicleinfo, &tempambvehicleinfo[0],
                                         maxambdatasize);
@@ -82,27 +82,27 @@ VICCommunicator::getAMBVehicleInfo(MWVehicleInfo *vehicleinfo)
         delete tempambvehicleinfo[i].value;
         ambvehicleinfo[i] = ambif->getPropertyRequest(
                 tempambvehicleinfo[i].name);
-        DebugOut() << "VICCOMM" << " getAMBVehicleInfo(AMBname = "
-                   << ambvehicleinfo[i]->name << ","
-                   << ambvehicleinfo[i]->value->toString() << ")\n";
+        DebugOut(8) << "VICCOMM" << " getAMBVehicleInfo(AMBname = "
+                    << ambvehicleinfo[i]->name << ","
+                    << ambvehicleinfo[i]->value->toString() << ")\n";
         converter->convertAMBtoMW(ambvehicleinfo[i], vehicleinfo);
     }
-    DebugOut() << "VICCOMM" << " out getAMBVehicleInfo(MWname = "
-               << vehicleinfo->name << "," << vehicleinfo->status[0] << ")\n";
+    DebugOut(8) << "VICCOMM" << " out getAMBVehicleInfo(MWname = "
+                << vehicleinfo->name << "," << vehicleinfo->status[0] << ")\n";
 }
 
 void
 VICCommunicator::setMWVehicleInfo(AMBVehicleInfo *vehicleinfo)
 {
     MWVehicleInfo mwvehicleinfo;
-    DebugOut() << "VICCOMM" << " in setMWVehicleInfo(AMBname = "
-               << vehicleinfo->name << "," << vehicleinfo->value->toString()
-               << ")\n";
+    DebugOut(8) << "VICCOMM" << " in setMWVehicleInfo(AMBname = "
+                << vehicleinfo->name << "," << vehicleinfo->value->toString()
+                << ")\n";
     resetMwBuf(&mwvehicleinfo);
     converter->convertAMBtoMW(vehicleinfo, &mwvehicleinfo);
     mwif->send(&mwvehicleinfo);
-    DebugOut() << "VICCOMM" << " out setMWVehicleInfo(MWname = "
-               << mwvehicleinfo.name << "," << mwvehicleinfo.status[0] << ")\n";
+    DebugOut(8) << "VICCOMM" << " out setMWVehicleInfo(MWname = "
+                << mwvehicleinfo.name << "," << mwvehicleinfo.status[0] << ")\n";
 }
 
 void
diff --git a/tests/AMBformat.conf b/tests/AMBformat.conf
new file mode 100644 (file)
index 0000000..124bdd0
--- /dev/null
@@ -0,0 +1,1113 @@
+{
+       "Config":
+       [
+               {
+                       "Section":"Common",
+                       "VehicleInfoDefine":
+                       [
+                               {
+                                       "KeyEventType":"VELOCITY",
+                                       "Status":
+                                       [
+                                               {
+                                                       "AMBPropertyName":"VehicleSpeed",
+                                                       "Type":"uint16",
+                                                       "AccessControl":"R",
+                                                       "Default":"0",
+                                                       "DBusProperty":"VehicleSpeed",
+                                                       "DBusObjectName":"VehicleSpeed",
+                                                       "Zone":"None"
+                                               }
+                                       ],
+                                       "sense":
+                                       [
+                                       ],
+                                       "event_mask":
+                                       [
+                                       ],
+                                       "Priority":1,
+                                       "DBusInterface":"org.automotive.vehicleSpeed",
+                    "DBusObject":"VehicleSpeed"
+                               },
+                               {
+                                       "KeyEventType":"ENGINE_SPEED",
+                                       "Status":
+                                       [
+                                               {
+                            "AMBPropertyName":"EngineSpeed",
+                            "Type":"uint16",
+                            "AccessControl":"R",
+                            "Default":"0",
+                            "DBusProperty":"EngineSpeed",
+                            "DBusObjectName":"EngineSpeed",
+                                                       "Zone":"None"
+                                               }
+                                       ],
+                                       "sense":
+                                       [
+                                       ],
+                                       "event_mask":
+                                       [
+                                       ],
+                                       "Priority":1,
+                                       "DBusInterface":"org.automotive.engineSpeed",
+                    "DBusObject":"EngineSpeed"
+                },
+                               {
+                                       "KeyEventType":"SHIFT",
+                                       "Status":
+                                       [
+                                               {
+                            "AMBPropertyName":"TransmissionShiftPosition",
+                            "Type":"int",
+                            "AccessControl":"R",
+                            "Default":"0",
+                            "DBusProperty":"ShiftPosition",
+                            "DBusObjectName":"Transmission",
+                                                       "Zone":"None"
+                                               },
+                                               {
+                                                       "AMBPropertyName":"TransmissionGearPostion",
+                                                       "Type":"int",
+                                                       "AccessControl":"R",
+                                                       "Default":"0",
+                                                       "DBusProperty":"GearPosition",
+                                                       "DBusObjectName":"Transmission",
+                                                       "Zone":"None"
+                                               },
+                                               {
+                                                       "AMBPropertyName":"TransmissionMode",
+                                                       "Type":"int",
+                                                       "AccessControl":"R",
+                                                       "Default":"0",
+                                                       "DBusProperty":"Mode",
+                                                       "DBusObjectName":"Transmission",
+                                                       "Zone":"None"
+                                               }
+                                       ],
+                                       "sense":
+                                       [
+                                       ],
+                                       "event_mask":
+                                       [
+                                       ],
+                                       "Priority":1,
+                                       "DBusInterface":"org.automotive.transmission",
+                    "DBusObject":"Transmission"
+                },
+                               {
+                                       "KeyEventType":"ACCPEDAL_OPEN",
+                                       "Status":
+                                       [
+                                               {
+                            "AMBPropertyName":"ThrottlePosition",
+                            "Type":"uint16",
+                            "AccessControl":"R",
+                            "Default":"0",
+                            "DBusProperty":"ThrottlePosition",
+                            "DBusObjectName":"ThrottlePosition",
+                                                       "Zone":"None"
+                                               }
+                                       ],
+                                       "sense":
+                                       [
+                                       ],
+                                       "event_mask":
+                                       [
+                                       ],
+                                       "Priority":1,
+                                       "DBusInterface":"Undefined",
+                    "DBusObject":"ThrottlePosition"
+                },
+                               {
+                                       "KeyEventType":"BRAKE_SIGNAL",
+                                       "Status":
+                                       [
+                                               {
+                            "AMBPropertyName":"WheelBrake",
+                            "Type":"bool",
+                            "AccessControl":"R",
+                            "Default":"0",
+                            "DBusProperty":"Engaged",
+                            "DBusObjectName":"WheelBrake",
+                                                       "Zone":"None"
+                                               }
+                                       ],
+                                       "sense":
+                                       [
+                                       ],
+                                       "event_mask":
+                                       [
+                                       ],
+                                       "Priority":1,
+                                       "DBusInterface":"Undefined",
+                    "DBusObject":"WheelBrake"
+                },
+                               {
+                                       "KeyEventType":"BRAKE_PRESSURE",
+                                       "Status":
+                                       [
+                                               {
+                            "AMBPropertyName":"WheelBrakePressure",
+                            "Type":"uint16",
+                            "AccessControl":"R",
+                            "Default":"0",
+                            "DBusProperty":"WheelBrakePressure",
+                            "DBusObjectName":"WheelBrakePressure",
+                                                       "Zone":"None"
+                                               }
+                                       ],
+                                       "sense":
+                                       [
+                                       ],
+                                       "event_mask":
+                                       [
+                                       ],
+                                       "Priority":1,
+                                       "DBusInterface":"org.automotive.WheelBrakePressure",
+                    "DBusObject":"WheelBrakePressure"
+                },
+                               {
+                                       "KeyEventType":"STEERING",
+                                       "Status":
+                                       [
+                                               {
+                            "AMBPropertyName":"SteeringWheelAngle",
+                            "Type":"uint16",
+                            "AccessControl":"R",
+                            "Default":"0",
+                            "DBusProperty":"SteeringWheelAngle",
+                            "DBusObjectName":"SteeringWheelAngle",
+                                                       "Zone":"None"
+                                               }
+                                       ],
+                                       "sense":
+                                       [
+                                       ],
+                                       "event_mask":
+                                       [
+                                       ],
+                                       "Priority":1,
+                                       "DBusInterface":"Undefined",
+                    "DBusObject":"SteeringWheelAngle"
+                },
+                               {
+                                       "KeyEventType":"TURN_SIGNAL",
+                                       "Status":
+                                       [
+                                               {
+                            "AMBPropertyName":"TurnSignal",
+                            "Type":"int",
+                            "AccessControl":"R",
+                            "Default":"0",
+                            "DBusProperty":"TurnSignal",
+                            "DBusObjectName":"TurnSignal",
+                                                       "Zone":"None"
+                                               }
+                                       ],
+                                       "sense":
+                                       [
+                                       ],
+                                       "event_mask":
+                                       [
+                                       ],
+                                       "Priority":1,
+                                       "DBusInterface":"Undefined",
+                    "DBusObject":"TurnSignal"
+                },
+                               {
+                                       "KeyEventType":"CLUTCH",
+                                       "Status":
+                                       [
+                                               {
+                            "AMBPropertyName":"ClutchStatus",
+                            "Type":"bool",
+                            "AccessControl":"R",
+                            "Default":"0",
+                            "DBusProperty":"ClutchStatus",
+                            "DBusObjectName":"ClutchStatus",
+                                                       "Zone":"None"
+                                               }
+                                       ],
+                                       "sense":
+                                       [
+                                       ],
+                                       "event_mask":
+                                       [
+                                       ],
+                                       "Priority":1,
+                                       "DBusInterface":"Undefined",
+                    "DBusObject":"ClutchStatus"
+                },
+                               {
+                                       "KeyEventType":"OIL",
+                                       "Status":
+                                       [
+                                               {
+                            "AMBPropertyName":"EngineOilPressure",
+                            "Type":"uint16",
+                            "AccessControl":"R",
+                            "Default":"0",
+                            "DBusProperty":"Pressure",
+                            "DBusObjectName":"EngineOil",
+                                                       "Zone":"None"
+                                               },
+                                               {
+                                                       "AMBPropertyName":"EngineOilLevel",
+                                                       "Type":"int",
+                                                       "AccessControl":"R",
+                                                       "Default":"0",
+                                                       "DBusProperty":"EngineOilLevel",
+                                                       "DBusObjectName":"EngineOilLevel",
+                                                       "Zone":"None"
+                                               }
+                                       ],
+                                       "sense":
+                                       [
+                                       ],
+                                       "event_mask":
+                                       [
+                                       ],
+                                       "Priority":1,
+                                       "DBusInterface":"org.automotive.EngineOilLevel",
+                    "DBusObject":"EngineOil"
+                },
+                               {
+                                       "KeyEventType":"WATER_TEMP",
+                                       "Status":
+                                       [
+                                               {
+                            "AMBPropertyName":"EngineCoolantTemperature",
+                            "Type":"int",
+                            "AccessControl":"R",
+                            "Default":"0",
+                            "DBusProperty":"EngineCoolantTemperature",
+                            "DBusObjectName":"EngineCoolantTemperature",
+                                                       "Zone":"None"
+                                               }
+                                       ],
+                                       "sense":
+                                       [
+                                       ],
+                                       "event_mask":
+                                       [
+                                       ],
+                                       "Priority":1,
+                                       "DBusInterface":"Undefined",
+                    "DBusObject":"EngineCoolantTemperature"
+                },
+                               {
+                                       "KeyEventType":"MACHINEGUNTURRET",
+                                       "Status":
+                                       [
+                                               {
+                        "AMBPropertyName":"MachineGunTurretStatus",
+                        "Type":"bool",
+                        "AccessControl":"R",
+                        "Default":"0",
+                        "DBusProperty":"MachineGunTurretStatus",
+                        "DBusObjectName":"MachineGunTurretStatus",
+                                               "Zone":"None"
+                                               }
+                                       ],
+                                       "sense":
+                                       [
+                                       ],
+                                       "event_mask":
+                                       [
+                                       ],
+                                       "Priority":1,
+                                       "DBusInterface":"Undefined",
+                    "DBusObject":"MachineGunTurretStatus"
+                },
+                               {
+                                       "KeyEventType":"ACCELERATION",
+                                       "Status":
+                                       [
+                                               {
+                                                       "AMBPropertyName":"AccelerationX",
+                                                       "Type":"uint16",
+                                                       "AccessControl":"R",
+                                                       "Default":"0",
+                                                       "DBusProperty":"X",
+                                                       "DBusObjectName":"Acceleration",
+                                                       "Zone":"None"
+                                               },
+                                               {
+                                                       "AMBPropertyName":"AccelerationY",
+                                                       "Type":"uint16",
+                                                       "AccessControl":"R",
+                                                       "Default":"0",
+                                                       "DBusProperty":"Y",
+                                                       "DBusObjectName":"Acceleration",
+                                                       "Zone":"None"
+                                               },
+                                               {
+                                                       "AMBPropertyName":"AccelerationZ",
+                                                       "Type":"uint16",
+                                                       "AccessControl":"R",
+                                                       "Default":"0",
+                                                       "DBusProperty":"Z",
+                                                       "DBusObjectName":"Acceleration",
+                                                       "Zone":"None"
+                                               }
+                                       ],
+                                       "sense":
+                                       [
+                                       ],
+                                       "event_mask":
+                                       [
+                                       ],
+                                       "Priority":1,
+                                       "DBusInterface":"org.automotive.acceleration",
+                    "DBusObject":"Acceleration"
+                },
+                               {
+                                       "KeyEventType":"MASSAIRFLOW",
+                                       "Status":
+                                       [
+                                               {
+                            "AMBPropertyName":"MassAirFlow",
+                            "Type":"uint16_t",
+                            "AccessControl":"R",
+                            "Default":"0",
+                            "DBusProperty":"MassAirFlow",
+                            "DBusObjectName":"MassAirFlow",
+                                                       "Zone":"None"
+                                               }
+                                       ],
+                                       "sense":
+                                       [
+                                       ],
+                                       "event_mask":
+                                       [
+                                       ],
+                                       "Priority":1,
+                                       "DBusInterface":"Undefined",
+                    "DBusObject":"MassAirFlow"
+                },
+                               {
+                                       "KeyEventType":"BUTTON",
+                                       "Status":
+                                       [
+                                               {
+                            "AMBPropertyName":"ButtonEvent",
+                            "Type":"char",
+                            "AccessControl":"R",
+                            "Default":"0",
+                            "DBusProperty":"ButtonEvent",
+                            "DBusObjectName":"ButtonEvent",
+                                                       "Zone":"None"
+                                               }
+                                       ],
+                                       "sense":
+                                       [
+                                       ],
+                                       "event_mask":
+                                       [
+                                       ],
+                                       "Priority":1,
+                                       "DBusInterface":"Undefined",
+                    "DBusObject":"ButtonEvent"
+                },
+                               {
+                                       "KeyEventType":"OUTSIDE",
+                                       "Status":
+                                       [
+                                               {
+                            "AMBPropertyName":"AirIntakeTemperature",
+                            "Type":"int",
+                            "AccessControl":"R",
+                            "Default":"0",
+                            "DBusProperty":"AirIntakeTemperature",
+                            "DBusObjectName":"AirIntakeTemperature",
+                                                       "Zone":"None"
+                                               }
+                                       ],
+                                       "sense":
+                                       [
+                                       ],
+                                       "event_mask":
+                                       [
+                                       ],
+                                       "Priority":1,
+                                       "DBusInterface":"Undefined",
+                    "DBusObject":"AirIntakeTemperature"
+                },
+                               {
+                                       "KeyEventType":"BATTERY",
+                                       "Status":
+                                       [
+                                               {
+                            "AMBPropertyName":"ButteryVoltage",
+                            "Type":"double",
+                            "AccessControl":"R",
+                            "Default":"0",
+                            "DBusProperty":"ButteryVoltage",
+                            "DBusObjectName":"ButteryVoltage",
+                                                       "Zone":"None"
+                                               }
+                                       ],
+                                       "sense":
+                                       [
+                                       ],
+                                       "event_mask":
+                                       [
+                                       ],
+                                       "Priority":1,
+                                       "DBusInterface":"Undefined",
+                    "DBusObject":"ButteryVoltage"
+                },
+                               {
+                                       "KeyEventType":"INSIDE",
+                                       "Status":
+                                       [
+                                               {
+                            "AMBPropertyName":"InteriorTemperature",
+                            "Type":"int",
+                            "AccessControl":"R",
+                            "Default":"0",
+                            "DBusProperty":"Interior",
+                            "DBusObjectName":"InteriorTemperature",
+                                                       "Zone":"None"
+                                               }
+                                       ],
+                                       "sense":
+                                       [
+                                       ],
+                                       "event_mask":
+                                       [
+                                       ],
+                                       "Priority":1,
+                                       "DBusInterface":"Undefined",
+                    "DBusObject":"InteriorTemperature"
+                },
+                               {
+                                       "KeyEventType":"ENGINEOIL",
+                                       "Status":
+                                       [
+                                               {
+                            "AMBPropertyName":"EngineOilTemperature",
+                            "Type":"int",
+                            "AccessControl":"R",
+                            "Default":"0",
+                            "DBusProperty":"Temperature",
+                            "DBusObjectName":"EngineOil",
+                                                       "Zone":"None"
+                                               },
+                                               {
+                            "AMBPropertyName":"EngineOilRemaining",
+                            "Type":"uint16_t",
+                            "AccessControl":"R",
+                            "Default":"0",
+                            "DBusProperty":"Remaining",
+                            "DBusObjectName":"EngineOil",
+                                                       "Zone":"None"
+                                               }
+                                       ],
+                                       "sense":
+                                       [
+                                       ],
+                                       "event_mask":
+                                       [
+                                       ],
+                                       "Priority":1,
+                                       "DBusInterface":"org.automotive.engineOil",
+                    "DBusObject":"EngineOil"
+                },
+                               {
+                                       "KeyEventType":"TIREPRESSURE",
+                                       "Status":
+                                       [
+                                               {
+                            "AMBPropertyName":"TirePressureLeftFront",
+                            "Type":"double",
+                            "AccessControl":"R",
+                            "Default":"0",
+                            "DBusProperty":"LeftFront",
+                            "DBusObjectName":"TirePressure",
+                                                       "Zone":"None"
+                                               },
+                                               {
+                            "AMBPropertyName":"TirePressureRightFront",
+                            "Type":"double",
+                            "AccessControl":"R",
+                            "Default":"0",
+                            "DBusProperty":"RightFront",
+                            "DBusObjectName":"TirePressure",
+                                                       "Zone":"None"
+                                               },
+                                               {
+                            "AMBPropertyName":"TirePressureLeftRear",
+                            "Type":"double",
+                            "AccessControl":"R",
+                            "Default":"0",
+                            "DBusProperty":"LeftRear",
+                            "DBusObjectName":"TirePressure",
+                                                       "Zone":"None"
+                                               },
+                                               {
+                        "AMBPropertyName":"TirePressureRightRear",
+                        "Type":"double",
+                        "AccessControl":"R",
+                        "Default":"0",
+                        "DBusProperty":"RightRear",
+                        "DBusObjectName":"TirePressure",
+                                               "Zone":"None"
+                                               }
+                                       ],
+                                       "sense":
+                                       [
+                                       ],
+                                       "event_mask":
+                                       [
+                                       ],
+                                       "Priority":1,
+                                       "DBusInterface":"org.automotive.tirePressure",
+                    "DBusObject":"TirePressure"
+                },
+                               {
+                                       "KeyEventType":"TIRETEMPERATURE",
+                                       "Status":
+                                       [
+                                               {
+                                                       "AMBPropertyName":"TireTemperatureLeftFront",
+                                                       "Type":"double",
+                                                       "AccessControl":"R",
+                                                       "Default":"0",
+                                                       "DBusProperty":"LeftFront",
+                                                       "DBusObjectName":"TireTemperature",
+                                                       "Zone":"None"
+                                               },
+                                               {
+                                                       "AMBPropertyName":"TireTemperatureRightFront",
+                                                       "Type":"double",
+                                                       "AccessControl":"R",
+                                                       "Default":"0",
+                                                       "DBusProperty":"RightFront",
+                                                       "DBusObjectName":"TireTemperature",
+                                                       "Zone":"None"
+                                               },
+                                               {
+                                                       "AMBPropertyName":"TireTemperatureLeftRear",
+                                                       "Type":"double",
+                                                       "AccessControl":"R",
+                                                       "Default":"0",
+                                                       "DBusProperty":"LeftRear",
+                                                       "DBusObjectName":"TireTemperature",
+                                                       "Zone":"None"
+                                               },
+                                               {
+                                                       "AMBPropertyName":"TireTemperatureRightRear",
+                                                       "Type":"double",
+                                                       "AccessControl":"R",
+                                                       "Default":"0",
+                                                       "DBusProperty":"RightRear",
+                                                       "DBusObjectName":"TireTemperature",
+                                                       "Zone":"None"
+                                               }
+                                       ],
+                                       "sense":
+                                       [
+                                       ],
+                                       "event_mask":
+                                       [
+                                       ],
+                                       "Priority":1,
+                                       "DBusInterface":"org.automotive.tireTemperature",
+                    "DBusObject":"TireTemperature"
+                               },
+                               {
+                                       "KeyEventType":"POWERMODE",
+                                       "Status":
+                                       [
+                                               {
+                                                       "AMBPropertyName":"VehiclePowerMode",
+                                                       "Type":"char",
+                                                       "AccessControl":"R",
+                                                       "Default":"0",
+                                                       "DBusProperty":"VehiclePowerMode",
+                                                       "DBusObjectName":"VehiclePowerMode",
+                                                       "Zone":"None"
+                                               }
+                                       ],
+                                       "sense":
+                                       [
+                                       ],
+                                       "event_mask":
+                                       [
+                                       ],
+                                       "Priority":1,
+                                       "DBusInterface":"org.automotive.vehiclePowerMode",
+                    "DBusObject":"VehiclePowerMode"
+                               },
+                               {
+                                       "KeyEventType":"CRUISECONTROL",
+                                       "Status":
+                                       [
+                                               {
+                                                       "AMBPropertyName":"CruiseControlActive",
+                                                       "Type":"bool",
+                                                       "AccessControl":"R",
+                                                       "Default":"0",
+                                                       "DBusProperty":"Activated",
+                                                       "DBusObjectName":"CruiseControlStatus",
+                                                       "Zone":"None"
+                                               },
+                                               {
+                                                       "AMBPropertyName":"CruiseControlSpeed",
+                                                       "Type":"uint16_t",
+                                                       "AccessControl":"R",
+                                                       "Default":"0",
+                                                       "DBusProperty":"Speed",
+                                                       "DBusObjectName":"CruiseControlStatus",
+                                                       "Zone":"None"
+                                               }
+                                       ],
+                                       "sense":
+                                       [
+                                       ],
+                                       "event_mask":
+                                       [
+                                       ],
+                                       "Priority":1,
+                                       "DBusInterface":"Undefined",
+                    "DBusObject":"CruiseControlStatus"
+                               },
+                               {
+                                       "KeyEventType":"LIGHTSTATUS",
+                                       "Status":
+                                       [
+                                               {
+                                                       "AMBPropertyName":"LightHead",
+                                                       "Type":"bool",
+                                                       "AccessControl":"R",
+                                                       "Default":"0",
+                                                       "DBusProperty":"Head",
+                                                       "DBusObjectName":"LightStatus",
+                                                       "Zone":"None"
+                                               },
+                                               {
+                                                       "AMBPropertyName":"LightLeftTurn",
+                                                       "Type":"bool",
+                                                       "AccessControl":"R",
+                                                       "Default":"0",
+                                                       "DBusProperty":"LeftTurn",
+                                                       "DBusObjectName":"LightStatus",
+                                                       "Zone":"None"
+                                               },
+                                               {
+                                                       "AMBPropertyName":"LightRightTurn",
+                                                       "Type":"bool",
+                                                       "AccessControl":"R",
+                                                       "Default":"0",
+                                                       "DBusProperty":"RightTurn",
+                                                       "DBusObjectName":"LightStatus",
+                                                       "Zone":"None"
+                                               },
+                                               {
+                                                       "AMBPropertyName":"LightParking",
+                                                       "Type":"bool",
+                                                       "AccessControl":"R",
+                                                       "Default":"0",
+                                                       "DBusProperty":"Parking",
+                                                       "DBusObjectName":"LightStatus",
+                                                       "Zone":"None"
+                                               },
+                                               {
+                                                       "AMBPropertyName":"LightFog",
+                                                       "Type":"bool",
+                                                       "AccessControl":"R",
+                                                       "Default":"0",
+                                                       "DBusProperty":"Fog",
+                                                       "DBusObjectName":"LightStatus",
+                                                       "Zone":"None"
+                                               },
+                                               {
+                                                       "AMBPropertyName":"LightHazard",
+                                                       "Type":"bool",
+                                                       "AccessControl":"R",
+                                                       "Default":"0",
+                                                       "DBusProperty":"Hazard",
+                                                       "DBusObjectName":"LightStatus",
+                                                       "Zone":"None"
+                                               },
+                                               {
+                                                       "AMBPropertyName":"LightBrake",
+                                                       "Type":"bool",
+                                                       "AccessControl":"R",
+                                                       "Default":"0",
+                                                       "DBusProperty":"Brake",
+                                                       "DBusObjectName":"LightStatus",
+                                                       "Zone":"None"
+                                               },
+                                               {
+                                                       "AMBPropertyName":"LightHighBeam",
+                                                       "Type":"bool",
+                                                       "AccessControl":"R",
+                                                       "Default":"0",
+                                                       "DBusProperty":"HighBeam",
+                                                       "DBusObjectName":"LightStatus",
+                                                       "Zone":"None"
+                                               }
+                                       ],
+                                       "sense":
+                                       [
+                                       ],
+                                       "event_mask":
+                                       [
+                                       ],
+                                       "Priority":1,
+                                       "DBusInterface":"org.automotive.ParkingLightStatus",
+                    "DBusObject":"LightStatus"
+                               },
+                               {
+                                       "KeyEventType":"ENGINELOAD",
+                                       "Status":
+                                       [
+                                               {
+                                                       "AMBPropertyName":"EngineLoad",
+                                                       "Type":"uint16",
+                                                       "AccessControl":"R",
+                                                       "Default":"0",
+                                                       "DBusProperty":"EngineLoad",
+                                                       "DBusObjectName":"EngineLoad",
+                                                       "Zone":"None"
+                                               }
+                                       ],
+                                       "sense":
+                                       [
+                                       ],
+                                       "event_mask":
+                                       [
+                                       ],
+                                       "Priority":1,
+                                       "DBusInterface":"Undefined",
+                    "DBusObject":"EngineLoad"
+                               },
+                               {
+                                       "KeyEventType":"HORN",
+                                       "Status":
+                                       [
+                                               {
+                                                       "AMBPropertyName":"Horn",
+                                                       "Type":"bool",
+                                                       "AccessControl":"R",
+                                                       "Default":"0",
+                                                       "DBusProperty":"On",
+                                                       "DBusObjectName":"Horn",
+                                                       "Zone":"None"
+                                               }
+                                       ],
+                                       "sense":
+                                       [
+                                       ],
+                                       "event_mask":
+                                       [
+                                       ],
+                                       "Priority":1,
+                                       "DBusInterface":"Undefined",
+                    "DBusObject":"Horn"
+                               },
+                               {
+                                       "KeyEventType":"FUEL_LEVEL",
+                                       "Status":
+                                       [
+                                               {
+                                                       "AMBPropertyName":"FuelLevel",
+                                                       "Type":"uint16",
+                                                       "AccessControl":"R",
+                                                       "Default":"0",
+                                                       "DBusProperty":"Level",
+                                                       "DBusObjectName":"Fuel",
+                                                       "Zone":"None"
+                                               }
+                                       ],
+                                       "sense":
+                                       [
+                                       ],
+                                       "event_mask":
+                                       [
+                                       ],
+                                       "Priority":1,
+                                       "DBusInterface":"org.automotive.fuel",
+                    "DBusObject":"Fuel"
+                               },
+                               {
+                                       "KeyEventType":"FUEL",
+                                       "Status":
+                                       [
+                                               {
+                                                       "AMBPropertyName":"FuelConsumption",
+                                                       "Type":"uint16_t",
+                                                       "AccessControl":"R",
+                                                       "Default":"0",
+                                                       "DBusProperty":"InstantConsumption",
+                                                       "DBusObjectName":"Fuel",
+                                                       "Zone":"None"
+                                               },
+                                               {
+                                                       "AMBPropertyName":"FuelRange",
+                                                       "Type":"uint16_t",
+                                                       "AccessControl":"R",
+                                                       "Default":"0",
+                                                       "DBusProperty":"Range",
+                                                       "DBusObjectName":"Fuel",
+                                                       "Zone":"None"
+                                               },
+                                               {
+                                                       "AMBPropertyName":"FuelEconomy",
+                                                       "Type":"uint16_t",
+                                                       "AccessControl":"R",
+                                                       "Default":"0",
+                                                       "DBusProperty":"InstantEconomy",
+                                                       "DBusObjectName":"Fuel",
+                                                       "Zone":"None"
+                                               },
+                                               {
+                                                       "AMBPropertyName":"FuelAverageEconomy",
+                                                       "Type":"uint16_t",
+                                                       "AccessControl":"R",
+                                                       "Default":"0",
+                                                       "DBusProperty":"AverageEconomy",
+                                                       "DBusObjectName":"Fuel",
+                                                       "Zone":"None"
+                                               },
+                                               {
+                                                       "AMBPropertyName":"FuelType",
+                                                       "Type":"char",
+                                                       "AccessControl":"R",
+                                                       "Default":"0",
+                                                       "DBusProperty":"Type",
+                                                       "DBusObjectName":"FuelInfo",
+                                                       "Zone":"None"
+                                               },
+                                               {
+                                                       "AMBPropertyName":"FuelPositionSide",
+                                                       "Type":"char",
+                                                       "AccessControl":"R",
+                                                       "Default":"0",
+                                                       "DBusProperty":"RefuelPosition",
+                                                       "DBusObjectName":"FuelInfo",
+                                                       "Zone":"None"
+                                               }
+                                       ],
+                                       "sense":
+                                       [
+                                       ],
+                                       "event_mask":
+                                       [
+                                       ],
+                                       "Priority":1,
+                                       "DBusInterface":"org.automotive.fuel",
+                    "DBusObject":"Fuel"
+                               },
+                               {
+                                       "KeyEventType":"EXTERIORBRIGHTNESS",
+                                       "Status":
+                                       [
+                                               {
+                                                       "AMBPropertyName":"ExteriorBrightness",
+                                                       "Type":"uint16_t",
+                                                       "AccessControl":"R",
+                                                       "Default":"0",
+                                                       "DBusProperty":"ExteriorBrightness",
+                                                       "DBusObjectName":"ExteriorBrightness",
+                                                       "Zone":"None"
+                                               }
+                                       ],
+                                       "sense":
+                                       [
+                                       ],
+                                       "event_mask":
+                                       [
+                                       ],
+                                       "Priority":1,
+                                       "DBusInterface":"org.automotive.exteriorBrightness",
+                    "DBusObject":"ExteriorBrightness"
+                               },
+                               {
+                                       "KeyEventType":"LOCATION",
+                                       "Status":
+                                       [
+                                               {
+                                                       "AMBPropertyName":"Latitude",
+                                                       "Type":"double",
+                                                       "AccessControl":"R",
+                                                       "Default":"0",
+                                                       "DBusProperty":"Latitude",
+                                                       "DBusObjectName":"Location",
+                                                       "Zone":"None"
+                                               },
+                                               {
+                                                       "AMBPropertyName":"Longitude",
+                                                       "Type":"double",
+                                                       "AccessControl":"R",
+                                                       "Default":"0",
+                                                       "DBusProperty":"Longitude",
+                                                       "DBusObjectName":"Location",
+                                                       "Zone":"None"
+                                               },
+                                               {
+                                                       "AMBPropertyName":"Altitude",
+                                                       "Type":"double",
+                                                       "AccessControl":"R",
+                                                       "Default":"0",
+                                                       "DBusProperty":"Altitude",
+                                                       "DBusObjectName":"Location",
+                                                       "Zone":"None"
+                                               }
+                                       ],
+                                       "sense":
+                                       [
+                                       ],
+                                       "event_mask":
+                                       [
+                                       ],
+                                       "Priority":1,
+                                       "DBusInterface":"org.automotive.Latitude",
+                    "DBusObject":"Location"
+                               },
+                               {
+                                       "KeyEventType":"DIRECTION",
+                                       "Status":
+                                       [
+                                               {
+                                                       "AMBPropertyName":"Direction",
+                                                       "Type":"uint16_t",
+                                                       "AccessControl":"R",
+                                                       "Default":"0",
+                                                       "DBusProperty":"Direction",
+                                                       "DBusObjectName":"Location",
+                                                       "Zone":"None"
+                                               }
+                                       ],
+                                       "sense":
+                                       [
+                                       ],
+                                       "event_mask":
+                                       [
+                                       ],
+                                       "Priority":1,
+                                       "DBusInterface":"org.automotive.Direction",
+                    "DBusObject":"Location"
+                               },
+                               {
+                                       "KeyEventType":"CUSTOM1",
+                                       "Status":
+                                       [
+                                               {
+                                                       "AMBPropertyName":"CustomA",
+                                                       "Type":"uint16_t",
+                                                       "AccessControl":"R",
+                                                       "Default":"0",
+                                                       "DBusProperty":"CustomA",
+                                                       "DBusObjectName":"CustomA",
+                                                       "Zone":"None"
+                                               }
+                                       ],
+                                       "sense":
+                                       [
+                                       ],
+                                       "event_mask":
+                                       [
+                                       ],
+                                       "Priority":1,
+                                       "DBusInterface":"org.automotive.Direction",
+                    "DBusObject":"CustomA"
+                               },
+                               {
+                                       "KeyEventType":"CUSTOM2",
+                                       "Status":
+                                       [
+                                               {
+                                                       "AMBPropertyName":"CustomB",
+                                                       "Type":"uint16_t",
+                                                       "AccessControl":"R",
+                                                       "Default":"0",
+                                                       "DBusProperty":"CustomB",
+                                                       "DBusObjectName":"CustomB",
+                                                       "Zone":"None"
+                                               }
+                                       ],
+                                       "sense":
+                                       [
+                                       ],
+                                       "event_mask":
+                                       [
+                                       ],
+                                       "Priority":1,
+                                       "DBusInterface":"org.automotive.Direction",
+                    "DBusObject":"CustomB"
+                               },
+                               {
+                                       "KeyEventType":"CUSTOM3",
+                                       "Status":
+                                       [
+                                               {
+                                                       "AMBPropertyName":"CustomC",
+                                                       "Type":"uint16_t",
+                                                       "AccessControl":"R",
+                                                       "Default":"0",
+                                                       "DBusProperty":"CustomC",
+                                                       "DBusObjectName":"CustomC",
+                                                       "Zone":"None"
+                                               }
+                                       ],
+                                       "sense":
+                                       [
+                                       ],
+                                       "event_mask":
+                                       [
+                                       ],
+                                       "Priority":1,
+                                       "DBusInterface":"org.automotive.Direction",
+                    "DBusObject":"CustomC"
+                               },
+                               {
+                                       "KeyEventType":"CUSTOM4",
+                                       "Status":
+                                       [
+                                               {
+                                                       "AMBPropertyName":"CustomD",
+                                                       "Type":"uint16_t",
+                                                       "AccessControl":"R",
+                                                       "Default":"0",
+                                                       "DBusProperty":"CustomD",
+                                                       "DBusObjectName":"CustomD",
+                                                       "Zone":"None"
+                                               }
+                                       ],
+                                       "sense":
+                                       [
+                                       ],
+                                       "event_mask":
+                                       [
+                                       ],
+                                       "Priority":1,
+                                       "DBusInterface":"org.automotive.Direction",
+                    "DBusObject":"CustomD"
+                               }
+                       ],
+            "DefaultInfoPort":
+            {
+                "DataPort":25010,
+                "CtrlPort":25011
+            },
+            "CustomizeInfoPort":
+            {
+                "DataPort":25020,
+                "CtrlPort":25021
+            }
+               },
+               {
+                       "Section":"CarSim",
+                       "VehicleInfoList":
+                       [
+                               "VELOCITY",
+                               "LOCATION",
+                               "SHIFT"
+                       ]
+               }
+       ]
+}
index 37e1738..2b6a9ef 100644 (file)
@@ -1,11 +1,24 @@
 include(CheckIncludeFiles)
-set(CMAKE_CXX_FLAGS "-g")
-include_directories(${CMAKE_SOURCE_DIR}/lib ${include_dirs} ${gio_INCLUDE_DIRS} ${gio-unix_INCLUDE_DIRS} /usr/include/amb /usr/include/dbus-1.0 ../src)
+set(CMAKE_CXX_FLAGS "-g -Wall -std=c++11")
+include_directories(${CMAKE_SOURCE_DIR}/lib ${include_dirs} ${gio_INCLUDE_DIRS} ${gio-unix_INCLUDE_DIRS} ${ambd_INCLUDE_DIRS} ${appcore-efl_INCLUDE_DIRS} ${ecore_INCLUDE_DIRS} ${elementary_INCLUDE_DIRS} ${dbus_INCLUDE_DIRS} ${edbus_INClUDE_DIRS} /usr/include/dbus-1.0 /usr/include/ico-util ../src/)
 
-set(testVehiclePluginMW_sources ../src/abstractconfig.cc ../src/ambconfig.cc ../src/standardmessage.cc ../src/eventmessage.cc ../src/datamessage.cc controlwebsocketclient.cc scenarioengine.cc mwscenario.cc)
-add_executable(testVehiclePluginMW ${testVehiclePluginMW_sources})
-target_link_libraries(testVehiclePluginMW amb pthread websockets -L${CMAKE_CURRENT_BINARY_DIR}/lib ${link_libraries} ${gio_LIBRARIES} ${gio-unix_LIBRARIES} -lico-util)
-
-set(testVehiclePluginWSApp_sources ../src/abstractconfig.cc ../src/ambconfig.cc ../src/standardmessage.cc ../src/eventmessage.cc ../src/datamessage.cc configamb.cc standardjsonmessage.cc controlwebsocketclient.cc controlwebsocketclientapp.cc scenarioengine.cc websocketscenario.cc)
-add_executable(testVehiclePluginWSApp ${testVehiclePluginWSApp_sources})
-target_link_libraries(testVehiclePluginWSApp amb pthread websockets -L${CMAKE_CURRENT_BINARY_DIR}/lib ${link_libraries} ${gio_LIBRARIES} ${gio-unix_LIBRARIES} -lico-util)
+set(VICCommon_sources ../src/standardmessage.cc ../src/datamessage.cc ../src/eventmessage.cc controlwebsocketclient.cc)
+set(Common_sources ../src/abstractconfig.cc ../src/ambconfig.cc logresult.cc)
+set(VICtest1_sources ${Common_sources} ${VICCommon_sources} vic1.cc)
+set(VICtest3_sources ${Common_sources} ${VICCommon_sources} vic3.cc)
+set(VICSeq_sources ${Common_sources} ${VICCommon_sources} vicseq.cc)
+set(VICReset_sources ${Common_sources} ${VICCommon_sources} vicreset.cc)
+set(DBustest1_sources ${Common_sources} dbustest1.cc)
+set(DBustest3_sources ${Common_sources} dbustest3.cc)
+add_executable(VICtest1 ${VICtest1_sources})
+target_link_libraries(VICtest1 ${link_libraries} ${gio_LIBRARIES} ${gio-unix_LIBRARIES} -lico-util)
+add_executable(VICtest3 ${VICtest3_sources})
+target_link_libraries(VICtest3 ${link_libraries} ${gio_LIBRARIES} ${gio-unix_LIBRARIES} -lico-util)
+add_executable(VICSeq ${VICSeq_sources})
+target_link_libraries(VICSeq ${link_libraries} ${gio_LIBRARIES} ${gio-unix_LIBRARIES} -lico-util)
+add_executable(VICReset ${VICReset_sources})
+target_link_libraries(VICReset ${link_libraries} ${gio_LIBRARIES} ${gio-unix_LIBRARIES} -lico-util)
+add_executable(DBustest1 ${DBustest1_sources})
+target_link_libraries(DBustest1 ${link_libraries} ${elementary_LIBRARIES} ${ecore_LIBRARIES} ${appcore-efl_LIBRARIES} ${edbus_LIBRARIES} -lico-util)
+add_executable(DBustest3 ${DBustest3_sources})
+target_link_libraries(DBustest3 ${link_libraries} ${elementary_LIBRARIES} ${ecore_LIBRARIES} ${appcore-efl_LIBRARIES} ${edbus_LIBRARIES} -lico-util)
diff --git a/tests/app1.cc b/tests/app1.cc
new file mode 100644 (file)
index 0000000..3942d17
--- /dev/null
@@ -0,0 +1,75 @@
+#include <appcore-efl.h>
+#include <Elementary.h>
+#include <stdio.h>
+
+#include <iostream>
+#include <vector>
+
+#include "ambconfig.h"
+#include "ico_dbus_amb_efl.h"
+
+void disp_notify(char *property, dbus_type type, union dbus_value_variant value, int sequence, struct timeval tv) {
+    std::cout << tv.tv_sec << "." << tv.tv_usec << " " << property << " ";
+    switch (type) {
+    case DBUS_TYPE_BYTE :
+        std::cout << value.yval;
+        break;
+    case DBUS_TYPE_BOOLEAN :
+        if (value.bval) {
+            std::cout << "true";
+        }
+        else {
+            std::cout << "false";
+        }
+        break;
+    case DBUS_TYPE_INT16 :
+        std::cout << value.i16val;
+        break;
+    case DBUS_TYPE_UINT16 :
+        std::cout << value.ui16val;
+        break;
+    case DBUS_TYPE_INT32 :
+        std::cout << value.i32val;
+        break;
+    case DBUS_TYPE_UINT32 :
+        std::cout << value.ui32val;
+        break;
+    case DBUS_TYPE_DOUBLE : 
+        std::cout << value.dval;
+        break;
+    case DBUS_TYPE_STRING :
+        std::cout << value.sval;
+        break;
+    default :
+        std::cout << "Not supported.";
+        break;
+    }
+    std::cout << std::endl;
+}
+
+EAPI int elm_main(int argc, char *argv[]) {
+    struct appcore_ops ops;
+
+    ops.create = NULL;
+    ops.resume = NULL;
+    ops.reset = NULL;
+    ops.pause = NULL;
+    ops.terminate = NULL;
+    ops.data = NULL;
+
+    ico_dbus_amb_start();
+    std::vector<VehicleInfoDefine> configlist;
+    configlist = 
+    //ico_dbus_amb_get("VehicleSpeed", 0, DBUS_TYPE_UINT16, getvalue);
+    //ico_dbus_amb_get("EngineSpeed", 0, DBUS_TYPE_UINT16, getvalue);
+
+    //ico_dbus_amb_subscribe("EngineSpeed", 0, DBUS_TYPE_UINT16, notifyvalue);
+    //ico_dbus_amb_get("FuelAverageEconomy", 0, DBUS_TYPE_UINT16, getvalue);
+
+    appcore_efl_main("org.tizen.ico.testdbus", &argc, &argv, &ops);
+
+    ico_dbus_amb_end();
+
+    elm_shutdown();
+}
+ELM_MAIN()
diff --git a/tests/checkinterspace.awk b/tests/checkinterspace.awk
new file mode 100644 (file)
index 0000000..d213694
--- /dev/null
@@ -0,0 +1,25 @@
+BEGIN {
+       FS = " "
+       prevtime = -1
+       measurementerror = 0.2
+       errorflg = 0
+}
+{
+       if (prevtime != -1) {
+               currenttime = $1
+               interspacetime = currenttime - prevtime
+               if (interspacetime < (standardvalue - (standardvalue * measurementerror)) || interspacetime > (standardvalue + (standardvalue * measurementerror))) {
+                       print interspacetime
+                       errorflg = 1
+               }
+       }
+       prevtime = $1
+}
+END {
+       if (errorflg == 0) {
+               print "OK!"
+       }
+       else {
+               print "NG"
+       }
+}
diff --git a/tests/checkresult.sh b/tests/checkresult.sh
new file mode 100755 (executable)
index 0000000..f9aedde
--- /dev/null
@@ -0,0 +1,1540 @@
+#!/bin/sh
+
+mkdir -p log
+
+systemctl stop ambd.service
+echo "=====Config Test1====="
+systemctl restart murphyd.service
+ambd -D -c/usr/local/tests/ico/etc/ambd/config -d5 -l/tmp/ambd.log
+sleep 2
+killall -15 ambd >/dev/null 2>&1
+sleep 1
+killall -9 ambd >/dev/null 2>&1
+ERRORCHECK=`grep "ERROR Failed to Load Configfile for VIC-Plugin" /tmp/ambd.log | wc -l`
+if [ $ERRORCHECK -eq 0 ] 
+then
+       echo "OK!"
+else
+       echo "NG"
+fi
+mv /tmp/ambd.log ambdlog_conf1
+
+echo "=====Config Test2====="
+systemctl restart murphyd.service
+ambd -D -c/usr/local/tests/ico/etc/ambd/config.wrong -d5 -l/tmp/ambd.log
+sleep 2
+killall -15 ambd >/dev/null 2>&1
+sleep 1
+killall -9 ambd >/dev/null 2>&1
+ERRORCHECK=`grep "ERROR Failed to Load Configfile for VIC-Plugin" /tmp/ambd.log | wc -l`
+if [ $ERRORCHECK -eq 1 ]
+then
+       echo "OK!"
+else
+       echo "NG"
+fi
+mv /tmp/ambd.log ambdlog_conf2
+
+echo "=====Config Test3====="
+systemctl restart murphyd.service
+ambd -D -c/usr/local/tests/ico/etc/ambd/config -d5 -l/tmp/ambd.log
+sleep 2
+killall -15 ambd >/dev/null 2>&1
+sleep 1
+killall -9 ambd >/dev/null 2>&1
+ERRORCHECK=`grep "ERROR Failed to Load Configfile for VIC-Plugin" /tmp/ambd.log | wc -l`
+if [ $ERRORCHECK -eq 0 ] 
+then
+       echo "OK!"
+else
+       echo "NG"
+fi
+mv /tmp/ambd.log ambdlog_conf3
+
+echo "=====Config Test4====="
+systemctl restart murphyd.service
+ambd -D -c/usr/local/tests/ico/etc/ambd/config.wrong2 -d5 -l/tmp/ambd.log
+sleep 2
+killall -15 ambd >/dev/null 2>&1
+sleep 1
+killall -9 ambd >/dev/null 2>&1
+ERRORCHECK=`grep "ERROR Can't find key\[\"Config\"\]" /tmp/ambd.log | wc -l`
+if [ $ERRORCHECK -eq 1 ] 
+then
+       echo "OK!"
+else
+       echo "NG"
+fi
+mv /tmp/ambd.log ambdlog_conf4
+
+echo "=====Config Test5====="
+systemctl restart murphyd.service
+ambd -D -c/usr/local/tests/ico/etc/ambd/config.wrong3 -d5 -l/tmp/ambd.log
+sleep 2
+killall -15 ambd >/dev/null 2>&1
+sleep 1
+killall -9 ambd >/dev/null 2>&1
+ERRORCHECK=`grep "ERROR Can't load vehicle information" /tmp/ambd.log | wc -l`
+if [ $ERRORCHECK -eq 1 ] 
+then
+       echo "OK!"
+else
+       echo "NG"
+fi
+mv /tmp/ambd.log ambdlog_conf5
+
+echo "=====Config Test6====="
+systemctl restart murphyd.service
+ambd -D -c/usr/local/tests/ico/etc/ambd/config.wrong4 -d5 -l/tmp/ambd.log
+sleep 2
+killall -15 ambd >/dev/null 2>&1
+sleep 1
+killall -9 ambd >/dev/null 2>&1
+ERRORCHECK=`grep "ERROR Can't load vehicle information" /tmp/ambd.log | wc -l`
+if [ $ERRORCHECK -eq 1 ] 
+then
+       echo "OK!"
+else
+       echo "NG"
+fi
+mv /tmp/ambd.log ambdlog_conf6
+
+echo "=====Config Test7====="
+systemctl restart murphyd.service
+ambd -D -c/usr/local/tests/ico/etc/ambd/config.wrong5 -d5 -l/tmp/ambd.log
+sleep 2
+killall -15 ambd >/dev/null 2>&1
+sleep 1
+killall -9 ambd >/dev/null 2>&1
+ERRORCHECK=`grep "WARNING \"KeyEventType\"  is not defined." /tmp/ambd.log | wc -l`
+ERRORCHECK2=`grep "Subscribing to:  EngineSpeed" /tmp/ambd.log | wc -l`
+if [ $ERRORCHECK -eq 1 ] && [ $ERRORCHECK2 -eq 0 ]
+then
+       echo "OK!"
+else
+       echo "NG"
+fi
+mv /tmp/ambd.log ambdlog_conf7
+
+echo "=====Config Test8====="
+systemctl restart murphyd.service
+ambd -D -c/usr/local/tests/ico/etc/ambd/config.wrong6 -d5 -l/tmp/ambd.log
+sleep 2
+killall -15 ambd >/dev/null 2>&1
+sleep 1
+killall -9 ambd >/dev/null 2>&1
+ERRORCHECK=`grep "WARNING Don't allow length of  \"KeyEventType\"'s value." /tmp/ambd.log | wc -l`
+ERRORCHECK2=`grep "Subscribing to:  EngineSpeed" /tmp/ambd.log | wc -l`
+if [ $ERRORCHECK -eq 1 ] && [ $ERRORCHECK2 -eq 0 ]
+then
+       echo "OK!"
+else
+       echo "NG"
+fi
+mv /tmp/ambd.log ambdlog_conf8
+
+echo "=====Config Test9====="
+systemctl restart murphyd.service
+ambd -D -c/usr/local/tests/ico/etc/ambd/config.wrong7 -d5 -l/tmp/ambd.log
+sleep 2
+killall -15 ambd >/dev/null 2>&1
+sleep 1
+killall -9 ambd >/dev/null 2>&1
+ERRORCHECK=`grep "WARNING \"AMBPropertyName\"  is not defined." /tmp/ambd.log | wc -l`
+ERRORCHECK2=`grep "Subscribing to:  EngineSpeed" /tmp/ambd.log | wc -l`
+if [ $ERRORCHECK -eq 1 ] && [ $ERRORCHECK2 -eq 0 ]
+then
+       echo "OK!"
+else
+       echo "NG"
+fi
+mv /tmp/ambd.log ambdlog_conf9
+
+echo "=====Config Test10====="
+systemctl restart murphyd.service
+ambd -D -c/usr/local/tests/ico/etc/ambd/config.wrong8 -d5 -l/tmp/ambd.log
+sleep 2
+killall -15 ambd >/dev/null 2>&1
+sleep 1
+killall -9 ambd >/dev/null 2>&1
+ERRORCHECK=`grep "WARNING \"Type\"  is not defined." /tmp/ambd.log | wc -l`
+ERRORCHECK2=`grep "Subscribing to:  EngineSpeed" /tmp/ambd.log | wc -l`
+if [ $ERRORCHECK -eq 1 ] && [ $ERRORCHECK2 -eq 0 ]
+then
+       echo "OK!"
+else
+       echo "NG"
+fi
+mv /tmp/ambd.log ambdlog_conf10
+
+echo "=====Config Test11====="
+systemctl restart murphyd.service
+ambd -D -c/usr/local/tests/ico/etc/ambd/config.wrong9 -d5 -l/tmp/ambd.log
+sleep 2
+killall -15 ambd >/dev/null 2>&1
+sleep 1
+killall -9 ambd >/dev/null 2>&1
+ERRORCHECK=`grep "WARNING \"Type\"'s value  is not defined." /tmp/ambd.log | wc -l`
+ERRORCHECK2=`grep "Subscribing to:  EngineSpeed" /tmp/ambd.log | wc -l`
+if [ $ERRORCHECK -eq 1 ] && [ $ERRORCHECK2 -eq 0 ]
+then
+       echo "OK!"
+else
+       echo "NG"
+fi
+mv /tmp/ambd.log ambdlog_conf11
+
+echo "=====Config Test12====="
+systemctl restart murphyd.service
+ambd -D -c/usr/local/tests/ico/etc/ambd/config.wrong10 -d5 -l/tmp/ambd.log
+sleep 2
+killall -15 ambd >/dev/null 2>&1
+sleep 1
+killall -9 ambd >/dev/null 2>&1
+ERRORCHECK=`grep "ERROR Can't load vehicle information." /tmp/ambd.log | wc -l`
+if [ $ERRORCHECK -eq 1 ]
+then
+       echo "OK!"
+else
+       echo "NG"
+fi
+mv /tmp/ambd.log ambdlog_conf12
+
+echo "=====Config Test13====="
+systemctl restart murphyd.service
+ambd -D -c/usr/local/tests/ico/etc/ambd/config.wrong11 -d5 -l/tmp/ambd.log
+sleep 2
+killall -15 ambd >/dev/null 2>&1
+sleep 1
+killall -9 ambd >/dev/null 2>&1
+ERRORCHECK=`grep "ERROR \"DefaultInfoPort\"-> \"DataPort\"  is not defined." /tmp/ambd.log | wc -l`
+if [ $ERRORCHECK -eq 1 ]
+then
+       echo "OK!"
+else
+       echo "NG"
+fi
+mv /tmp/ambd.log ambdlog_conf13
+
+echo "=====Config Test14====="
+systemctl restart murphyd.service
+ambd -D -c/usr/local/tests/ico/etc/ambd/config.wrong12 -d5 -l/tmp/ambd.log
+sleep 2
+killall -15 ambd >/dev/null 2>&1
+sleep 1
+killall -9 ambd >/dev/null 2>&1
+ERRORCHECK=`grep "ERROR Failed to Load Configfile for VIC-Plugin" /tmp/ambd.log | wc -l`
+if [ $ERRORCHECK -eq 0 ]
+then
+       echo "OK!"
+else
+       echo "NG"
+fi
+mv /tmp/ambd.log ambdlog_conf14
+
+echo "=====Config Test15====="
+systemctl restart murphyd.service
+ambd -D -c/usr/local/tests/ico/etc/ambd/config.wrong13 -d5 -l/tmp/ambd.log
+sleep 2
+killall -15 ambd >/dev/null 2>&1
+sleep 1
+killall -9 ambd >/dev/null 2>&1
+ERRORCHECK=`grep "ERROR object value separator ',' expected" /tmp/ambd.log | wc -l`
+ERRORCHECK2=`grep "ERROR Failed to Load Configfile for VIC-Plugin" /tmp/ambd.log | wc -l`
+if [ $ERRORCHECK -eq 1 ] && [ $ERRORCHECK2 -eq 1 ]
+then
+       echo "OK!"
+else
+       echo "NG"
+fi
+mv /tmp/ambd.log ambdlog_conf15
+
+echo "=====Config Test16====="
+systemctl restart murphyd.service
+ambd -D -c/usr/local/tests/ico/etc/ambd/config.wrong14 -d5 -l/tmp/ambd.log
+sleep 2
+killall -15 ambd >/dev/null 2>&1
+sleep 1
+killall -9 ambd >/dev/null 2>&1
+ERRORCHECK=`grep "ERROR \"Config\" is not array." /tmp/ambd.log | wc -l`
+if [ $ERRORCHECK -eq 1 ]
+then
+       echo "OK!"
+else
+       echo "NG"
+fi
+mv /tmp/ambd.log ambdlog_conf16
+
+echo "=====Config Test17====="
+systemctl restart murphyd.service
+ambd -D -c/usr/local/tests/ico/etc/ambd/config.wrong15 -d5 -l/tmp/ambd.log
+sleep 2
+killall -15 ambd >/dev/null 2>&1
+sleep 1
+killall -9 ambd >/dev/null 2>&1
+ERRORCHECK=`grep "ERROR \"VehicleInfoDefine\"  is not array." /tmp/ambd.log | wc -l`
+if [ $ERRORCHECK -eq 1 ]
+then
+       echo "OK!"
+else
+       echo "NG"
+fi
+mv /tmp/ambd.log ambdlog_conf17
+
+systemctl restart murphyd.service
+systemctl start ambd.service
+
+sleep 3
+
+echo "=====Test1====="
+./DBustest1 >applog 2>/dev/null &
+sleep 1
+./VICtest1 >viclog 2>/dev/null
+sleep 3
+killall -15 DBustest1 >/dev/null 2>&1
+sleep 1
+killall -9 DBustest1 >/dev/null 2>&1
+sleep 1
+
+VICSET=`grep -c SET viclog`
+VICGET=`grep -c GET viclog`
+APPNOTI=`grep -c NOTIFY applog`
+if [ $VICSET -ne $VICGET ]
+then
+       echo "NG"
+else
+       echo "OK!"
+fi
+if [ $VICSET -ne $APPNOTI ]
+then
+       echo "NG"
+else
+       echo "OK!"
+fi
+mv viclog viclog1
+mv applog applog1
+
+./VICReset >/dev/null 2>&1
+
+echo "=====Test2====="
+./VICtest3 >viclog 2>/dev/null
+./DBustest3 >applog 2>/dev/null &
+sleep 3
+killall -15 DBustest3 >/dev/null 2>&1
+sleep 1
+killall -9 DBustest3 >/dev/null 2>&1
+sleep 1
+
+VICSET=`grep -c SET viclog`
+APPGET=`grep -c GET applog`
+if [ $VICSET -ne $APPGET ]
+then
+       echo "NG"
+else
+       echo "OK!"
+fi
+mv viclog viclog3
+mv applog applog3
+
+./VICReset >/dev/null 2>&1
+
+echo "=====Interspace Test(Interspace 1000, Standarddata 1)====="
+./DBustest1 >applog  2>/dev/null &
+sleep 1
+./VICSeq -s 1 -n 0 -i 1000 >viclog 2>/dev/null
+sleep 3
+killall -15 DBustest1 >/dev/null 2>&1
+sleep 1
+killall -9 DBustest1 >/dev/null 2>&1
+sleep 1
+
+cat viclog | grep "SET" | cut -d " " -f1,4 >tmpviclog
+cat applog | grep "NOTIFY" | cut -d " " -f1,4 >tmpapplog
+awk -v standardvalue=1 -f checkinterspace.awk tmpviclog
+awk -v standardvalue=1 -f checkinterspace.awk tmpapplog
+
+mv viclog viclogis1
+mv applog applogis1
+
+./VICReset >/dev/null 2>&1
+
+echo "=====Interspace Test(Interspace 1000, Customdata 1)====="
+./DBustest1 >applog  2>/dev/null &
+sleep 1
+./VICSeq -s 0 -n 1 -i 1000 >viclog 2>/dev/null
+sleep 3
+killall -15 DBustest1 >/dev/null 2>&1
+sleep 1
+killall -9 DBustest1 >/dev/null 2>&1
+sleep 1
+
+cat viclog | grep "SET" | cut -d " " -f1,4 >tmpviclog
+cat applog | grep "NOTIFY" | cut -d " " -f1,4 >tmpapplog
+awk -v standardvalue=1 -f checkinterspace.awk tmpviclog
+awk -v standardvalue=1 -f checkinterspace.awk tmpapplog
+
+mv viclog viclogis2
+mv applog applogis2
+
+./VICReset >/dev/null 2>&1
+
+echo "=====Interspace Test(Interspace 1000, Standarddata 2)====="
+./DBustest1 >applog  2>/dev/null &
+sleep 1
+./VICSeq -s 2 -n 0 -i 1000 >viclog 2>/dev/null
+sleep 3
+killall -15 DBustest1 >/dev/null 2>&1
+sleep 1
+killall -9 DBustest1 >/dev/null 2>&1
+sleep 1
+
+cat viclog | grep "SET" | cut -d " " -f4 | sort | uniq >tmpviclist
+while read line
+do
+       echo "Check Vehicle Property is $line"
+       cat viclog | grep "SET" | cut -d " " -f1,4 | grep $line >tmpviclog
+       cat applog | grep "NOTIFY" | cut -d " " -f1,4 | grep $line >tmpapplog
+       awk -v standardvalue=1 -f checkinterspace.awk tmpviclog
+       awk -v standardvalue=1 -f checkinterspace.awk tmpapplog
+done < tmpviclist
+
+mv viclog viclogis3
+mv applog applogis3
+
+./VICReset >/dev/null 2>&1
+
+echo "=====Interspace Test(Interspace 1000, Customdata 2)====="
+./DBustest1 >applog  2>/dev/null &
+sleep 1
+./VICSeq -s 0 -n 2 -i 1000 >viclog 2>/dev/null
+sleep 3
+killall -15 DBustest1 >/dev/null 2>&1
+sleep 1
+killall -9 DBustest1 >/dev/null 2>&1
+sleep 1
+
+cat viclog | grep "SET" | cut -d " " -f4 | sort | uniq >tmpviclist
+while read line
+do
+       echo "Check Vehicle Property is $line"
+       cat viclog | grep "SET" | cut -d " " -f1,4 | grep $line >tmpviclog
+       cat applog | grep "NOTIFY" | cut -d " " -f1,4 | grep $line >tmpapplog
+       awk -v standardvalue=1 -f checkinterspace.awk tmpviclog
+       awk -v standardvalue=1 -f checkinterspace.awk tmpapplog
+done < tmpviclist
+
+mv viclog viclogis4
+mv applog applogis4
+
+./VICReset >/dev/null 2>&1
+
+echo "=====Interspace Test(Interspace 1000, Standardata 1, Customdata 1)====="
+./DBustest1 >applog  2>/dev/null &
+sleep 1
+./VICSeq -s 1 -n 1 -i 1000 >viclog 2>/dev/null
+sleep 3
+killall -15 DBustest1 >/dev/null 2>&1
+sleep 1
+killall -9 DBustest1 >/dev/null 2>&1
+sleep 1
+
+cat viclog | grep "SET" | cut -d " " -f4 | sort | uniq >tmpviclist
+while read line
+do
+       echo "Check Vehicle Property is $line"
+       cat viclog | grep "SET" | cut -d " " -f1,4 | grep $line >tmpviclog
+       cat applog | grep "NOTIFY" | cut -d " " -f1,4 | grep $line >tmpapplog
+       awk -v standardvalue=1 -f checkinterspace.awk tmpviclog
+       awk -v standardvalue=1 -f checkinterspace.awk tmpapplog
+done < tmpviclist
+
+mv viclog viclogis5
+mv applog applogis5
+
+./VICReset >/dev/null 2>&1
+
+echo "=====Interspace Test(Interspace 1000, Standardata 4)====="
+./DBustest1 >applog  2>/dev/null &
+sleep 1
+./VICSeq -s 4 -n 0 -i 1000 >viclog 2>/dev/null
+sleep 3
+killall -15 DBustest1 >/dev/null 2>&1
+sleep 1
+killall -9 DBustest1 >/dev/null 2>&1
+sleep 1
+
+cat viclog | grep "SET" | cut -d " " -f4 | sort | uniq >tmpviclist
+while read line
+do
+       echo "Check Vehicle Property is $line"
+       cat viclog | grep "SET" | cut -d " " -f1,4 | grep $line >tmpviclog
+       cat applog | grep "NOTIFY" | cut -d " " -f1,4 | grep $line >tmpapplog
+       awk -v standardvalue=1 -f checkinterspace.awk tmpviclog
+       awk -v standardvalue=1 -f checkinterspace.awk tmpapplog
+done < tmpviclist
+
+mv viclog viclogis6
+mv applog applogis6
+
+./VICReset >/dev/null 2>&1
+
+echo "=====Interspace Test(Interspace 1000, Standardata 3, Customdata 1)====="
+./DBustest1 >applog  2>/dev/null &
+sleep 1
+./VICSeq -s 3 -n 1 -i 1000 >viclog 2>/dev/null
+sleep 3
+killall -15 DBustest1 >/dev/null 2>&1
+sleep 1
+killall -9 DBustest1 >/dev/null 2>&1
+sleep 1
+
+cat viclog | grep "SET" | cut -d " " -f4 | sort | uniq >tmpviclist
+while read line
+do
+       echo "Check Vehicle Property is $line"
+       cat viclog | grep "SET" | cut -d " " -f1,4 | grep $line >tmpviclog
+       cat applog | grep "NOTIFY" | cut -d " " -f1,4 | grep $line >tmpapplog
+       awk -v standardvalue=1 -f checkinterspace.awk tmpviclog
+       awk -v standardvalue=1 -f checkinterspace.awk tmpapplog
+done < tmpviclist
+
+mv viclog viclogis7
+mv applog applogis7
+
+./VICReset >/dev/null 2>&1
+
+echo "=====Interspace Test(Interspace 1000, Standardata 2, Customdata 2)====="
+./DBustest1 >applog  2>/dev/null &
+sleep 1
+./VICSeq -s 2 -n 2 -i 1000 >viclog 2>/dev/null
+sleep 3
+killall -15 DBustest1 >/dev/null 2>&1
+sleep 1
+killall -9 DBustest1 >/dev/null 2>&1
+sleep 1
+
+cat viclog | grep "SET" | cut -d " " -f4 | sort | uniq >tmpviclist
+while read line
+do
+       echo "Check Vehicle Property is $line"
+       cat viclog | grep "SET" | cut -d " " -f1,4 | grep $line >tmpviclog
+       cat applog | grep "NOTIFY" | cut -d " " -f1,4 | grep $line >tmpapplog
+       awk -v standardvalue=1 -f checkinterspace.awk tmpviclog
+       awk -v standardvalue=1 -f checkinterspace.awk tmpapplog
+done < tmpviclist
+
+mv viclog viclogis8
+mv applog applogis8
+
+./VICReset >/dev/null 2>&1
+
+echo "=====Interspace Test(Interspace 1000, Standardata 1, Customdata 3)====="
+./DBustest1 >applog  2>/dev/null &
+sleep 1
+./VICSeq -s 1 -n 3 -i 1000 >viclog 2>/dev/null
+sleep 3
+killall -15 DBustest1 >/dev/null 2>&1
+sleep 1
+killall -9 DBustest1 >/dev/null 2>&1
+sleep 1
+
+cat viclog | grep "SET" | cut -d " " -f4 | sort | uniq >tmpviclist
+while read line
+do
+       echo "Check Vehicle Property is $line"
+       cat viclog | grep "SET" | cut -d " " -f1,4 | grep $line >tmpviclog
+       cat applog | grep "NOTIFY" | cut -d " " -f1,4 | grep $line >tmpapplog
+       awk -v standardvalue=1 -f checkinterspace.awk tmpviclog
+       awk -v standardvalue=1 -f checkinterspace.awk tmpapplog
+done < tmpviclist
+
+mv viclog viclogis9
+mv applog applogis9
+
+./VICReset >/dev/null 2>&1
+
+echo "=====Interspace Test(Interspace 1000, Customdata 4)====="
+./DBustest1 >applog  2>/dev/null &
+sleep 1
+./VICSeq -s 0 -n 4 -i 1000 >viclog 2>/dev/null
+sleep 3
+killall -15 DBustest1 >/dev/null 2>&1
+sleep 1
+killall -9 DBustest1 >/dev/null 2>&1
+sleep 1
+
+cat viclog | grep "SET" | cut -d " " -f4 | sort | uniq >tmpviclist
+while read line
+do
+       echo "Check Vehicle Property is $line"
+       cat viclog | grep "SET" | cut -d " " -f1,4 | grep $line >tmpviclog
+       cat applog | grep "NOTIFY" | cut -d " " -f1,4 | grep $line >tmpapplog
+       awk -v standardvalue=1 -f checkinterspace.awk tmpviclog
+       awk -v standardvalue=1 -f checkinterspace.awk tmpapplog
+done < tmpviclist
+
+mv viclog viclogis10
+mv applog applogis10
+
+./VICReset >/dev/null 2>&1
+
+echo "=====Interspace Test(Interspace 500, Standarddata 1)====="
+./DBustest1 >applog  2>/dev/null &
+sleep 1
+./VICSeq -s 1 -n 0 -i 500 >viclog 2>/dev/null
+sleep 3
+killall -15 DBustest1 >/dev/null 2>&1
+sleep 1
+killall -9 DBustest1 >/dev/null 2>&1
+sleep 1
+
+cat viclog | grep "SET" | cut -d " " -f1,4 >tmpviclog
+cat applog | grep "NOTIFY" | cut -d " " -f1,4 >tmpapplog
+awk -v standardvalue=0.5 -f checkinterspace.awk tmpviclog
+awk -v standardvalue=0.5 -f checkinterspace.awk tmpapplog
+
+mv viclog viclogis11
+mv applog applogis11
+
+./VICReset >/dev/null 2>&1
+
+echo "=====Interspace Test(Interspace 500, Customdata 1)====="
+./DBustest1 >applog  2>/dev/null &
+sleep 1
+./VICSeq -s 0 -n 1 -i 500 >viclog 2>/dev/null
+sleep 3
+killall -15 DBustest1 >/dev/null 2>&1
+sleep 1
+killall -9 DBustest1 >/dev/null 2>&1
+sleep 1
+
+cat viclog | grep "SET" | cut -d " " -f1,4 >tmpviclog
+cat applog | grep "NOTIFY" | cut -d " " -f1,4 >tmpapplog
+awk -v standardvalue=0.5 -f checkinterspace.awk tmpviclog
+awk -v standardvalue=0.5 -f checkinterspace.awk tmpapplog
+
+mv viclog viclogis12
+mv applog applogis12
+
+./VICReset >/dev/null 2>&1
+
+echo "=====Interspace Test(Interspace 500, Standarddata 2)====="
+./DBustest1 >applog  2>/dev/null &
+sleep 1
+./VICSeq -s 2 -n 0 -i 500 >viclog 2>/dev/null
+sleep 3
+killall -15 DBustest1 >/dev/null 2>&1
+sleep 1
+killall -9 DBustest1 >/dev/null 2>&1
+sleep 1
+
+cat viclog | grep "SET" | cut -d " " -f4 | sort | uniq >tmpviclist
+while read line
+do
+       echo "Check Vehicle Property is $line"
+       cat viclog | grep "SET" | cut -d " " -f1,4 | grep $line >tmpviclog
+       cat applog | grep "NOTIFY" | cut -d " " -f1,4 | grep $line >tmpapplog
+       awk -v standardvalue=0.5 -f checkinterspace.awk tmpviclog
+       awk -v standardvalue=0.5 -f checkinterspace.awk tmpapplog
+done < tmpviclist
+
+mv viclog viclogis13
+mv applog applogis13
+
+./VICReset >/dev/null 2>&1
+
+echo "=====Interspace Test(Interspace 500, Customdata 2)====="
+./DBustest1 >applog  2>/dev/null &
+sleep 1
+./VICSeq -s 0 -n 2 -i 500 >viclog 2>/dev/null
+sleep 3
+killall -15 DBustest1 >/dev/null 2>&1
+sleep 1
+killall -9 DBustest1 >/dev/null 2>&1
+sleep 1
+
+cat viclog | grep "SET" | cut -d " " -f4 | sort | uniq >tmpviclist
+while read line
+do
+       echo "Check Vehicle Property is $line"
+       cat viclog | grep "SET" | cut -d " " -f1,4 | grep $line >tmpviclog
+       cat applog | grep "NOTIFY" | cut -d " " -f1,4 | grep $line >tmpapplog
+       awk -v standardvalue=0.5 -f checkinterspace.awk tmpviclog
+       awk -v standardvalue=0.5 -f checkinterspace.awk tmpapplog
+done < tmpviclist
+
+mv viclog viclogis14
+mv applog applogis14
+
+./VICReset >/dev/null 2>&1
+
+echo "=====Interspace Test(Interspace 500, Standardata 1, Customdata 1)====="
+./DBustest1 >applog  2>/dev/null &
+sleep 1
+./VICSeq -s 1 -n 1 -i 500 >viclog 2>/dev/null
+sleep 3
+killall -15 DBustest1 >/dev/null 2>&1
+sleep 1
+killall -9 DBustest1 >/dev/null 2>&1
+sleep 1
+
+cat viclog | grep "SET" | cut -d " " -f4 | sort | uniq >tmpviclist
+while read line
+do
+       echo "Check Vehicle Property is $line"
+       cat viclog | grep "SET" | cut -d " " -f1,4 | grep $line >tmpviclog
+       cat applog | grep "NOTIFY" | cut -d " " -f1,4 | grep $line >tmpapplog
+       awk -v standardvalue=0.5 -f checkinterspace.awk tmpviclog
+       awk -v standardvalue=0.5 -f checkinterspace.awk tmpapplog
+done < tmpviclist
+
+mv viclog viclogis15
+mv applog applogis15
+
+./VICReset >/dev/null 2>&1
+
+echo "=====Interspace Test(Interspace 500, Standardata 4)====="
+./DBustest1 >applog  2>/dev/null &
+sleep 1
+./VICSeq -s 4 -n 0 -i 500 >viclog 2>/dev/null
+sleep 3
+killall -15 DBustest1 >/dev/null 2>&1
+sleep 1
+killall -9 DBustest1 >/dev/null 2>&1
+sleep 1
+
+cat viclog | grep "SET" | cut -d " " -f4 | sort | uniq >tmpviclist
+while read line
+do
+       echo "Check Vehicle Property is $line"
+       cat viclog | grep "SET" | cut -d " " -f1,4 | grep $line >tmpviclog
+       cat applog | grep "NOTIFY" | cut -d " " -f1,4 | grep $line >tmpapplog
+       awk -v standardvalue=0.5 -f checkinterspace.awk tmpviclog
+       awk -v standardvalue=0.5 -f checkinterspace.awk tmpapplog
+done < tmpviclist
+
+mv viclog viclogis16
+mv applog applogis16
+
+./VICReset >/dev/null 2>&1
+
+echo "=====Interspace Test(Interspace 500, Standardata 3, Customdata 1)====="
+./DBustest1 >applog  2>/dev/null &
+sleep 1
+./VICSeq -s 3 -n 1 -i 500 >viclog 2>/dev/null
+sleep 3
+killall -15 DBustest1 >/dev/null 2>&1
+sleep 1
+killall -9 DBustest1 >/dev/null 2>&1
+sleep 1
+
+cat viclog | grep "SET" | cut -d " " -f4 | sort | uniq >tmpviclist
+while read line
+do
+       echo "Check Vehicle Property is $line"
+       cat viclog | grep "SET" | cut -d " " -f1,4 | grep $line >tmpviclog
+       cat applog | grep "NOTIFY" | cut -d " " -f1,4 | grep $line >tmpapplog
+       awk -v standardvalue=0.5 -f checkinterspace.awk tmpviclog
+       awk -v standardvalue=0.5 -f checkinterspace.awk tmpapplog
+done < tmpviclist
+
+mv viclog viclogis17
+mv applog applogis17
+
+./VICReset >/dev/null 2>&1
+
+echo "=====Interspace Test(Interspace 500, Standardata 2, Customdata 2)====="
+./DBustest1 >applog  2>/dev/null &
+sleep 1
+./VICSeq -s 2 -n 2 -i 500 >viclog 2>/dev/null
+sleep 3
+killall -15 DBustest1 >/dev/null 2>&1
+sleep 1
+killall -9 DBustest1 >/dev/null 2>&1
+sleep 1
+
+cat viclog | grep "SET" | cut -d " " -f4 | sort | uniq >tmpviclist
+while read line
+do
+       echo "Check Vehicle Property is $line"
+       cat viclog | grep "SET" | cut -d " " -f1,4 | grep $line >tmpviclog
+       cat applog | grep "NOTIFY" | cut -d " " -f1,4 | grep $line >tmpapplog
+       awk -v standardvalue=0.5 -f checkinterspace.awk tmpviclog
+       awk -v standardvalue=0.5 -f checkinterspace.awk tmpapplog
+done < tmpviclist
+
+mv viclog viclogis18
+mv applog applogis18
+
+./VICReset >/dev/null 2>&1
+
+echo "=====Interspace Test(Interspace 500, Standardata 1, Customdata 3)====="
+./DBustest1 >applog  2>/dev/null &
+sleep 1
+./VICSeq -s 1 -n 3 -i 500 >viclog 2>/dev/null
+sleep 3
+killall -15 DBustest1 >/dev/null 2>&1
+sleep 1
+killall -9 DBustest1 >/dev/null 2>&1
+sleep 1
+
+cat viclog | grep "SET" | cut -d " " -f4 | sort | uniq >tmpviclist
+while read line
+do
+       echo "Check Vehicle Property is $line"
+       cat viclog | grep "SET" | cut -d " " -f1,4 | grep $line >tmpviclog
+       cat applog | grep "NOTIFY" | cut -d " " -f1,4 | grep $line >tmpapplog
+       awk -v standardvalue=0.5 -f checkinterspace.awk tmpviclog
+       awk -v standardvalue=0.5 -f checkinterspace.awk tmpapplog
+done < tmpviclist
+
+mv viclog viclogis19
+mv applog applogis19
+
+./VICReset >/dev/null 2>&1
+
+echo "=====Interspace Test(Interspace 500, Customdata 4)====="
+./DBustest1 >applog  2>/dev/null &
+sleep 1
+./VICSeq -s 0 -n 4 -i 500 >viclog 2>/dev/null
+sleep 3
+killall -15 DBustest1 >/dev/null 2>&1
+sleep 1
+killall -9 DBustest1 >/dev/null 2>&1
+sleep 1
+
+cat viclog | grep "SET" | cut -d " " -f4 | sort | uniq >tmpviclist
+while read line
+do
+       echo "Check Vehicle Property is $line"
+       cat viclog | grep "SET" | cut -d " " -f1,4 | grep $line >tmpviclog
+       cat applog | grep "NOTIFY" | cut -d " " -f1,4 | grep $line >tmpapplog
+       awk -v standardvalue=0.5 -f checkinterspace.awk tmpviclog
+       awk -v standardvalue=0.5 -f checkinterspace.awk tmpapplog
+done < tmpviclist
+
+mv viclog viclogis20
+mv applog applogis20
+
+./VICReset >/dev/null 2>&1
+
+echo "=====Interspace Test(Interspace 100, Standarddata 1)====="
+./DBustest1 >applog  2>/dev/null &
+sleep 1
+./VICSeq -s 1 -n 0 -i 100 >viclog 2>/dev/null
+sleep 3
+killall -15 DBustest1 >/dev/null 2>&1
+sleep 1
+killall -9 DBustest1 >/dev/null 2>&1
+sleep 1
+
+cat viclog | grep "SET" | cut -d " " -f1,4 >tmpviclog
+cat applog | grep "NOTIFY" | cut -d " " -f1,4 >tmpapplog
+awk -v standardvalue=0.1 -f checkinterspace.awk tmpviclog
+awk -v standardvalue=0.1 -f checkinterspace.awk tmpapplog
+
+mv viclog viclogis21
+mv applog applogis21
+
+./VICReset >/dev/null 2>&1
+
+echo "=====Interspace Test(Interspace 100, Customdata 1)====="
+./DBustest1 >applog  2>/dev/null &
+sleep 1
+./VICSeq -s 0 -n 1 -i 100 >viclog 2>/dev/null
+sleep 3
+killall -15 DBustest1 >/dev/null 2>&1
+sleep 1
+killall -9 DBustest1 >/dev/null 2>&1
+sleep 1
+
+cat viclog | grep "SET" | cut -d " " -f1,4 >tmpviclog
+cat applog | grep "NOTIFY" | cut -d " " -f1,4 >tmpapplog
+awk -v standardvalue=0.1 -f checkinterspace.awk tmpviclog
+awk -v standardvalue=0.1 -f checkinterspace.awk tmpapplog
+
+mv viclog viclogis22
+mv applog applogis22
+
+./VICReset >/dev/null 2>&1
+
+echo "=====Interspace Test(Interspace 100, Standarddata 2)====="
+./DBustest1 >applog  2>/dev/null &
+sleep 1
+./VICSeq -s 2 -n 0 -i 100 >viclog 2>/dev/null
+sleep 3
+killall -15 DBustest1 >/dev/null 2>&1
+sleep 1
+killall -9 DBustest1 >/dev/null 2>&1
+sleep 1
+
+cat viclog | grep "SET" | cut -d " " -f4 | sort | uniq >tmpviclist
+while read line
+do
+       echo "Check Vehicle Property is $line"
+       cat viclog | grep "SET" | cut -d " " -f1,4 | grep $line >tmpviclog
+       cat applog | grep "NOTIFY" | cut -d " " -f1,4 | grep $line >tmpapplog
+       awk -v standardvalue=0.1 -f checkinterspace.awk tmpviclog
+       awk -v standardvalue=0.1 -f checkinterspace.awk tmpapplog
+done < tmpviclist
+
+mv viclog viclogis23
+mv applog applogis23
+
+./VICReset >/dev/null 2>&1
+
+echo "=====Interspace Test(Interspace 100, Customdata 2)====="
+./DBustest1 >applog  2>/dev/null &
+sleep 1
+./VICSeq -s 0 -n 2 -i 100 >viclog 2>/dev/null
+sleep 3
+killall -15 DBustest1 >/dev/null 2>&1
+sleep 1
+killall -9 DBustest1 >/dev/null 2>&1
+sleep 1
+
+cat viclog | grep "SET" | cut -d " " -f4 | sort | uniq >tmpviclist
+while read line
+do
+       echo "Check Vehicle Property is $line"
+       cat viclog | grep "SET" | cut -d " " -f1,4 | grep $line >tmpviclog
+       cat applog | grep "NOTIFY" | cut -d " " -f1,4 | grep $line >tmpapplog
+       awk -v standardvalue=0.1 -f checkinterspace.awk tmpviclog
+       awk -v standardvalue=0.1 -f checkinterspace.awk tmpapplog
+done < tmpviclist
+
+mv viclog viclogis24
+mv applog applogis24
+
+./VICReset >/dev/null 2>&1
+
+echo "=====Interspace Test(Interspace 100, Standardata 1, Customdata 1)====="
+./DBustest1 >applog  2>/dev/null &
+sleep 1
+./VICSeq -s 1 -n 1 -i 100 >viclog 2>/dev/null
+sleep 3
+killall -15 DBustest1 >/dev/null 2>&1
+sleep 1
+killall -9 DBustest1 >/dev/null 2>&1
+sleep 1
+
+cat viclog | grep "SET" | cut -d " " -f4 | sort | uniq >tmpviclist
+while read line
+do
+       echo "Check Vehicle Property is $line"
+       cat viclog | grep "SET" | cut -d " " -f1,4 | grep $line >tmpviclog
+       cat applog | grep "NOTIFY" | cut -d " " -f1,4 | grep $line >tmpapplog
+       awk -v standardvalue=0.1 -f checkinterspace.awk tmpviclog
+       awk -v standardvalue=0.1 -f checkinterspace.awk tmpapplog
+done < tmpviclist
+
+mv viclog viclogis25
+mv applog applogis25
+
+./VICReset >/dev/null 2>&1
+
+echo "=====Interspace Test(Interspace 100, Standardata 4)====="
+./DBustest1 >applog  2>/dev/null &
+sleep 1
+./VICSeq -s 4 -n 0 -i 100 >viclog 2>/dev/null
+sleep 3
+killall -15 DBustest1 >/dev/null 2>&1
+sleep 1
+killall -9 DBustest1 >/dev/null 2>&1
+sleep 1
+
+cat viclog | grep "SET" | cut -d " " -f4 | sort | uniq >tmpviclist
+while read line
+do
+       echo "Check Vehicle Property is $line"
+       cat viclog | grep "SET" | cut -d " " -f1,4 | grep $line >tmpviclog
+       cat applog | grep "NOTIFY" | cut -d " " -f1,4 | grep $line >tmpapplog
+       awk -v standardvalue=0.1 -f checkinterspace.awk tmpviclog
+       awk -v standardvalue=0.1 -f checkinterspace.awk tmpapplog
+done < tmpviclist
+
+mv viclog viclogis26
+mv applog applogis26
+
+./VICReset >/dev/null 2>&1
+
+echo "=====Interspace Test(Interspace 100, Standardata 3, Customdata 1)====="
+./DBustest1 >applog  2>/dev/null &
+sleep 1
+./VICSeq -s 3 -n 1 -i 100 >viclog 2>/dev/null
+sleep 3
+killall -15 DBustest1 >/dev/null 2>&1
+sleep 1
+killall -9 DBustest1 >/dev/null 2>&1
+sleep 1
+
+cat viclog | grep "SET" | cut -d " " -f4 | sort | uniq >tmpviclist
+while read line
+do
+       echo "Check Vehicle Property is $line"
+       cat viclog | grep "SET" | cut -d " " -f1,4 | grep $line >tmpviclog
+       cat applog | grep "NOTIFY" | cut -d " " -f1,4 | grep $line >tmpapplog
+       awk -v standardvalue=0.1 -f checkinterspace.awk tmpviclog
+       awk -v standardvalue=0.1 -f checkinterspace.awk tmpapplog
+done < tmpviclist
+
+mv viclog viclogis27
+mv applog applogis27
+
+./VICReset >/dev/null 2>&1
+
+echo "=====Interspace Test(Interspace 100, Standardata 2, Customdata 2)====="
+./DBustest1 >applog  2>/dev/null &
+sleep 1
+./VICSeq -s 2 -n 2 -i 100 >viclog 2>/dev/null
+sleep 3
+killall -15 DBustest1 >/dev/null 2>&1
+sleep 1
+killall -9 DBustest1 >/dev/null 2>&1
+sleep 1
+
+cat viclog | grep "SET" | cut -d " " -f4 | sort | uniq >tmpviclist
+while read line
+do
+       echo "Check Vehicle Property is $line"
+       cat viclog | grep "SET" | cut -d " " -f1,4 | grep $line >tmpviclog
+       cat applog | grep "NOTIFY" | cut -d " " -f1,4 | grep $line >tmpapplog
+       awk -v standardvalue=0.1 -f checkinterspace.awk tmpviclog
+       awk -v standardvalue=0.1 -f checkinterspace.awk tmpapplog
+done < tmpviclist
+
+mv viclog viclogis28
+mv applog applogis28
+
+./VICReset >/dev/null 2>&1
+
+echo "=====Interspace Test(Interspace 100, Standardata 1, Customdata 3)====="
+./DBustest1 >applog  2>/dev/null &
+sleep 1
+./VICSeq -s 1 -n 3 -i 100 >viclog 2>/dev/null
+sleep 3
+killall -15 DBustest1 >/dev/null 2>&1
+sleep 1
+killall -9 DBustest1 >/dev/null 2>&1
+sleep 1
+
+cat viclog | grep "SET" | cut -d " " -f4 | sort | uniq >tmpviclist
+while read line
+do
+       echo "Check Vehicle Property is $line"
+       cat viclog | grep "SET" | cut -d " " -f1,4 | grep $line >tmpviclog
+       cat applog | grep "NOTIFY" | cut -d " " -f1,4 | grep $line >tmpapplog
+       awk -v standardvalue=0.1 -f checkinterspace.awk tmpviclog
+       awk -v standardvalue=0.1 -f checkinterspace.awk tmpapplog
+done < tmpviclist
+
+mv viclog viclogis29
+mv applog applogis29
+
+./VICReset >/dev/null 2>&1
+
+echo "=====Interspace Test(Interspace 100, Customdata 4)====="
+./DBustest1 >applog  2>/dev/null &
+sleep 1
+./VICSeq -s 0 -n 4 -i 100 >viclog 2>/dev/null
+sleep 3
+killall -15 DBustest1 >/dev/null 2>&1
+sleep 1
+killall -9 DBustest1 >/dev/null 2>&1
+sleep 1
+
+cat viclog | grep "SET" | cut -d " " -f4 | sort | uniq >tmpviclist
+while read line
+do
+       echo "Check Vehicle Property is $line"
+       cat viclog | grep "SET" | cut -d " " -f1,4 | grep $line >tmpviclog
+       cat applog | grep "NOTIFY" | cut -d " " -f1,4 | grep $line >tmpapplog
+       awk -v standardvalue=0.1 -f checkinterspace.awk tmpviclog
+       awk -v standardvalue=0.1 -f checkinterspace.awk tmpapplog
+done < tmpviclist
+
+mv viclog viclogis30
+mv applog applogis30
+
+echo "=====Interspace Test(Interspace 50, Standarddata 1)====="
+./DBustest1 >applog  2>/dev/null &
+sleep 1
+./VICSeq -s 1 -n 0 -i 50 >viclog 2>/dev/null
+sleep 3
+killall -15 DBustest1 >/dev/null 2>&1
+sleep 1
+killall -9 DBustest1 >/dev/null 2>&1
+sleep 1
+
+cat viclog | grep "SET" | cut -d " " -f1,4 >tmpviclog
+cat applog | grep "NOTIFY" | cut -d " " -f1,4 >tmpapplog
+awk -v standardvalue=0.05 -f checkinterspace.awk tmpviclog
+awk -v standardvalue=0.05 -f checkinterspace.awk tmpapplog
+
+mv viclog viclogis31
+mv applog applogis31
+
+./VICReset >/dev/null 2>&1
+
+echo "=====Interspace Test(Interspace 50, Customdata 1)====="
+./DBustest1 >applog  2>/dev/null &
+sleep 1
+./VICSeq -s 0 -n 1 -i 50 >viclog 2>/dev/null
+sleep 3
+killall -15 DBustest1 >/dev/null 2>&1
+sleep 1
+killall -9 DBustest1 >/dev/null 2>&1
+sleep 1
+
+cat viclog | grep "SET" | cut -d " " -f1,4 >tmpviclog
+cat applog | grep "NOTIFY" | cut -d " " -f1,4 >tmpapplog
+awk -v standardvalue=0.05 -f checkinterspace.awk tmpviclog
+awk -v standardvalue=0.05 -f checkinterspace.awk tmpapplog
+
+mv viclog viclogis32
+mv applog applogis32
+
+./VICReset >/dev/null 2>&1
+
+echo "=====Interspace Test(Interspace 50, Standarddata 2)====="
+./DBustest1 >applog  2>/dev/null &
+sleep 1
+./VICSeq -s 2 -n 0 -i 50 >viclog 2>/dev/null
+sleep 3
+killall -15 DBustest1 >/dev/null 2>&1
+sleep 1
+killall -9 DBustest1 >/dev/null 2>&1
+sleep 1
+
+cat viclog | grep "SET" | cut -d " " -f4 | sort | uniq >tmpviclist
+while read line
+do
+       echo "Check Vehicle Property is $line"
+       cat viclog | grep "SET" | cut -d " " -f1,4 | grep $line >tmpviclog
+       cat applog | grep "NOTIFY" | cut -d " " -f1,4 | grep $line >tmpapplog
+       awk -v standardvalue=0.05 -f checkinterspace.awk tmpviclog
+       awk -v standardvalue=0.05 -f checkinterspace.awk tmpapplog
+done < tmpviclist
+
+mv viclog viclogis33
+mv applog applogis33
+
+./VICReset >/dev/null 2>&1
+
+echo "=====Interspace Test(Interspace 50, Customdata 2)====="
+./DBustest1 >applog  2>/dev/null &
+sleep 1
+./VICSeq -s 0 -n 2 -i 50 >viclog 2>/dev/null
+sleep 3
+killall -15 DBustest1 >/dev/null 2>&1
+sleep 1
+killall -9 DBustest1 >/dev/null 2>&1
+sleep 1
+
+cat viclog | grep "SET" | cut -d " " -f4 | sort | uniq >tmpviclist
+while read line
+do
+       echo "Check Vehicle Property is $line"
+       cat viclog | grep "SET" | cut -d " " -f1,4 | grep $line >tmpviclog
+       cat applog | grep "NOTIFY" | cut -d " " -f1,4 | grep $line >tmpapplog
+       awk -v standardvalue=0.05 -f checkinterspace.awk tmpviclog
+       awk -v standardvalue=0.05 -f checkinterspace.awk tmpapplog
+done < tmpviclist
+
+mv viclog viclogis34
+mv applog applogis34
+
+./VICReset >/dev/null 2>&1
+
+echo "=====Interspace Test(Interspace 50, Standardata 1, Customdata 1)====="
+./DBustest1 >applog  2>/dev/null &
+sleep 1
+./VICSeq -s 1 -n 1 -i 50 >viclog 2>/dev/null
+sleep 3
+killall -15 DBustest1 >/dev/null 2>&1
+sleep 1
+killall -9 DBustest1 >/dev/null 2>&1
+sleep 1
+
+cat viclog | grep "SET" | cut -d " " -f4 | sort | uniq >tmpviclist
+while read line
+do
+       echo "Check Vehicle Property is $line"
+       cat viclog | grep "SET" | cut -d " " -f1,4 | grep $line >tmpviclog
+       cat applog | grep "NOTIFY" | cut -d " " -f1,4 | grep $line >tmpapplog
+       awk -v standardvalue=0.05 -f checkinterspace.awk tmpviclog
+       awk -v standardvalue=0.05 -f checkinterspace.awk tmpapplog
+done < tmpviclist
+
+mv viclog viclogis35
+mv applog applogis35
+
+./VICReset >/dev/null 2>&1
+
+echo "=====Interspace Test(Interspace 50, Standardata 4)====="
+./DBustest1 >applog  2>/dev/null &
+sleep 1
+./VICSeq -s 4 -n 0 -i 50 >viclog 2>/dev/null
+sleep 3
+killall -15 DBustest1 >/dev/null 2>&1
+sleep 1
+killall -9 DBustest1 >/dev/null 2>&1
+sleep 1
+
+cat viclog | grep "SET" | cut -d " " -f4 | sort | uniq >tmpviclist
+while read line
+do
+       echo "Check Vehicle Property is $line"
+       cat viclog | grep "SET" | cut -d " " -f1,4 | grep $line >tmpviclog
+       cat applog | grep "NOTIFY" | cut -d " " -f1,4 | grep $line >tmpapplog
+       awk -v standardvalue=0.05 -f checkinterspace.awk tmpviclog
+       awk -v standardvalue=0.05 -f checkinterspace.awk tmpapplog
+done < tmpviclist
+
+mv viclog viclogis36
+mv applog applogis36
+
+./VICReset >/dev/null 2>&1
+
+echo "=====Interspace Test(Interspace 50, Standardata 3, Customdata 1)====="
+./DBustest1 >applog  2>/dev/null &
+sleep 1
+./VICSeq -s 3 -n 1 -i 50 >viclog 2>/dev/null
+sleep 3
+killall -15 DBustest1 >/dev/null 2>&1
+sleep 1
+killall -9 DBustest1 >/dev/null 2>&1
+sleep 1
+
+cat viclog | grep "SET" | cut -d " " -f4 | sort | uniq >tmpviclist
+while read line
+do
+       echo "Check Vehicle Property is $line"
+       cat viclog | grep "SET" | cut -d " " -f1,4 | grep $line >tmpviclog
+       cat applog | grep "NOTIFY" | cut -d " " -f1,4 | grep $line >tmpapplog
+       awk -v standardvalue=0.05 -f checkinterspace.awk tmpviclog
+       awk -v standardvalue=0.05 -f checkinterspace.awk tmpapplog
+done < tmpviclist
+
+mv viclog viclogis37
+mv applog applogis37
+
+./VICReset >/dev/null 2>&1
+
+echo "=====Interspace Test(Interspace 50, Standardata 2, Customdata 2)====="
+./DBustest1 >applog  2>/dev/null &
+sleep 1
+./VICSeq -s 2 -n 2 -i 50 >viclog 2>/dev/null
+sleep 3
+killall -15 DBustest1 >/dev/null 2>&1
+sleep 1
+killall -9 DBustest1 >/dev/null 2>&1
+sleep 1
+
+cat viclog | grep "SET" | cut -d " " -f4 | sort | uniq >tmpviclist
+while read line
+do
+       echo "Check Vehicle Property is $line"
+       cat viclog | grep "SET" | cut -d " " -f1,4 | grep $line >tmpviclog
+       cat applog | grep "NOTIFY" | cut -d " " -f1,4 | grep $line >tmpapplog
+       awk -v standardvalue=0.05 -f checkinterspace.awk tmpviclog
+       awk -v standardvalue=0.05 -f checkinterspace.awk tmpapplog
+done < tmpviclist
+
+mv viclog viclogis38
+mv applog applogis38
+
+./VICReset >/dev/null 2>&1
+
+echo "=====Interspace Test(Interspace 50, Standardata 1, Customdata 3)====="
+./DBustest1 >applog  2>/dev/null &
+sleep 1
+./VICSeq -s 1 -n 3 -i 50 >viclog 2>/dev/null
+sleep 3
+killall -15 DBustest1 >/dev/null 2>&1
+sleep 1
+killall -9 DBustest1 >/dev/null 2>&1
+sleep 1
+
+cat viclog | grep "SET" | cut -d " " -f4 | sort | uniq >tmpviclist
+while read line
+do
+       echo "Check Vehicle Property is $line"
+       cat viclog | grep "SET" | cut -d " " -f1,4 | grep $line >tmpviclog
+       cat applog | grep "NOTIFY" | cut -d " " -f1,4 | grep $line >tmpapplog
+       awk -v standardvalue=0.05 -f checkinterspace.awk tmpviclog
+       awk -v standardvalue=0.05 -f checkinterspace.awk tmpapplog
+done < tmpviclist
+
+mv viclog viclogis39
+mv applog applogis39
+
+./VICReset >/dev/null 2>&1
+
+echo "=====Interspace Test(Interspace 50, Customdata 4)====="
+./DBustest1 >applog  2>/dev/null &
+sleep 1
+./VICSeq -s 0 -n 4 -i 50 >viclog 2>/dev/null
+sleep 3
+killall -15 DBustest1 >/dev/null 2>&1
+sleep 1
+killall -9 DBustest1 >/dev/null 2>&1
+sleep 1
+
+cat viclog | grep "SET" | cut -d " " -f4 | sort | uniq >tmpviclist
+while read line
+do
+       echo "Check Vehicle Property is $line"
+       cat viclog | grep "SET" | cut -d " " -f1,4 | grep $line >tmpviclog
+       cat applog | grep "NOTIFY" | cut -d " " -f1,4 | grep $line >tmpapplog
+       awk -v standardvalue=0.05 -f checkinterspace.awk tmpviclog
+       awk -v standardvalue=0.05 -f checkinterspace.awk tmpapplog
+done < tmpviclist
+
+mv viclog viclogis40
+mv applog applogis40
+
+echo "=====Interspace Test(Interspace 24, Standarddata 1)====="
+./DBustest1 >applog  2>/dev/null &
+sleep 1
+./VICSeq -s 1 -n 0 -i 24 >viclog 2>/dev/null
+sleep 3
+killall -15 DBustest1 >/dev/null 2>&1
+sleep 1
+killall -9 DBustest1 >/dev/null 2>&1
+sleep 1
+
+cat viclog | grep "SET" | cut -d " " -f1,4 >tmpviclog
+cat applog | grep "NOTIFY" | cut -d " " -f1,4 >tmpapplog
+awk -v standardvalue=0.024 -f checkinterspace.awk tmpviclog
+awk -v standardvalue=0.024 -f checkinterspace.awk tmpapplog
+
+mv viclog viclogis41
+mv applog applogis41
+
+./VICReset >/dev/null 2>&1
+
+echo "=====Interspace Test(Interspace 24, Customdata 1)====="
+./DBustest1 >applog  2>/dev/null &
+sleep 1
+./VICSeq -s 0 -n 1 -i 24 >viclog 2>/dev/null
+sleep 3
+killall -15 DBustest1 >/dev/null 2>&1
+sleep 1
+killall -9 DBustest1 >/dev/null 2>&1
+sleep 1
+
+cat viclog | grep "SET" | cut -d " " -f1,4 >tmpviclog
+cat applog | grep "NOTIFY" | cut -d " " -f1,4 >tmpapplog
+awk -v standardvalue=0.024 -f checkinterspace.awk tmpviclog
+awk -v standardvalue=0.024 -f checkinterspace.awk tmpapplog
+
+mv viclog viclogis42
+mv applog applogis42
+
+./VICReset >/dev/null 2>&1
+
+echo "=====Interspace Test(Interspace 24, Standarddata 2)====="
+./DBustest1 >applog  2>/dev/null &
+sleep 1
+./VICSeq -s 2 -n 0 -i 24 >viclog 2>/dev/null
+sleep 3
+killall -15 DBustest1 >/dev/null 2>&1
+sleep 1
+killall -9 DBustest1 >/dev/null 2>&1
+sleep 1
+
+cat viclog | grep "SET" | cut -d " " -f4 | sort | uniq >tmpviclist
+while read line
+do
+       echo "Check Vehicle Property is $line"
+       cat viclog | grep "SET" | cut -d " " -f1,4 | grep $line >tmpviclog
+       cat applog | grep "NOTIFY" | cut -d " " -f1,4 | grep $line >tmpapplog
+       awk -v standardvalue=0.024 -f checkinterspace.awk tmpviclog
+       awk -v standardvalue=0.024 -f checkinterspace.awk tmpapplog
+done < tmpviclist
+
+mv viclog viclogis43
+mv applog applogis43
+
+./VICReset >/dev/null 2>&1
+
+echo "=====Interspace Test(Interspace 24, Customdata 2)====="
+./DBustest1 >applog  2>/dev/null &
+sleep 1
+./VICSeq -s 0 -n 2 -i 24 >viclog 2>/dev/null
+sleep 3
+killall -15 DBustest1 >/dev/null 2>&1
+sleep 1
+killall -9 DBustest1 >/dev/null 2>&1
+sleep 1
+
+cat viclog | grep "SET" | cut -d " " -f4 | sort | uniq >tmpviclist
+while read line
+do
+       echo "Check Vehicle Property is $line"
+       cat viclog | grep "SET" | cut -d " " -f1,4 | grep $line >tmpviclog
+       cat applog | grep "NOTIFY" | cut -d " " -f1,4 | grep $line >tmpapplog
+       awk -v standardvalue=0.024 -f checkinterspace.awk tmpviclog
+       awk -v standardvalue=0.024 -f checkinterspace.awk tmpapplog
+done < tmpviclist
+
+mv viclog viclogis44
+mv applog applogis44
+
+./VICReset >/dev/null 2>&1
+
+echo "=====Interspace Test(Interspace 24, Standardata 1, Customdata 1)====="
+./DBustest1 >applog  2>/dev/null &
+sleep 1
+./VICSeq -s 1 -n 1 -i 24 >viclog 2>/dev/null
+sleep 3
+killall -15 DBustest1 >/dev/null 2>&1
+sleep 1
+killall -9 DBustest1 >/dev/null 2>&1
+sleep 1
+
+cat viclog | grep "SET" | cut -d " " -f4 | sort | uniq >tmpviclist
+while read line
+do
+       echo "Check Vehicle Property is $line"
+       cat viclog | grep "SET" | cut -d " " -f1,4 | grep $line >tmpviclog
+       cat applog | grep "NOTIFY" | cut -d " " -f1,4 | grep $line >tmpapplog
+       awk -v standardvalue=0.024 -f checkinterspace.awk tmpviclog
+       awk -v standardvalue=0.024 -f checkinterspace.awk tmpapplog
+done < tmpviclist
+
+mv viclog viclogis45
+mv applog applogis45
+
+./VICReset >/dev/null 2>&1
+
+echo "=====Interspace Test(Interspace 24, Standardata 4)====="
+./DBustest1 >applog  2>/dev/null &
+sleep 1
+./VICSeq -s 4 -n 0 -i 24 >viclog 2>/dev/null
+sleep 3
+killall -15 DBustest1 >/dev/null 2>&1
+sleep 1
+killall -9 DBustest1 >/dev/null 2>&1
+sleep 1
+
+cat viclog | grep "SET" | cut -d " " -f4 | sort | uniq >tmpviclist
+while read line
+do
+       echo "Check Vehicle Property is $line"
+       cat viclog | grep "SET" | cut -d " " -f1,4 | grep $line >tmpviclog
+       cat applog | grep "NOTIFY" | cut -d " " -f1,4 | grep $line >tmpapplog
+       awk -v standardvalue=0.024 -f checkinterspace.awk tmpviclog
+       awk -v standardvalue=0.024 -f checkinterspace.awk tmpapplog
+done < tmpviclist
+
+mv viclog viclogis46
+mv applog applogis46
+
+./VICReset >/dev/null 2>&1
+
+echo "=====Interspace Test(Interspace 24, Standardata 3, Customdata 1)====="
+./DBustest1 >applog  2>/dev/null &
+sleep 1
+./VICSeq -s 3 -n 1 -i 24 >viclog 2>/dev/null
+sleep 3
+killall -15 DBustest1 >/dev/null 2>&1
+sleep 1
+killall -9 DBustest1 >/dev/null 2>&1
+sleep 1
+
+cat viclog | grep "SET" | cut -d " " -f4 | sort | uniq >tmpviclist
+while read line
+do
+       echo "Check Vehicle Property is $line"
+       cat viclog | grep "SET" | cut -d " " -f1,4 | grep $line >tmpviclog
+       cat applog | grep "NOTIFY" | cut -d " " -f1,4 | grep $line >tmpapplog
+       awk -v standardvalue=0.024 -f checkinterspace.awk tmpviclog
+       awk -v standardvalue=0.024 -f checkinterspace.awk tmpapplog
+done < tmpviclist
+
+mv viclog viclogis47
+mv applog applogis47
+
+./VICReset >/dev/null 2>&1
+
+echo "=====Interspace Test(Interspace 24, Standardata 2, Customdata 2)====="
+./DBustest1 >applog  2>/dev/null &
+sleep 1
+./VICSeq -s 2 -n 2 -i 24 >viclog 2>/dev/null
+sleep 3
+killall -15 DBustest1 >/dev/null 2>&1
+sleep 1
+killall -9 DBustest1 >/dev/null 2>&1
+sleep 1
+
+cat viclog | grep "SET" | cut -d " " -f4 | sort | uniq >tmpviclist
+while read line
+do
+       echo "Check Vehicle Property is $line"
+       cat viclog | grep "SET" | cut -d " " -f1,4 | grep $line >tmpviclog
+       cat applog | grep "NOTIFY" | cut -d " " -f1,4 | grep $line >tmpapplog
+       awk -v standardvalue=0.024 -f checkinterspace.awk tmpviclog
+       awk -v standardvalue=0.024 -f checkinterspace.awk tmpapplog
+done < tmpviclist
+
+mv viclog viclogis48
+mv applog applogis48
+
+./VICReset >/dev/null 2>&1
+
+echo "=====Interspace Test(Interspace 24, Standardata 1, Customdata 3)====="
+./DBustest1 >applog  2>/dev/null &
+sleep 1
+./VICSeq -s 1 -n 3 -i 24 >viclog 2>/dev/null
+sleep 3
+killall -15 DBustest1 >/dev/null 2>&1
+sleep 1
+killall -9 DBustest1 >/dev/null 2>&1
+sleep 1
+
+cat viclog | grep "SET" | cut -d " " -f4 | sort | uniq >tmpviclist
+while read line
+do
+       echo "Check Vehicle Property is $line"
+       cat viclog | grep "SET" | cut -d " " -f1,4 | grep $line >tmpviclog
+       cat applog | grep "NOTIFY" | cut -d " " -f1,4 | grep $line >tmpapplog
+       awk -v standardvalue=0.024 -f checkinterspace.awk tmpviclog
+       awk -v standardvalue=0.024 -f checkinterspace.awk tmpapplog
+done < tmpviclist
+
+mv viclog viclogis49
+mv applog applogis49
+
+./VICReset >/dev/null 2>&1
+
+echo "=====Interspace Test(Interspace 24, Customdata 4)====="
+./DBustest1 >applog  2>/dev/null &
+sleep 1
+./VICSeq -s 0 -n 4 -i 24 >viclog 2>/dev/null
+sleep 3
+killall -15 DBustest1 >/dev/null 2>&1
+sleep 1
+killall -9 DBustest1 >/dev/null 2>&1
+sleep 1
+
+cat viclog | grep "SET" | cut -d " " -f4 | sort | uniq >tmpviclist
+while read line
+do
+       echo "Check Vehicle Property is $line"
+       cat viclog | grep "SET" | cut -d " " -f1,4 | grep $line >tmpviclog
+       cat applog | grep "NOTIFY" | cut -d " " -f1,4 | grep $line >tmpapplog
+       awk -v standardvalue=0.024 -f checkinterspace.awk tmpviclog
+       awk -v standardvalue=0.024 -f checkinterspace.awk tmpapplog
+done < tmpviclist
+
+mv viclog viclogis50
+mv applog applogis50
+
+./VICReset >/dev/null 2>&1
+
+mv viclog* log/
+mv applog* log/
+
+#End script
diff --git a/tests/configamb.cc b/tests/configamb.cc
deleted file mode 100644 (file)
index 1012ff1..0000000
+++ /dev/null
@@ -1,122 +0,0 @@
-#include <string.h>
-
-#include <fstream>
-#include <iostream>
-#include <stdexcept>
-
-#include <json/json.h>
-
-#include "debugout.h"
-
-#include "configamb.h"
-
-using std::string;
-using std::vector;
-
-ConfigAMB::ConfigAMB() :
-        port(23000)
-{
-}
-
-ConfigAMB::~ConfigAMB()
-{
-}
-
-std::string
-ConfigAMB::getAMBformatPath()
-{
-    return ambformatpath;
-}
-
-int
-ConfigAMB::getPort()
-{
-    return port;
-}
-
-bool
-ConfigAMB::readConfig(std::string confpath)
-{
-    std::ifstream in(confpath, std::ios::in);
-    std::string output;
-    std::string line;
-    while (in.good()) {
-        getline(in, line);
-        output.append(line);
-    }
-    return parseJson(output);
-}
-
-bool
-ConfigAMB::parseJson(string config)
-{
-    bool ret = false;
-    json_object *rootobject;
-    json_tokener *tokener = json_tokener_new();
-    enum json_tokener_error err;
-    do {
-        rootobject = json_tokener_parse_ex(tokener, config.c_str(),
-                                           config.length());
-    } while ((err = json_tokener_get_error(tokener)) == json_tokener_continue);
-
-    if (err != json_tokener_success) {
-        std::cerr << "Error: " << json_tokener_error_desc(err) << "\n";
-        return ret;
-    }
-    json_object *configobject = json_object_object_get(rootobject, "sources");
-    if (!configobject) {
-        std::cerr << "Error getting ConfigAMB\n";
-        return ret;
-    }
-    array_list *configlist = json_object_get_array(configobject);
-    for (int i = 0; i < array_list_length(configlist); i++) {
-        json_object *obj = reinterpret_cast<json_object*>(array_list_get_idx(
-                configlist, i));
-        json_object *nameobj = json_object_object_get(obj, "name");
-        if ("VehicleSource" != string(json_object_get_string(nameobj))) {
-            std::cout << "Loop:" << json_object_get_string(nameobj) << "\n";
-            continue;
-        }
-        json_object *conffileobj = json_object_object_get(obj, "configfile");
-        if (!conffileobj) {
-            std::cerr << "Error: conffileobj = NULL" << std::endl;
-            break;
-        }
-        else {
-            ambformatpath = std::string(json_object_get_string(conffileobj));
-        }
-        ret = true;
-        break;
-    }
-    if (!ret) {
-        std::cerr << "Can't find AMBformat path.\n";
-        return ret;
-    }
-
-    configobject = json_object_object_get(rootobject, "sinks");
-    if (!configobject) {
-        std::cerr << "Error getting ConfigAMB\n";
-        return ret;
-    }
-    configlist = json_object_get_array(configobject);
-    for (int i = 0; i < array_list_length(configlist); i++) {
-        json_object *obj = reinterpret_cast<json_object*>(array_list_get_idx(
-                configlist, i));
-        json_object *nameobj = json_object_object_get(obj, "name");
-        if ("WebsocketSink" != string(json_object_get_string(nameobj))) {
-            continue;
-        }
-        json_object *portobj = json_object_object_get(obj, "port");
-        if (!portobj) {
-            port = 23000;
-            std::cout << "Default Port = " << port << std::endl;
-        }
-        else {
-            port = json_object_get_int(portobj);
-            std::cout << "Read Port = " << port << std::endl;
-        }
-        ret = true;
-        break;
-    }
-    return ret;
-}
diff --git a/tests/configamb.h b/tests/configamb.h
deleted file mode 100644 (file)
index 6f80482..0000000
+++ /dev/null
@@ -1,55 +0,0 @@
-/**
- * Copyright (C) 2012  TOYOTA MOTOR CORPORATION.
- * 
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 2.1 of the License, or (at your option) any later version.
- * 
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
- * Lesser General Public License for more details.
- * 
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
- * 
- */
-#ifndef CONFIGAPP_H
-#define CONFIGAPP_H
-
-#include <string>
-#include <vector>
-
-#include "ambconfig.h"
-
-/**
- * This class handles the data in the configuration file.
- */
-class ConfigAMB {
-public:
-    /**
-     * Constructor.
-     */
-    ConfigAMB();
-    /**
-     * Destructor.
-     */
-    ~ConfigAMB();
-    bool
-    readConfig(std::string confpath);
-
-    int
-    getPort();
-
-    std::string
-    getAMBformatPath();
-private:
-    bool
-    parseJson(std::string config);
-
-    std::string ambformatpath;
-    int port;
-};
-#endif // #ifndef CONFIGAPP_H
index bdc36a6..2bdab47 100644 (file)
-/**
- * Copyright (C) 2012  TOYOTA MOTOR CORPORATION.
- * 
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 2.1 of the License, or (at your option) any later version.
- * 
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
- * Lesser General Public License for more details.
- * 
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
- * 
- */
-#include <string.h>
-#include <unistd.h>
-
+#include <cstdio>
 #include <iostream>
-#include <sstream>
-
-#include "debugout.h"
+#include <sys/time.h>
 
-#include "config.h"
-#include "controlwebsocketclient.h"
 #include "datamessage.h"
-#include "eventmessage.h"
-#include "messageformat.h"
 
-pthread_mutex_t ControlWebsocketClient::mutex_scenario =
-        PTHREAD_MUTEX_INITIALIZER;
-pthread_cond_t ControlWebsocketClient::cond_scenario = PTHREAD_COND_INITIALIZER;
-std::string ControlWebsocketClient::vehiclename_scenario = "";
-void *ControlWebsocketClient::wsi[4] = {NULL, NULL, NULL, NULL};
+#include "controlwebsocketclient.h"
 
-ControlWebsocketClient::ControlWebsocketClient()
-{
-    mutex = PTHREAD_MUTEX_INITIALIZER;
+ControlWebsocketClient::ControlWebsocketClient() 
+: context_(NULL), wsid_(NULL), fd_(0) {
 }
 
-ControlWebsocketClient::~ControlWebsocketClient()
-{
+ControlWebsocketClient::~ControlWebsocketClient() {
 }
 
-bool
-ControlWebsocketClient::initialize(int port,
-                                   enum ControlWebsocket::ServerProtocol stype)
-{
-    DebugOut(10) << "ControlWebsocketClient initialize.(" << port << ")\n";
-    type = stype;
-    stringstream address, protocol;
-    address.str("");
-    address << "ws://127.0.0.1:" << port;
-    protocol.str("");
-    switch (type) {
-    case ControlWebsocket::DATA_STANDARD:
-    {
-        protocol << "standarddatamessage-only";
-        break;
-    }
-    case ControlWebsocket::CONTROL_STANDARD:
-    {
-        protocol << "standardcontrolmessage-only";
-        break;
-    }
-    case ControlWebsocket::DATA_CUSTOM:
-    {
-        protocol << "customdatamessage-only";
-        break;
-    }
-    case ControlWebsocket::CONTROL_CUSTOM:
-    {
-        protocol << "customcontrolmessage-only";
-        break;
-    }
-    default:
-    {
-        return false;
-    }
-    }
-    context = ico_uws_create_context(address.str().c_str(),
-                                     protocol.str().c_str());
-    if (context == NULL) {
+bool ControlWebsocketClient::initialize(const char *uri, const int port, const char *protocol) {
+    /* Memo */
+    /* If strlen(uri) == 0, websocket server. If strlen(uri) > 0, websocket client. */
+    if ((uri == NULL || strlen(uri) == 0) || (port < 1 || port > 65535) || (protocol == NULL || strlen(protocol) == 0)) {
         return false;
     }
-    if (ico_uws_set_event_cb(context, ControlWebsocketClient::callback_receive,
-                             ((void *)type)) != 0) {
-        DebugOut() << "ControlWebsocket[" << type << "]"
-                   << " couldn't set callback function." << std::endl;
+    char uribuf[256];
+    memset(uribuf, 0, sizeof(uribuf));
+    sprintf(uribuf, "%s:%d", uri, port);
+    context_ = ico_uws_create_context(uribuf, protocol);
+    if (context_ == NULL) {
         return false;
     }
-    /*
-     socket = libwebsocket_client_connect(context, "127.0.0.1", port, 0, "/",
-     "localhost", "websocket",
-     protocollist[0].name, -1);
-     if (socket == NULL) {
-     return false;
-     }
-     */
-    if (pthread_create(&threadid, NULL, ControlWebsocketClient::run,
-                       (void*)this) == -1) {
-        ico_uws_close(context);
+
+    int ret = ico_uws_set_event_cb(context_, callbackfunc, this);
+    if (ret != ICO_UWS_ERR_NONE) {
+        terminate();
         return false;
     }
     return true;
 }
 
-bool
-ControlWebsocketClient::send(char *keyeventtype, timeval time, void *data,
-                             size_t len)
-{
-    pthread_mutex_lock(&mutex);
-    memset(buf, 0, sizeof(buf));
-    switch (type) {
-    case ControlWebsocket::DATA_STANDARD:
-    case ControlWebsocket::DATA_CUSTOM:
-    {
-        memcpy(buf,
-               datamsg.encode(keyeventtype, time,
-                              *(reinterpret_cast<DataOpt*>(data))),
-                              len);
-        DebugOut(10) << keyeventtype << " encode\n";
-        break;
-    }
-    case ControlWebsocket::CONTROL_STANDARD:
-    case ControlWebsocket::CONTROL_CUSTOM:
-    {
-        memcpy(buf,
-               eventmsg.encode(keyeventtype, time,
-                               *(reinterpret_cast<EventOpt*>(data))),
-               len);
-        break;
+void ControlWebsocketClient::terminate() {
+    if (context_ != NULL) {
+        ico_uws_unset_event_cb(context_);
+        ico_uws_close(context_);
+        fd_ = 0;
     }
-    default:
-    {
+}
+
+bool ControlWebsocketClient::send(char *sendbuf, const size_t len) {
+    if (context_ == NULL || wsid_ == NULL) {
         return false;
-        break;
     }
-    }
-    ico_uws_send(context, wsi[type], reinterpret_cast<unsigned char*>(buf),
-                 len);
-    pthread_mutex_unlock(&mutex);
+    ico_uws_send(context_, wsid_, reinterpret_cast<unsigned char*>(sendbuf), len);
     return true;
 }
 
-bool
-ControlWebsocketClient::receive(char *keyeventtype, timeval recordtime,
-                                void *data, size_t len)
-{
-    datamsg.decodeOpt(keyeventtype, recordtime, data);
+bool ControlWebsocketClient::recv(char *recvbuf, const size_t len) {
+    std::cout << &recvbuf[0] << " ";
+    DataMessage dmsg;
+    dmsg.decode(recvbuf, len);
+    timeval tv;
+    tv = dmsg.getRecordtime();
+    std::cout << tv.tv_sec << "." << tv.tv_usec << " ";
+    DataOpt dopt = dmsg.getDataOpt();
+    std::cout << dopt.common_status << " ";
+    int statuslen = getStatussize(len);
+    for (int i = 0; i < statuslen; i++) {
+        std::cout << static_cast<int>(dopt.status[i]);
+    }
+    
+    std::cout << std::endl;
     return true;
 }
 
-void
-ControlWebsocketClient::observation()
-{
-    while (true) {
-        ico_uws_service(context);
-        usleep(50);
-    }
+int ControlWebsocketClient::getsocketid() const {
+    return fd_;
 }
 
-void
-ControlWebsocketClient::callback_receive(const struct ico_uws_context *context,
-                                         const ico_uws_evt_e event,
-                                         const void *id,
-                                         const ico_uws_detail *detail,
-                                         void *user_data)
-{
+void ControlWebsocketClient::setsocketid(int fd) {
+    fd_ = fd;
+}
+
+void ControlWebsocketClient::setwsid(void *id) {
+    wsid_ = id;
+}
+
+void ControlWebsocketClient::service() {
+    ico_uws_service(context_);
+}
+
+void ControlWebsocketClient::callbackfunc(const struct ico_uws_context *context, const ico_uws_evt_e event, const void *id, const ico_uws_detail *detail, void *user_data) {
+    ControlWebsocketClient *client = reinterpret_cast<ControlWebsocketClient*>(user_data);
     switch (event) {
-    case ICO_UWS_EVT_OPEN:
-    {
-        int idx = reinterpret_cast<int>(user_data);
-        DebugOut() << "Open. wsi index = " << idx << "\n";
-        ControlWebsocketClient::wsi[idx] = const_cast<void*>(id);
-        break;
-    }
-    case ICO_UWS_EVT_ERROR:
+    case ICO_UWS_EVT_RECEIVE :
+        //std::cout << "ICO_UWS_EVT_RECEIV\n";
+        client->recv(reinterpret_cast<char*>(detail->_ico_uws_message.recv_data), detail->_ico_uws_message.recv_len);
         break;
-    case ICO_UWS_EVT_CLOSE:
-    {
-        int idx = reinterpret_cast<int>(user_data);
-        ControlWebsocketClient::wsi[idx] = NULL;
-        break;
-    }
-    case ICO_UWS_EVT_RECEIVE:
-    {
-        DataMessage msg;
-        char *recvbuf =
-                reinterpret_cast<char*>(detail->_ico_uws_message.recv_data);
-        msg.decode(recvbuf, detail->_ico_uws_message.recv_len);
-        DebugOut(10) << "[R]: " << msg.getKeyEventType() << " , "
-                     << msg.getRecordtime().tv_sec << "."
-                     << msg.getRecordtime().tv_usec << " , ";
-        if (string(msg.getKeyEventType())
-                == ControlWebsocketClient::vehiclename_scenario) {
-            pthread_cond_signal(&ControlWebsocketClient::cond_scenario);
+    case ICO_UWS_EVT_ADD_FD :
+        //std::cout << "ICO_UWS_EVT_ADD_FD\n";
+        if (detail->_ico_uws_fd.fd > 0) {
+            client->setsocketid(detail->_ico_uws_fd.fd);
         }
+        client->setwsid(const_cast<void*>(id));
         break;
-    }
-    case ICO_UWS_EVT_ADD_FD:
-        break;
-    case ICO_UWS_EVT_DEL_FD:
+    case ICO_UWS_EVT_DEL_FD :
+        //std::cout << "ICO_UWS_EVT_DEL_FD\n";
+        client->setsocketid(0);
+        client->setwsid(NULL);
         break;
-    default:
+    default :
         break;
     }
-}
-
-void *
-ControlWebsocketClient::run(void *arg)
-{
-    ControlWebsocketClient *control =
-            reinterpret_cast<ControlWebsocketClient*>(arg);
-    control->observation();
-    return NULL;
+    return;
 }
index b17d92a..38bf070 100644 (file)
@@ -1,68 +1,27 @@
-/**
- * Copyright (C) 2012  TOYOTA MOTOR CORPORATION.
- * 
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 2.1 of the License, or (at your option) any later version.
- * 
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
- * Lesser General Public License for more details.
- * 
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
- * 
- */
 #ifndef CONTROLWEBSOCKETCLIENT_H_
 #define CONTROLWEBSOCKETCLIENT_H_
+#include <cstring>
+#include <ctime>
 
-#include <pthread.h>
-#include <sys/time.h>
-
-#include <map>
-#include <vector>
-
-#include "controlwebsocket.h"
-#include "eventmessage.h"
-#include "datamessage.h"
+#include <ico_uws.h>
 
 class ControlWebsocketClient {
-public:
-    ControlWebsocketClient();
-    ~ControlWebsocketClient();
-    bool
-    initialize(int port, enum ControlWebsocket::ServerProtocol stype);
-    bool
-    send(char *keyeventtype, timeval time, void *data, size_t len);
-    bool
-    receive(char *keyeventtype, timeval recordtime, void *data, size_t len);
-    void
-    observation();
-
-    static void
-    callback_receive(const struct ico_uws_context *context,
-                     const ico_uws_evt_e event, const void *id,
-                     const ico_uws_detail *detail, void *user_data);
-
-    static void *
-    run(void *arg);
-
-    static pthread_mutex_t mutex_scenario;
-    static pthread_cond_t cond_scenario;
-    static std::string vehiclename_scenario;
-    static void *wsi[4];
-
-protected:
-    enum ControlWebsocket::ServerProtocol type;
-private:
-    ico_uws_context *context;
-    EventMessage eventmsg;
-    DataMessage datamsg;
-    pthread_t threadid;
-    pthread_mutex_t mutex;
-    char buf[StandardMessage::BUFSIZE];
+    public:
+        ControlWebsocketClient();
+        ~ControlWebsocketClient();
+        bool initialize(const char *uri, const int port, const char *protocol);
+        void terminate();
+        virtual bool send(char *sendbuf, const size_t len);
+        virtual bool recv(char *recvbuf, const size_t len);
+        int getsocketid() const;
+        void setsocketid(int fd);
+        void setwsid(void *id);
+        void service();
+
+        static void callbackfunc(const struct ico_uws_context *context, const ico_uws_evt_e event, const void *id, const ico_uws_detail *detail, void *user_data);
+    protected:
+        struct ico_uws_context *context_;
+        void* wsid_;
+        int fd_;
 };
-#endif // #ifndef CONTROLWEBSOCKETCLIENT_H_
+#endif // CONTROLWEBSOCKETCLIENT_H_
diff --git a/tests/controlwebsocketclientapp.cc b/tests/controlwebsocketclientapp.cc
deleted file mode 100644 (file)
index 35c1813..0000000
+++ /dev/null
@@ -1,166 +0,0 @@
-/**
- * Copyright (C) 2012  TOYOTA MOTOR CORPORATION.
- * 
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 2.1 of the License, or (at your option) any later version.
- * 
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
- * Lesser General Public License for more details.
- * 
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
- * 
- */
-#include <string.h>
-#include <unistd.h>
-
-#include <iostream>
-#include <sstream>
-
-#include "debugout.h"
-
-#include "config.h"
-#include "controlwebsocketclientapp.h"
-#include "messageformat.h"
-
-pthread_mutex_t ControlWebsocketClientApp::mutex_scenario =
-        PTHREAD_MUTEX_INITIALIZER;
-pthread_cond_t ControlWebsocketClientApp::cond_scenario =
-        PTHREAD_COND_INITIALIZER;
-std::string ControlWebsocketClientApp::vehiclename_scenario = "";
-void *ControlWebsocketClientApp::wsiapp = NULL;
-
-ControlWebsocketClientApp::ControlWebsocketClientApp()
-{
-    mutex = PTHREAD_MUTEX_INITIALIZER;
-}
-
-ControlWebsocketClientApp::~ControlWebsocketClientApp()
-{
-}
-
-bool
-ControlWebsocketClientApp::initialize(int port)
-{
-    DebugOut(10) << "ControlWebsocketClientApp initialize.(" << port << ")\n";
-    stringstream address;
-    address.str("");
-    address << "ws://127.0.0.1:" << port;
-    context = ico_uws_create_context(address.str().c_str(), "http-only");
-    if (context == NULL) {
-        return false;
-    }
-    if (ico_uws_set_event_cb(context,
-                             ControlWebsocketClientApp::callback_receive, NULL)
-        != 0) {
-        DebugOut() << "ControlWebsocket[" << type << "]"
-                   << " couldn't set callback function." << std::endl;
-        return false;
-    }
-    if (pthread_create(&threadid, NULL, ControlWebsocketClientApp::run,
-                       (void*)this) == -1) {
-        ico_uws_close(context);
-        return false;
-    }
-    return true;
-}
-
-bool
-ControlWebsocketClientApp::send(std::string type, std::string name,
-                                std::string propertyname, std::string value,
-                                double timestamp)
-{
-    pthread_mutex_lock(&mutex);
-    memset(buf, 0, sizeof(buf));
-    JsonData jdata;
-    jdata.propertyName = propertyname;
-    jdata.value = value;
-    jdata.timestamp = timestamp;
-    vector<JsonData> dataarray;
-    dataarray.push_back(jdata);
-    memcpy(buf, jsonmsg.encode(type, name, "transactionid", dataarray),
-           JsonMessage::BUFSIZE);
-    int i = 0;
-    while (buf[(i++)] != '\0')
-        ;
-    ico_uws_send(context, wsiapp, reinterpret_cast<unsigned char*>(buf), i);
-    pthread_mutex_unlock(&mutex);
-    return true;
-}
-
-bool
-ControlWebsocketClientApp::receive(char *keyeventtype, timeval recordtime,
-                                   void *data, size_t len)
-{
-    return true;
-}
-
-void
-ControlWebsocketClientApp::observation()
-{
-    while (true) {
-        ico_uws_service(context);
-        usleep(50);
-    }
-}
-
-void
-ControlWebsocketClientApp::callback_receive(
-        const struct ico_uws_context *context, const ico_uws_evt_e event,
-        const void *id, const ico_uws_detail *detail, void *user_data)
-{
-    switch (event) {
-    case ICO_UWS_EVT_OPEN:
-    {
-        ControlWebsocketClientApp::wsiapp = const_cast<void*>(id);
-        break;
-    }
-    case ICO_UWS_EVT_ERROR:
-        break;
-    case ICO_UWS_EVT_CLOSE:
-    {
-        ControlWebsocketClientApp::wsiapp = NULL;
-        break;
-    }
-    case ICO_UWS_EVT_RECEIVE:
-    {
-        JsonMessage jmsg;
-        char *recvbuf =
-                reinterpret_cast<char*>(detail->_ico_uws_message.recv_data);
-        jmsg.decode(recvbuf, detail->_ico_uws_message.recv_len);
-        std::vector<JsonData> jdataarray;
-        jdataarray = jmsg.getData();
-        for (auto itr = jdataarray.begin(); itr != jdataarray.end(); itr++) {
-            DebugOut(10) << "[R]: " << (*itr).propertyName << " , "
-                         << (*itr).timestamp << " , " << (*itr).value << std::endl;
-            if (((*itr).propertyName
-                  == ControlWebsocketClientApp::vehiclename_scenario) || 
-                (jmsg.getName()
-                 == ControlWebsocketClientApp::vehiclename_scenario)) {
-                pthread_cond_signal(&ControlWebsocketClientApp::cond_scenario);
-            }
-        }
-        break;
-    }
-    case ICO_UWS_EVT_ADD_FD:
-        break;
-    case ICO_UWS_EVT_DEL_FD:
-        break;
-    default:
-        break;
-    }
-}
-
-void *
-ControlWebsocketClientApp::run(void *arg)
-{
-    ControlWebsocketClientApp *control =
-            reinterpret_cast<ControlWebsocketClientApp*>(arg);
-    control->observation();
-    return NULL;
-}
diff --git a/tests/controlwebsocketclientapp.h b/tests/controlwebsocketclientapp.h
deleted file mode 100644 (file)
index 1bd9230..0000000
+++ /dev/null
@@ -1,66 +0,0 @@
-/**
- * Copyright (C) 2012  TOYOTA MOTOR CORPORATION.
- * 
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 2.1 of the License, or (at your option) any later version.
- * 
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
- * Lesser General Public License for more details.
- * 
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
- * 
- */
-#ifndef CONTROLWEBSOCKETCLIENTAPP_H_
-#define CONTROLWEBSOCKETCLIENTAPP_H_
-
-#include <pthread.h>
-#include <sys/time.h>
-
-#include <map>
-#include <vector>
-
-#include <libwebsockets.h>
-
-#include "controlwebsocket.h"
-#include "controlwebsocketclient.h"
-#include "standardjsonmessage.h"
-
-class ControlWebsocketClientApp : public ControlWebsocketClient {
-public:
-    ControlWebsocketClientApp();
-    ~ControlWebsocketClientApp();
-    bool
-    initialize(int port);
-    bool
-    send(std::string type, std::string name, std::string propertyname,
-         std::string value, double timestamp);
-    bool
-    receive(char *keyeventtype, timeval recordtime, void *data, size_t len);
-    void
-    observation();
-    static void
-    callback_receive(const struct ico_uws_context *context,
-                     const ico_uws_evt_e event, const void *id,
-                     const ico_uws_detail *detail, void *user_data);
-    static void *
-    run(void *arg);
-
-    static pthread_mutex_t mutex_scenario;
-    static pthread_cond_t cond_scenario;
-    static std::string vehiclename_scenario;
-    static void *wsiapp;
-
-private:
-    ico_uws_context *context;
-    JsonMessage jsonmsg;
-    pthread_t threadid;
-    pthread_mutex_t mutex;
-    char buf[JsonMessage::BUFSIZE];
-};
-#endif // #ifndef CONTROLWEBSOCKETCLIENTAPP_H_
diff --git a/tests/dbustest1.cc b/tests/dbustest1.cc
new file mode 100644 (file)
index 0000000..35c6dcd
--- /dev/null
@@ -0,0 +1,140 @@
+#include <appcore-efl.h>
+#include <Elementary.h>
+#include <stdio.h>
+
+#include <cassert>
+
+#include <ico_dbus_amb_efl.h>
+
+#include "ambconfig.h"
+#include "logresult.h"
+
+void notifyvalue(const char *objectname, const char *property, dbus_type type, union dbus_value_variant value, int sequence, struct timeval tv, void *user_data) {
+    enum ClientType cltype = CLIENT_APP;
+    enum CommandType cotype = CMDTYPE_NOTIFY;
+    LogResult *logger = reinterpret_cast<LogResult*>(user_data);
+    switch (type) {
+    case DBUS_TYPE_BYTE :
+        logger->PutOut(cltype, cotype, std::string(property), value.yval, tv);
+        break;
+    case DBUS_TYPE_BOOLEAN :
+        if (value.bval) {
+            logger->PutOut(cltype, cotype, std::string(property), true, tv);
+        }
+        else {
+            logger->PutOut(cltype, cotype, std::string(property), false, tv);
+        }
+        break;
+    case DBUS_TYPE_INT16 :
+        logger->PutOut(cltype, cotype, std::string(property), value.i16val, tv);
+        break;
+    case DBUS_TYPE_UINT16 :
+        logger->PutOut(cltype, cotype, std::string(property), value.ui16val, tv);
+        break;
+    case DBUS_TYPE_INT32 :
+        logger->PutOut(cltype, cotype, std::string(property), value.i32val, tv);
+        break;
+    case DBUS_TYPE_UINT32 :
+        logger->PutOut(cltype, cotype, std::string(property), value.ui32val, tv);
+        break;
+    case DBUS_TYPE_DOUBLE :
+        logger->PutOut(cltype, cotype, std::string(property), value.dval, tv);
+        break;
+    case DBUS_TYPE_STRING :
+        logger->PutOut(cltype, cotype, std::string(property), value.sval, tv);
+        break;
+    default :
+        break;
+    }
+    return;
+}
+
+EAPI int elm_main(int argc, char *argv[]) {
+    int ret;
+    std::string configpath = "/etc/ambd/AMBformat.conf";
+    while ((ret = getopt(argc, argv, "c:")) != -1) {
+        switch (ret) {
+        case 'c':
+            configpath = std::string(optarg);
+            break;
+        default :
+            break;
+        }
+    }
+
+    struct appcore_ops ops;
+    ops.create = NULL;
+    ops.resume = NULL;
+    ops.reset = NULL;
+    ops.pause = NULL;
+    ops.terminate = NULL;
+    ops.data = NULL;
+
+    assert(ico_dbus_amb_start() == 0);
+
+    AMBConfig config;
+    if (!config.readConfig(configpath)) {
+        std::cerr << "Can't read VIC-Plugin config file." << std::endl;
+        return -1;
+    }
+
+    std::vector<VehicleInfoDefine> vehicleinfolist =config.getVehicleInfoConfig();
+    LogResult logger;
+
+    auto itr_end = vehicleinfolist.end();
+    for (auto itr = vehicleinfolist.begin(); itr != itr_end; itr++) {
+        auto itr2_end = (*itr).status.end();
+        for (auto itr2 = (*itr).status.begin(); itr2 != itr2_end; itr2++) {
+            std::cerr << "dbusObjectName = " << (*itr2).dbusObjectName << ", dbusPropertyName = " << (*itr2).dbusPropertyName << std::endl;
+            switch ((*itr2).type) {
+            case INT : {
+                ico_dbus_amb_subscribe((*itr2).dbusObjectName.c_str(), (*itr2).dbusPropertyName.c_str(), 0, DBUS_TYPE_INT32, notifyvalue, &logger);
+                break;
+            }
+            case DOUBLE : {
+                ico_dbus_amb_subscribe((*itr2).dbusObjectName.c_str(), (*itr2).dbusPropertyName.c_str(), 0, DBUS_TYPE_DOUBLE, notifyvalue, &logger);
+                break;
+            }
+            case CHAR : {
+                ico_dbus_amb_subscribe((*itr2).dbusObjectName.c_str(), (*itr2).dbusPropertyName.c_str(), 0, DBUS_TYPE_BYTE, notifyvalue, &logger);
+                break;
+            }
+            case INT16 : {
+                ico_dbus_amb_subscribe((*itr2).dbusObjectName.c_str(), (*itr2).dbusPropertyName.c_str(), 0, DBUS_TYPE_INT16, notifyvalue, &logger);
+                break;
+            }
+            case UINT16 : {
+                ico_dbus_amb_subscribe((*itr2).dbusObjectName.c_str(), (*itr2).dbusPropertyName.c_str(), 0, DBUS_TYPE_UINT16, notifyvalue, &logger);
+                break;
+            }
+            case UINT32 : {
+                ico_dbus_amb_subscribe((*itr2).dbusObjectName.c_str(), (*itr2).dbusPropertyName.c_str(), 0, DBUS_TYPE_UINT32, notifyvalue, &logger);
+                break;
+            }
+            case INT64 : {
+                ico_dbus_amb_subscribe((*itr2).dbusObjectName.c_str(), (*itr2).dbusPropertyName.c_str(), 0, DBUS_TYPE_INT64, notifyvalue, &logger);
+                break;
+            }
+            case UINT64 : {
+                ico_dbus_amb_subscribe((*itr2).dbusObjectName.c_str(), (*itr2).dbusPropertyName.c_str(), 0, DBUS_TYPE_UINT64, notifyvalue, &logger);
+                break;
+            }
+            case BOOL : {
+                ico_dbus_amb_subscribe((*itr2).dbusObjectName.c_str(), (*itr2).dbusPropertyName.c_str(), 0, DBUS_TYPE_BOOLEAN, notifyvalue, &logger);
+                break;
+            }
+            default : {
+                break;
+            }
+            }
+        }
+    }
+
+    appcore_efl_main("org.tizen.ico.testdbus", &argc, &argv, &ops);
+
+    assert(ico_dbus_amb_end() == 0);
+
+    elm_shutdown();
+    return 0;
+}
+ELM_MAIN()
diff --git a/tests/dbustest3.cc b/tests/dbustest3.cc
new file mode 100644 (file)
index 0000000..79fff1d
--- /dev/null
@@ -0,0 +1,139 @@
+#include <appcore-efl.h>
+#include <Elementary.h>
+#include <stdio.h>
+
+#include <cassert>
+#include <ico_dbus_amb_efl.h>
+
+#include "ambconfig.h"
+#include "logresult.h"
+
+void getvalue(const char *objectname, const char *property, dbus_type type, union dbus_value_variant value, void *user_data) {
+    enum ClientType cltype = CLIENT_APP;
+    enum CommandType cotype = CMDTYPE_GET;
+    LogResult *logger = reinterpret_cast<LogResult*>(user_data);
+    switch (type) {
+    case DBUS_TYPE_BYTE :
+        logger->PutOut(cltype, cotype, std::string(property), value.yval);
+        break;
+    case DBUS_TYPE_BOOLEAN :
+        if (value.bval) {
+            logger->PutOut(cltype, cotype, std::string(property), true);
+        }
+        else {
+            logger->PutOut(cltype, cotype, std::string(property), false);
+        }
+        break;
+    case DBUS_TYPE_INT16 :
+        logger->PutOut(cltype, cotype, std::string(property), value.i16val);
+        break;
+    case DBUS_TYPE_UINT16 :
+        logger->PutOut(cltype, cotype, std::string(property), value.ui16val);
+        break;
+    case DBUS_TYPE_INT32 :
+        logger->PutOut(cltype, cotype, std::string(property), value.i32val);
+        break;
+    case DBUS_TYPE_UINT32 :
+        logger->PutOut(cltype, cotype, std::string(property), value.ui32val);
+        break;
+    case DBUS_TYPE_DOUBLE :
+        logger->PutOut(cltype, cotype, std::string(property), value.dval);
+        break;
+    case DBUS_TYPE_STRING :
+        logger->PutOut(cltype, cotype, std::string(property), value.sval);
+        break;
+    default :
+        break;
+    }
+    return;
+}
+
+EAPI int elm_main(int argc, char *argv[]) {
+    int ret;
+    std::string configpath = "/etc/ambd/AMBformat.conf";
+    while ((ret = getopt(argc, argv, "c:")) != -1) {
+        switch (ret) {
+        case 'c':
+            configpath = std::string(optarg);
+            break;
+        default :
+            break;
+        }
+    }
+
+    struct appcore_ops ops;
+    ops.create = NULL;
+    ops.resume = NULL;
+    ops.reset = NULL;
+    ops.pause = NULL;
+    ops.terminate = NULL;
+    ops.data = NULL;
+
+    assert(ico_dbus_amb_start() == 0);
+
+    AMBConfig config;
+    if (!config.readConfig(configpath)) {
+        std::cerr << "Can't read VIC-Plugin config file." << std::endl;
+        return -1;
+    }
+
+    std::vector<VehicleInfoDefine> vehicleinfolist =config.getVehicleInfoConfig();
+    LogResult logger;
+
+    auto itr_end = vehicleinfolist.end();
+    for (auto itr = vehicleinfolist.begin(); itr != itr_end; itr++) {
+        auto itr2_end = (*itr).status.end();
+        for (auto itr2 = (*itr).status.begin(); itr2 != itr2_end; itr2++) {
+            switch ((*itr2).type) {
+            case INT : {
+                ico_dbus_amb_get((*itr2).dbusObjectName.c_str(), (*itr2).dbusPropertyName.c_str(), 0, DBUS_TYPE_INT32, getvalue, &logger);
+                break;
+            }
+            case DOUBLE : {
+                ico_dbus_amb_get((*itr2).dbusObjectName.c_str(), (*itr2).dbusPropertyName.c_str(), 0, DBUS_TYPE_DOUBLE, getvalue, &logger);
+                break;
+            }
+            case CHAR : {
+                ico_dbus_amb_get((*itr2).dbusObjectName.c_str(), (*itr2).dbusPropertyName.c_str(), 0, DBUS_TYPE_BYTE, getvalue, &logger);
+                break;
+            }
+            case INT16 : {
+                ico_dbus_amb_get((*itr2).dbusObjectName.c_str(), (*itr2).dbusPropertyName.c_str(), 0, DBUS_TYPE_INT16, getvalue, &logger);
+                break;
+            }
+            case UINT16 : {
+                ico_dbus_amb_get((*itr2).dbusObjectName.c_str(), (*itr2).dbusPropertyName.c_str(), 0, DBUS_TYPE_UINT16, getvalue, &logger);
+                break;
+            }
+            case UINT32 : {
+                ico_dbus_amb_get((*itr2).dbusObjectName.c_str(), (*itr2).dbusPropertyName.c_str(), 0, DBUS_TYPE_UINT32, getvalue, &logger);
+                break;
+            }
+            case INT64 : {
+                ico_dbus_amb_get((*itr2).dbusObjectName.c_str(), (*itr2).dbusPropertyName.c_str(), 0, DBUS_TYPE_INT64, getvalue, &logger);
+                break;
+            }
+            case UINT64 : {
+                ico_dbus_amb_get((*itr2).dbusObjectName.c_str(), (*itr2).dbusPropertyName.c_str(), 0, DBUS_TYPE_UINT64, getvalue, &logger);
+                break;
+            }
+            case BOOL : {
+                ico_dbus_amb_get((*itr2).dbusObjectName.c_str(), (*itr2).dbusPropertyName.c_str(), 0, DBUS_TYPE_BOOLEAN, getvalue, &logger);
+                break;
+            }
+            default : {
+                break;
+            }
+            }
+        }
+    }
+
+    appcore_efl_main("org.tizen.ico.testdbus", &argc, &argv, &ops);
+
+    assert(ico_dbus_amb_end() == 0);
+
+    elm_shutdown();
+
+    return 0;
+}
+ELM_MAIN()
diff --git a/tests/etc/ambd/AMBformat.conf b/tests/etc/ambd/AMBformat.conf
new file mode 100644 (file)
index 0000000..124bdd0
--- /dev/null
@@ -0,0 +1,1113 @@
+{
+       "Config":
+       [
+               {
+                       "Section":"Common",
+                       "VehicleInfoDefine":
+                       [
+                               {
+                                       "KeyEventType":"VELOCITY",
+                                       "Status":
+                                       [
+                                               {
+                                                       "AMBPropertyName":"VehicleSpeed",
+                                                       "Type":"uint16",
+                                                       "AccessControl":"R",
+                                                       "Default":"0",
+                                                       "DBusProperty":"VehicleSpeed",
+                                                       "DBusObjectName":"VehicleSpeed",
+                                                       "Zone":"None"
+                                               }
+                                       ],
+                                       "sense":
+                                       [
+                                       ],
+                                       "event_mask":
+                                       [
+                                       ],
+                                       "Priority":1,
+                                       "DBusInterface":"org.automotive.vehicleSpeed",
+                    "DBusObject":"VehicleSpeed"
+                               },
+                               {
+                                       "KeyEventType":"ENGINE_SPEED",
+                                       "Status":
+                                       [
+                                               {
+                            "AMBPropertyName":"EngineSpeed",
+                            "Type":"uint16",
+                            "AccessControl":"R",
+                            "Default":"0",
+                            "DBusProperty":"EngineSpeed",
+                            "DBusObjectName":"EngineSpeed",
+                                                       "Zone":"None"
+                                               }
+                                       ],
+                                       "sense":
+                                       [
+                                       ],
+                                       "event_mask":
+                                       [
+                                       ],
+                                       "Priority":1,
+                                       "DBusInterface":"org.automotive.engineSpeed",
+                    "DBusObject":"EngineSpeed"
+                },
+                               {
+                                       "KeyEventType":"SHIFT",
+                                       "Status":
+                                       [
+                                               {
+                            "AMBPropertyName":"TransmissionShiftPosition",
+                            "Type":"int",
+                            "AccessControl":"R",
+                            "Default":"0",
+                            "DBusProperty":"ShiftPosition",
+                            "DBusObjectName":"Transmission",
+                                                       "Zone":"None"
+                                               },
+                                               {
+                                                       "AMBPropertyName":"TransmissionGearPostion",
+                                                       "Type":"int",
+                                                       "AccessControl":"R",
+                                                       "Default":"0",
+                                                       "DBusProperty":"GearPosition",
+                                                       "DBusObjectName":"Transmission",
+                                                       "Zone":"None"
+                                               },
+                                               {
+                                                       "AMBPropertyName":"TransmissionMode",
+                                                       "Type":"int",
+                                                       "AccessControl":"R",
+                                                       "Default":"0",
+                                                       "DBusProperty":"Mode",
+                                                       "DBusObjectName":"Transmission",
+                                                       "Zone":"None"
+                                               }
+                                       ],
+                                       "sense":
+                                       [
+                                       ],
+                                       "event_mask":
+                                       [
+                                       ],
+                                       "Priority":1,
+                                       "DBusInterface":"org.automotive.transmission",
+                    "DBusObject":"Transmission"
+                },
+                               {
+                                       "KeyEventType":"ACCPEDAL_OPEN",
+                                       "Status":
+                                       [
+                                               {
+                            "AMBPropertyName":"ThrottlePosition",
+                            "Type":"uint16",
+                            "AccessControl":"R",
+                            "Default":"0",
+                            "DBusProperty":"ThrottlePosition",
+                            "DBusObjectName":"ThrottlePosition",
+                                                       "Zone":"None"
+                                               }
+                                       ],
+                                       "sense":
+                                       [
+                                       ],
+                                       "event_mask":
+                                       [
+                                       ],
+                                       "Priority":1,
+                                       "DBusInterface":"Undefined",
+                    "DBusObject":"ThrottlePosition"
+                },
+                               {
+                                       "KeyEventType":"BRAKE_SIGNAL",
+                                       "Status":
+                                       [
+                                               {
+                            "AMBPropertyName":"WheelBrake",
+                            "Type":"bool",
+                            "AccessControl":"R",
+                            "Default":"0",
+                            "DBusProperty":"Engaged",
+                            "DBusObjectName":"WheelBrake",
+                                                       "Zone":"None"
+                                               }
+                                       ],
+                                       "sense":
+                                       [
+                                       ],
+                                       "event_mask":
+                                       [
+                                       ],
+                                       "Priority":1,
+                                       "DBusInterface":"Undefined",
+                    "DBusObject":"WheelBrake"
+                },
+                               {
+                                       "KeyEventType":"BRAKE_PRESSURE",
+                                       "Status":
+                                       [
+                                               {
+                            "AMBPropertyName":"WheelBrakePressure",
+                            "Type":"uint16",
+                            "AccessControl":"R",
+                            "Default":"0",
+                            "DBusProperty":"WheelBrakePressure",
+                            "DBusObjectName":"WheelBrakePressure",
+                                                       "Zone":"None"
+                                               }
+                                       ],
+                                       "sense":
+                                       [
+                                       ],
+                                       "event_mask":
+                                       [
+                                       ],
+                                       "Priority":1,
+                                       "DBusInterface":"org.automotive.WheelBrakePressure",
+                    "DBusObject":"WheelBrakePressure"
+                },
+                               {
+                                       "KeyEventType":"STEERING",
+                                       "Status":
+                                       [
+                                               {
+                            "AMBPropertyName":"SteeringWheelAngle",
+                            "Type":"uint16",
+                            "AccessControl":"R",
+                            "Default":"0",
+                            "DBusProperty":"SteeringWheelAngle",
+                            "DBusObjectName":"SteeringWheelAngle",
+                                                       "Zone":"None"
+                                               }
+                                       ],
+                                       "sense":
+                                       [
+                                       ],
+                                       "event_mask":
+                                       [
+                                       ],
+                                       "Priority":1,
+                                       "DBusInterface":"Undefined",
+                    "DBusObject":"SteeringWheelAngle"
+                },
+                               {
+                                       "KeyEventType":"TURN_SIGNAL",
+                                       "Status":
+                                       [
+                                               {
+                            "AMBPropertyName":"TurnSignal",
+                            "Type":"int",
+                            "AccessControl":"R",
+                            "Default":"0",
+                            "DBusProperty":"TurnSignal",
+                            "DBusObjectName":"TurnSignal",
+                                                       "Zone":"None"
+                                               }
+                                       ],
+                                       "sense":
+                                       [
+                                       ],
+                                       "event_mask":
+                                       [
+                                       ],
+                                       "Priority":1,
+                                       "DBusInterface":"Undefined",
+                    "DBusObject":"TurnSignal"
+                },
+                               {
+                                       "KeyEventType":"CLUTCH",
+                                       "Status":
+                                       [
+                                               {
+                            "AMBPropertyName":"ClutchStatus",
+                            "Type":"bool",
+                            "AccessControl":"R",
+                            "Default":"0",
+                            "DBusProperty":"ClutchStatus",
+                            "DBusObjectName":"ClutchStatus",
+                                                       "Zone":"None"
+                                               }
+                                       ],
+                                       "sense":
+                                       [
+                                       ],
+                                       "event_mask":
+                                       [
+                                       ],
+                                       "Priority":1,
+                                       "DBusInterface":"Undefined",
+                    "DBusObject":"ClutchStatus"
+                },
+                               {
+                                       "KeyEventType":"OIL",
+                                       "Status":
+                                       [
+                                               {
+                            "AMBPropertyName":"EngineOilPressure",
+                            "Type":"uint16",
+                            "AccessControl":"R",
+                            "Default":"0",
+                            "DBusProperty":"Pressure",
+                            "DBusObjectName":"EngineOil",
+                                                       "Zone":"None"
+                                               },
+                                               {
+                                                       "AMBPropertyName":"EngineOilLevel",
+                                                       "Type":"int",
+                                                       "AccessControl":"R",
+                                                       "Default":"0",
+                                                       "DBusProperty":"EngineOilLevel",
+                                                       "DBusObjectName":"EngineOilLevel",
+                                                       "Zone":"None"
+                                               }
+                                       ],
+                                       "sense":
+                                       [
+                                       ],
+                                       "event_mask":
+                                       [
+                                       ],
+                                       "Priority":1,
+                                       "DBusInterface":"org.automotive.EngineOilLevel",
+                    "DBusObject":"EngineOil"
+                },
+                               {
+                                       "KeyEventType":"WATER_TEMP",
+                                       "Status":
+                                       [
+                                               {
+                            "AMBPropertyName":"EngineCoolantTemperature",
+                            "Type":"int",
+                            "AccessControl":"R",
+                            "Default":"0",
+                            "DBusProperty":"EngineCoolantTemperature",
+                            "DBusObjectName":"EngineCoolantTemperature",
+                                                       "Zone":"None"
+                                               }
+                                       ],
+                                       "sense":
+                                       [
+                                       ],
+                                       "event_mask":
+                                       [
+                                       ],
+                                       "Priority":1,
+                                       "DBusInterface":"Undefined",
+                    "DBusObject":"EngineCoolantTemperature"
+                },
+                               {
+                                       "KeyEventType":"MACHINEGUNTURRET",
+                                       "Status":
+                                       [
+                                               {
+                        "AMBPropertyName":"MachineGunTurretStatus",
+                        "Type":"bool",
+                        "AccessControl":"R",
+                        "Default":"0",
+                        "DBusProperty":"MachineGunTurretStatus",
+                        "DBusObjectName":"MachineGunTurretStatus",
+                                               "Zone":"None"
+                                               }
+                                       ],
+                                       "sense":
+                                       [
+                                       ],
+                                       "event_mask":
+                                       [
+                                       ],
+                                       "Priority":1,
+                                       "DBusInterface":"Undefined",
+                    "DBusObject":"MachineGunTurretStatus"
+                },
+                               {
+                                       "KeyEventType":"ACCELERATION",
+                                       "Status":
+                                       [
+                                               {
+                                                       "AMBPropertyName":"AccelerationX",
+                                                       "Type":"uint16",
+                                                       "AccessControl":"R",
+                                                       "Default":"0",
+                                                       "DBusProperty":"X",
+                                                       "DBusObjectName":"Acceleration",
+                                                       "Zone":"None"
+                                               },
+                                               {
+                                                       "AMBPropertyName":"AccelerationY",
+                                                       "Type":"uint16",
+                                                       "AccessControl":"R",
+                                                       "Default":"0",
+                                                       "DBusProperty":"Y",
+                                                       "DBusObjectName":"Acceleration",
+                                                       "Zone":"None"
+                                               },
+                                               {
+                                                       "AMBPropertyName":"AccelerationZ",
+                                                       "Type":"uint16",
+                                                       "AccessControl":"R",
+                                                       "Default":"0",
+                                                       "DBusProperty":"Z",
+                                                       "DBusObjectName":"Acceleration",
+                                                       "Zone":"None"
+                                               }
+                                       ],
+                                       "sense":
+                                       [
+                                       ],
+                                       "event_mask":
+                                       [
+                                       ],
+                                       "Priority":1,
+                                       "DBusInterface":"org.automotive.acceleration",
+                    "DBusObject":"Acceleration"
+                },
+                               {
+                                       "KeyEventType":"MASSAIRFLOW",
+                                       "Status":
+                                       [
+                                               {
+                            "AMBPropertyName":"MassAirFlow",
+                            "Type":"uint16_t",
+                            "AccessControl":"R",
+                            "Default":"0",
+                            "DBusProperty":"MassAirFlow",
+                            "DBusObjectName":"MassAirFlow",
+                                                       "Zone":"None"
+                                               }
+                                       ],
+                                       "sense":
+                                       [
+                                       ],
+                                       "event_mask":
+                                       [
+                                       ],
+                                       "Priority":1,
+                                       "DBusInterface":"Undefined",
+                    "DBusObject":"MassAirFlow"
+                },
+                               {
+                                       "KeyEventType":"BUTTON",
+                                       "Status":
+                                       [
+                                               {
+                            "AMBPropertyName":"ButtonEvent",
+                            "Type":"char",
+                            "AccessControl":"R",
+                            "Default":"0",
+                            "DBusProperty":"ButtonEvent",
+                            "DBusObjectName":"ButtonEvent",
+                                                       "Zone":"None"
+                                               }
+                                       ],
+                                       "sense":
+                                       [
+                                       ],
+                                       "event_mask":
+                                       [
+                                       ],
+                                       "Priority":1,
+                                       "DBusInterface":"Undefined",
+                    "DBusObject":"ButtonEvent"
+                },
+                               {
+                                       "KeyEventType":"OUTSIDE",
+                                       "Status":
+                                       [
+                                               {
+                            "AMBPropertyName":"AirIntakeTemperature",
+                            "Type":"int",
+                            "AccessControl":"R",
+                            "Default":"0",
+                            "DBusProperty":"AirIntakeTemperature",
+                            "DBusObjectName":"AirIntakeTemperature",
+                                                       "Zone":"None"
+                                               }
+                                       ],
+                                       "sense":
+                                       [
+                                       ],
+                                       "event_mask":
+                                       [
+                                       ],
+                                       "Priority":1,
+                                       "DBusInterface":"Undefined",
+                    "DBusObject":"AirIntakeTemperature"
+                },
+                               {
+                                       "KeyEventType":"BATTERY",
+                                       "Status":
+                                       [
+                                               {
+                            "AMBPropertyName":"ButteryVoltage",
+                            "Type":"double",
+                            "AccessControl":"R",
+                            "Default":"0",
+                            "DBusProperty":"ButteryVoltage",
+                            "DBusObjectName":"ButteryVoltage",
+                                                       "Zone":"None"
+                                               }
+                                       ],
+                                       "sense":
+                                       [
+                                       ],
+                                       "event_mask":
+                                       [
+                                       ],
+                                       "Priority":1,
+                                       "DBusInterface":"Undefined",
+                    "DBusObject":"ButteryVoltage"
+                },
+                               {
+                                       "KeyEventType":"INSIDE",
+                                       "Status":
+                                       [
+                                               {
+                            "AMBPropertyName":"InteriorTemperature",
+                            "Type":"int",
+                            "AccessControl":"R",
+                            "Default":"0",
+                            "DBusProperty":"Interior",
+                            "DBusObjectName":"InteriorTemperature",
+                                                       "Zone":"None"
+                                               }
+                                       ],
+                                       "sense":
+                                       [
+                                       ],
+                                       "event_mask":
+                                       [
+                                       ],
+                                       "Priority":1,
+                                       "DBusInterface":"Undefined",
+                    "DBusObject":"InteriorTemperature"
+                },
+                               {
+                                       "KeyEventType":"ENGINEOIL",
+                                       "Status":
+                                       [
+                                               {
+                            "AMBPropertyName":"EngineOilTemperature",
+                            "Type":"int",
+                            "AccessControl":"R",
+                            "Default":"0",
+                            "DBusProperty":"Temperature",
+                            "DBusObjectName":"EngineOil",
+                                                       "Zone":"None"
+                                               },
+                                               {
+                            "AMBPropertyName":"EngineOilRemaining",
+                            "Type":"uint16_t",
+                            "AccessControl":"R",
+                            "Default":"0",
+                            "DBusProperty":"Remaining",
+                            "DBusObjectName":"EngineOil",
+                                                       "Zone":"None"
+                                               }
+                                       ],
+                                       "sense":
+                                       [
+                                       ],
+                                       "event_mask":
+                                       [
+                                       ],
+                                       "Priority":1,
+                                       "DBusInterface":"org.automotive.engineOil",
+                    "DBusObject":"EngineOil"
+                },
+                               {
+                                       "KeyEventType":"TIREPRESSURE",
+                                       "Status":
+                                       [
+                                               {
+                            "AMBPropertyName":"TirePressureLeftFront",
+                            "Type":"double",
+                            "AccessControl":"R",
+                            "Default":"0",
+                            "DBusProperty":"LeftFront",
+                            "DBusObjectName":"TirePressure",
+                                                       "Zone":"None"
+                                               },
+                                               {
+                            "AMBPropertyName":"TirePressureRightFront",
+                            "Type":"double",
+                            "AccessControl":"R",
+                            "Default":"0",
+                            "DBusProperty":"RightFront",
+                            "DBusObjectName":"TirePressure",
+                                                       "Zone":"None"
+                                               },
+                                               {
+                            "AMBPropertyName":"TirePressureLeftRear",
+                            "Type":"double",
+                            "AccessControl":"R",
+                            "Default":"0",
+                            "DBusProperty":"LeftRear",
+                            "DBusObjectName":"TirePressure",
+                                                       "Zone":"None"
+                                               },
+                                               {
+                        "AMBPropertyName":"TirePressureRightRear",
+                        "Type":"double",
+                        "AccessControl":"R",
+                        "Default":"0",
+                        "DBusProperty":"RightRear",
+                        "DBusObjectName":"TirePressure",
+                                               "Zone":"None"
+                                               }
+                                       ],
+                                       "sense":
+                                       [
+                                       ],
+                                       "event_mask":
+                                       [
+                                       ],
+                                       "Priority":1,
+                                       "DBusInterface":"org.automotive.tirePressure",
+                    "DBusObject":"TirePressure"
+                },
+                               {
+                                       "KeyEventType":"TIRETEMPERATURE",
+                                       "Status":
+                                       [
+                                               {
+                                                       "AMBPropertyName":"TireTemperatureLeftFront",
+                                                       "Type":"double",
+                                                       "AccessControl":"R",
+                                                       "Default":"0",
+                                                       "DBusProperty":"LeftFront",
+                                                       "DBusObjectName":"TireTemperature",
+                                                       "Zone":"None"
+                                               },
+                                               {
+                                                       "AMBPropertyName":"TireTemperatureRightFront",
+                                                       "Type":"double",
+                                                       "AccessControl":"R",
+                                                       "Default":"0",
+                                                       "DBusProperty":"RightFront",
+                                                       "DBusObjectName":"TireTemperature",
+                                                       "Zone":"None"
+                                               },
+                                               {
+                                                       "AMBPropertyName":"TireTemperatureLeftRear",
+                                                       "Type":"double",
+                                                       "AccessControl":"R",
+                                                       "Default":"0",
+                                                       "DBusProperty":"LeftRear",
+                                                       "DBusObjectName":"TireTemperature",
+                                                       "Zone":"None"
+                                               },
+                                               {
+                                                       "AMBPropertyName":"TireTemperatureRightRear",
+                                                       "Type":"double",
+                                                       "AccessControl":"R",
+                                                       "Default":"0",
+                                                       "DBusProperty":"RightRear",
+                                                       "DBusObjectName":"TireTemperature",
+                                                       "Zone":"None"
+                                               }
+                                       ],
+                                       "sense":
+                                       [
+                                       ],
+                                       "event_mask":
+                                       [
+                                       ],
+                                       "Priority":1,
+                                       "DBusInterface":"org.automotive.tireTemperature",
+                    "DBusObject":"TireTemperature"
+                               },
+                               {
+                                       "KeyEventType":"POWERMODE",
+                                       "Status":
+                                       [
+                                               {
+                                                       "AMBPropertyName":"VehiclePowerMode",
+                                                       "Type":"char",
+                                                       "AccessControl":"R",
+                                                       "Default":"0",
+                                                       "DBusProperty":"VehiclePowerMode",
+                                                       "DBusObjectName":"VehiclePowerMode",
+                                                       "Zone":"None"
+                                               }
+                                       ],
+                                       "sense":
+                                       [
+                                       ],
+                                       "event_mask":
+                                       [
+                                       ],
+                                       "Priority":1,
+                                       "DBusInterface":"org.automotive.vehiclePowerMode",
+                    "DBusObject":"VehiclePowerMode"
+                               },
+                               {
+                                       "KeyEventType":"CRUISECONTROL",
+                                       "Status":
+                                       [
+                                               {
+                                                       "AMBPropertyName":"CruiseControlActive",
+                                                       "Type":"bool",
+                                                       "AccessControl":"R",
+                                                       "Default":"0",
+                                                       "DBusProperty":"Activated",
+                                                       "DBusObjectName":"CruiseControlStatus",
+                                                       "Zone":"None"
+                                               },
+                                               {
+                                                       "AMBPropertyName":"CruiseControlSpeed",
+                                                       "Type":"uint16_t",
+                                                       "AccessControl":"R",
+                                                       "Default":"0",
+                                                       "DBusProperty":"Speed",
+                                                       "DBusObjectName":"CruiseControlStatus",
+                                                       "Zone":"None"
+                                               }
+                                       ],
+                                       "sense":
+                                       [
+                                       ],
+                                       "event_mask":
+                                       [
+                                       ],
+                                       "Priority":1,
+                                       "DBusInterface":"Undefined",
+                    "DBusObject":"CruiseControlStatus"
+                               },
+                               {
+                                       "KeyEventType":"LIGHTSTATUS",
+                                       "Status":
+                                       [
+                                               {
+                                                       "AMBPropertyName":"LightHead",
+                                                       "Type":"bool",
+                                                       "AccessControl":"R",
+                                                       "Default":"0",
+                                                       "DBusProperty":"Head",
+                                                       "DBusObjectName":"LightStatus",
+                                                       "Zone":"None"
+                                               },
+                                               {
+                                                       "AMBPropertyName":"LightLeftTurn",
+                                                       "Type":"bool",
+                                                       "AccessControl":"R",
+                                                       "Default":"0",
+                                                       "DBusProperty":"LeftTurn",
+                                                       "DBusObjectName":"LightStatus",
+                                                       "Zone":"None"
+                                               },
+                                               {
+                                                       "AMBPropertyName":"LightRightTurn",
+                                                       "Type":"bool",
+                                                       "AccessControl":"R",
+                                                       "Default":"0",
+                                                       "DBusProperty":"RightTurn",
+                                                       "DBusObjectName":"LightStatus",
+                                                       "Zone":"None"
+                                               },
+                                               {
+                                                       "AMBPropertyName":"LightParking",
+                                                       "Type":"bool",
+                                                       "AccessControl":"R",
+                                                       "Default":"0",
+                                                       "DBusProperty":"Parking",
+                                                       "DBusObjectName":"LightStatus",
+                                                       "Zone":"None"
+                                               },
+                                               {
+                                                       "AMBPropertyName":"LightFog",
+                                                       "Type":"bool",
+                                                       "AccessControl":"R",
+                                                       "Default":"0",
+                                                       "DBusProperty":"Fog",
+                                                       "DBusObjectName":"LightStatus",
+                                                       "Zone":"None"
+                                               },
+                                               {
+                                                       "AMBPropertyName":"LightHazard",
+                                                       "Type":"bool",
+                                                       "AccessControl":"R",
+                                                       "Default":"0",
+                                                       "DBusProperty":"Hazard",
+                                                       "DBusObjectName":"LightStatus",
+                                                       "Zone":"None"
+                                               },
+                                               {
+                                                       "AMBPropertyName":"LightBrake",
+                                                       "Type":"bool",
+                                                       "AccessControl":"R",
+                                                       "Default":"0",
+                                                       "DBusProperty":"Brake",
+                                                       "DBusObjectName":"LightStatus",
+                                                       "Zone":"None"
+                                               },
+                                               {
+                                                       "AMBPropertyName":"LightHighBeam",
+                                                       "Type":"bool",
+                                                       "AccessControl":"R",
+                                                       "Default":"0",
+                                                       "DBusProperty":"HighBeam",
+                                                       "DBusObjectName":"LightStatus",
+                                                       "Zone":"None"
+                                               }
+                                       ],
+                                       "sense":
+                                       [
+                                       ],
+                                       "event_mask":
+                                       [
+                                       ],
+                                       "Priority":1,
+                                       "DBusInterface":"org.automotive.ParkingLightStatus",
+                    "DBusObject":"LightStatus"
+                               },
+                               {
+                                       "KeyEventType":"ENGINELOAD",
+                                       "Status":
+                                       [
+                                               {
+                                                       "AMBPropertyName":"EngineLoad",
+                                                       "Type":"uint16",
+                                                       "AccessControl":"R",
+                                                       "Default":"0",
+                                                       "DBusProperty":"EngineLoad",
+                                                       "DBusObjectName":"EngineLoad",
+                                                       "Zone":"None"
+                                               }
+                                       ],
+                                       "sense":
+                                       [
+                                       ],
+                                       "event_mask":
+                                       [
+                                       ],
+                                       "Priority":1,
+                                       "DBusInterface":"Undefined",
+                    "DBusObject":"EngineLoad"
+                               },
+                               {
+                                       "KeyEventType":"HORN",
+                                       "Status":
+                                       [
+                                               {
+                                                       "AMBPropertyName":"Horn",
+                                                       "Type":"bool",
+                                                       "AccessControl":"R",
+                                                       "Default":"0",
+                                                       "DBusProperty":"On",
+                                                       "DBusObjectName":"Horn",
+                                                       "Zone":"None"
+                                               }
+                                       ],
+                                       "sense":
+                                       [
+                                       ],
+                                       "event_mask":
+                                       [
+                                       ],
+                                       "Priority":1,
+                                       "DBusInterface":"Undefined",
+                    "DBusObject":"Horn"
+                               },
+                               {
+                                       "KeyEventType":"FUEL_LEVEL",
+                                       "Status":
+                                       [
+                                               {
+                                                       "AMBPropertyName":"FuelLevel",
+                                                       "Type":"uint16",
+                                                       "AccessControl":"R",
+                                                       "Default":"0",
+                                                       "DBusProperty":"Level",
+                                                       "DBusObjectName":"Fuel",
+                                                       "Zone":"None"
+                                               }
+                                       ],
+                                       "sense":
+                                       [
+                                       ],
+                                       "event_mask":
+                                       [
+                                       ],
+                                       "Priority":1,
+                                       "DBusInterface":"org.automotive.fuel",
+                    "DBusObject":"Fuel"
+                               },
+                               {
+                                       "KeyEventType":"FUEL",
+                                       "Status":
+                                       [
+                                               {
+                                                       "AMBPropertyName":"FuelConsumption",
+                                                       "Type":"uint16_t",
+                                                       "AccessControl":"R",
+                                                       "Default":"0",
+                                                       "DBusProperty":"InstantConsumption",
+                                                       "DBusObjectName":"Fuel",
+                                                       "Zone":"None"
+                                               },
+                                               {
+                                                       "AMBPropertyName":"FuelRange",
+                                                       "Type":"uint16_t",
+                                                       "AccessControl":"R",
+                                                       "Default":"0",
+                                                       "DBusProperty":"Range",
+                                                       "DBusObjectName":"Fuel",
+                                                       "Zone":"None"
+                                               },
+                                               {
+                                                       "AMBPropertyName":"FuelEconomy",
+                                                       "Type":"uint16_t",
+                                                       "AccessControl":"R",
+                                                       "Default":"0",
+                                                       "DBusProperty":"InstantEconomy",
+                                                       "DBusObjectName":"Fuel",
+                                                       "Zone":"None"
+                                               },
+                                               {
+                                                       "AMBPropertyName":"FuelAverageEconomy",
+                                                       "Type":"uint16_t",
+                                                       "AccessControl":"R",
+                                                       "Default":"0",
+                                                       "DBusProperty":"AverageEconomy",
+                                                       "DBusObjectName":"Fuel",
+                                                       "Zone":"None"
+                                               },
+                                               {
+                                                       "AMBPropertyName":"FuelType",
+                                                       "Type":"char",
+                                                       "AccessControl":"R",
+                                                       "Default":"0",
+                                                       "DBusProperty":"Type",
+                                                       "DBusObjectName":"FuelInfo",
+                                                       "Zone":"None"
+                                               },
+                                               {
+                                                       "AMBPropertyName":"FuelPositionSide",
+                                                       "Type":"char",
+                                                       "AccessControl":"R",
+                                                       "Default":"0",
+                                                       "DBusProperty":"RefuelPosition",
+                                                       "DBusObjectName":"FuelInfo",
+                                                       "Zone":"None"
+                                               }
+                                       ],
+                                       "sense":
+                                       [
+                                       ],
+                                       "event_mask":
+                                       [
+                                       ],
+                                       "Priority":1,
+                                       "DBusInterface":"org.automotive.fuel",
+                    "DBusObject":"Fuel"
+                               },
+                               {
+                                       "KeyEventType":"EXTERIORBRIGHTNESS",
+                                       "Status":
+                                       [
+                                               {
+                                                       "AMBPropertyName":"ExteriorBrightness",
+                                                       "Type":"uint16_t",
+                                                       "AccessControl":"R",
+                                                       "Default":"0",
+                                                       "DBusProperty":"ExteriorBrightness",
+                                                       "DBusObjectName":"ExteriorBrightness",
+                                                       "Zone":"None"
+                                               }
+                                       ],
+                                       "sense":
+                                       [
+                                       ],
+                                       "event_mask":
+                                       [
+                                       ],
+                                       "Priority":1,
+                                       "DBusInterface":"org.automotive.exteriorBrightness",
+                    "DBusObject":"ExteriorBrightness"
+                               },
+                               {
+                                       "KeyEventType":"LOCATION",
+                                       "Status":
+                                       [
+                                               {
+                                                       "AMBPropertyName":"Latitude",
+                                                       "Type":"double",
+                                                       "AccessControl":"R",
+                                                       "Default":"0",
+                                                       "DBusProperty":"Latitude",
+                                                       "DBusObjectName":"Location",
+                                                       "Zone":"None"
+                                               },
+                                               {
+                                                       "AMBPropertyName":"Longitude",
+                                                       "Type":"double",
+                                                       "AccessControl":"R",
+                                                       "Default":"0",
+                                                       "DBusProperty":"Longitude",
+                                                       "DBusObjectName":"Location",
+                                                       "Zone":"None"
+                                               },
+                                               {
+                                                       "AMBPropertyName":"Altitude",
+                                                       "Type":"double",
+                                                       "AccessControl":"R",
+                                                       "Default":"0",
+                                                       "DBusProperty":"Altitude",
+                                                       "DBusObjectName":"Location",
+                                                       "Zone":"None"
+                                               }
+                                       ],
+                                       "sense":
+                                       [
+                                       ],
+                                       "event_mask":
+                                       [
+                                       ],
+                                       "Priority":1,
+                                       "DBusInterface":"org.automotive.Latitude",
+                    "DBusObject":"Location"
+                               },
+                               {
+                                       "KeyEventType":"DIRECTION",
+                                       "Status":
+                                       [
+                                               {
+                                                       "AMBPropertyName":"Direction",
+                                                       "Type":"uint16_t",
+                                                       "AccessControl":"R",
+                                                       "Default":"0",
+                                                       "DBusProperty":"Direction",
+                                                       "DBusObjectName":"Location",
+                                                       "Zone":"None"
+                                               }
+                                       ],
+                                       "sense":
+                                       [
+                                       ],
+                                       "event_mask":
+                                       [
+                                       ],
+                                       "Priority":1,
+                                       "DBusInterface":"org.automotive.Direction",
+                    "DBusObject":"Location"
+                               },
+                               {
+                                       "KeyEventType":"CUSTOM1",
+                                       "Status":
+                                       [
+                                               {
+                                                       "AMBPropertyName":"CustomA",
+                                                       "Type":"uint16_t",
+                                                       "AccessControl":"R",
+                                                       "Default":"0",
+                                                       "DBusProperty":"CustomA",
+                                                       "DBusObjectName":"CustomA",
+                                                       "Zone":"None"
+                                               }
+                                       ],
+                                       "sense":
+                                       [
+                                       ],
+                                       "event_mask":
+                                       [
+                                       ],
+                                       "Priority":1,
+                                       "DBusInterface":"org.automotive.Direction",
+                    "DBusObject":"CustomA"
+                               },
+                               {
+                                       "KeyEventType":"CUSTOM2",
+                                       "Status":
+                                       [
+                                               {
+                                                       "AMBPropertyName":"CustomB",
+                                                       "Type":"uint16_t",
+                                                       "AccessControl":"R",
+                                                       "Default":"0",
+                                                       "DBusProperty":"CustomB",
+                                                       "DBusObjectName":"CustomB",
+                                                       "Zone":"None"
+                                               }
+                                       ],
+                                       "sense":
+                                       [
+                                       ],
+                                       "event_mask":
+                                       [
+                                       ],
+                                       "Priority":1,
+                                       "DBusInterface":"org.automotive.Direction",
+                    "DBusObject":"CustomB"
+                               },
+                               {
+                                       "KeyEventType":"CUSTOM3",
+                                       "Status":
+                                       [
+                                               {
+                                                       "AMBPropertyName":"CustomC",
+                                                       "Type":"uint16_t",
+                                                       "AccessControl":"R",
+                                                       "Default":"0",
+                                                       "DBusProperty":"CustomC",
+                                                       "DBusObjectName":"CustomC",
+                                                       "Zone":"None"
+                                               }
+                                       ],
+                                       "sense":
+                                       [
+                                       ],
+                                       "event_mask":
+                                       [
+                                       ],
+                                       "Priority":1,
+                                       "DBusInterface":"org.automotive.Direction",
+                    "DBusObject":"CustomC"
+                               },
+                               {
+                                       "KeyEventType":"CUSTOM4",
+                                       "Status":
+                                       [
+                                               {
+                                                       "AMBPropertyName":"CustomD",
+                                                       "Type":"uint16_t",
+                                                       "AccessControl":"R",
+                                                       "Default":"0",
+                                                       "DBusProperty":"CustomD",
+                                                       "DBusObjectName":"CustomD",
+                                                       "Zone":"None"
+                                               }
+                                       ],
+                                       "sense":
+                                       [
+                                       ],
+                                       "event_mask":
+                                       [
+                                       ],
+                                       "Priority":1,
+                                       "DBusInterface":"org.automotive.Direction",
+                    "DBusObject":"CustomD"
+                               }
+                       ],
+            "DefaultInfoPort":
+            {
+                "DataPort":25010,
+                "CtrlPort":25011
+            },
+            "CustomizeInfoPort":
+            {
+                "DataPort":25020,
+                "CtrlPort":25021
+            }
+               },
+               {
+                       "Section":"CarSim",
+                       "VehicleInfoList":
+                       [
+                               "VELOCITY",
+                               "LOCATION",
+                               "SHIFT"
+                       ]
+               }
+       ]
+}
diff --git a/tests/etc/ambd/AMBformat_wrong1.conf b/tests/etc/ambd/AMBformat_wrong1.conf
new file mode 100644 (file)
index 0000000..839b560
--- /dev/null
@@ -0,0 +1,1113 @@
+{
+       "Config_hoge":
+       [
+               {
+                       "Section":"Common",
+                       "VehicleInfoDefine":
+                       [
+                               {
+                                       "KeyEventType":"VELOCITY",
+                                       "Status":
+                                       [
+                                               {
+                                                       "AMBPropertyName":"VehicleSpeed",
+                                                       "Type":"uint16",
+                                                       "AccessControl":"R",
+                                                       "Default":"0",
+                                                       "DBusProperty":"VehicleSpeed",
+                                                       "DBusObjectName":"VehicleSpeed",
+                                                       "Zone":"None"
+                                               }
+                                       ],
+                                       "sense":
+                                       [
+                                       ],
+                                       "event_mask":
+                                       [
+                                       ],
+                                       "Priority":1,
+                                       "DBusInterface":"org.automotive.vehicleSpeed",
+                    "DBusObject":"VehicleSpeed"
+                               },
+                               {
+                                       "KeyEventType":"ENGINE_SPEED",
+                                       "Status":
+                                       [
+                                               {
+                            "AMBPropertyName":"EngineSpeed",
+                            "Type":"uint16",
+                            "AccessControl":"R",
+                            "Default":"0",
+                            "DBusProperty":"EngineSpeed",
+                            "DBusObjectName":"EngineSpeed",
+                                                       "Zone":"None"
+                                               }
+                                       ],
+                                       "sense":
+                                       [
+                                       ],
+                                       "event_mask":
+                                       [
+                                       ],
+                                       "Priority":1,
+                                       "DBusInterface":"org.automotive.engineSpeed",
+                    "DBusObject":"EngineSpeed"
+                },
+                               {
+                                       "KeyEventType":"SHIFT",
+                                       "Status":
+                                       [
+                                               {
+                            "AMBPropertyName":"TransmissionShiftPosition",
+                            "Type":"int",
+                            "AccessControl":"R",
+                            "Default":"0",
+                            "DBusProperty":"ShiftPosition",
+                            "DBusObjectName":"Transmission",
+                                                       "Zone":"None"
+                                               },
+                                               {
+                                                       "AMBPropertyName":"TransmissionGearPostion",
+                                                       "Type":"int",
+                                                       "AccessControl":"R",
+                                                       "Default":"0",
+                                                       "DBusProperty":"GearPosition",
+                                                       "DBusObjectName":"Transmission",
+                                                       "Zone":"None"
+                                               },
+                                               {
+                                                       "AMBPropertyName":"TransmissionMode",
+                                                       "Type":"int",
+                                                       "AccessControl":"R",
+                                                       "Default":"0",
+                                                       "DBusProperty":"Mode",
+                                                       "DBusObjectName":"Transmission",
+                                                       "Zone":"None"
+                                               }
+                                       ],
+                                       "sense":
+                                       [
+                                       ],
+                                       "event_mask":
+                                       [
+                                       ],
+                                       "Priority":1,
+                                       "DBusInterface":"org.automotive.transmission",
+                    "DBusObject":"Transmission"
+                },
+                               {
+                                       "KeyEventType":"ACCPEDAL_OPEN",
+                                       "Status":
+                                       [
+                                               {
+                            "AMBPropertyName":"ThrottlePosition",
+                            "Type":"uint16",
+                            "AccessControl":"R",
+                            "Default":"0",
+                            "DBusProperty":"ThrottlePosition",
+                            "DBusObjectName":"ThrottlePosition",
+                                                       "Zone":"None"
+                                               }
+                                       ],
+                                       "sense":
+                                       [
+                                       ],
+                                       "event_mask":
+                                       [
+                                       ],
+                                       "Priority":1,
+                                       "DBusInterface":"Undefined",
+                    "DBusObject":"ThrottlePosition"
+                },
+                               {
+                                       "KeyEventType":"BRAKE_SIGNAL",
+                                       "Status":
+                                       [
+                                               {
+                            "AMBPropertyName":"WheelBrake",
+                            "Type":"bool",
+                            "AccessControl":"R",
+                            "Default":"0",
+                            "DBusProperty":"Engaged",
+                            "DBusObjectName":"WheelBrake",
+                                                       "Zone":"None"
+                                               }
+                                       ],
+                                       "sense":
+                                       [
+                                       ],
+                                       "event_mask":
+                                       [
+                                       ],
+                                       "Priority":1,
+                                       "DBusInterface":"Undefined",
+                    "DBusObject":"WheelBrake"
+                },
+                               {
+                                       "KeyEventType":"BRAKE_PRESSURE",
+                                       "Status":
+                                       [
+                                               {
+                            "AMBPropertyName":"WheelBrakePressure",
+                            "Type":"uint16",
+                            "AccessControl":"R",
+                            "Default":"0",
+                            "DBusProperty":"WheelBrakePressure",
+                            "DBusObjectName":"WheelBrakePressure",
+                                                       "Zone":"None"
+                                               }
+                                       ],
+                                       "sense":
+                                       [
+                                       ],
+                                       "event_mask":
+                                       [
+                                       ],
+                                       "Priority":1,
+                                       "DBusInterface":"org.automotive.WheelBrakePressure",
+                    "DBusObject":"WheelBrakePressure"
+                },
+                               {
+                                       "KeyEventType":"STEERING",
+                                       "Status":
+                                       [
+                                               {
+                            "AMBPropertyName":"SteeringWheelAngle",
+                            "Type":"uint16",
+                            "AccessControl":"R",
+                            "Default":"0",
+                            "DBusProperty":"SteeringWheelAngle",
+                            "DBusObjectName":"SteeringWheelAngle",
+                                                       "Zone":"None"
+                                               }
+                                       ],
+                                       "sense":
+                                       [
+                                       ],
+                                       "event_mask":
+                                       [
+                                       ],
+                                       "Priority":1,
+                                       "DBusInterface":"Undefined",
+                    "DBusObject":"SteeringWheelAngle"
+                },
+                               {
+                                       "KeyEventType":"TURN_SIGNAL",
+                                       "Status":
+                                       [
+                                               {
+                            "AMBPropertyName":"TurnSignal",
+                            "Type":"int",
+                            "AccessControl":"R",
+                            "Default":"0",
+                            "DBusProperty":"TurnSignal",
+                            "DBusObjectName":"TurnSignal",
+                                                       "Zone":"None"
+                                               }
+                                       ],
+                                       "sense":
+                                       [
+                                       ],
+                                       "event_mask":
+                                       [
+                                       ],
+                                       "Priority":1,
+                                       "DBusInterface":"Undefined",
+                    "DBusObject":"TurnSignal"
+                },
+                               {
+                                       "KeyEventType":"CLUTCH",
+                                       "Status":
+                                       [
+                                               {
+                            "AMBPropertyName":"ClutchStatus",
+                            "Type":"bool",
+                            "AccessControl":"R",
+                            "Default":"0",
+                            "DBusProperty":"ClutchStatus",
+                            "DBusObjectName":"ClutchStatus",
+                                                       "Zone":"None"
+                                               }
+                                       ],
+                                       "sense":
+                                       [
+                                       ],
+                                       "event_mask":
+                                       [
+                                       ],
+                                       "Priority":1,
+                                       "DBusInterface":"Undefined",
+                    "DBusObject":"ClutchStatus"
+                },
+                               {
+                                       "KeyEventType":"OIL",
+                                       "Status":
+                                       [
+                                               {
+                            "AMBPropertyName":"EngineOilPressure",
+                            "Type":"uint16",
+                            "AccessControl":"R",
+                            "Default":"0",
+                            "DBusProperty":"Pressure",
+                            "DBusObjectName":"EngineOil",
+                                                       "Zone":"None"
+                                               },
+                                               {
+                                                       "AMBPropertyName":"EngineOilLevel",
+                                                       "Type":"int",
+                                                       "AccessControl":"R",
+                                                       "Default":"0",
+                                                       "DBusProperty":"EngineOilLevel",
+                                                       "DBusObjectName":"EngineOilLevel",
+                                                       "Zone":"None"
+                                               }
+                                       ],
+                                       "sense":
+                                       [
+                                       ],
+                                       "event_mask":
+                                       [
+                                       ],
+                                       "Priority":1,
+                                       "DBusInterface":"org.automotive.EngineOilLevel",
+                    "DBusObject":"EngineOil"
+                },
+                               {
+                                       "KeyEventType":"WATER_TEMP",
+                                       "Status":
+                                       [
+                                               {
+                            "AMBPropertyName":"EngineCoolantTemperature",
+                            "Type":"int",
+                            "AccessControl":"R",
+                            "Default":"0",
+                            "DBusProperty":"EngineCoolantTemperature",
+                            "DBusObjectName":"EngineCoolantTemperature",
+                                                       "Zone":"None"
+                                               }
+                                       ],
+                                       "sense":
+                                       [
+                                       ],
+                                       "event_mask":
+                                       [
+                                       ],
+                                       "Priority":1,
+                                       "DBusInterface":"Undefined",
+                    "DBusObject":"EngineCoolantTemperature"
+                },
+                               {
+                                       "KeyEventType":"MACHINEGUNTURRET",
+                                       "Status":
+                                       [
+                                               {
+                        "AMBPropertyName":"MachineGunTurretStatus",
+                        "Type":"bool",
+                        "AccessControl":"R",
+                        "Default":"0",
+                        "DBusProperty":"MachineGunTurretStatus",
+                        "DBusObjectName":"MachineGunTurretStatus",
+                                               "Zone":"None"
+                                               }
+                                       ],
+                                       "sense":
+                                       [
+                                       ],
+                                       "event_mask":
+                                       [
+                                       ],
+                                       "Priority":1,
+                                       "DBusInterface":"Undefined",
+                    "DBusObject":"MachineGunTurretStatus"
+                },
+                               {
+                                       "KeyEventType":"ACCELERATION",
+                                       "Status":
+                                       [
+                                               {
+                                                       "AMBPropertyName":"AccelerationX",
+                                                       "Type":"uint16",
+                                                       "AccessControl":"R",
+                                                       "Default":"0",
+                                                       "DBusProperty":"X",
+                                                       "DBusObjectName":"Acceleration",
+                                                       "Zone":"None"
+                                               },
+                                               {
+                                                       "AMBPropertyName":"AccelerationY",
+                                                       "Type":"uint16",
+                                                       "AccessControl":"R",
+                                                       "Default":"0",
+                                                       "DBusProperty":"Y",
+                                                       "DBusObjectName":"Acceleration",
+                                                       "Zone":"None"
+                                               },
+                                               {
+                                                       "AMBPropertyName":"AccelerationZ",
+                                                       "Type":"uint16",
+                                                       "AccessControl":"R",
+                                                       "Default":"0",
+                                                       "DBusProperty":"Z",
+                                                       "DBusObjectName":"Acceleration",
+                                                       "Zone":"None"
+                                               }
+                                       ],
+                                       "sense":
+                                       [
+                                       ],
+                                       "event_mask":
+                                       [
+                                       ],
+                                       "Priority":1,
+                                       "DBusInterface":"org.automotive.acceleration",
+                    "DBusObject":"Acceleration"
+                },
+                               {
+                                       "KeyEventType":"MASSAIRFLOW",
+                                       "Status":
+                                       [
+                                               {
+                            "AMBPropertyName":"MassAirFlow",
+                            "Type":"uint16_t",
+                            "AccessControl":"R",
+                            "Default":"0",
+                            "DBusProperty":"MassAirFlow",
+                            "DBusObjectName":"MassAirFlow",
+                                                       "Zone":"None"
+                                               }
+                                       ],
+                                       "sense":
+                                       [
+                                       ],
+                                       "event_mask":
+                                       [
+                                       ],
+                                       "Priority":1,
+                                       "DBusInterface":"Undefined",
+                    "DBusObject":"MassAirFlow"
+                },
+                               {
+                                       "KeyEventType":"BUTTON",
+                                       "Status":
+                                       [
+                                               {
+                            "AMBPropertyName":"ButtonEvent",
+                            "Type":"char",
+                            "AccessControl":"R",
+                            "Default":"0",
+                            "DBusProperty":"ButtonEvent",
+                            "DBusObjectName":"ButtonEvent",
+                                                       "Zone":"None"
+                                               }
+                                       ],
+                                       "sense":
+                                       [
+                                       ],
+                                       "event_mask":
+                                       [
+                                       ],
+                                       "Priority":1,
+                                       "DBusInterface":"Undefined",
+                    "DBusObject":"ButtonEvent"
+                },
+                               {
+                                       "KeyEventType":"OUTSIDE",
+                                       "Status":
+                                       [
+                                               {
+                            "AMBPropertyName":"AirIntakeTemperature",
+                            "Type":"int",
+                            "AccessControl":"R",
+                            "Default":"0",
+                            "DBusProperty":"AirIntakeTemperature",
+                            "DBusObjectName":"AirIntakeTemperature",
+                                                       "Zone":"None"
+                                               }
+                                       ],
+                                       "sense":
+                                       [
+                                       ],
+                                       "event_mask":
+                                       [
+                                       ],
+                                       "Priority":1,
+                                       "DBusInterface":"Undefined",
+                    "DBusObject":"AirIntakeTemperature"
+                },
+                               {
+                                       "KeyEventType":"BATTERY",
+                                       "Status":
+                                       [
+                                               {
+                            "AMBPropertyName":"ButteryVoltage",
+                            "Type":"double",
+                            "AccessControl":"R",
+                            "Default":"0",
+                            "DBusProperty":"ButteryVoltage",
+                            "DBusObjectName":"ButteryVoltage",
+                                                       "Zone":"None"
+                                               }
+                                       ],
+                                       "sense":
+                                       [
+                                       ],
+                                       "event_mask":
+                                       [
+                                       ],
+                                       "Priority":1,
+                                       "DBusInterface":"Undefined",
+                    "DBusObject":"ButteryVoltage"
+                },
+                               {
+                                       "KeyEventType":"INSIDE",
+                                       "Status":
+                                       [
+                                               {
+                            "AMBPropertyName":"InteriorTemperature",
+                            "Type":"int",
+                            "AccessControl":"R",
+                            "Default":"0",
+                            "DBusProperty":"Interior",
+                            "DBusObjectName":"InteriorTemperature",
+                                                       "Zone":"None"
+                                               }
+                                       ],
+                                       "sense":
+                                       [
+                                       ],
+                                       "event_mask":
+                                       [
+                                       ],
+                                       "Priority":1,
+                                       "DBusInterface":"Undefined",
+                    "DBusObject":"InteriorTemperature"
+                },
+                               {
+                                       "KeyEventType":"ENGINEOIL",
+                                       "Status":
+                                       [
+                                               {
+                            "AMBPropertyName":"EngineOilTemperature",
+                            "Type":"int",
+                            "AccessControl":"R",
+                            "Default":"0",
+                            "DBusProperty":"Temperature",
+                            "DBusObjectName":"EngineOil",
+                                                       "Zone":"None"
+                                               },
+                                               {
+                            "AMBPropertyName":"EngineOilRemaining",
+                            "Type":"uint16_t",
+                            "AccessControl":"R",
+                            "Default":"0",
+                            "DBusProperty":"Remaining",
+                            "DBusObjectName":"EngineOil",
+                                                       "Zone":"None"
+                                               }
+                                       ],
+                                       "sense":
+                                       [
+                                       ],
+                                       "event_mask":
+                                       [
+                                       ],
+                                       "Priority":1,
+                                       "DBusInterface":"org.automotive.engineOil",
+                    "DBusObject":"EngineOil"
+                },
+                               {
+                                       "KeyEventType":"TIREPRESSURE",
+                                       "Status":
+                                       [
+                                               {
+                            "AMBPropertyName":"TirePressureLeftFront",
+                            "Type":"double",
+                            "AccessControl":"R",
+                            "Default":"0",
+                            "DBusProperty":"LeftFront",
+                            "DBusObjectName":"TirePressure",
+                                                       "Zone":"None"
+                                               },
+                                               {
+                            "AMBPropertyName":"TirePressureRightFront",
+                            "Type":"double",
+                            "AccessControl":"R",
+                            "Default":"0",
+                            "DBusProperty":"RightFront",
+                            "DBusObjectName":"TirePressure",
+                                                       "Zone":"None"
+                                               },
+                                               {
+                            "AMBPropertyName":"TirePressureLeftRear",
+                            "Type":"double",
+                            "AccessControl":"R",
+                            "Default":"0",
+                            "DBusProperty":"LeftRear",
+                            "DBusObjectName":"TirePressure",
+                                                       "Zone":"None"
+                                               },
+                                               {
+                        "AMBPropertyName":"TirePressureRightRear",
+                        "Type":"double",
+                        "AccessControl":"R",
+                        "Default":"0",
+                        "DBusProperty":"RightRear",
+                        "DBusObjectName":"TirePressure",
+                                               "Zone":"None"
+                                               }
+                                       ],
+                                       "sense":
+                                       [
+                                       ],
+                                       "event_mask":
+                                       [
+                                       ],
+                                       "Priority":1,
+                                       "DBusInterface":"org.automotive.tirePressure",
+                    "DBusObject":"TirePressure"
+                },
+                               {
+                                       "KeyEventType":"TIRETEMPERATURE",
+                                       "Status":
+                                       [
+                                               {
+                                                       "AMBPropertyName":"TireTemperatureLeftFront",
+                                                       "Type":"double",
+                                                       "AccessControl":"R",
+                                                       "Default":"0",
+                                                       "DBusProperty":"LeftFront",
+                                                       "DBusObjectName":"TireTemperature",
+                                                       "Zone":"None"
+                                               },
+                                               {
+                                                       "AMBPropertyName":"TireTemperatureRightFront",
+                                                       "Type":"double",
+                                                       "AccessControl":"R",
+                                                       "Default":"0",
+                                                       "DBusProperty":"RightFront",
+                                                       "DBusObjectName":"TireTemperature",
+                                                       "Zone":"None"
+                                               },
+                                               {
+                                                       "AMBPropertyName":"TireTemperatureLeftRear",
+                                                       "Type":"double",
+                                                       "AccessControl":"R",
+                                                       "Default":"0",
+                                                       "DBusProperty":"LeftRear",
+                                                       "DBusObjectName":"TireTemperature",
+                                                       "Zone":"None"
+                                               },
+                                               {
+                                                       "AMBPropertyName":"TireTemperatureRightRear",
+                                                       "Type":"double",
+                                                       "AccessControl":"R",
+                                                       "Default":"0",
+                                                       "DBusProperty":"RightRear",
+                                                       "DBusObjectName":"TireTemperature",
+                                                       "Zone":"None"
+                                               }
+                                       ],
+                                       "sense":
+                                       [
+                                       ],
+                                       "event_mask":
+                                       [
+                                       ],
+                                       "Priority":1,
+                                       "DBusInterface":"org.automotive.tireTemperature",
+                    "DBusObject":"TireTemperature"
+                               },
+                               {
+                                       "KeyEventType":"POWERMODE",
+                                       "Status":
+                                       [
+                                               {
+                                                       "AMBPropertyName":"VehiclePowerMode",
+                                                       "Type":"char",
+                                                       "AccessControl":"R",
+                                                       "Default":"0",
+                                                       "DBusProperty":"VehiclePowerMode",
+                                                       "DBusObjectName":"VehiclePowerMode",
+                                                       "Zone":"None"
+                                               }
+                                       ],
+                                       "sense":
+                                       [
+                                       ],
+                                       "event_mask":
+                                       [
+                                       ],
+                                       "Priority":1,
+                                       "DBusInterface":"org.automotive.vehiclePowerMode",
+                    "DBusObject":"VehiclePowerMode"
+                               },
+                               {
+                                       "KeyEventType":"CRUISECONTROL",
+                                       "Status":
+                                       [
+                                               {
+                                                       "AMBPropertyName":"CruiseControlActive",
+                                                       "Type":"bool",
+                                                       "AccessControl":"R",
+                                                       "Default":"0",
+                                                       "DBusProperty":"Activated",
+                                                       "DBusObjectName":"CruiseControlStatus",
+                                                       "Zone":"None"
+                                               },
+                                               {
+                                                       "AMBPropertyName":"CruiseControlSpeed",
+                                                       "Type":"uint16_t",
+                                                       "AccessControl":"R",
+                                                       "Default":"0",
+                                                       "DBusProperty":"Speed",
+                                                       "DBusObjectName":"CruiseControlStatus",
+                                                       "Zone":"None"
+                                               }
+                                       ],
+                                       "sense":
+                                       [
+                                       ],
+                                       "event_mask":
+                                       [
+                                       ],
+                                       "Priority":1,
+                                       "DBusInterface":"Undefined",
+                    "DBusObject":"CruiseControlStatus"
+                               },
+                               {
+                                       "KeyEventType":"LIGHTSTATUS",
+                                       "Status":
+                                       [
+                                               {
+                                                       "AMBPropertyName":"LightHead",
+                                                       "Type":"bool",
+                                                       "AccessControl":"R",
+                                                       "Default":"0",
+                                                       "DBusProperty":"Head",
+                                                       "DBusObjectName":"LightStatus",
+                                                       "Zone":"None"
+                                               },
+                                               {
+                                                       "AMBPropertyName":"LightLeftTurn",
+                                                       "Type":"bool",
+                                                       "AccessControl":"R",
+                                                       "Default":"0",
+                                                       "DBusProperty":"LeftTurn",
+                                                       "DBusObjectName":"LightStatus",
+                                                       "Zone":"None"
+                                               },
+                                               {
+                                                       "AMBPropertyName":"LightRightTurn",
+                                                       "Type":"bool",
+                                                       "AccessControl":"R",
+                                                       "Default":"0",
+                                                       "DBusProperty":"RightTurn",
+                                                       "DBusObjectName":"LightStatus",
+                                                       "Zone":"None"
+                                               },
+                                               {
+                                                       "AMBPropertyName":"LightParking",
+                                                       "Type":"bool",
+                                                       "AccessControl":"R",
+                                                       "Default":"0",
+                                                       "DBusProperty":"Parking",
+                                                       "DBusObjectName":"LightStatus",
+                                                       "Zone":"None"
+                                               },
+                                               {
+                                                       "AMBPropertyName":"LightFog",
+                                                       "Type":"bool",
+                                                       "AccessControl":"R",
+                                                       "Default":"0",
+                                                       "DBusProperty":"Fog",
+                                                       "DBusObjectName":"LightStatus",
+                                                       "Zone":"None"
+                                               },
+                                               {
+                                                       "AMBPropertyName":"LightHazard",
+                                                       "Type":"bool",
+                                                       "AccessControl":"R",
+                                                       "Default":"0",
+                                                       "DBusProperty":"Hazard",
+                                                       "DBusObjectName":"LightStatus",
+                                                       "Zone":"None"
+                                               },
+                                               {
+                                                       "AMBPropertyName":"LightBrake",
+                                                       "Type":"bool",
+                                                       "AccessControl":"R",
+                                                       "Default":"0",
+                                                       "DBusProperty":"Brake",
+                                                       "DBusObjectName":"LightStatus",
+                                                       "Zone":"None"
+                                               },
+                                               {
+                                                       "AMBPropertyName":"LightHighBeam",
+                                                       "Type":"bool",
+                                                       "AccessControl":"R",
+                                                       "Default":"0",
+                                                       "DBusProperty":"HighBeam",
+                                                       "DBusObjectName":"LightStatus",
+                                                       "Zone":"None"
+                                               }
+                                       ],
+                                       "sense":
+                                       [
+                                       ],
+                                       "event_mask":
+                                       [
+                                       ],
+                                       "Priority":1,
+                                       "DBusInterface":"org.automotive.ParkingLightStatus",
+                    "DBusObject":"LightStatus"
+                               },
+                               {
+                                       "KeyEventType":"ENGINELOAD",
+                                       "Status":
+                                       [
+                                               {
+                                                       "AMBPropertyName":"EngineLoad",
+                                                       "Type":"uint16",
+                                                       "AccessControl":"R",
+                                                       "Default":"0",
+                                                       "DBusProperty":"EngineLoad",
+                                                       "DBusObjectName":"EngineLoad",
+                                                       "Zone":"None"
+                                               }
+                                       ],
+                                       "sense":
+                                       [
+                                       ],
+                                       "event_mask":
+                                       [
+                                       ],
+                                       "Priority":1,
+                                       "DBusInterface":"Undefined",
+                    "DBusObject":"EngineLoad"
+                               },
+                               {
+                                       "KeyEventType":"HORN",
+                                       "Status":
+                                       [
+                                               {
+                                                       "AMBPropertyName":"Horn",
+                                                       "Type":"bool",
+                                                       "AccessControl":"R",
+                                                       "Default":"0",
+                                                       "DBusProperty":"On",
+                                                       "DBusObjectName":"Horn",
+                                                       "Zone":"None"
+                                               }
+                                       ],
+                                       "sense":
+                                       [
+                                       ],
+                                       "event_mask":
+                                       [
+                                       ],
+                                       "Priority":1,
+                                       "DBusInterface":"Undefined",
+                    "DBusObject":"Horn"
+                               },
+                               {
+                                       "KeyEventType":"FUEL_LEVEL",
+                                       "Status":
+                                       [
+                                               {
+                                                       "AMBPropertyName":"FuelLevel",
+                                                       "Type":"uint16",
+                                                       "AccessControl":"R",
+                                                       "Default":"0",
+                                                       "DBusProperty":"Level",
+                                                       "DBusObjectName":"Fuel",
+                                                       "Zone":"None"
+                                               }
+                                       ],
+                                       "sense":
+                                       [
+                                       ],
+                                       "event_mask":
+                                       [
+                                       ],
+                                       "Priority":1,
+                                       "DBusInterface":"org.automotive.fuel",
+                    "DBusObject":"Fuel"
+                               },
+                               {
+                                       "KeyEventType":"FUEL",
+                                       "Status":
+                                       [
+                                               {
+                                                       "AMBPropertyName":"FuelConsumption",
+                                                       "Type":"uint16_t",
+                                                       "AccessControl":"R",
+                                                       "Default":"0",
+                                                       "DBusProperty":"InstantConsumption",
+                                                       "DBusObjectName":"Fuel",
+                                                       "Zone":"None"
+                                               },
+                                               {
+                                                       "AMBPropertyName":"FuelRange",
+                                                       "Type":"uint16_t",
+                                                       "AccessControl":"R",
+                                                       "Default":"0",
+                                                       "DBusProperty":"Range",
+                                                       "DBusObjectName":"Fuel",
+                                                       "Zone":"None"
+                                               },
+                                               {
+                                                       "AMBPropertyName":"FuelEconomy",
+                                                       "Type":"uint16_t",
+                                                       "AccessControl":"R",
+                                                       "Default":"0",
+                                                       "DBusProperty":"InstantEconomy",
+                                                       "DBusObjectName":"Fuel",
+                                                       "Zone":"None"
+                                               },
+                                               {
+                                                       "AMBPropertyName":"FuelAverageEconomy",
+                                                       "Type":"uint16_t",
+                                                       "AccessControl":"R",
+                                                       "Default":"0",
+                                                       "DBusProperty":"AverageEconomy",
+                                                       "DBusObjectName":"Fuel",
+                                                       "Zone":"None"
+                                               },
+                                               {
+                                                       "AMBPropertyName":"FuelType",
+                                                       "Type":"char",
+                                                       "AccessControl":"R",
+                                                       "Default":"0",
+                                                       "DBusProperty":"Type",
+                                                       "DBusObjectName":"FuelInfo",
+                                                       "Zone":"None"
+                                               },
+                                               {
+                                                       "AMBPropertyName":"FuelPositionSide",
+                                                       "Type":"char",
+                                                       "AccessControl":"R",
+                                                       "Default":"0",
+                                                       "DBusProperty":"RefuelPosition",
+                                                       "DBusObjectName":"FuelInfo",
+                                                       "Zone":"None"
+                                               }
+                                       ],
+                                       "sense":
+                                       [
+                                       ],
+                                       "event_mask":
+                                       [
+                                       ],
+                                       "Priority":1,
+                                       "DBusInterface":"org.automotive.fuel",
+                    "DBusObject":"Fuel"
+                               },
+                               {
+                                       "KeyEventType":"EXTERIORBRIGHTNESS",
+                                       "Status":
+                                       [
+                                               {
+                                                       "AMBPropertyName":"ExteriorBrightness",
+                                                       "Type":"uint16_t",
+                                                       "AccessControl":"R",
+                                                       "Default":"0",
+                                                       "DBusProperty":"ExteriorBrightness",
+                                                       "DBusObjectName":"ExteriorBrightness",
+                                                       "Zone":"None"
+                                               }
+                                       ],
+                                       "sense":
+                                       [
+                                       ],
+                                       "event_mask":
+                                       [
+                                       ],
+                                       "Priority":1,
+                                       "DBusInterface":"org.automotive.exteriorBrightness",
+                    "DBusObject":"ExteriorBrightness"
+                               },
+                               {
+                                       "KeyEventType":"LOCATION",
+                                       "Status":
+                                       [
+                                               {
+                                                       "AMBPropertyName":"Latitude",
+                                                       "Type":"double",
+                                                       "AccessControl":"R",
+                                                       "Default":"0",
+                                                       "DBusProperty":"Latitude",
+                                                       "DBusObjectName":"Location",
+                                                       "Zone":"None"
+                                               },
+                                               {
+                                                       "AMBPropertyName":"Longitude",
+                                                       "Type":"double",
+                                                       "AccessControl":"R",
+                                                       "Default":"0",
+                                                       "DBusProperty":"Longitude",
+                                                       "DBusObjectName":"Location",
+                                                       "Zone":"None"
+                                               },
+                                               {
+                                                       "AMBPropertyName":"Altitude",
+                                                       "Type":"double",
+                                                       "AccessControl":"R",
+                                                       "Default":"0",
+                                                       "DBusProperty":"Altitude",
+                                                       "DBusObjectName":"Location",
+                                                       "Zone":"None"
+                                               }
+                                       ],
+                                       "sense":
+                                       [
+                                       ],
+                                       "event_mask":
+                                       [
+                                       ],
+                                       "Priority":1,
+                                       "DBusInterface":"org.automotive.Latitude",
+                    "DBusObject":"Location"
+                               },
+                               {
+                                       "KeyEventType":"DIRECTION",
+                                       "Status":
+                                       [
+                                               {
+                                                       "AMBPropertyName":"Direction",
+                                                       "Type":"uint16_t",
+                                                       "AccessControl":"R",
+                                                       "Default":"0",
+                                                       "DBusProperty":"Direction",
+                                                       "DBusObjectName":"Location",
+                                                       "Zone":"None"
+                                               }
+                                       ],
+                                       "sense":
+                                       [
+                                       ],
+                                       "event_mask":
+                                       [
+                                       ],
+                                       "Priority":1,
+                                       "DBusInterface":"org.automotive.Direction",
+                    "DBusObject":"Location"
+                               },
+                               {
+                                       "KeyEventType":"CUSTOM1",
+                                       "Status":
+                                       [
+                                               {
+                                                       "AMBPropertyName":"CustomA",
+                                                       "Type":"uint16_t",
+                                                       "AccessControl":"R",
+                                                       "Default":"0",
+                                                       "DBusProperty":"CustomA",
+                                                       "DBusObjectName":"CustomA",
+                                                       "Zone":"None"
+                                               }
+                                       ],
+                                       "sense":
+                                       [
+                                       ],
+                                       "event_mask":
+                                       [
+                                       ],
+                                       "Priority":1,
+                                       "DBusInterface":"org.automotive.Direction",
+                    "DBusObject":"CustomA"
+                               },
+                               {
+                                       "KeyEventType":"CUSTOM2",
+                                       "Status":
+                                       [
+                                               {
+                                                       "AMBPropertyName":"CustomB",
+                                                       "Type":"uint16_t",
+                                                       "AccessControl":"R",
+                                                       "Default":"0",
+                                                       "DBusProperty":"CustomB",
+                                                       "DBusObjectName":"CustomB",
+                                                       "Zone":"None"
+                                               }
+                                       ],
+                                       "sense":
+                                       [
+                                       ],
+                                       "event_mask":
+                                       [
+                                       ],
+                                       "Priority":1,
+                                       "DBusInterface":"org.automotive.Direction",
+                    "DBusObject":"CustomB"
+                               },
+                               {
+                                       "KeyEventType":"CUSTOM3",
+                                       "Status":
+                                       [
+                                               {
+                                                       "AMBPropertyName":"CustomC",
+                                                       "Type":"uint16_t",
+                                                       "AccessControl":"R",
+                                                       "Default":"0",
+                                                       "DBusProperty":"CustomC",
+                                                       "DBusObjectName":"CustomC",
+                                                       "Zone":"None"
+                                               }
+                                       ],
+                                       "sense":
+                                       [
+                                       ],
+                                       "event_mask":
+                                       [
+                                       ],
+                                       "Priority":1,
+                                       "DBusInterface":"org.automotive.Direction",
+                    "DBusObject":"CustomC"
+                               },
+                               {
+                                       "KeyEventType":"CUSTOM4",
+                                       "Status":
+                                       [
+                                               {
+                                                       "AMBPropertyName":"CustomD",
+                                                       "Type":"uint16_t",
+                                                       "AccessControl":"R",
+                                                       "Default":"0",
+                                                       "DBusProperty":"CustomD",
+                                                       "DBusObjectName":"CustomD",
+                                                       "Zone":"None"
+                                               }
+                                       ],
+                                       "sense":
+                                       [
+                                       ],
+                                       "event_mask":
+                                       [
+                                       ],
+                                       "Priority":1,
+                                       "DBusInterface":"org.automotive.Direction",
+                    "DBusObject":"CustomD"
+                               }
+                       ],
+            "DefaultInfoPort":
+            {
+                "DataPort":25010,
+                "CtrlPort":25011
+            },
+            "CustomizeInfoPort":
+            {
+                "DataPort":25020,
+                "CtrlPort":25021
+            }
+               },
+               {
+                       "Section":"CarSim",
+                       "VehicleInfoList":
+                       [
+                               "VELOCITY",
+                               "LOCATION",
+                               "SHIFT"
+                       ]
+               }
+       ]
+}
diff --git a/tests/etc/ambd/AMBformat_wrong10.conf b/tests/etc/ambd/AMBformat_wrong10.conf
new file mode 100644 (file)
index 0000000..f86cf2a
--- /dev/null
@@ -0,0 +1,77 @@
+{
+       "Config":
+       [
+               {
+                       "Section":"Common",
+                       "VehicleInfoDefine":
+                       [
+                               {
+                                       "KeyEventType":"VELOCITY",
+                                       "Status":
+                                       [
+                                               {
+                                                       "AMBPropertyName":"VehicleSpeed",
+                                                       "Type":"uint16",
+                                                       "AccessControl":"R",
+                                                       "Default":"0",
+                                                       "DBusProperty":"VehicleSpeed",
+                                                       "DBusObjectName":"VehicleSpeed",
+                                                       "Zone":"None"
+                                               }
+                                       ],
+                                       "sense":
+                                       [
+                                       ],
+                                       "event_mask":
+                                       [
+                                       ],
+                                       "Priority":1,
+                                       "DBusInterface":"org.automotive.vehicleSpeed",
+                    "DBusObject":"VehicleSpeed"
+                               },
+                               {
+                                       "KeyEventType":"ENGINE_SPEED",
+                                       "Status":
+                                       [
+                                               {
+                            "AMBPropertyName":"EngineSpeed",
+                            "Type":"uint16",
+                            "AccessControl":"R",
+                            "Default":"0",
+                            "DBusProperty":"EngineSpeed",
+                            "DBusObjectName":"EngineSpeed",
+                                                       "Zone":"None"
+                                               }
+                                       ],
+                                       "sense":
+                                       [
+                                       ],
+                                       "event_mask":
+                                       [
+                                       ],
+                                       "Priority":1,
+                                       "DBusInterface":"org.automotive.engineSpeed",
+                    "DBusObject":"EngineSpeed"
+                }
+                       ],
+            "DefaultInfoPort":
+            {
+                "CtrlPort":25011
+            },
+            "CustomizeInfoPort":
+            {
+                "DataPort":25020,
+                "CtrlPort":25021
+            }
+               },
+               {
+                       "Section":"CarSim",
+                       "VehicleInfoList":
+                       [
+                               "VELOCITY",
+                               "LOCATION",
+                               "SHIFT"
+                       ]
+               }
+       ]
+}
diff --git a/tests/etc/ambd/AMBformat_wrong11.conf b/tests/etc/ambd/AMBformat_wrong11.conf
new file mode 100644 (file)
index 0000000..24af739
--- /dev/null
@@ -0,0 +1,1114 @@
+{
+       "Config":
+       [
+               {
+                       "Section":"Common",
+                       "VehicleInfoDefine":
+                       [
+                               {
+                                       "KeyEventType":"VELOCITY",
+                                       "Status":
+                                       [
+                                               {
+                                                       "AMBPropertyName":"VehicleSpeed",
+                                                       "Type":"uint16",
+                                                       "AccessControl":"R",
+                                                       "Default":"0",
+                                                       "DBusProperty":"VehicleSpeed",
+                                                       "DBusObjectName":"VehicleSpeed",
+                                                       "Zone":"None"
+                                               }
+                                       ],
+                                       "sense":
+                                       [
+                                       ],
+                                       "event_mask":
+                                       [
+                                       ],
+                                       "Priority":1,
+                                       "DBusInterface":"org.automotive.vehicleSpeed",
+                    "DBusObject":"VehicleSpeed",
+                                       "VehicleSpeed":true
+                               },
+                               {
+                                       "KeyEventType":"ENGINE_SPEED",
+                                       "Status":
+                                       [
+                                               {
+                            "AMBPropertyName":"EngineSpeed",
+                            "Type":"uint16",
+                            "AccessControl":"R",
+                            "Default":"0",
+                            "DBusProperty":"EngineSpeed",
+                            "DBusObjectName":"EngineSpeed",
+                                                       "Zone":"None"
+                                               }
+                                       ],
+                                       "sense":
+                                       [
+                                       ],
+                                       "event_mask":
+                                       [
+                                       ],
+                                       "Priority":1,
+                                       "DBusInterface":"org.automotive.engineSpeed",
+                    "DBusObject":"EngineSpeed"
+                },
+                               {
+                                       "KeyEventType":"SHIFT",
+                                       "Status":
+                                       [
+                                               {
+                            "AMBPropertyName":"TransmissionShiftPosition",
+                            "Type":"int",
+                            "AccessControl":"R",
+                            "Default":"0",
+                            "DBusProperty":"ShiftPosition",
+                            "DBusObjectName":"Transmission",
+                                                       "Zone":"None"
+                                               },
+                                               {
+                                                       "AMBPropertyName":"TransmissionGearPostion",
+                                                       "Type":"int",
+                                                       "AccessControl":"R",
+                                                       "Default":"0",
+                                                       "DBusProperty":"GearPosition",
+                                                       "DBusObjectName":"Transmission",
+                                                       "Zone":"None"
+                                               },
+                                               {
+                                                       "AMBPropertyName":"TransmissionMode",
+                                                       "Type":"int",
+                                                       "AccessControl":"R",
+                                                       "Default":"0",
+                                                       "DBusProperty":"Mode",
+                                                       "DBusObjectName":"Transmission",
+                                                       "Zone":"None"
+                                               }
+                                       ],
+                                       "sense":
+                                       [
+                                       ],
+                                       "event_mask":
+                                       [
+                                       ],
+                                       "Priority":1,
+                                       "DBusInterface":"org.automotive.transmission",
+                    "DBusObject":"Transmission"
+                },
+                               {
+                                       "KeyEventType":"ACCPEDAL_OPEN",
+                                       "Status":
+                                       [
+                                               {
+                            "AMBPropertyName":"ThrottlePosition",
+                            "Type":"uint16",
+                            "AccessControl":"R",
+                            "Default":"0",
+                            "DBusProperty":"ThrottlePosition",
+                            "DBusObjectName":"ThrottlePosition",
+                                                       "Zone":"None"
+                                               }
+                                       ],
+                                       "sense":
+                                       [
+                                       ],
+                                       "event_mask":
+                                       [
+                                       ],
+                                       "Priority":1,
+                                       "DBusInterface":"Undefined",
+                    "DBusObject":"ThrottlePosition"
+                },
+                               {
+                                       "KeyEventType":"BRAKE_SIGNAL",
+                                       "Status":
+                                       [
+                                               {
+                            "AMBPropertyName":"WheelBrake",
+                            "Type":"bool",
+                            "AccessControl":"R",
+                            "Default":"0",
+                            "DBusProperty":"Engaged",
+                            "DBusObjectName":"WheelBrake",
+                                                       "Zone":"None"
+                                               }
+                                       ],
+                                       "sense":
+                                       [
+                                       ],
+                                       "event_mask":
+                                       [
+                                       ],
+                                       "Priority":1,
+                                       "DBusInterface":"Undefined",
+                    "DBusObject":"WheelBrake"
+                },
+                               {
+                                       "KeyEventType":"BRAKE_PRESSURE",
+                                       "Status":
+                                       [
+                                               {
+                            "AMBPropertyName":"WheelBrakePressure",
+                            "Type":"uint16",
+                            "AccessControl":"R",
+                            "Default":"0",
+                            "DBusProperty":"WheelBrakePressure",
+                            "DBusObjectName":"WheelBrakePressure",
+                                                       "Zone":"None"
+                                               }
+                                       ],
+                                       "sense":
+                                       [
+                                       ],
+                                       "event_mask":
+                                       [
+                                       ],
+                                       "Priority":1,
+                                       "DBusInterface":"org.automotive.WheelBrakePressure",
+                    "DBusObject":"WheelBrakePressure"
+                },
+                               {
+                                       "KeyEventType":"STEERING",
+                                       "Status":
+                                       [
+                                               {
+                            "AMBPropertyName":"SteeringWheelAngle",
+                            "Type":"uint16",
+                            "AccessControl":"R",
+                            "Default":"0",
+                            "DBusProperty":"SteeringWheelAngle",
+                            "DBusObjectName":"SteeringWheelAngle",
+                                                       "Zone":"None"
+                                               }
+                                       ],
+                                       "sense":
+                                       [
+                                       ],
+                                       "event_mask":
+                                       [
+                                       ],
+                                       "Priority":1,
+                                       "DBusInterface":"Undefined",
+                    "DBusObject":"SteeringWheelAngle"
+                },
+                               {
+                                       "KeyEventType":"TURN_SIGNAL",
+                                       "Status":
+                                       [
+                                               {
+                            "AMBPropertyName":"TurnSignal",
+                            "Type":"int",
+                            "AccessControl":"R",
+                            "Default":"0",
+                            "DBusProperty":"TurnSignal",
+                            "DBusObjectName":"TurnSignal",
+                                                       "Zone":"None"
+                                               }
+                                       ],
+                                       "sense":
+                                       [
+                                       ],
+                                       "event_mask":
+                                       [
+                                       ],
+                                       "Priority":1,
+                                       "DBusInterface":"Undefined",
+                    "DBusObject":"TurnSignal"
+                },
+                               {
+                                       "KeyEventType":"CLUTCH",
+                                       "Status":
+                                       [
+                                               {
+                            "AMBPropertyName":"ClutchStatus",
+                            "Type":"bool",
+                            "AccessControl":"R",
+                            "Default":"0",
+                            "DBusProperty":"ClutchStatus",
+                            "DBusObjectName":"ClutchStatus",
+                                                       "Zone":"None"
+                                               }
+                                       ],
+                                       "sense":
+                                       [
+                                       ],
+                                       "event_mask":
+                                       [
+                                       ],
+                                       "Priority":1,
+                                       "DBusInterface":"Undefined",
+                    "DBusObject":"ClutchStatus"
+                },
+                               {
+                                       "KeyEventType":"OIL",
+                                       "Status":
+                                       [
+                                               {
+                            "AMBPropertyName":"EngineOilPressure",
+                            "Type":"uint16",
+                            "AccessControl":"R",
+                            "Default":"0",
+                            "DBusProperty":"Pressure",
+                            "DBusObjectName":"EngineOil",
+                                                       "Zone":"None"
+                                               },
+                                               {
+                                                       "AMBPropertyName":"EngineOilLevel",
+                                                       "Type":"int",
+                                                       "AccessControl":"R",
+                                                       "Default":"0",
+                                                       "DBusProperty":"EngineOilLevel",
+                                                       "DBusObjectName":"EngineOilLevel",
+                                                       "Zone":"None"
+                                               }
+                                       ],
+                                       "sense":
+                                       [
+                                       ],
+                                       "event_mask":
+                                       [
+                                       ],
+                                       "Priority":1,
+                                       "DBusInterface":"org.automotive.EngineOilLevel",
+                    "DBusObject":"EngineOil"
+                },
+                               {
+                                       "KeyEventType":"WATER_TEMP",
+                                       "Status":
+                                       [
+                                               {
+                            "AMBPropertyName":"EngineCoolantTemperature",
+                            "Type":"int",
+                            "AccessControl":"R",
+                            "Default":"0",
+                            "DBusProperty":"EngineCoolantTemperature",
+                            "DBusObjectName":"EngineCoolantTemperature",
+                                                       "Zone":"None"
+                                               }
+                                       ],
+                                       "sense":
+                                       [
+                                       ],
+                                       "event_mask":
+                                       [
+                                       ],
+                                       "Priority":1,
+                                       "DBusInterface":"Undefined",
+                    "DBusObject":"EngineCoolantTemperature"
+                },
+                               {
+                                       "KeyEventType":"MACHINEGUNTURRET",
+                                       "Status":
+                                       [
+                                               {
+                        "AMBPropertyName":"MachineGunTurretStatus",
+                        "Type":"bool",
+                        "AccessControl":"R",
+                        "Default":"0",
+                        "DBusProperty":"MachineGunTurretStatus",
+                        "DBusObjectName":"MachineGunTurretStatus",
+                                               "Zone":"None"
+                                               }
+                                       ],
+                                       "sense":
+                                       [
+                                       ],
+                                       "event_mask":
+                                       [
+                                       ],
+                                       "Priority":1,
+                                       "DBusInterface":"Undefined",
+                    "DBusObject":"MachineGunTurretStatus"
+                },
+                               {
+                                       "KeyEventType":"ACCELERATION",
+                                       "Status":
+                                       [
+                                               {
+                                                       "AMBPropertyName":"AccelerationX",
+                                                       "Type":"uint16",
+                                                       "AccessControl":"R",
+                                                       "Default":"0",
+                                                       "DBusProperty":"X",
+                                                       "DBusObjectName":"Acceleration",
+                                                       "Zone":"None"
+                                               },
+                                               {
+                                                       "AMBPropertyName":"AccelerationY",
+                                                       "Type":"uint16",
+                                                       "AccessControl":"R",
+                                                       "Default":"0",
+                                                       "DBusProperty":"Y",
+                                                       "DBusObjectName":"Acceleration",
+                                                       "Zone":"None"
+                                               },
+                                               {
+                                                       "AMBPropertyName":"AccelerationZ",
+                                                       "Type":"uint16",
+                                                       "AccessControl":"R",
+                                                       "Default":"0",
+                                                       "DBusProperty":"Z",
+                                                       "DBusObjectName":"Acceleration",
+                                                       "Zone":"None"
+                                               }
+                                       ],
+                                       "sense":
+                                       [
+                                       ],
+                                       "event_mask":
+                                       [
+                                       ],
+                                       "Priority":1,
+                                       "DBusInterface":"org.automotive.acceleration",
+                    "DBusObject":"Acceleration"
+                },
+                               {
+                                       "KeyEventType":"MASSAIRFLOW",
+                                       "Status":
+                                       [
+                                               {
+                            "AMBPropertyName":"MassAirFlow",
+                            "Type":"uint16_t",
+                            "AccessControl":"R",
+                            "Default":"0",
+                            "DBusProperty":"MassAirFlow",
+                            "DBusObjectName":"MassAirFlow",
+                                                       "Zone":"None"
+                                               }
+                                       ],
+                                       "sense":
+                                       [
+                                       ],
+                                       "event_mask":
+                                       [
+                                       ],
+                                       "Priority":1,
+                                       "DBusInterface":"Undefined",
+                    "DBusObject":"MassAirFlow"
+                },
+                               {
+                                       "KeyEventType":"BUTTON",
+                                       "Status":
+                                       [
+                                               {
+                            "AMBPropertyName":"ButtonEvent",
+                            "Type":"char",
+                            "AccessControl":"R",
+                            "Default":"0",
+                            "DBusProperty":"ButtonEvent",
+                            "DBusObjectName":"ButtonEvent",
+                                                       "Zone":"None"
+                                               }
+                                       ],
+                                       "sense":
+                                       [
+                                       ],
+                                       "event_mask":
+                                       [
+                                       ],
+                                       "Priority":1,
+                                       "DBusInterface":"Undefined",
+                    "DBusObject":"ButtonEvent"
+                },
+                               {
+                                       "KeyEventType":"OUTSIDE",
+                                       "Status":
+                                       [
+                                               {
+                            "AMBPropertyName":"AirIntakeTemperature",
+                            "Type":"int",
+                            "AccessControl":"R",
+                            "Default":"0",
+                            "DBusProperty":"AirIntakeTemperature",
+                            "DBusObjectName":"AirIntakeTemperature",
+                                                       "Zone":"None"
+                                               }
+                                       ],
+                                       "sense":
+                                       [
+                                       ],
+                                       "event_mask":
+                                       [
+                                       ],
+                                       "Priority":1,
+                                       "DBusInterface":"Undefined",
+                    "DBusObject":"AirIntakeTemperature"
+                },
+                               {
+                                       "KeyEventType":"BATTERY",
+                                       "Status":
+                                       [
+                                               {
+                            "AMBPropertyName":"ButteryVoltage",
+                            "Type":"double",
+                            "AccessControl":"R",
+                            "Default":"0",
+                            "DBusProperty":"ButteryVoltage",
+                            "DBusObjectName":"ButteryVoltage",
+                                                       "Zone":"None"
+                                               }
+                                       ],
+                                       "sense":
+                                       [
+                                       ],
+                                       "event_mask":
+                                       [
+                                       ],
+                                       "Priority":1,
+                                       "DBusInterface":"Undefined",
+                    "DBusObject":"ButteryVoltage"
+                },
+                               {
+                                       "KeyEventType":"INSIDE",
+                                       "Status":
+                                       [
+                                               {
+                            "AMBPropertyName":"InteriorTemperature",
+                            "Type":"int",
+                            "AccessControl":"R",
+                            "Default":"0",
+                            "DBusProperty":"Interior",
+                            "DBusObjectName":"InteriorTemperature",
+                                                       "Zone":"None"
+                                               }
+                                       ],
+                                       "sense":
+                                       [
+                                       ],
+                                       "event_mask":
+                                       [
+                                       ],
+                                       "Priority":1,
+                                       "DBusInterface":"Undefined",
+                    "DBusObject":"InteriorTemperature"
+                },
+                               {
+                                       "KeyEventType":"ENGINEOIL",
+                                       "Status":
+                                       [
+                                               {
+                            "AMBPropertyName":"EngineOilTemperature",
+                            "Type":"int",
+                            "AccessControl":"R",
+                            "Default":"0",
+                            "DBusProperty":"Temperature",
+                            "DBusObjectName":"EngineOil",
+                                                       "Zone":"None"
+                                               },
+                                               {
+                            "AMBPropertyName":"EngineOilRemaining",
+                            "Type":"uint16_t",
+                            "AccessControl":"R",
+                            "Default":"0",
+                            "DBusProperty":"Remaining",
+                            "DBusObjectName":"EngineOil",
+                                                       "Zone":"None"
+                                               }
+                                       ],
+                                       "sense":
+                                       [
+                                       ],
+                                       "event_mask":
+                                       [
+                                       ],
+                                       "Priority":1,
+                                       "DBusInterface":"org.automotive.engineOil",
+                    "DBusObject":"EngineOil"
+                },
+                               {
+                                       "KeyEventType":"TIREPRESSURE",
+                                       "Status":
+                                       [
+                                               {
+                            "AMBPropertyName":"TirePressureLeftFront",
+                            "Type":"double",
+                            "AccessControl":"R",
+                            "Default":"0",
+                            "DBusProperty":"LeftFront",
+                            "DBusObjectName":"TirePressure",
+                                                       "Zone":"None"
+                                               },
+                                               {
+                            "AMBPropertyName":"TirePressureRightFront",
+                            "Type":"double",
+                            "AccessControl":"R",
+                            "Default":"0",
+                            "DBusProperty":"RightFront",
+                            "DBusObjectName":"TirePressure",
+                                                       "Zone":"None"
+                                               },
+                                               {
+                            "AMBPropertyName":"TirePressureLeftRear",
+                            "Type":"double",
+                            "AccessControl":"R",
+                            "Default":"0",
+                            "DBusProperty":"LeftRear",
+                            "DBusObjectName":"TirePressure",
+                                                       "Zone":"None"
+                                               },
+                                               {
+                        "AMBPropertyName":"TirePressureRightRear",
+                        "Type":"double",
+                        "AccessControl":"R",
+                        "Default":"0",
+                        "DBusProperty":"RightRear",
+                        "DBusObjectName":"TirePressure",
+                                               "Zone":"None"
+                                               }
+                                       ],
+                                       "sense":
+                                       [
+                                       ],
+                                       "event_mask":
+                                       [
+                                       ],
+                                       "Priority":1,
+                                       "DBusInterface":"org.automotive.tirePressure",
+                    "DBusObject":"TirePressure"
+                },
+                               {
+                                       "KeyEventType":"TIRETEMPERATURE",
+                                       "Status":
+                                       [
+                                               {
+                                                       "AMBPropertyName":"TireTemperatureLeftFront",
+                                                       "Type":"double",
+                                                       "AccessControl":"R",
+                                                       "Default":"0",
+                                                       "DBusProperty":"LeftFront",
+                                                       "DBusObjectName":"TireTemperature",
+                                                       "Zone":"None"
+                                               },
+                                               {
+                                                       "AMBPropertyName":"TireTemperatureRightFront",
+                                                       "Type":"double",
+                                                       "AccessControl":"R",
+                                                       "Default":"0",
+                                                       "DBusProperty":"RightFront",
+                                                       "DBusObjectName":"TireTemperature",
+                                                       "Zone":"None"
+                                               },
+                                               {
+                                                       "AMBPropertyName":"TireTemperatureLeftRear",
+                                                       "Type":"double",
+                                                       "AccessControl":"R",
+                                                       "Default":"0",
+                                                       "DBusProperty":"LeftRear",
+                                                       "DBusObjectName":"TireTemperature",
+                                                       "Zone":"None"
+                                               },
+                                               {
+                                                       "AMBPropertyName":"TireTemperatureRightRear",
+                                                       "Type":"double",
+                                                       "AccessControl":"R",
+                                                       "Default":"0",
+                                                       "DBusProperty":"RightRear",
+                                                       "DBusObjectName":"TireTemperature",
+                                                       "Zone":"None"
+                                               }
+                                       ],
+                                       "sense":
+                                       [
+                                       ],
+                                       "event_mask":
+                                       [
+                                       ],
+                                       "Priority":1,
+                                       "DBusInterface":"org.automotive.tireTemperature",
+                    "DBusObject":"TireTemperature"
+                               },
+                               {
+                                       "KeyEventType":"POWERMODE",
+                                       "Status":
+                                       [
+                                               {
+                                                       "AMBPropertyName":"VehiclePowerMode",
+                                                       "Type":"char",
+                                                       "AccessControl":"R",
+                                                       "Default":"0",
+                                                       "DBusProperty":"VehiclePowerMode",
+                                                       "DBusObjectName":"VehiclePowerMode",
+                                                       "Zone":"None"
+                                               }
+                                       ],
+                                       "sense":
+                                       [
+                                       ],
+                                       "event_mask":
+                                       [
+                                       ],
+                                       "Priority":1,
+                                       "DBusInterface":"org.automotive.vehiclePowerMode",
+                    "DBusObject":"VehiclePowerMode"
+                               },
+                               {
+                                       "KeyEventType":"CRUISECONTROL",
+                                       "Status":
+                                       [
+                                               {
+                                                       "AMBPropertyName":"CruiseControlActive",
+                                                       "Type":"bool",
+                                                       "AccessControl":"R",
+                                                       "Default":"0",
+                                                       "DBusProperty":"Activated",
+                                                       "DBusObjectName":"CruiseControlStatus",
+                                                       "Zone":"None"
+                                               },
+                                               {
+                                                       "AMBPropertyName":"CruiseControlSpeed",
+                                                       "Type":"uint16_t",
+                                                       "AccessControl":"R",
+                                                       "Default":"0",
+                                                       "DBusProperty":"Speed",
+                                                       "DBusObjectName":"CruiseControlStatus",
+                                                       "Zone":"None"
+                                               }
+                                       ],
+                                       "sense":
+                                       [
+                                       ],
+                                       "event_mask":
+                                       [
+                                       ],
+                                       "Priority":1,
+                                       "DBusInterface":"Undefined",
+                    "DBusObject":"CruiseControlStatus"
+                               },
+                               {
+                                       "KeyEventType":"LIGHTSTATUS",
+                                       "Status":
+                                       [
+                                               {
+                                                       "AMBPropertyName":"LightHead",
+                                                       "Type":"bool",
+                                                       "AccessControl":"R",
+                                                       "Default":"0",
+                                                       "DBusProperty":"Head",
+                                                       "DBusObjectName":"LightStatus",
+                                                       "Zone":"None"
+                                               },
+                                               {
+                                                       "AMBPropertyName":"LightLeftTurn",
+                                                       "Type":"bool",
+                                                       "AccessControl":"R",
+                                                       "Default":"0",
+                                                       "DBusProperty":"LeftTurn",
+                                                       "DBusObjectName":"LightStatus",
+                                                       "Zone":"None"
+                                               },
+                                               {
+                                                       "AMBPropertyName":"LightRightTurn",
+                                                       "Type":"bool",
+                                                       "AccessControl":"R",
+                                                       "Default":"0",
+                                                       "DBusProperty":"RightTurn",
+                                                       "DBusObjectName":"LightStatus",
+                                                       "Zone":"None"
+                                               },
+                                               {
+                                                       "AMBPropertyName":"LightParking",
+                                                       "Type":"bool",
+                                                       "AccessControl":"R",
+                                                       "Default":"0",
+                                                       "DBusProperty":"Parking",
+                                                       "DBusObjectName":"LightStatus",
+                                                       "Zone":"None"
+                                               },
+                                               {
+                                                       "AMBPropertyName":"LightFog",
+                                                       "Type":"bool",
+                                                       "AccessControl":"R",
+                                                       "Default":"0",
+                                                       "DBusProperty":"Fog",
+                                                       "DBusObjectName":"LightStatus",
+                                                       "Zone":"None"
+                                               },
+                                               {
+                                                       "AMBPropertyName":"LightHazard",
+                                                       "Type":"bool",
+                                                       "AccessControl":"R",
+                                                       "Default":"0",
+                                                       "DBusProperty":"Hazard",
+                                                       "DBusObjectName":"LightStatus",
+                                                       "Zone":"None"
+                                               },
+                                               {
+                                                       "AMBPropertyName":"LightBrake",
+                                                       "Type":"bool",
+                                                       "AccessControl":"R",
+                                                       "Default":"0",
+                                                       "DBusProperty":"Brake",
+                                                       "DBusObjectName":"LightStatus",
+                                                       "Zone":"None"
+                                               },
+                                               {
+                                                       "AMBPropertyName":"LightHighBeam",
+                                                       "Type":"bool",
+                                                       "AccessControl":"R",
+                                                       "Default":"0",
+                                                       "DBusProperty":"HighBeam",
+                                                       "DBusObjectName":"LightStatus",
+                                                       "Zone":"None"
+                                               }
+                                       ],
+                                       "sense":
+                                       [
+                                       ],
+                                       "event_mask":
+                                       [
+                                       ],
+                                       "Priority":1,
+                                       "DBusInterface":"org.automotive.ParkingLightStatus",
+                    "DBusObject":"LightStatus"
+                               },
+                               {
+                                       "KeyEventType":"ENGINELOAD",
+                                       "Status":
+                                       [
+                                               {
+                                                       "AMBPropertyName":"EngineLoad",
+                                                       "Type":"uint16",
+                                                       "AccessControl":"R",
+                                                       "Default":"0",
+                                                       "DBusProperty":"EngineLoad",
+                                                       "DBusObjectName":"EngineLoad",
+                                                       "Zone":"None"
+                                               }
+                                       ],
+                                       "sense":
+                                       [
+                                       ],
+                                       "event_mask":
+                                       [
+                                       ],
+                                       "Priority":1,
+                                       "DBusInterface":"Undefined",
+                    "DBusObject":"EngineLoad"
+                               },
+                               {
+                                       "KeyEventType":"HORN",
+                                       "Status":
+                                       [
+                                               {
+                                                       "AMBPropertyName":"Horn",
+                                                       "Type":"bool",
+                                                       "AccessControl":"R",
+                                                       "Default":"0",
+                                                       "DBusProperty":"On",
+                                                       "DBusObjectName":"Horn",
+                                                       "Zone":"None"
+                                               }
+                                       ],
+                                       "sense":
+                                       [
+                                       ],
+                                       "event_mask":
+                                       [
+                                       ],
+                                       "Priority":1,
+                                       "DBusInterface":"Undefined",
+                    "DBusObject":"Horn"
+                               },
+                               {
+                                       "KeyEventType":"FUEL_LEVEL",
+                                       "Status":
+                                       [
+                                               {
+                                                       "AMBPropertyName":"FuelLevel",
+                                                       "Type":"uint16",
+                                                       "AccessControl":"R",
+                                                       "Default":"0",
+                                                       "DBusProperty":"Level",
+                                                       "DBusObjectName":"Fuel",
+                                                       "Zone":"None"
+                                               }
+                                       ],
+                                       "sense":
+                                       [
+                                       ],
+                                       "event_mask":
+                                       [
+                                       ],
+                                       "Priority":1,
+                                       "DBusInterface":"org.automotive.fuel",
+                    "DBusObject":"Fuel"
+                               },
+                               {
+                                       "KeyEventType":"FUEL",
+                                       "Status":
+                                       [
+                                               {
+                                                       "AMBPropertyName":"FuelConsumption",
+                                                       "Type":"uint16_t",
+                                                       "AccessControl":"R",
+                                                       "Default":"0",
+                                                       "DBusProperty":"InstantConsumption",
+                                                       "DBusObjectName":"Fuel",
+                                                       "Zone":"None"
+                                               },
+                                               {
+                                                       "AMBPropertyName":"FuelRange",
+                                                       "Type":"uint16_t",
+                                                       "AccessControl":"R",
+                                                       "Default":"0",
+                                                       "DBusProperty":"Range",
+                                                       "DBusObjectName":"Fuel",
+                                                       "Zone":"None"
+                                               },
+                                               {
+                                                       "AMBPropertyName":"FuelEconomy",
+                                                       "Type":"uint16_t",
+                                                       "AccessControl":"R",
+                                                       "Default":"0",
+                                                       "DBusProperty":"InstantEconomy",
+                                                       "DBusObjectName":"Fuel",
+                                                       "Zone":"None"
+                                               },
+                                               {
+                                                       "AMBPropertyName":"FuelAverageEconomy",
+                                                       "Type":"uint16_t",
+                                                       "AccessControl":"R",
+                                                       "Default":"0",
+                                                       "DBusProperty":"AverageEconomy",
+                                                       "DBusObjectName":"Fuel",
+                                                       "Zone":"None"
+                                               },
+                                               {
+                                                       "AMBPropertyName":"FuelType",
+                                                       "Type":"char",
+                                                       "AccessControl":"R",
+                                                       "Default":"0",
+                                                       "DBusProperty":"Type",
+                                                       "DBusObjectName":"FuelInfo",
+                                                       "Zone":"None"
+                                               },
+                                               {
+                                                       "AMBPropertyName":"FuelPositionSide",
+                                                       "Type":"char",
+                                                       "AccessControl":"R",
+                                                       "Default":"0",
+                                                       "DBusProperty":"RefuelPosition",
+                                                       "DBusObjectName":"FuelInfo",
+                                                       "Zone":"None"
+                                               }
+                                       ],
+                                       "sense":
+                                       [
+                                       ],
+                                       "event_mask":
+                                       [
+                                       ],
+                                       "Priority":1,
+                                       "DBusInterface":"org.automotive.fuel",
+                    "DBusObject":"Fuel"
+                               },
+                               {
+                                       "KeyEventType":"EXTERIORBRIGHTNESS",
+                                       "Status":
+                                       [
+                                               {
+                                                       "AMBPropertyName":"ExteriorBrightness",
+                                                       "Type":"uint16_t",
+                                                       "AccessControl":"R",
+                                                       "Default":"0",
+                                                       "DBusProperty":"ExteriorBrightness",
+                                                       "DBusObjectName":"ExteriorBrightness",
+                                                       "Zone":"None"
+                                               }
+                                       ],
+                                       "sense":
+                                       [
+                                       ],
+                                       "event_mask":
+                                       [
+                                       ],
+                                       "Priority":1,
+                                       "DBusInterface":"org.automotive.exteriorBrightness",
+                    "DBusObject":"ExteriorBrightness"
+                               },
+                               {
+                                       "KeyEventType":"LOCATION",
+                                       "Status":
+                                       [
+                                               {
+                                                       "AMBPropertyName":"Latitude",
+                                                       "Type":"double",
+                                                       "AccessControl":"R",
+                                                       "Default":"0",
+                                                       "DBusProperty":"Latitude",
+                                                       "DBusObjectName":"Location",
+                                                       "Zone":"None"
+                                               },
+                                               {
+                                                       "AMBPropertyName":"Longitude",
+                                                       "Type":"double",
+                                                       "AccessControl":"R",
+                                                       "Default":"0",
+                                                       "DBusProperty":"Longitude",
+                                                       "DBusObjectName":"Location",
+                                                       "Zone":"None"
+                                               },
+                                               {
+                                                       "AMBPropertyName":"Altitude",
+                                                       "Type":"double",
+                                                       "AccessControl":"R",
+                                                       "Default":"0",
+                                                       "DBusProperty":"Altitude",
+                                                       "DBusObjectName":"Location",
+                                                       "Zone":"None"
+                                               }
+                                       ],
+                                       "sense":
+                                       [
+                                       ],
+                                       "event_mask":
+                                       [
+                                       ],
+                                       "Priority":1,
+                                       "DBusInterface":"org.automotive.Latitude",
+                    "DBusObject":"Location"
+                               },
+                               {
+                                       "KeyEventType":"DIRECTION",
+                                       "Status":
+                                       [
+                                               {
+                                                       "AMBPropertyName":"Direction",
+                                                       "Type":"uint16_t",
+                                                       "AccessControl":"R",
+                                                       "Default":"0",
+                                                       "DBusProperty":"Direction",
+                                                       "DBusObjectName":"Location",
+                                                       "Zone":"None"
+                                               }
+                                       ],
+                                       "sense":
+                                       [
+                                       ],
+                                       "event_mask":
+                                       [
+                                       ],
+                                       "Priority":1,
+                                       "DBusInterface":"org.automotive.Direction",
+                    "DBusObject":"Location"
+                               },
+                               {
+                                       "KeyEventType":"CUSTOM1",
+                                       "Status":
+                                       [
+                                               {
+                                                       "AMBPropertyName":"CustomA",
+                                                       "Type":"uint16_t",
+                                                       "AccessControl":"R",
+                                                       "Default":"0",
+                                                       "DBusProperty":"CustomA",
+                                                       "DBusObjectName":"CustomA",
+                                                       "Zone":"None"
+                                               }
+                                       ],
+                                       "sense":
+                                       [
+                                       ],
+                                       "event_mask":
+                                       [
+                                       ],
+                                       "Priority":1,
+                                       "DBusInterface":"org.automotive.Direction",
+                    "DBusObject":"CustomA"
+                               },
+                               {
+                                       "KeyEventType":"CUSTOM2",
+                                       "Status":
+                                       [
+                                               {
+                                                       "AMBPropertyName":"CustomB",
+                                                       "Type":"uint16_t",
+                                                       "AccessControl":"R",
+                                                       "Default":"0",
+                                                       "DBusProperty":"CustomB",
+                                                       "DBusObjectName":"CustomB",
+                                                       "Zone":"None"
+                                               }
+                                       ],
+                                       "sense":
+                                       [
+                                       ],
+                                       "event_mask":
+                                       [
+                                       ],
+                                       "Priority":1,
+                                       "DBusInterface":"org.automotive.Direction",
+                    "DBusObject":"CustomB"
+                               },
+                               {
+                                       "KeyEventType":"CUSTOM3",
+                                       "Status":
+                                       [
+                                               {
+                                                       "AMBPropertyName":"CustomC",
+                                                       "Type":"uint16_t",
+                                                       "AccessControl":"R",
+                                                       "Default":"0",
+                                                       "DBusProperty":"CustomC",
+                                                       "DBusObjectName":"CustomC",
+                                                       "Zone":"None"
+                                               }
+                                       ],
+                                       "sense":
+                                       [
+                                       ],
+                                       "event_mask":
+                                       [
+                                       ],
+                                       "Priority":1,
+                                       "DBusInterface":"org.automotive.Direction",
+                    "DBusObject":"CustomC"
+                               },
+                               {
+                                       "KeyEventType":"CUSTOM4",
+                                       "Status":
+                                       [
+                                               {
+                                                       "AMBPropertyName":"CustomD",
+                                                       "Type":"uint16_t",
+                                                       "AccessControl":"R",
+                                                       "Default":"0",
+                                                       "DBusProperty":"CustomD",
+                                                       "DBusObjectName":"CustomD",
+                                                       "Zone":"None"
+                                               }
+                                       ],
+                                       "sense":
+                                       [
+                                       ],
+                                       "event_mask":
+                                       [
+                                       ],
+                                       "Priority":1,
+                                       "DBusInterface":"org.automotive.Direction",
+                    "DBusObject":"CustomD"
+                               }
+                       ],
+            "DefaultInfoPort":
+            {
+                "DataPort":25010,
+                "CtrlPort":25011
+            },
+            "CustomizeInfoPort":
+            {
+                "DataPort":25020,
+                "CtrlPort":25021
+            }
+               },
+               {
+                       "Section":"CarSim",
+                       "VehicleInfoList":
+                       [
+                               "VELOCITY",
+                               "LOCATION",
+                               "SHIFT"
+                       ]
+               }
+       ]
+}
diff --git a/tests/etc/ambd/AMBformat_wrong12.conf b/tests/etc/ambd/AMBformat_wrong12.conf
new file mode 100644 (file)
index 0000000..db3e62f
--- /dev/null
@@ -0,0 +1,1112 @@
+{
+       "Config":
+       [
+               {
+                       "Section":"Common",
+                       "VehicleInfoDefine":
+                       [
+                               {
+                                       "KeyEventType":"VELOCITY",
+                                       "Status":
+                                       [
+                                               {
+                                                       "AMBPropertyName":"VehicleSpeed",
+                                                       "Type":"uint16",
+                                                       "AccessControl":"R",
+                                                       "Default":"0",
+                                                       "DBusProperty":"VehicleSpeed",
+                                                       "DBusObjectName":"VehicleSpeed",
+                                                       "Zone":"None"
+                                               }
+                                       ],
+                                       "sense":
+                                       [
+                                       ],
+                                       "event_mask":
+                                       [
+                                       ],
+                                       "Priority":1,
+                                       "DBusInterface":"org.automotive.vehicleSpeed",
+                    "DBusObject":"VehicleSpeed"
+                               },
+                               {
+                                       "KeyEventType":"ENGINE_SPEED",
+                                       "Status":
+                                       [
+                                               {
+                            "AMBPropertyName":"EngineSpeed",
+                            "Type":"uint16",
+                            "AccessControl":"R",
+                            "Default":"0",
+                            "DBusProperty":"EngineSpeed",
+                            "DBusObjectName":"EngineSpeed",
+                                                       "Zone":"None"
+                                               }
+                                       ],
+                                       "sense":
+                                       [
+                                       ],
+                                       "event_mask":
+                                       [
+                                       ],
+                                       "Priority":1,
+                                       "DBusInterface":"org.automotive.engineSpeed",
+                    "DBusObject":"EngineSpeed"
+                },
+                               {
+                                       "KeyEventType":"SHIFT",
+                                       "Status":
+                                       [
+                                               {
+                            "AMBPropertyName":"TransmissionShiftPosition",
+                            "Type":"int",
+                            "AccessControl":"R",
+                            "Default":"0",
+                            "DBusProperty":"ShiftPosition",
+                            "DBusObjectName":"Transmission",
+                                                       "Zone":"None"
+                                               },
+                                               {
+                                                       "AMBPropertyName":"TransmissionGearPostion",
+                                                       "Type":"int",
+                                                       "AccessControl":"R",
+                                                       "Default":"0",
+                                                       "DBusProperty":"GearPosition",
+                                                       "DBusObjectName":"Transmission",
+                                                       "Zone":"None"
+                                               },
+                                               {
+                                                       "AMBPropertyName":"TransmissionMode",
+                                                       "Type":"int",
+                                                       "AccessControl":"R",
+                                                       "Default":"0",
+                                                       "DBusProperty":"Mode",
+                                                       "DBusObjectName":"Transmission",
+                                                       "Zone":"None"
+                                               }
+                                       ],
+                                       "sense":
+                                       [
+                                       ],
+                                       "event_mask":
+                                       [
+                                       ],
+                                       "Priority":1,
+                                       "DBusInterface":"org.automotive.transmission",
+                    "DBusObject":"Transmission"
+                },
+                               {
+                                       "KeyEventType":"ACCPEDAL_OPEN",
+                                       "Status":
+                                       [
+                                               {
+                            "AMBPropertyName":"ThrottlePosition",
+                            "Type":"uint16",
+                            "AccessControl":"R",
+                            "Default":"0",
+                            "DBusProperty":"ThrottlePosition",
+                            "DBusObjectName":"ThrottlePosition",
+                                                       "Zone":"None"
+                                               }
+                                       ],
+                                       "sense":
+                                       [
+                                       ],
+                                       "event_mask":
+                                       [
+                                       ],
+                                       "Priority":1,
+                                       "DBusInterface":"Undefined",
+                    "DBusObject":"ThrottlePosition"
+                },
+                               {
+                                       "KeyEventType":"BRAKE_SIGNAL",
+                                       "Status":
+                                       [
+                                               {
+                            "AMBPropertyName":"WheelBrake",
+                            "Type":"bool",
+                            "AccessControl":"R",
+                            "Default":"0",
+                            "DBusProperty":"Engaged",
+                            "DBusObjectName":"WheelBrake",
+                                                       "Zone":"None"
+                                               }
+                                       ],
+                                       "sense":
+                                       [
+                                       ],
+                                       "event_mask":
+                                       [
+                                       ],
+                                       "Priority":1,
+                                       "DBusInterface":"Undefined",
+                    "DBusObject":"WheelBrake"
+                },
+                               {
+                                       "KeyEventType":"BRAKE_PRESSURE",
+                                       "Status":
+                                       [
+                                               {
+                            "AMBPropertyName":"WheelBrakePressure",
+                            "Type":"uint16",
+                            "AccessControl":"R",
+                            "Default":"0",
+                            "DBusProperty":"WheelBrakePressure",
+                            "DBusObjectName":"WheelBrakePressure",
+                                                       "Zone":"None"
+                                               }
+                                       ],
+                                       "sense":
+                                       [
+                                       ],
+                                       "event_mask":
+                                       [
+                                       ],
+                                       "Priority":1,
+                                       "DBusInterface":"org.automotive.WheelBrakePressure",
+                    "DBusObject":"WheelBrakePressure"
+                },
+                               {
+                                       "KeyEventType":"STEERING",
+                                       "Status":
+                                       [
+                                               {
+                            "AMBPropertyName":"SteeringWheelAngle",
+                            "Type":"uint16",
+                            "AccessControl":"R",
+                            "Default":"0",
+                            "DBusProperty":"SteeringWheelAngle",
+                            "DBusObjectName":"SteeringWheelAngle",
+                                                       "Zone":"None"
+                                               }
+                                       ],
+                                       "sense":
+                                       [
+                                       ],
+                                       "event_mask":
+                                       [
+                                       ],
+                                       "Priority":1,
+                                       "DBusInterface":"Undefined",
+                    "DBusObject":"SteeringWheelAngle"
+                },
+                               {
+                                       "KeyEventType":"TURN_SIGNAL",
+                                       "Status":
+                                       [
+                                               {
+                            "AMBPropertyName":"TurnSignal",
+                            "Type":"int",
+                            "AccessControl":"R",
+                            "Default":"0",
+                            "DBusProperty":"TurnSignal",
+                            "DBusObjectName":"TurnSignal",
+                                                       "Zone":"None"
+                                               }
+                                       ],
+                                       "sense":
+                                       [
+                                       ],
+                                       "event_mask":
+                                       [
+                                       ],
+                                       "Priority":1,
+                                       "DBusInterface":"Undefined",
+                    "DBusObject":"TurnSignal"
+                },
+                               {
+                                       "KeyEventType":"CLUTCH",
+                                       "Status":
+                                       [
+                                               {
+                            "AMBPropertyName":"ClutchStatus",
+                            "Type":"bool",
+                            "AccessControl":"R",
+                            "Default":"0",
+                            "DBusProperty":"ClutchStatus",
+                            "DBusObjectName":"ClutchStatus",
+                                                       "Zone":"None"
+                                               }
+                                       ],
+                                       "sense":
+                                       [
+                                       ],
+                                       "event_mask":
+                                       [
+                                       ],
+                                       "Priority":1,
+                                       "DBusInterface":"Undefined",
+                    "DBusObject":"ClutchStatus"
+                },
+                               {
+                                       "KeyEventType":"OIL",
+                                       "Status":
+                                       [
+                                               {
+                            "AMBPropertyName":"EngineOilPressure",
+                            "Type":"uint16",
+                            "AccessControl":"R",
+                            "Default":"0",
+                            "DBusProperty":"Pressure",
+                            "DBusObjectName":"EngineOil",
+                                                       "Zone":"None"
+                                               },
+                                               {
+                                                       "AMBPropertyName":"EngineOilLevel",
+                                                       "Type":"int",
+                                                       "AccessControl":"R",
+                                                       "Default":"0",
+                                                       "DBusProperty":"EngineOilLevel",
+                                                       "DBusObjectName":"EngineOilLevel",
+                                                       "Zone":"None"
+                                               }
+                                       ],
+                                       "sense":
+                                       [
+                                       ],
+                                       "event_mask":
+                                       [
+                                       ],
+                                       "Priority":1,
+                                       "DBusInterface":"org.automotive.EngineOilLevel",
+                    "DBusObject":"EngineOil"
+                },
+                               {
+                                       "KeyEventType":"WATER_TEMP",
+                                       "Status":
+                                       [
+                                               {
+                            "AMBPropertyName":"EngineCoolantTemperature",
+                            "Type":"int",
+                            "AccessControl":"R",
+                            "Default":"0",
+                            "DBusProperty":"EngineCoolantTemperature",
+                            "DBusObjectName":"EngineCoolantTemperature",
+                                                       "Zone":"None"
+                                               }
+                                       ],
+                                       "sense":
+                                       [
+                                       ],
+                                       "event_mask":
+                                       [
+                                       ],
+                                       "Priority":1,
+                                       "DBusInterface":"Undefined",
+                    "DBusObject":"EngineCoolantTemperature"
+                },
+                               {
+                                       "KeyEventType":"MACHINEGUNTURRET",
+                                       "Status":
+                                       [
+                                               {
+                        "AMBPropertyName":"MachineGunTurretStatus",
+                        "Type":"bool",
+                        "AccessControl":"R",
+                        "Default":"0",
+                        "DBusProperty":"MachineGunTurretStatus",
+                        "DBusObjectName":"MachineGunTurretStatus",
+                                               "Zone":"None"
+                                               }
+                                       ],
+                                       "sense":
+                                       [
+                                       ],
+                                       "event_mask":
+                                       [
+                                       ],
+                                       "Priority":1,
+                                       "DBusInterface":"Undefined",
+                    "DBusObject":"MachineGunTurretStatus"
+                },
+                               {
+                                       "KeyEventType":"ACCELERATION",
+                                       "Status":
+                                       [
+                                               {
+                                                       "AMBPropertyName":"AccelerationX",
+                                                       "Type":"uint16",
+                                                       "AccessControl":"R",
+                                                       "Default":"0",
+                                                       "DBusProperty":"X",
+                                                       "DBusObjectName":"Acceleration",
+                                                       "Zone":"None"
+                                               },
+                                               {
+                                                       "AMBPropertyName":"AccelerationY",
+                                                       "Type":"uint16",
+                                                       "AccessControl":"R",
+                                                       "Default":"0",
+                                                       "DBusProperty":"Y",
+                                                       "DBusObjectName":"Acceleration",
+                                                       "Zone":"None"
+                                               },
+                                               {
+                                                       "AMBPropertyName":"AccelerationZ",
+                                                       "Type":"uint16",
+                                                       "AccessControl":"R",
+                                                       "Default":"0",
+                                                       "DBusProperty":"Z",
+                                                       "DBusObjectName":"Acceleration",
+                                                       "Zone":"None"
+                                               }
+                                       ],
+                                       "sense":
+                                       [
+                                       ],
+                                       "event_mask":
+                                       [
+                                       ],
+                                       "Priority":1,
+                                       "DBusInterface":"org.automotive.acceleration",
+                    "DBusObject":"Acceleration"
+                },
+                               {
+                                       "KeyEventType":"MASSAIRFLOW",
+                                       "Status":
+                                       [
+                                               {
+                            "AMBPropertyName":"MassAirFlow",
+                            "Type":"uint16_t",
+                            "AccessControl":"R",
+                            "Default":"0",
+                            "DBusProperty":"MassAirFlow",
+                            "DBusObjectName":"MassAirFlow",
+                                                       "Zone":"None"
+                                               }
+                                       ],
+                                       "sense":
+                                       [
+                                       ],
+                                       "event_mask":
+                                       [
+                                       ],
+                                       "Priority":1,
+                                       "DBusInterface":"Undefined",
+                    "DBusObject":"MassAirFlow"
+                },
+                               {
+                                       "KeyEventType":"BUTTON",
+                                       "Status":
+                                       [
+                                               {
+                            "AMBPropertyName":"ButtonEvent",
+                            "Type":"char",
+                            "AccessControl":"R",
+                            "Default":"0",
+                            "DBusProperty":"ButtonEvent",
+                            "DBusObjectName":"ButtonEvent",
+                                                       "Zone":"None"
+                                               }
+                                       ],
+                                       "sense":
+                                       [
+                                       ],
+                                       "event_mask":
+                                       [
+                                       ],
+                                       "Priority":1,
+                                       "DBusInterface":"Undefined",
+                    "DBusObject":"ButtonEvent"
+                },
+                               {
+                                       "KeyEventType":"OUTSIDE",
+                                       "Status":
+                                       [
+                                               {
+                            "AMBPropertyName":"AirIntakeTemperature",
+                            "Type":"int",
+                            "AccessControl":"R",
+                            "Default":"0",
+                            "DBusProperty":"AirIntakeTemperature",
+                            "DBusObjectName":"AirIntakeTemperature",
+                                                       "Zone":"None"
+                                               }
+                                       ],
+                                       "sense":
+                                       [
+                                       ],
+                                       "event_mask":
+                                       [
+                                       ],
+                                       "Priority":1,
+                                       "DBusInterface":"Undefined",
+                    "DBusObject":"AirIntakeTemperature"
+                },
+                               {
+                                       "KeyEventType":"BATTERY",
+                                       "Status":
+                                       [
+                                               {
+                            "AMBPropertyName":"ButteryVoltage",
+                            "Type":"double",
+                            "AccessControl":"R",
+                            "Default":"0",
+                            "DBusProperty":"ButteryVoltage",
+                            "DBusObjectName":"ButteryVoltage",
+                                                       "Zone":"None"
+                                               }
+                                       ],
+                                       "sense":
+                                       [
+                                       ],
+                                       "event_mask":
+                                       [
+                                       ],
+                                       "Priority":1,
+                                       "DBusInterface":"Undefined",
+                    "DBusObject":"ButteryVoltage"
+                },
+                               {
+                                       "KeyEventType":"INSIDE",
+                                       "Status":
+                                       [
+                                               {
+                            "AMBPropertyName":"InteriorTemperature",
+                            "Type":"int",
+                            "AccessControl":"R",
+                            "Default":"0",
+                            "DBusProperty":"Interior",
+                            "DBusObjectName":"InteriorTemperature",
+                                                       "Zone":"None"
+                                               }
+                                       ],
+                                       "sense":
+                                       [
+                                       ],
+                                       "event_mask":
+                                       [
+                                       ],
+                                       "Priority":1,
+                                       "DBusInterface":"Undefined",
+                    "DBusObject":"InteriorTemperature"
+                },
+                               {
+                                       "KeyEventType":"ENGINEOIL",
+                                       "Status":
+                                       [
+                                               {
+                            "AMBPropertyName":"EngineOilTemperature",
+                            "Type":"int",
+                            "AccessControl":"R",
+                            "Default":"0",
+                            "DBusProperty":"Temperature",
+                            "DBusObjectName":"EngineOil",
+                                                       "Zone":"None"
+                                               },
+                                               {
+                            "AMBPropertyName":"EngineOilRemaining",
+                            "Type":"uint16_t",
+                            "AccessControl":"R",
+                            "Default":"0",
+                            "DBusProperty":"Remaining",
+                            "DBusObjectName":"EngineOil",
+                                                       "Zone":"None"
+                                               }
+                                       ],
+                                       "sense":
+                                       [
+                                       ],
+                                       "event_mask":
+                                       [
+                                       ],
+                                       "Priority":1,
+                                       "DBusInterface":"org.automotive.engineOil",
+                    "DBusObject":"EngineOil"
+                },
+                               {
+                                       "KeyEventType":"TIREPRESSURE",
+                                       "Status":
+                                       [
+                                               {
+                            "AMBPropertyName":"TirePressureLeftFront",
+                            "Type":"double",
+                            "AccessControl":"R",
+                            "Default":"0",
+                            "DBusProperty":"LeftFront",
+                            "DBusObjectName":"TirePressure",
+                                                       "Zone":"None"
+                                               },
+                                               {
+                            "AMBPropertyName":"TirePressureRightFront",
+                            "Type":"double",
+                            "AccessControl":"R",
+                            "Default":"0",
+                            "DBusProperty":"RightFront",
+                            "DBusObjectName":"TirePressure",
+                                                       "Zone":"None"
+                                               },
+                                               {
+                            "AMBPropertyName":"TirePressureLeftRear",
+                            "Type":"double",
+                            "AccessControl":"R",
+                            "Default":"0",
+                            "DBusProperty":"LeftRear",
+                            "DBusObjectName":"TirePressure",
+                                                       "Zone":"None"
+                                               },
+                                               {
+                        "AMBPropertyName":"TirePressureRightRear",
+                        "Type":"double",
+                        "AccessControl":"R",
+                        "Default":"0",
+                        "DBusProperty":"RightRear",
+                        "DBusObjectName":"TirePressure",
+                                               "Zone":"None"
+                                               }
+                                       ],
+                                       "sense":
+                                       [
+                                       ],
+                                       "event_mask":
+                                       [
+                                       ],
+                                       "Priority":1,
+                                       "DBusInterface":"org.automotive.tirePressure",
+                    "DBusObject":"TirePressure"
+                },
+                               {
+                                       "KeyEventType":"TIRETEMPERATURE",
+                                       "Status":
+                                       [
+                                               {
+                                                       "AMBPropertyName":"TireTemperatureLeftFront",
+                                                       "Type":"double",
+                                                       "AccessControl":"R",
+                                                       "Default":"0",
+                                                       "DBusProperty":"LeftFront",
+                                                       "DBusObjectName":"TireTemperature",
+                                                       "Zone":"None"
+                                               },
+                                               {
+                                                       "AMBPropertyName":"TireTemperatureRightFront",
+                                                       "Type":"double",
+                                                       "AccessControl":"R",
+                                                       "Default":"0",
+                                                       "DBusProperty":"RightFront",
+                                                       "DBusObjectName":"TireTemperature",
+                                                       "Zone":"None"
+                                               },
+                                               {
+                                                       "AMBPropertyName":"TireTemperatureLeftRear",
+                                                       "Type":"double",
+                                                       "AccessControl":"R",
+                                                       "Default":"0",
+                                                       "DBusProperty":"LeftRear",
+                                                       "DBusObjectName":"TireTemperature",
+                                                       "Zone":"None"
+                                               },
+                                               {
+                                                       "AMBPropertyName":"TireTemperatureRightRear",
+                                                       "Type":"double",
+                                                       "AccessControl":"R",
+                                                       "Default":"0",
+                                                       "DBusProperty":"RightRear",
+                                                       "DBusObjectName":"TireTemperature",
+                                                       "Zone":"None"
+                                               }
+                                       ],
+                                       "sense":
+                                       [
+                                       ],
+                                       "event_mask":
+                                       [
+                                       ],
+                                       "Priority":1,
+                                       "DBusInterface":"org.automotive.tireTemperature",
+                    "DBusObject":"TireTemperature"
+                               },
+                               {
+                                       "KeyEventType":"POWERMODE",
+                                       "Status":
+                                       [
+                                               {
+                                                       "AMBPropertyName":"VehiclePowerMode",
+                                                       "Type":"char",
+                                                       "AccessControl":"R",
+                                                       "Default":"0",
+                                                       "DBusProperty":"VehiclePowerMode",
+                                                       "DBusObjectName":"VehiclePowerMode",
+                                                       "Zone":"None"
+                                               }
+                                       ],
+                                       "sense":
+                                       [
+                                       ],
+                                       "event_mask":
+                                       [
+                                       ],
+                                       "Priority":1,
+                                       "DBusInterface":"org.automotive.vehiclePowerMode",
+                    "DBusObject":"VehiclePowerMode"
+                               },
+                               {
+                                       "KeyEventType":"CRUISECONTROL",
+                                       "Status":
+                                       [
+                                               {
+                                                       "AMBPropertyName":"CruiseControlActive",
+                                                       "Type":"bool",
+                                                       "AccessControl":"R",
+                                                       "Default":"0",
+                                                       "DBusProperty":"Activated",
+                                                       "DBusObjectName":"CruiseControlStatus",
+                                                       "Zone":"None"
+                                               },
+                                               {
+                                                       "AMBPropertyName":"CruiseControlSpeed",
+                                                       "Type":"uint16_t",
+                                                       "AccessControl":"R",
+                                                       "Default":"0",
+                                                       "DBusProperty":"Speed",
+                                                       "DBusObjectName":"CruiseControlStatus",
+                                                       "Zone":"None"
+                                               }
+                                       ],
+                                       "sense":
+                                       [
+                                       ],
+                                       "event_mask":
+                                       [
+                                       ],
+                                       "Priority":1,
+                                       "DBusInterface":"Undefined",
+                    "DBusObject":"CruiseControlStatus"
+                               },
+                               {
+                                       "KeyEventType":"LIGHTSTATUS",
+                                       "Status":
+                                       [
+                                               {
+                                                       "AMBPropertyName":"LightHead",
+                                                       "Type":"bool",
+                                                       "AccessControl":"R",
+                                                       "Default":"0",
+                                                       "DBusProperty":"Head",
+                                                       "DBusObjectName":"LightStatus",
+                                                       "Zone":"None"
+                                               },
+                                               {
+                                                       "AMBPropertyName":"LightLeftTurn",
+                                                       "Type":"bool",
+                                                       "AccessControl":"R",
+                                                       "Default":"0",
+                                                       "DBusProperty":"LeftTurn",
+                                                       "DBusObjectName":"LightStatus",
+                                                       "Zone":"None"
+                                               },
+                                               {
+                                                       "AMBPropertyName":"LightRightTurn",
+                                                       "Type":"bool",
+                                                       "AccessControl":"R",
+                                                       "Default":"0",
+                                                       "DBusProperty":"RightTurn",
+                                                       "DBusObjectName":"LightStatus",
+                                                       "Zone":"None"
+                                               },
+                                               {
+                                                       "AMBPropertyName":"LightParking",
+                                                       "Type":"bool",
+                                                       "AccessControl":"R",
+                                                       "Default":"0",
+                                                       "DBusProperty":"Parking",
+                                                       "DBusObjectName":"LightStatus",
+                                                       "Zone":"None"
+                                               },
+                                               {
+                                                       "AMBPropertyName":"LightFog",
+                                                       "Type":"bool",
+                                                       "AccessControl":"R",
+                                                       "Default":"0",
+                                                       "DBusProperty":"Fog",
+                                                       "DBusObjectName":"LightStatus",
+                                                       "Zone":"None"
+                                               },
+                                               {
+                                                       "AMBPropertyName":"LightHazard",
+                                                       "Type":"bool",
+                                                       "AccessControl":"R",
+                                                       "Default":"0",
+                                                       "DBusProperty":"Hazard",
+                                                       "DBusObjectName":"LightStatus",
+                                                       "Zone":"None"
+                                               },
+                                               {
+                                                       "AMBPropertyName":"LightBrake",
+                                                       "Type":"bool",
+                                                       "AccessControl":"R",
+                                                       "Default":"0",
+                                                       "DBusProperty":"Brake",
+                                                       "DBusObjectName":"LightStatus",
+                                                       "Zone":"None"
+                                               },
+                                               {
+                                                       "AMBPropertyName":"LightHighBeam",
+                                                       "Type":"bool",
+                                                       "AccessControl":"R",
+                                                       "Default":"0",
+                                                       "DBusProperty":"HighBeam",
+                                                       "DBusObjectName":"LightStatus",
+                                                       "Zone":"None"
+                                               }
+                                       ],
+                                       "sense":
+                                       [
+                                       ],
+                                       "event_mask":
+                                       [
+                                       ],
+                                       "Priority":1,
+                                       "DBusInterface":"org.automotive.ParkingLightStatus",
+                    "DBusObject":"LightStatus"
+                               },
+                               {
+                                       "KeyEventType":"ENGINELOAD",
+                                       "Status":
+                                       [
+                                               {
+                                                       "AMBPropertyName":"EngineLoad",
+                                                       "Type":"uint16",
+                                                       "AccessControl":"R",
+                                                       "Default":"0",
+                                                       "DBusProperty":"EngineLoad",
+                                                       "DBusObjectName":"EngineLoad",
+                                                       "Zone":"None"
+                                               }
+                                       ],
+                                       "sense":
+                                       [
+                                       ],
+                                       "event_mask":
+                                       [
+                                       ],
+                                       "Priority":1,
+                                       "DBusInterface":"Undefined",
+                    "DBusObject":"EngineLoad"
+                               },
+                               {
+                                       "KeyEventType":"HORN",
+                                       "Status":
+                                       [
+                                               {
+                                                       "AMBPropertyName":"Horn",
+                                                       "Type":"bool",
+                                                       "AccessControl":"R",
+                                                       "Default":"0",
+                                                       "DBusProperty":"On",
+                                                       "DBusObjectName":"Horn",
+                                                       "Zone":"None"
+                                               }
+                                       ],
+                                       "sense":
+                                       [
+                                       ],
+                                       "event_mask":
+                                       [
+                                       ],
+                                       "Priority":1,
+                                       "DBusInterface":"Undefined",
+                    "DBusObject":"Horn"
+                               },
+                               {
+                                       "KeyEventType":"FUEL_LEVEL",
+                                       "Status":
+                                       [
+                                               {
+                                                       "AMBPropertyName":"FuelLevel",
+                                                       "Type":"uint16",
+                                                       "AccessControl":"R",
+                                                       "Default":"0",
+                                                       "DBusProperty":"Level",
+                                                       "DBusObjectName":"Fuel",
+                                                       "Zone":"None"
+                                               }
+                                       ],
+                                       "sense":
+                                       [
+                                       ],
+                                       "event_mask":
+                                       [
+                                       ],
+                                       "Priority":1,
+                                       "DBusInterface":"org.automotive.fuel",
+                    "DBusObject":"Fuel"
+                               },
+                               {
+                                       "KeyEventType":"FUEL",
+                                       "Status":
+                                       [
+                                               {
+                                                       "AMBPropertyName":"FuelConsumption",
+                                                       "Type":"uint16_t",
+                                                       "AccessControl":"R",
+                                                       "Default":"0",
+                                                       "DBusProperty":"InstantConsumption",
+                                                       "DBusObjectName":"Fuel",
+                                                       "Zone":"None"
+                                               },
+                                               {
+                                                       "AMBPropertyName":"FuelRange",
+                                                       "Type":"uint16_t",
+                                                       "AccessControl":"R",
+                                                       "Default":"0",
+                                                       "DBusProperty":"Range",
+                                                       "DBusObjectName":"Fuel",
+                                                       "Zone":"None"
+                                               },
+                                               {
+                                                       "AMBPropertyName":"FuelEconomy",
+                                                       "Type":"uint16_t",
+                                                       "AccessControl":"R",
+                                                       "Default":"0",
+                                                       "DBusProperty":"InstantEconomy",
+                                                       "DBusObjectName":"Fuel",
+                                                       "Zone":"None"
+                                               },
+                                               {
+                                                       "AMBPropertyName":"FuelAverageEconomy",
+                                                       "Type":"uint16_t",
+                                                       "AccessControl":"R",
+                                                       "Default":"0",
+                                                       "DBusProperty":"AverageEconomy",
+                                                       "DBusObjectName":"Fuel",
+                                                       "Zone":"None"
+                                               },
+                                               {
+                                                       "AMBPropertyName":"FuelType",
+                                                       "Type":"char",
+                                                       "AccessControl":"R",
+                                                       "Default":"0",
+                                                       "DBusProperty":"Type",
+                                                       "DBusObjectName":"FuelInfo",
+                                                       "Zone":"None"
+                                               },
+                                               {
+                                                       "AMBPropertyName":"FuelPositionSide",
+                                                       "Type":"char",
+                                                       "AccessControl":"R",
+                                                       "Default":"0",
+                                                       "DBusProperty":"RefuelPosition",
+                                                       "DBusObjectName":"FuelInfo",
+                                                       "Zone":"None"
+                                               }
+                                       ],
+                                       "sense":
+                                       [
+                                       ],
+                                       "event_mask":
+                                       [
+                                       ],
+                                       "Priority":1,
+                                       "DBusInterface":"org.automotive.fuel",
+                    "DBusObject":"Fuel"
+                               },
+                               {
+                                       "KeyEventType":"EXTERIORBRIGHTNESS",
+                                       "Status":
+                                       [
+                                               {
+                                                       "AMBPropertyName":"ExteriorBrightness",
+                                                       "Type":"uint16_t",
+                                                       "AccessControl":"R",
+                                                       "Default":"0",
+                                                       "DBusProperty":"ExteriorBrightness",
+                                                       "DBusObjectName":"ExteriorBrightness",
+                                                       "Zone":"None"
+                                               }
+                                       ],
+                                       "sense":
+                                       [
+                                       ],
+                                       "event_mask":
+                                       [
+                                       ],
+                                       "Priority":1,
+                                       "DBusInterface":"org.automotive.exteriorBrightness",
+                    "DBusObject":"ExteriorBrightness"
+                               },
+                               {
+                                       "KeyEventType":"LOCATION",
+                                       "Status":
+                                       [
+                                               {
+                                                       "AMBPropertyName":"Latitude",
+                                                       "Type":"double",
+                                                       "AccessControl":"R",
+                                                       "Default":"0",
+                                                       "DBusProperty":"Latitude",
+                                                       "DBusObjectName":"Location",
+                                                       "Zone":"None"
+                                               },
+                                               {
+                                                       "AMBPropertyName":"Longitude",
+                                                       "Type":"double",
+                                                       "AccessControl":"R",
+                                                       "Default":"0",
+                                                       "DBusProperty":"Longitude",
+                                                       "DBusObjectName":"Location",
+                                                       "Zone":"None"
+                                               },
+                                               {
+                                                       "AMBPropertyName":"Altitude",
+                                                       "Type":"double",
+                                                       "AccessControl":"R",
+                                                       "Default":"0",
+                                                       "DBusProperty":"Altitude",
+                                                       "DBusObjectName":"Location",
+                                                       "Zone":"None"
+                                               }
+                                       ],
+                                       "sense":
+                                       [
+                                       ],
+                                       "event_mask":
+                                       [
+                                       ],
+                                       "Priority":1,
+                                       "DBusInterface":"org.automotive.Latitude",
+                    "DBusObject":"Location"
+                               },
+                               {
+                                       "KeyEventType":"DIRECTION",
+                                       "Status":
+                                       [
+                                               {
+                                                       "AMBPropertyName":"Direction",
+                                                       "Type":"uint16_t",
+                                                       "AccessControl":"R",
+                                                       "Default":"0",
+                                                       "DBusProperty":"Direction",
+                                                       "DBusObjectName":"Location",
+                                                       "Zone":"None"
+                                               }
+                                       ],
+                                       "sense":
+                                       [
+                                       ],
+                                       "event_mask":
+                                       [
+                                       ],
+                                       "Priority":1,
+                                       "DBusInterface":"org.automotive.Direction",
+                    "DBusObject":"Location"
+                               },
+                               {
+                                       "KeyEventType":"CUSTOM1",
+                                       "Status":
+                                       [
+                                               {
+                                                       "AMBPropertyName":"CustomA",
+                                                       "Type":"uint16_t",
+                                                       "AccessControl":"R",
+                                                       "Default":"0",
+                                                       "DBusProperty":"CustomA",
+                                                       "DBusObjectName":"CustomA",
+                                                       "Zone":"None"
+                                               }
+                                       ],
+                                       "sense":
+                                       [
+                                       ],
+                                       "event_mask":
+                                       [
+                                       ],
+                                       "Priority":1,
+                                       "DBusInterface":"org.automotive.Direction",
+                    "DBusObject":"CustomA"
+                               },
+                               {
+                                       "KeyEventType":"CUSTOM2",
+                                       "Status":
+                                       [
+                                               {
+                                                       "AMBPropertyName":"CustomB",
+                                                       "Type":"uint16_t",
+                                                       "AccessControl":"R",
+                                                       "Default":"0",
+                                                       "DBusProperty":"CustomB",
+                                                       "DBusObjectName":"CustomB",
+                                                       "Zone":"None"
+                                               }
+                                       ],
+                                       "sense":
+                                       [
+                                       ],
+                                       "event_mask":
+                                       [
+                                       ],
+                                       "Priority":1,
+                                       "DBusInterface":"org.automotive.Direction",
+                    "DBusObject":"CustomB"
+                               },
+                               {
+                                       "KeyEventType":"CUSTOM3",
+                                       "Status":
+                                       [
+                                               {
+                                                       "AMBPropertyName":"CustomC",
+                                                       "Type":"uint16_t",
+                                                       "AccessControl":"R",
+                                                       "Default":"0",
+                                                       "DBusProperty":"CustomC",
+                                                       "DBusObjectName":"CustomC",
+                                                       "Zone":"None"
+                                               }
+                                       ],
+                                       "sense":
+                                       [
+                                       ],
+                                       "event_mask":
+                                       [
+                                       ],
+                                       "Priority":1,
+                                       "DBusInterface":"org.automotive.Direction",
+                    "DBusObject":"CustomC"
+                               },
+                               {
+                                       "KeyEventType":"CUSTOM4",
+                                       "Status":
+                                       [
+                                               {
+                                                       "AMBPropertyName":"CustomD",
+                                                       "Type":"uint16_t",
+                                                       "AccessControl":"R",
+                                                       "Default":"0",
+                                                       "DBusProperty":"CustomD",
+                                                       "DBusObjectName":"CustomD",
+                                                       "Zone":"None"
+                                               }
+                                       ],
+                                       "sense":
+                                       [
+                                       ],
+                                       "event_mask":
+                                       [
+                                       ],
+                                       "Priority":1,
+                                       "DBusInterface":"org.automotive.Direction",
+                    "DBusObject":"CustomD"
+                               }
+                       ],
+            "DefaultInfoPort":
+            {
+                "DataPort":25010,
+                "CtrlPort":25011
+            },
+            "CustomizeInfoPort":
+            {
+                "DataPort":25020,
+                "CtrlPort":25021
+            }
+               },
+               {
+                       "Section":"CarSim",
+                       "VehicleInfoList":
+                       [
+                               "VELOCITY",
+                               "LOCATION",
+                               "SHIFT"
+                       ]
+               }
+       ]
diff --git a/tests/etc/ambd/AMBformat_wrong13.conf b/tests/etc/ambd/AMBformat_wrong13.conf
new file mode 100644 (file)
index 0000000..2a47f5e
--- /dev/null
@@ -0,0 +1,67 @@
+{
+       "Config":
+       {
+               "Section":"Common",
+               "VehicleInfoDefine":
+               [
+                       {
+                               "KeyEventType":"VELOCITY",
+                               "Status":
+                               [
+                                       {
+                                               "AMBPropertyName":"VehicleSpeed",
+                                               "Type":"uint16",
+                                               "AccessControl":"R",
+                                               "Default":"0",
+                                               "DBusProperty":"VehicleSpeed",
+                                               "DBusObjectName":"VehicleSpeed",
+                                               "Zone":"None"
+                                       }
+                               ],
+                               "sense":
+                               [
+                               ],
+                               "event_mask":
+                               [
+                               ],
+                               "Priority":1,
+                               "DBusInterface":"org.automotive.vehicleSpeed",
+                               "DBusObject":"VehicleSpeed"
+                       },
+                       {
+                               "KeyEventType":"ENGINE_SPEED",
+                               "Status":
+                               [
+                                       {
+                                               "AMBPropertyName":"EngineSpeed",
+                                               "Type":"uint16",
+                                               "AccessControl":"R",
+                                               "Default":"0",
+                                               "DBusProperty":"EngineSpeed",
+                                               "DBusObjectName":"EngineSpeed",
+                                               "Zone":"None"
+                                       }
+                               ],
+                               "sense":
+                               [
+                               ],
+                               "event_mask":
+                               [
+                               ],
+                               "Priority":1,
+                               "DBusInterface":"org.automotive.engineSpeed",
+                               "DBusObject":"EngineSpeed"
+                       }
+               ],
+               "DefaultInfoPort":
+               {
+                       "DataPort":25010,
+                       "CtrlPort":25011
+               },
+               "CustomizeInfoPort":
+               {
+                       "DataPort":25020,
+                       "CtrlPort":25021
+               }
+       }
+}
diff --git a/tests/etc/ambd/AMBformat_wrong14.conf b/tests/etc/ambd/AMBformat_wrong14.conf
new file mode 100644 (file)
index 0000000..db510c8
--- /dev/null
@@ -0,0 +1,52 @@
+{
+       "Config":
+       [
+               {
+                       "Section":"Common",
+                       "VehicleInfoDefine":
+                       {
+                               "KeyEventType":"VELOCITY",
+                               "Status":
+                               [
+                                       {
+                                               "AMBPropertyName":"VehicleSpeed",
+                                               "Type":"uint16",
+                                               "AccessControl":"R",
+                                               "Default":"0",
+                                               "DBusProperty":"VehicleSpeed",
+                                               "DBusObjectName":"VehicleSpeed",
+                                               "Zone":"None"
+                                       }
+                               ],
+                               "sense":
+                               [
+                               ],
+                               "event_mask":
+                               [
+                               ],
+                               "Priority":1,
+                               "DBusInterface":"org.automotive.vehicleSpeed",
+                               "DBusObject":"VehicleSpeed"
+                       },
+            "DefaultInfoPort":
+            {
+                "DataPort":25010,
+                "CtrlPort":25011
+            },
+            "CustomizeInfoPort":
+            {
+                "DataPort":25020,
+                "CtrlPort":25021
+            }
+               },
+               {
+                       "Section":"CarSim",
+                       "VehicleInfoList":
+                       [
+                               "VELOCITY",
+                               "LOCATION",
+                               "SHIFT"
+                       ]
+               }
+       ]
+}
diff --git a/tests/etc/ambd/AMBformat_wrong2.conf b/tests/etc/ambd/AMBformat_wrong2.conf
new file mode 100644 (file)
index 0000000..d96f306
--- /dev/null
@@ -0,0 +1,1113 @@
+{
+       "Config":
+       [
+               {
+                       "Section":"Commo",
+                       "VehicleInfoDefine":
+                       [
+                               {
+                                       "KeyEventType":"VELOCITY",
+                                       "Status":
+                                       [
+                                               {
+                                                       "AMBPropertyName":"VehicleSpeed",
+                                                       "Type":"uint16",
+                                                       "AccessControl":"R",
+                                                       "Default":"0",
+                                                       "DBusProperty":"VehicleSpeed",
+                                                       "DBusObjectName":"VehicleSpeed",
+                                                       "Zone":"None"
+                                               }
+                                       ],
+                                       "sense":
+                                       [
+                                       ],
+                                       "event_mask":
+                                       [
+                                       ],
+                                       "Priority":1,
+                                       "DBusInterface":"org.automotive.vehicleSpeed",
+                    "DBusObject":"VehicleSpeed"
+                               },
+                               {
+                                       "KeyEventType":"ENGINE_SPEED",
+                                       "Status":
+                                       [
+                                               {
+                            "AMBPropertyName":"EngineSpeed",
+                            "Type":"uint16",
+                            "AccessControl":"R",
+                            "Default":"0",
+                            "DBusProperty":"EngineSpeed",
+                            "DBusObjectName":"EngineSpeed",
+                                                       "Zone":"None"
+                                               }
+                                       ],
+                                       "sense":
+                                       [
+                                       ],
+                                       "event_mask":
+                                       [
+                                       ],
+                                       "Priority":1,
+                                       "DBusInterface":"org.automotive.engineSpeed",
+                    "DBusObject":"EngineSpeed"
+                },
+                               {
+                                       "KeyEventType":"SHIFT",
+                                       "Status":
+                                       [
+                                               {
+                            "AMBPropertyName":"TransmissionShiftPosition",
+                            "Type":"int",
+                            "AccessControl":"R",
+                            "Default":"0",
+                            "DBusProperty":"ShiftPosition",
+                            "DBusObjectName":"Transmission",
+                                                       "Zone":"None"
+                                               },
+                                               {
+                                                       "AMBPropertyName":"TransmissionGearPostion",
+                                                       "Type":"int",
+                                                       "AccessControl":"R",
+                                                       "Default":"0",
+                                                       "DBusProperty":"GearPosition",
+                                                       "DBusObjectName":"Transmission",
+                                                       "Zone":"None"
+                                               },
+                                               {
+                                                       "AMBPropertyName":"TransmissionMode",
+                                                       "Type":"int",
+                                                       "AccessControl":"R",
+                                                       "Default":"0",
+                                                       "DBusProperty":"Mode",
+                                                       "DBusObjectName":"Transmission",
+                                                       "Zone":"None"
+                                               }
+                                       ],
+                                       "sense":
+                                       [
+                                       ],
+                                       "event_mask":
+                                       [
+                                       ],
+                                       "Priority":1,
+                                       "DBusInterface":"org.automotive.transmission",
+                    "DBusObject":"Transmission"
+                },
+                               {
+                                       "KeyEventType":"ACCPEDAL_OPEN",
+                                       "Status":
+                                       [
+                                               {
+                            "AMBPropertyName":"ThrottlePosition",
+                            "Type":"uint16",
+                            "AccessControl":"R",
+                            "Default":"0",
+                            "DBusProperty":"ThrottlePosition",
+                            "DBusObjectName":"ThrottlePosition",
+                                                       "Zone":"None"
+                                               }
+                                       ],
+                                       "sense":
+                                       [
+                                       ],
+                                       "event_mask":
+                                       [
+                                       ],
+                                       "Priority":1,
+                                       "DBusInterface":"Undefined",
+                    "DBusObject":"ThrottlePosition"
+                },
+                               {
+                                       "KeyEventType":"BRAKE_SIGNAL",
+                                       "Status":
+                                       [
+                                               {
+                            "AMBPropertyName":"WheelBrake",
+                            "Type":"bool",
+                            "AccessControl":"R",
+                            "Default":"0",
+                            "DBusProperty":"Engaged",
+                            "DBusObjectName":"WheelBrake",
+                                                       "Zone":"None"
+                                               }
+                                       ],
+                                       "sense":
+                                       [
+                                       ],
+                                       "event_mask":
+                                       [
+                                       ],
+                                       "Priority":1,
+                                       "DBusInterface":"Undefined",
+                    "DBusObject":"WheelBrake"
+                },
+                               {
+                                       "KeyEventType":"BRAKE_PRESSURE",
+                                       "Status":
+                                       [
+                                               {
+                            "AMBPropertyName":"WheelBrakePressure",
+                            "Type":"uint16",
+                            "AccessControl":"R",
+                            "Default":"0",
+                            "DBusProperty":"WheelBrakePressure",
+                            "DBusObjectName":"WheelBrakePressure",
+                                                       "Zone":"None"
+                                               }
+                                       ],
+                                       "sense":
+                                       [
+                                       ],
+                                       "event_mask":
+                                       [
+                                       ],
+                                       "Priority":1,
+                                       "DBusInterface":"org.automotive.WheelBrakePressure",
+                    "DBusObject":"WheelBrakePressure"
+                },
+                               {
+                                       "KeyEventType":"STEERING",
+                                       "Status":
+                                       [
+                                               {
+                            "AMBPropertyName":"SteeringWheelAngle",
+                            "Type":"uint16",
+                            "AccessControl":"R",
+                            "Default":"0",
+                            "DBusProperty":"SteeringWheelAngle",
+                            "DBusObjectName":"SteeringWheelAngle",
+                                                       "Zone":"None"
+                                               }
+                                       ],
+                                       "sense":
+                                       [
+                                       ],
+                                       "event_mask":
+                                       [
+                                       ],
+                                       "Priority":1,
+                                       "DBusInterface":"Undefined",
+                    "DBusObject":"SteeringWheelAngle"
+                },
+                               {
+                                       "KeyEventType":"TURN_SIGNAL",
+                                       "Status":
+                                       [
+                                               {
+                            "AMBPropertyName":"TurnSignal",
+                            "Type":"int",
+                            "AccessControl":"R",
+                            "Default":"0",
+                            "DBusProperty":"TurnSignal",
+                            "DBusObjectName":"TurnSignal",
+                                                       "Zone":"None"
+                                               }
+                                       ],
+                                       "sense":
+                                       [
+                                       ],
+                                       "event_mask":
+                                       [
+                                       ],
+                                       "Priority":1,
+                                       "DBusInterface":"Undefined",
+                    "DBusObject":"TurnSignal"
+                },
+                               {
+                                       "KeyEventType":"CLUTCH",
+                                       "Status":
+                                       [
+                                               {
+                            "AMBPropertyName":"ClutchStatus",
+                            "Type":"bool",
+                            "AccessControl":"R",
+                            "Default":"0",
+                            "DBusProperty":"ClutchStatus",
+                            "DBusObjectName":"ClutchStatus",
+                                                       "Zone":"None"
+                                               }
+                                       ],
+                                       "sense":
+                                       [
+                                       ],
+                                       "event_mask":
+                                       [
+                                       ],
+                                       "Priority":1,
+                                       "DBusInterface":"Undefined",
+                    "DBusObject":"ClutchStatus"
+                },
+                               {
+                                       "KeyEventType":"OIL",
+                                       "Status":
+                                       [
+                                               {
+                            "AMBPropertyName":"EngineOilPressure",
+                            "Type":"uint16",
+                            "AccessControl":"R",
+                            "Default":"0",
+                            "DBusProperty":"Pressure",
+                            "DBusObjectName":"EngineOil",
+                                                       "Zone":"None"
+                                               },
+                                               {
+                                                       "AMBPropertyName":"EngineOilLevel",
+                                                       "Type":"int",
+                                                       "AccessControl":"R",
+                                                       "Default":"0",
+                                                       "DBusProperty":"EngineOilLevel",
+                                                       "DBusObjectName":"EngineOilLevel",
+                                                       "Zone":"None"
+                                               }
+                                       ],
+                                       "sense":
+                                       [
+                                       ],
+                                       "event_mask":
+                                       [
+                                       ],
+                                       "Priority":1,
+                                       "DBusInterface":"org.automotive.EngineOilLevel",
+                    "DBusObject":"EngineOil"
+                },
+                               {
+                                       "KeyEventType":"WATER_TEMP",
+                                       "Status":
+                                       [
+                                               {
+                            "AMBPropertyName":"EngineCoolantTemperature",
+                            "Type":"int",
+                            "AccessControl":"R",
+                            "Default":"0",
+                            "DBusProperty":"EngineCoolantTemperature",
+                            "DBusObjectName":"EngineCoolantTemperature",
+                                                       "Zone":"None"
+                                               }
+                                       ],
+                                       "sense":
+                                       [
+                                       ],
+                                       "event_mask":
+                                       [
+                                       ],
+                                       "Priority":1,
+                                       "DBusInterface":"Undefined",
+                    "DBusObject":"EngineCoolantTemperature"
+                },
+                               {
+                                       "KeyEventType":"MACHINEGUNTURRET",
+                                       "Status":
+                                       [
+                                               {
+                        "AMBPropertyName":"MachineGunTurretStatus",
+                        "Type":"bool",
+                        "AccessControl":"R",
+                        "Default":"0",
+                        "DBusProperty":"MachineGunTurretStatus",
+                        "DBusObjectName":"MachineGunTurretStatus",
+                                               "Zone":"None"
+                                               }
+                                       ],
+                                       "sense":
+                                       [
+                                       ],
+                                       "event_mask":
+                                       [
+                                       ],
+                                       "Priority":1,
+                                       "DBusInterface":"Undefined",
+                    "DBusObject":"MachineGunTurretStatus"
+                },
+                               {
+                                       "KeyEventType":"ACCELERATION",
+                                       "Status":
+                                       [
+                                               {
+                                                       "AMBPropertyName":"AccelerationX",
+                                                       "Type":"uint16",
+                                                       "AccessControl":"R",
+                                                       "Default":"0",
+                                                       "DBusProperty":"X",
+                                                       "DBusObjectName":"Acceleration",
+                                                       "Zone":"None"
+                                               },
+                                               {
+                                                       "AMBPropertyName":"AccelerationY",
+                                                       "Type":"uint16",
+                                                       "AccessControl":"R",
+                                                       "Default":"0",
+                                                       "DBusProperty":"Y",
+                                                       "DBusObjectName":"Acceleration",
+                                                       "Zone":"None"
+                                               },
+                                               {
+                                                       "AMBPropertyName":"AccelerationZ",
+                                                       "Type":"uint16",
+                                                       "AccessControl":"R",
+                                                       "Default":"0",
+                                                       "DBusProperty":"Z",
+                                                       "DBusObjectName":"Acceleration",
+                                                       "Zone":"None"
+                                               }
+                                       ],
+                                       "sense":
+                                       [
+                                       ],
+                                       "event_mask":
+                                       [
+                                       ],
+                                       "Priority":1,
+                                       "DBusInterface":"org.automotive.acceleration",
+                    "DBusObject":"Acceleration"
+                },
+                               {
+                                       "KeyEventType":"MASSAIRFLOW",
+                                       "Status":
+                                       [
+                                               {
+                            "AMBPropertyName":"MassAirFlow",
+                            "Type":"uint16_t",
+                            "AccessControl":"R",
+                            "Default":"0",
+                            "DBusProperty":"MassAirFlow",
+                            "DBusObjectName":"MassAirFlow",
+                                                       "Zone":"None"
+                                               }
+                                       ],
+                                       "sense":
+                                       [
+                                       ],
+                                       "event_mask":
+                                       [
+                                       ],
+                                       "Priority":1,
+                                       "DBusInterface":"Undefined",
+                    "DBusObject":"MassAirFlow"
+                },
+                               {
+                                       "KeyEventType":"BUTTON",
+                                       "Status":
+                                       [
+                                               {
+                            "AMBPropertyName":"ButtonEvent",
+                            "Type":"char",
+                            "AccessControl":"R",
+                            "Default":"0",
+                            "DBusProperty":"ButtonEvent",
+                            "DBusObjectName":"ButtonEvent",
+                                                       "Zone":"None"
+                                               }
+                                       ],
+                                       "sense":
+                                       [
+                                       ],
+                                       "event_mask":
+                                       [
+                                       ],
+                                       "Priority":1,
+                                       "DBusInterface":"Undefined",
+                    "DBusObject":"ButtonEvent"
+                },
+                               {
+                                       "KeyEventType":"OUTSIDE",
+                                       "Status":
+                                       [
+                                               {
+                            "AMBPropertyName":"AirIntakeTemperature",
+                            "Type":"int",
+                            "AccessControl":"R",
+                            "Default":"0",
+                            "DBusProperty":"AirIntakeTemperature",
+                            "DBusObjectName":"AirIntakeTemperature",
+                                                       "Zone":"None"
+                                               }
+                                       ],
+                                       "sense":
+                                       [
+                                       ],
+                                       "event_mask":
+                                       [
+                                       ],
+                                       "Priority":1,
+                                       "DBusInterface":"Undefined",
+                    "DBusObject":"AirIntakeTemperature"
+                },
+                               {
+                                       "KeyEventType":"BATTERY",
+                                       "Status":
+                                       [
+                                               {
+                            "AMBPropertyName":"ButteryVoltage",
+                            "Type":"double",
+                            "AccessControl":"R",
+                            "Default":"0",
+                            "DBusProperty":"ButteryVoltage",
+                            "DBusObjectName":"ButteryVoltage",
+                                                       "Zone":"None"
+                                               }
+                                       ],
+                                       "sense":
+                                       [
+                                       ],
+                                       "event_mask":
+                                       [
+                                       ],
+                                       "Priority":1,
+                                       "DBusInterface":"Undefined",
+                    "DBusObject":"ButteryVoltage"
+                },
+                               {
+                                       "KeyEventType":"INSIDE",
+                                       "Status":
+                                       [
+                                               {
+                            "AMBPropertyName":"InteriorTemperature",
+                            "Type":"int",
+                            "AccessControl":"R",
+                            "Default":"0",
+                            "DBusProperty":"Interior",
+                            "DBusObjectName":"InteriorTemperature",
+                                                       "Zone":"None"
+                                               }
+                                       ],
+                                       "sense":
+                                       [
+                                       ],
+                                       "event_mask":
+                                       [
+                                       ],
+                                       "Priority":1,
+                                       "DBusInterface":"Undefined",
+                    "DBusObject":"InteriorTemperature"
+                },
+                               {
+                                       "KeyEventType":"ENGINEOIL",
+                                       "Status":
+                                       [
+                                               {
+                            "AMBPropertyName":"EngineOilTemperature",
+                            "Type":"int",
+                            "AccessControl":"R",
+                            "Default":"0",
+                            "DBusProperty":"Temperature",
+                            "DBusObjectName":"EngineOil",
+                                                       "Zone":"None"
+                                               },
+                                               {
+                            "AMBPropertyName":"EngineOilRemaining",
+                            "Type":"uint16_t",
+                            "AccessControl":"R",
+                            "Default":"0",
+                            "DBusProperty":"Remaining",
+                            "DBusObjectName":"EngineOil",
+                                                       "Zone":"None"
+                                               }
+                                       ],
+                                       "sense":
+                                       [
+                                       ],
+                                       "event_mask":
+                                       [
+                                       ],
+                                       "Priority":1,
+                                       "DBusInterface":"org.automotive.engineOil",
+                    "DBusObject":"EngineOil"
+                },
+                               {
+                                       "KeyEventType":"TIREPRESSURE",
+                                       "Status":
+                                       [
+                                               {
+                            "AMBPropertyName":"TirePressureLeftFront",
+                            "Type":"double",
+                            "AccessControl":"R",
+                            "Default":"0",
+                            "DBusProperty":"LeftFront",
+                            "DBusObjectName":"TirePressure",
+                                                       "Zone":"None"
+                                               },
+                                               {
+                            "AMBPropertyName":"TirePressureRightFront",
+                            "Type":"double",
+                            "AccessControl":"R",
+                            "Default":"0",
+                            "DBusProperty":"RightFront",
+                            "DBusObjectName":"TirePressure",
+                                                       "Zone":"None"
+                                               },
+                                               {
+                            "AMBPropertyName":"TirePressureLeftRear",
+                            "Type":"double",
+                            "AccessControl":"R",
+                            "Default":"0",
+                            "DBusProperty":"LeftRear",
+                            "DBusObjectName":"TirePressure",
+                                                       "Zone":"None"
+                                               },
+                                               {
+                        "AMBPropertyName":"TirePressureRightRear",
+                        "Type":"double",
+                        "AccessControl":"R",
+                        "Default":"0",
+                        "DBusProperty":"RightRear",
+                        "DBusObjectName":"TirePressure",
+                                               "Zone":"None"
+                                               }
+                                       ],
+                                       "sense":
+                                       [
+                                       ],
+                                       "event_mask":
+                                       [
+                                       ],
+                                       "Priority":1,
+                                       "DBusInterface":"org.automotive.tirePressure",
+                    "DBusObject":"TirePressure"
+                },
+                               {
+                                       "KeyEventType":"TIRETEMPERATURE",
+                                       "Status":
+                                       [
+                                               {
+                                                       "AMBPropertyName":"TireTemperatureLeftFront",
+                                                       "Type":"double",
+                                                       "AccessControl":"R",
+                                                       "Default":"0",
+                                                       "DBusProperty":"LeftFront",
+                                                       "DBusObjectName":"TireTemperature",
+                                                       "Zone":"None"
+                                               },
+                                               {
+                                                       "AMBPropertyName":"TireTemperatureRightFront",
+                                                       "Type":"double",
+                                                       "AccessControl":"R",
+                                                       "Default":"0",
+                                                       "DBusProperty":"RightFront",
+                                                       "DBusObjectName":"TireTemperature",
+                                                       "Zone":"None"
+                                               },
+                                               {
+                                                       "AMBPropertyName":"TireTemperatureLeftRear",
+                                                       "Type":"double",
+                                                       "AccessControl":"R",
+                                                       "Default":"0",
+                                                       "DBusProperty":"LeftRear",
+                                                       "DBusObjectName":"TireTemperature",
+                                                       "Zone":"None"
+                                               },
+                                               {
+                                                       "AMBPropertyName":"TireTemperatureRightRear",
+                                                       "Type":"double",
+                                                       "AccessControl":"R",
+                                                       "Default":"0",
+                                                       "DBusProperty":"RightRear",
+                                                       "DBusObjectName":"TireTemperature",
+                                                       "Zone":"None"
+                                               }
+                                       ],
+                                       "sense":
+                                       [
+                                       ],
+                                       "event_mask":
+                                       [
+                                       ],
+                                       "Priority":1,
+                                       "DBusInterface":"org.automotive.tireTemperature",
+                    "DBusObject":"TireTemperature"
+                               },
+                               {
+                                       "KeyEventType":"POWERMODE",
+                                       "Status":
+                                       [
+                                               {
+                                                       "AMBPropertyName":"VehiclePowerMode",
+                                                       "Type":"char",
+                                                       "AccessControl":"R",
+                                                       "Default":"0",
+                                                       "DBusProperty":"VehiclePowerMode",
+                                                       "DBusObjectName":"VehiclePowerMode",
+                                                       "Zone":"None"
+                                               }
+                                       ],
+                                       "sense":
+                                       [
+                                       ],
+                                       "event_mask":
+                                       [
+                                       ],
+                                       "Priority":1,
+                                       "DBusInterface":"org.automotive.vehiclePowerMode",
+                    "DBusObject":"VehiclePowerMode"
+                               },
+                               {
+                                       "KeyEventType":"CRUISECONTROL",
+                                       "Status":
+                                       [
+                                               {
+                                                       "AMBPropertyName":"CruiseControlActive",
+                                                       "Type":"bool",
+                                                       "AccessControl":"R",
+                                                       "Default":"0",
+                                                       "DBusProperty":"Activated",
+                                                       "DBusObjectName":"CruiseControlStatus",
+                                                       "Zone":"None"
+                                               },
+                                               {
+                                                       "AMBPropertyName":"CruiseControlSpeed",
+                                                       "Type":"uint16_t",
+                                                       "AccessControl":"R",
+                                                       "Default":"0",
+                                                       "DBusProperty":"Speed",
+                                                       "DBusObjectName":"CruiseControlStatus",
+                                                       "Zone":"None"
+                                               }
+                                       ],
+                                       "sense":
+                                       [
+                                       ],
+                                       "event_mask":
+                                       [
+                                       ],
+                                       "Priority":1,
+                                       "DBusInterface":"Undefined",
+                    "DBusObject":"CruiseControlStatus"
+                               },
+                               {
+                                       "KeyEventType":"LIGHTSTATUS",
+                                       "Status":
+                                       [
+                                               {
+                                                       "AMBPropertyName":"LightHead",
+                                                       "Type":"bool",
+                                                       "AccessControl":"R",
+                                                       "Default":"0",
+                                                       "DBusProperty":"Head",
+                                                       "DBusObjectName":"LightStatus",
+                                                       "Zone":"None"
+                                               },
+                                               {
+                                                       "AMBPropertyName":"LightLeftTurn",
+                                                       "Type":"bool",
+                                                       "AccessControl":"R",
+                                                       "Default":"0",
+                                                       "DBusProperty":"LeftTurn",
+                                                       "DBusObjectName":"LightStatus",
+                                                       "Zone":"None"
+                                               },
+                                               {
+                                                       "AMBPropertyName":"LightRightTurn",
+                                                       "Type":"bool",
+                                                       "AccessControl":"R",
+                                                       "Default":"0",
+                                                       "DBusProperty":"RightTurn",
+                                                       "DBusObjectName":"LightStatus",
+                                                       "Zone":"None"
+                                               },
+                                               {
+                                                       "AMBPropertyName":"LightParking",
+                                                       "Type":"bool",
+                                                       "AccessControl":"R",
+                                                       "Default":"0",
+                                                       "DBusProperty":"Parking",
+                                                       "DBusObjectName":"LightStatus",
+                                                       "Zone":"None"
+                                               },
+                                               {
+                                                       "AMBPropertyName":"LightFog",
+                                                       "Type":"bool",
+                                                       "AccessControl":"R",
+                                                       "Default":"0",
+                                                       "DBusProperty":"Fog",
+                                                       "DBusObjectName":"LightStatus",
+                                                       "Zone":"None"
+                                               },
+                                               {
+                                                       "AMBPropertyName":"LightHazard",
+                                                       "Type":"bool",
+                                                       "AccessControl":"R",
+                                                       "Default":"0",
+                                                       "DBusProperty":"Hazard",
+                                                       "DBusObjectName":"LightStatus",
+                                                       "Zone":"None"
+                                               },
+                                               {
+                                                       "AMBPropertyName":"LightBrake",
+                                                       "Type":"bool",
+                                                       "AccessControl":"R",
+                                                       "Default":"0",
+                                                       "DBusProperty":"Brake",
+                                                       "DBusObjectName":"LightStatus",
+                                                       "Zone":"None"
+                                               },
+                                               {
+                                                       "AMBPropertyName":"LightHighBeam",
+                                                       "Type":"bool",
+                                                       "AccessControl":"R",
+                                                       "Default":"0",
+                                                       "DBusProperty":"HighBeam",
+                                                       "DBusObjectName":"LightStatus",
+                                                       "Zone":"None"
+                                               }
+                                       ],
+                                       "sense":
+                                       [
+                                       ],
+                                       "event_mask":
+                                       [
+                                       ],
+                                       "Priority":1,
+                                       "DBusInterface":"org.automotive.ParkingLightStatus",
+                    "DBusObject":"LightStatus"
+                               },
+                               {
+                                       "KeyEventType":"ENGINELOAD",
+                                       "Status":
+                                       [
+                                               {
+                                                       "AMBPropertyName":"EngineLoad",
+                                                       "Type":"uint16",
+                                                       "AccessControl":"R",
+                                                       "Default":"0",
+                                                       "DBusProperty":"EngineLoad",
+                                                       "DBusObjectName":"EngineLoad",
+                                                       "Zone":"None"
+                                               }
+                                       ],
+                                       "sense":
+                                       [
+                                       ],
+                                       "event_mask":
+                                       [
+                                       ],
+                                       "Priority":1,
+                                       "DBusInterface":"Undefined",
+                    "DBusObject":"EngineLoad"
+                               },
+                               {
+                                       "KeyEventType":"HORN",
+                                       "Status":
+                                       [
+                                               {
+                                                       "AMBPropertyName":"Horn",
+                                                       "Type":"bool",
+                                                       "AccessControl":"R",
+                                                       "Default":"0",
+                                                       "DBusProperty":"On",
+                                                       "DBusObjectName":"Horn",
+                                                       "Zone":"None"
+                                               }
+                                       ],
+                                       "sense":
+                                       [
+                                       ],
+                                       "event_mask":
+                                       [
+                                       ],
+                                       "Priority":1,
+                                       "DBusInterface":"Undefined",
+                    "DBusObject":"Horn"
+                               },
+                               {
+                                       "KeyEventType":"FUEL_LEVEL",
+                                       "Status":
+                                       [
+                                               {
+                                                       "AMBPropertyName":"FuelLevel",
+                                                       "Type":"uint16",
+                                                       "AccessControl":"R",
+                                                       "Default":"0",
+                                                       "DBusProperty":"Level",
+                                                       "DBusObjectName":"Fuel",
+                                                       "Zone":"None"
+                                               }
+                                       ],
+                                       "sense":
+                                       [
+                                       ],
+                                       "event_mask":
+                                       [
+                                       ],
+                                       "Priority":1,
+                                       "DBusInterface":"org.automotive.fuel",
+                    "DBusObject":"Fuel"
+                               },
+                               {
+                                       "KeyEventType":"FUEL",
+                                       "Status":
+                                       [
+                                               {
+                                                       "AMBPropertyName":"FuelConsumption",
+                                                       "Type":"uint16_t",
+                                                       "AccessControl":"R",
+                                                       "Default":"0",
+                                                       "DBusProperty":"InstantConsumption",
+                                                       "DBusObjectName":"Fuel",
+                                                       "Zone":"None"
+                                               },
+                                               {
+                                                       "AMBPropertyName":"FuelRange",
+                                                       "Type":"uint16_t",
+                                                       "AccessControl":"R",
+                                                       "Default":"0",
+                                                       "DBusProperty":"Range",
+                                                       "DBusObjectName":"Fuel",
+                                                       "Zone":"None"
+                                               },
+                                               {
+                                                       "AMBPropertyName":"FuelEconomy",
+                                                       "Type":"uint16_t",
+                                                       "AccessControl":"R",
+                                                       "Default":"0",
+                                                       "DBusProperty":"InstantEconomy",
+                                                       "DBusObjectName":"Fuel",
+                                                       "Zone":"None"
+                                               },
+                                               {
+                                                       "AMBPropertyName":"FuelAverageEconomy",
+                                                       "Type":"uint16_t",
+                                                       "AccessControl":"R",
+                                                       "Default":"0",
+                                                       "DBusProperty":"AverageEconomy",
+                                                       "DBusObjectName":"Fuel",
+                                                       "Zone":"None"
+                                               },
+                                               {
+                                                       "AMBPropertyName":"FuelType",
+                                                       "Type":"char",
+                                                       "AccessControl":"R",
+                                                       "Default":"0",
+                                                       "DBusProperty":"Type",
+                                                       "DBusObjectName":"FuelInfo",
+                                                       "Zone":"None"
+                                               },
+                                               {
+                                                       "AMBPropertyName":"FuelPositionSide",
+                                                       "Type":"char",
+                                                       "AccessControl":"R",
+                                                       "Default":"0",
+                                                       "DBusProperty":"RefuelPosition",
+                                                       "DBusObjectName":"FuelInfo",
+                                                       "Zone":"None"
+                                               }
+                                       ],
+                                       "sense":
+                                       [
+                                       ],
+                                       "event_mask":
+                                       [
+                                       ],
+                                       "Priority":1,
+                                       "DBusInterface":"org.automotive.fuel",
+                    "DBusObject":"Fuel"
+                               },
+                               {
+                                       "KeyEventType":"EXTERIORBRIGHTNESS",
+                                       "Status":
+                                       [
+                                               {
+                                                       "AMBPropertyName":"ExteriorBrightness",
+                                                       "Type":"uint16_t",
+                                                       "AccessControl":"R",
+                                                       "Default":"0",
+                                                       "DBusProperty":"ExteriorBrightness",
+                                                       "DBusObjectName":"ExteriorBrightness",
+                                                       "Zone":"None"
+                                               }
+                                       ],
+                                       "sense":
+                                       [
+                                       ],
+                                       "event_mask":
+                                       [
+                                       ],
+                                       "Priority":1,
+                                       "DBusInterface":"org.automotive.exteriorBrightness",
+                    "DBusObject":"ExteriorBrightness"
+                               },
+                               {
+                                       "KeyEventType":"LOCATION",
+                                       "Status":
+                                       [
+                                               {
+                                                       "AMBPropertyName":"Latitude",
+                                                       "Type":"double",
+                                                       "AccessControl":"R",
+                                                       "Default":"0",
+                                                       "DBusProperty":"Latitude",
+                                                       "DBusObjectName":"Location",
+                                                       "Zone":"None"
+                                               },
+                                               {
+                                                       "AMBPropertyName":"Longitude",
+                                                       "Type":"double",
+                                                       "AccessControl":"R",
+                                                       "Default":"0",
+                                                       "DBusProperty":"Longitude",
+                                                       "DBusObjectName":"Location",
+                                                       "Zone":"None"
+                                               },
+                                               {
+                                                       "AMBPropertyName":"Altitude",
+                                                       "Type":"double",
+                                                       "AccessControl":"R",
+                                                       "Default":"0",
+                                                       "DBusProperty":"Altitude",
+                                                       "DBusObjectName":"Location",
+                                                       "Zone":"None"
+                                               }
+                                       ],
+                                       "sense":
+                                       [
+                                       ],
+                                       "event_mask":
+                                       [
+                                       ],
+                                       "Priority":1,
+                                       "DBusInterface":"org.automotive.Latitude",
+                    "DBusObject":"Location"
+                               },
+                               {
+                                       "KeyEventType":"DIRECTION",
+                                       "Status":
+                                       [
+                                               {
+                                                       "AMBPropertyName":"Direction",
+                                                       "Type":"uint16_t",
+                                                       "AccessControl":"R",
+                                                       "Default":"0",
+                                                       "DBusProperty":"Direction",
+                                                       "DBusObjectName":"Location",
+                                                       "Zone":"None"
+                                               }
+                                       ],
+                                       "sense":
+                                       [
+                                       ],
+                                       "event_mask":
+                                       [
+                                       ],
+                                       "Priority":1,
+                                       "DBusInterface":"org.automotive.Direction",
+                    "DBusObject":"Location"
+                               },
+                               {
+                                       "KeyEventType":"CUSTOM1",
+                                       "Status":
+                                       [
+                                               {
+                                                       "AMBPropertyName":"CustomA",
+                                                       "Type":"uint16_t",
+                                                       "AccessControl":"R",
+                                                       "Default":"0",
+                                                       "DBusProperty":"CustomA",
+                                                       "DBusObjectName":"CustomA",
+                                                       "Zone":"None"
+                                               }
+                                       ],
+                                       "sense":
+                                       [
+                                       ],
+                                       "event_mask":
+                                       [
+                                       ],
+                                       "Priority":1,
+                                       "DBusInterface":"org.automotive.Direction",
+                    "DBusObject":"CustomA"
+                               },
+                               {
+                                       "KeyEventType":"CUSTOM2",
+                                       "Status":
+                                       [
+                                               {
+                                                       "AMBPropertyName":"CustomB",
+                                                       "Type":"uint16_t",
+                                                       "AccessControl":"R",
+                                                       "Default":"0",
+                                                       "DBusProperty":"CustomB",
+                                                       "DBusObjectName":"CustomB",
+                                                       "Zone":"None"
+                                               }
+                                       ],
+                                       "sense":
+                                       [
+                                       ],
+                                       "event_mask":
+                                       [
+                                       ],
+                                       "Priority":1,
+                                       "DBusInterface":"org.automotive.Direction",
+                    "DBusObject":"CustomB"
+                               },
+                               {
+                                       "KeyEventType":"CUSTOM3",
+                                       "Status":
+                                       [
+                                               {
+                                                       "AMBPropertyName":"CustomC",
+                                                       "Type":"uint16_t",
+                                                       "AccessControl":"R",
+                                                       "Default":"0",
+                                                       "DBusProperty":"CustomC",
+                                                       "DBusObjectName":"CustomC",
+                                                       "Zone":"None"
+                                               }
+                                       ],
+                                       "sense":
+                                       [
+                                       ],
+                                       "event_mask":
+                                       [
+                                       ],
+                                       "Priority":1,
+                                       "DBusInterface":"org.automotive.Direction",
+                    "DBusObject":"CustomC"
+                               },
+                               {
+                                       "KeyEventType":"CUSTOM4",
+                                       "Status":
+                                       [
+                                               {
+                                                       "AMBPropertyName":"CustomD",
+                                                       "Type":"uint16_t",
+                                                       "AccessControl":"R",
+                                                       "Default":"0",
+                                                       "DBusProperty":"CustomD",
+                                                       "DBusObjectName":"CustomD",
+                                                       "Zone":"None"
+                                               }
+                                       ],
+                                       "sense":
+                                       [
+                                       ],
+                                       "event_mask":
+                                       [
+                                       ],
+                                       "Priority":1,
+                                       "DBusInterface":"org.automotive.Direction",
+                    "DBusObject":"CustomD"
+                               }
+                       ],
+            "DefaultInfoPort":
+            {
+                "DataPort":25010,
+                "CtrlPort":25011
+            },
+            "CustomizeInfoPort":
+            {
+                "DataPort":25020,
+                "CtrlPort":25021
+            }
+               },
+               {
+                       "Section":"CarSim",
+                       "VehicleInfoList":
+                       [
+                               "VELOCITY",
+                               "LOCATION",
+                               "SHIFT"
+                       ]
+               }
+       ]
+}
diff --git a/tests/etc/ambd/AMBformat_wrong3.conf b/tests/etc/ambd/AMBformat_wrong3.conf
new file mode 100644 (file)
index 0000000..e3946e5
--- /dev/null
@@ -0,0 +1,1113 @@
+{
+       "Config":
+       [
+               {
+                       "Section":"Common",
+                       "VehicleInfoDefin":
+                       [
+                               {
+                                       "KeyEventType":"VELOCITY",
+                                       "Status":
+                                       [
+                                               {
+                                                       "AMBPropertyName":"VehicleSpeed",
+                                                       "Type":"uint16",
+                                                       "AccessControl":"R",
+                                                       "Default":"0",
+                                                       "DBusProperty":"VehicleSpeed",
+                                                       "DBusObjectName":"VehicleSpeed",
+                                                       "Zone":"None"
+                                               }
+                                       ],
+                                       "sense":
+                                       [
+                                       ],
+                                       "event_mask":
+                                       [
+                                       ],
+                                       "Priority":1,
+                                       "DBusInterface":"org.automotive.vehicleSpeed",
+                    "DBusObject":"VehicleSpeed"
+                               },
+                               {
+                                       "KeyEventType":"ENGINE_SPEED",
+                                       "Status":
+                                       [
+                                               {
+                            "AMBPropertyName":"EngineSpeed",
+                            "Type":"uint16",
+                            "AccessControl":"R",
+                            "Default":"0",
+                            "DBusProperty":"EngineSpeed",
+                            "DBusObjectName":"EngineSpeed",
+                                                       "Zone":"None"
+                                               }
+                                       ],
+                                       "sense":
+                                       [
+                                       ],
+                                       "event_mask":
+                                       [
+                                       ],
+                                       "Priority":1,
+                                       "DBusInterface":"org.automotive.engineSpeed",
+                    "DBusObject":"EngineSpeed"
+                },
+                               {
+                                       "KeyEventType":"SHIFT",
+                                       "Status":
+                                       [
+                                               {
+                            "AMBPropertyName":"TransmissionShiftPosition",
+                            "Type":"int",
+                            "AccessControl":"R",
+                            "Default":"0",
+                            "DBusProperty":"ShiftPosition",
+                            "DBusObjectName":"Transmission",
+                                                       "Zone":"None"
+                                               },
+                                               {
+                                                       "AMBPropertyName":"TransmissionGearPostion",
+                                                       "Type":"int",
+                                                       "AccessControl":"R",
+                                                       "Default":"0",
+                                                       "DBusProperty":"GearPosition",
+                                                       "DBusObjectName":"Transmission",
+                                                       "Zone":"None"
+                                               },
+                                               {
+                                                       "AMBPropertyName":"TransmissionMode",
+                                                       "Type":"int",
+                                                       "AccessControl":"R",
+                                                       "Default":"0",
+                                                       "DBusProperty":"Mode",
+                                                       "DBusObjectName":"Transmission",
+                                                       "Zone":"None"
+                                               }
+                                       ],
+                                       "sense":
+                                       [
+                                       ],
+                                       "event_mask":
+                                       [
+                                       ],
+                                       "Priority":1,
+                                       "DBusInterface":"org.automotive.transmission",
+                    "DBusObject":"Transmission"
+                },
+                               {
+                                       "KeyEventType":"ACCPEDAL_OPEN",
+                                       "Status":
+                                       [
+                                               {
+                            "AMBPropertyName":"ThrottlePosition",
+                            "Type":"uint16",
+                            "AccessControl":"R",
+                            "Default":"0",
+                            "DBusProperty":"ThrottlePosition",
+                            "DBusObjectName":"ThrottlePosition",
+                                                       "Zone":"None"
+                                               }
+                                       ],
+                                       "sense":
+                                       [
+                                       ],
+                                       "event_mask":
+                                       [
+                                       ],
+                                       "Priority":1,
+                                       "DBusInterface":"Undefined",
+                    "DBusObject":"ThrottlePosition"
+                },
+                               {
+                                       "KeyEventType":"BRAKE_SIGNAL",
+                                       "Status":
+                                       [
+                                               {
+                            "AMBPropertyName":"WheelBrake",
+                            "Type":"bool",
+                            "AccessControl":"R",
+                            "Default":"0",
+                            "DBusProperty":"Engaged",
+                            "DBusObjectName":"WheelBrake",
+                                                       "Zone":"None"
+                                               }
+                                       ],
+                                       "sense":
+                                       [
+                                       ],
+                                       "event_mask":
+                                       [
+                                       ],
+                                       "Priority":1,
+                                       "DBusInterface":"Undefined",
+                    "DBusObject":"WheelBrake"
+                },
+                               {
+                                       "KeyEventType":"BRAKE_PRESSURE",
+                                       "Status":
+                                       [
+                                               {
+                            "AMBPropertyName":"WheelBrakePressure",
+                            "Type":"uint16",
+                            "AccessControl":"R",
+                            "Default":"0",
+                            "DBusProperty":"WheelBrakePressure",
+                            "DBusObjectName":"WheelBrakePressure",
+                                                       "Zone":"None"
+                                               }
+                                       ],
+                                       "sense":
+                                       [
+                                       ],
+                                       "event_mask":
+                                       [
+                                       ],
+                                       "Priority":1,
+                                       "DBusInterface":"org.automotive.WheelBrakePressure",
+                    "DBusObject":"WheelBrakePressure"
+                },
+                               {
+                                       "KeyEventType":"STEERING",
+                                       "Status":
+                                       [
+                                               {
+                            "AMBPropertyName":"SteeringWheelAngle",
+                            "Type":"uint16",
+                            "AccessControl":"R",
+                            "Default":"0",
+                            "DBusProperty":"SteeringWheelAngle",
+                            "DBusObjectName":"SteeringWheelAngle",
+                                                       "Zone":"None"
+                                               }
+                                       ],
+                                       "sense":
+                                       [
+                                       ],
+                                       "event_mask":
+                                       [
+                                       ],
+                                       "Priority":1,
+                                       "DBusInterface":"Undefined",
+                    "DBusObject":"SteeringWheelAngle"
+                },
+                               {
+                                       "KeyEventType":"TURN_SIGNAL",
+                                       "Status":
+                                       [
+                                               {
+                            "AMBPropertyName":"TurnSignal",
+                            "Type":"int",
+                            "AccessControl":"R",
+                            "Default":"0",
+                            "DBusProperty":"TurnSignal",
+                            "DBusObjectName":"TurnSignal",
+                                                       "Zone":"None"
+                                               }
+                                       ],
+                                       "sense":
+                                       [
+                                       ],
+                                       "event_mask":
+                                       [
+                                       ],
+                                       "Priority":1,
+                                       "DBusInterface":"Undefined",
+                    "DBusObject":"TurnSignal"
+                },
+                               {
+                                       "KeyEventType":"CLUTCH",
+                                       "Status":
+                                       [
+                                               {
+                            "AMBPropertyName":"ClutchStatus",
+                            "Type":"bool",
+                            "AccessControl":"R",
+                            "Default":"0",
+                            "DBusProperty":"ClutchStatus",
+                            "DBusObjectName":"ClutchStatus",
+                                                       "Zone":"None"
+                                               }
+                                       ],
+                                       "sense":
+                                       [
+                                       ],
+                                       "event_mask":
+                                       [
+                                       ],
+                                       "Priority":1,
+                                       "DBusInterface":"Undefined",
+                    "DBusObject":"ClutchStatus"
+                },
+                               {
+                                       "KeyEventType":"OIL",
+                                       "Status":
+                                       [
+                                               {
+                            "AMBPropertyName":"EngineOilPressure",
+                            "Type":"uint16",
+                            "AccessControl":"R",
+                            "Default":"0",
+                            "DBusProperty":"Pressure",
+                            "DBusObjectName":"EngineOil",
+                                                       "Zone":"None"
+                                               },
+                                               {
+                                                       "AMBPropertyName":"EngineOilLevel",
+                                                       "Type":"int",
+                                                       "AccessControl":"R",
+                                                       "Default":"0",
+                                                       "DBusProperty":"EngineOilLevel",
+                                                       "DBusObjectName":"EngineOilLevel",
+                                                       "Zone":"None"
+                                               }
+                                       ],
+                                       "sense":
+                                       [
+                                       ],
+                                       "event_mask":
+                                       [
+                                       ],
+                                       "Priority":1,
+                                       "DBusInterface":"org.automotive.EngineOilLevel",
+                    "DBusObject":"EngineOil"
+                },
+                               {
+                                       "KeyEventType":"WATER_TEMP",
+                                       "Status":
+                                       [
+                                               {
+                            "AMBPropertyName":"EngineCoolantTemperature",
+                            "Type":"int",
+                            "AccessControl":"R",
+                            "Default":"0",
+                            "DBusProperty":"EngineCoolantTemperature",
+                            "DBusObjectName":"EngineCoolantTemperature",
+                                                       "Zone":"None"
+                                               }
+                                       ],
+                                       "sense":
+                                       [
+                                       ],
+                                       "event_mask":
+                                       [
+                                       ],
+                                       "Priority":1,
+                                       "DBusInterface":"Undefined",
+                    "DBusObject":"EngineCoolantTemperature"
+                },
+                               {
+                                       "KeyEventType":"MACHINEGUNTURRET",
+                                       "Status":
+                                       [
+                                               {
+                        "AMBPropertyName":"MachineGunTurretStatus",
+                        "Type":"bool",
+                        "AccessControl":"R",
+                        "Default":"0",
+                        "DBusProperty":"MachineGunTurretStatus",
+                        "DBusObjectName":"MachineGunTurretStatus",
+                                               "Zone":"None"
+                                               }
+                                       ],
+                                       "sense":
+                                       [
+                                       ],
+                                       "event_mask":
+                                       [
+                                       ],
+                                       "Priority":1,
+                                       "DBusInterface":"Undefined",
+                    "DBusObject":"MachineGunTurretStatus"
+                },
+                               {
+                                       "KeyEventType":"ACCELERATION",
+                                       "Status":
+                                       [
+                                               {
+                                                       "AMBPropertyName":"AccelerationX",
+                                                       "Type":"uint16",
+                                                       "AccessControl":"R",
+                                                       "Default":"0",
+                                                       "DBusProperty":"X",
+                                                       "DBusObjectName":"Acceleration",
+                                                       "Zone":"None"
+                                               },
+                                               {
+                                                       "AMBPropertyName":"AccelerationY",
+                                                       "Type":"uint16",
+                                                       "AccessControl":"R",
+                                                       "Default":"0",
+                                                       "DBusProperty":"Y",
+                                                       "DBusObjectName":"Acceleration",
+                                                       "Zone":"None"
+                                               },
+                                               {
+                                                       "AMBPropertyName":"AccelerationZ",
+                                                       "Type":"uint16",
+                                                       "AccessControl":"R",
+                                                       "Default":"0",
+                                                       "DBusProperty":"Z",
+                                                       "DBusObjectName":"Acceleration",
+                                                       "Zone":"None"
+                                               }
+                                       ],
+                                       "sense":
+                                       [
+                                       ],
+                                       "event_mask":
+                                       [
+                                       ],
+                                       "Priority":1,
+                                       "DBusInterface":"org.automotive.acceleration",
+                    "DBusObject":"Acceleration"
+                },
+                               {
+                                       "KeyEventType":"MASSAIRFLOW",
+                                       "Status":
+                                       [
+                                               {
+                            "AMBPropertyName":"MassAirFlow",
+                            "Type":"uint16_t",
+                            "AccessControl":"R",
+                            "Default":"0",
+                            "DBusProperty":"MassAirFlow",
+                            "DBusObjectName":"MassAirFlow",
+                                                       "Zone":"None"
+                                               }
+                                       ],
+                                       "sense":
+                                       [
+                                       ],
+                                       "event_mask":
+                                       [
+                                       ],
+                                       "Priority":1,
+                                       "DBusInterface":"Undefined",
+                    "DBusObject":"MassAirFlow"
+                },
+                               {
+                                       "KeyEventType":"BUTTON",
+                                       "Status":
+                                       [
+                                               {
+                            "AMBPropertyName":"ButtonEvent",
+                            "Type":"char",
+                            "AccessControl":"R",
+                            "Default":"0",
+                            "DBusProperty":"ButtonEvent",
+                            "DBusObjectName":"ButtonEvent",
+                                                       "Zone":"None"
+                                               }
+                                       ],
+                                       "sense":
+                                       [
+                                       ],
+                                       "event_mask":
+                                       [
+                                       ],
+                                       "Priority":1,
+                                       "DBusInterface":"Undefined",
+                    "DBusObject":"ButtonEvent"
+                },
+                               {
+                                       "KeyEventType":"OUTSIDE",
+                                       "Status":
+                                       [
+                                               {
+                            "AMBPropertyName":"AirIntakeTemperature",
+                            "Type":"int",
+                            "AccessControl":"R",
+                            "Default":"0",
+                            "DBusProperty":"AirIntakeTemperature",
+                            "DBusObjectName":"AirIntakeTemperature",
+                                                       "Zone":"None"
+                                               }
+                                       ],
+                                       "sense":
+                                       [
+                                       ],
+                                       "event_mask":
+                                       [
+                                       ],
+                                       "Priority":1,
+                                       "DBusInterface":"Undefined",
+                    "DBusObject":"AirIntakeTemperature"
+                },
+                               {
+                                       "KeyEventType":"BATTERY",
+                                       "Status":
+                                       [
+                                               {
+                            "AMBPropertyName":"ButteryVoltage",
+                            "Type":"double",
+                            "AccessControl":"R",
+                            "Default":"0",
+                            "DBusProperty":"ButteryVoltage",
+                            "DBusObjectName":"ButteryVoltage",
+                                                       "Zone":"None"
+                                               }
+                                       ],
+                                       "sense":
+                                       [
+                                       ],
+                                       "event_mask":
+                                       [
+                                       ],
+                                       "Priority":1,
+                                       "DBusInterface":"Undefined",
+                    "DBusObject":"ButteryVoltage"
+                },
+                               {
+                                       "KeyEventType":"INSIDE",
+                                       "Status":
+                                       [
+                                               {
+                            "AMBPropertyName":"InteriorTemperature",
+                            "Type":"int",
+                            "AccessControl":"R",
+                            "Default":"0",
+                            "DBusProperty":"Interior",
+                            "DBusObjectName":"InteriorTemperature",
+                                                       "Zone":"None"
+                                               }
+                                       ],
+                                       "sense":
+                                       [
+                                       ],
+                                       "event_mask":
+                                       [
+                                       ],
+                                       "Priority":1,
+                                       "DBusInterface":"Undefined",
+                    "DBusObject":"InteriorTemperature"
+                },
+                               {
+                                       "KeyEventType":"ENGINEOIL",
+                                       "Status":
+                                       [
+                                               {
+                            "AMBPropertyName":"EngineOilTemperature",
+                            "Type":"int",
+                            "AccessControl":"R",
+                            "Default":"0",
+                            "DBusProperty":"Temperature",
+                            "DBusObjectName":"EngineOil",
+                                                       "Zone":"None"
+                                               },
+                                               {
+                            "AMBPropertyName":"EngineOilRemaining",
+                            "Type":"uint16_t",
+                            "AccessControl":"R",
+                            "Default":"0",
+                            "DBusProperty":"Remaining",
+                            "DBusObjectName":"EngineOil",
+                                                       "Zone":"None"
+                                               }
+                                       ],
+                                       "sense":
+                                       [
+                                       ],
+                                       "event_mask":
+                                       [
+                                       ],
+                                       "Priority":1,
+                                       "DBusInterface":"org.automotive.engineOil",
+                    "DBusObject":"EngineOil"
+                },
+                               {
+                                       "KeyEventType":"TIREPRESSURE",
+                                       "Status":
+                                       [
+                                               {
+                            "AMBPropertyName":"TirePressureLeftFront",
+                            "Type":"double",
+                            "AccessControl":"R",
+                            "Default":"0",
+                            "DBusProperty":"LeftFront",
+                            "DBusObjectName":"TirePressure",
+                                                       "Zone":"None"
+                                               },
+                                               {
+                            "AMBPropertyName":"TirePressureRightFront",
+                            "Type":"double",
+                            "AccessControl":"R",
+                            "Default":"0",
+                            "DBusProperty":"RightFront",
+                            "DBusObjectName":"TirePressure",
+                                                       "Zone":"None"
+                                               },
+                                               {
+                            "AMBPropertyName":"TirePressureLeftRear",
+                            "Type":"double",
+                            "AccessControl":"R",
+                            "Default":"0",
+                            "DBusProperty":"LeftRear",
+                            "DBusObjectName":"TirePressure",
+                                                       "Zone":"None"
+                                               },
+                                               {
+                        "AMBPropertyName":"TirePressureRightRear",
+                        "Type":"double",
+                        "AccessControl":"R",
+                        "Default":"0",
+                        "DBusProperty":"RightRear",
+                        "DBusObjectName":"TirePressure",
+                                               "Zone":"None"
+                                               }
+                                       ],
+                                       "sense":
+                                       [
+                                       ],
+                                       "event_mask":
+                                       [
+                                       ],
+                                       "Priority":1,
+                                       "DBusInterface":"org.automotive.tirePressure",
+                    "DBusObject":"TirePressure"
+                },
+                               {
+                                       "KeyEventType":"TIRETEMPERATURE",
+                                       "Status":
+                                       [
+                                               {
+                                                       "AMBPropertyName":"TireTemperatureLeftFront",
+                                                       "Type":"double",
+                                                       "AccessControl":"R",
+                                                       "Default":"0",
+                                                       "DBusProperty":"LeftFront",
+                                                       "DBusObjectName":"TireTemperature",
+                                                       "Zone":"None"
+                                               },
+                                               {
+                                                       "AMBPropertyName":"TireTemperatureRightFront",
+                                                       "Type":"double",
+                                                       "AccessControl":"R",
+                                                       "Default":"0",
+                                                       "DBusProperty":"RightFront",
+                                                       "DBusObjectName":"TireTemperature",
+                                                       "Zone":"None"
+                                               },
+                                               {
+                                                       "AMBPropertyName":"TireTemperatureLeftRear",
+                                                       "Type":"double",
+                                                       "AccessControl":"R",
+                                                       "Default":"0",
+                                                       "DBusProperty":"LeftRear",
+                                                       "DBusObjectName":"TireTemperature",
+                                                       "Zone":"None"
+                                               },
+                                               {
+                                                       "AMBPropertyName":"TireTemperatureRightRear",
+                                                       "Type":"double",
+                                                       "AccessControl":"R",
+                                                       "Default":"0",
+                                                       "DBusProperty":"RightRear",
+                                                       "DBusObjectName":"TireTemperature",
+                                                       "Zone":"None"
+                                               }
+                                       ],
+                                       "sense":
+                                       [
+                                       ],
+                                       "event_mask":
+                                       [
+                                       ],
+                                       "Priority":1,
+                                       "DBusInterface":"org.automotive.tireTemperature",
+                    "DBusObject":"TireTemperature"
+                               },
+                               {
+                                       "KeyEventType":"POWERMODE",
+                                       "Status":
+                                       [
+                                               {
+                                                       "AMBPropertyName":"VehiclePowerMode",
+                                                       "Type":"char",
+                                                       "AccessControl":"R",
+                                                       "Default":"0",
+                                                       "DBusProperty":"VehiclePowerMode",
+                                                       "DBusObjectName":"VehiclePowerMode",
+                                                       "Zone":"None"
+                                               }
+                                       ],
+                                       "sense":
+                                       [
+                                       ],
+                                       "event_mask":
+                                       [
+                                       ],
+                                       "Priority":1,
+                                       "DBusInterface":"org.automotive.vehiclePowerMode",
+                    "DBusObject":"VehiclePowerMode"
+                               },
+                               {
+                                       "KeyEventType":"CRUISECONTROL",
+                                       "Status":
+                                       [
+                                               {
+                                                       "AMBPropertyName":"CruiseControlActive",
+                                                       "Type":"bool",
+                                                       "AccessControl":"R",
+                                                       "Default":"0",
+                                                       "DBusProperty":"Activated",
+                                                       "DBusObjectName":"CruiseControlStatus",
+                                                       "Zone":"None"
+                                               },
+                                               {
+                                                       "AMBPropertyName":"CruiseControlSpeed",
+                                                       "Type":"uint16_t",
+                                                       "AccessControl":"R",
+                                                       "Default":"0",
+                                                       "DBusProperty":"Speed",
+                                                       "DBusObjectName":"CruiseControlStatus",
+                                                       "Zone":"None"
+                                               }
+                                       ],
+                                       "sense":
+                                       [
+                                       ],
+                                       "event_mask":
+                                       [
+                                       ],
+                                       "Priority":1,
+                                       "DBusInterface":"Undefined",
+                    "DBusObject":"CruiseControlStatus"
+                               },
+                               {
+                                       "KeyEventType":"LIGHTSTATUS",
+                                       "Status":
+                                       [
+                                               {
+                                                       "AMBPropertyName":"LightHead",
+                                                       "Type":"bool",
+                                                       "AccessControl":"R",
+                                                       "Default":"0",
+                                                       "DBusProperty":"Head",
+                                                       "DBusObjectName":"LightStatus",
+                                                       "Zone":"None"
+                                               },
+                                               {
+                                                       "AMBPropertyName":"LightLeftTurn",
+                                                       "Type":"bool",
+                                                       "AccessControl":"R",
+                                                       "Default":"0",
+                                                       "DBusProperty":"LeftTurn",
+                                                       "DBusObjectName":"LightStatus",
+                                                       "Zone":"None"
+                                               },
+                                               {
+                                                       "AMBPropertyName":"LightRightTurn",
+                                                       "Type":"bool",
+                                                       "AccessControl":"R",
+                                                       "Default":"0",
+                                                       "DBusProperty":"RightTurn",
+                                                       "DBusObjectName":"LightStatus",
+                                                       "Zone":"None"
+                                               },
+                                               {
+                                                       "AMBPropertyName":"LightParking",
+                                                       "Type":"bool",
+                                                       "AccessControl":"R",
+                                                       "Default":"0",
+                                                       "DBusProperty":"Parking",
+                                                       "DBusObjectName":"LightStatus",
+                                                       "Zone":"None"
+                                               },
+                                               {
+                                                       "AMBPropertyName":"LightFog",
+                                                       "Type":"bool",
+                                                       "AccessControl":"R",
+                                                       "Default":"0",
+                                                       "DBusProperty":"Fog",
+                                                       "DBusObjectName":"LightStatus",
+                                                       "Zone":"None"
+                                               },
+                                               {
+                                                       "AMBPropertyName":"LightHazard",
+                                                       "Type":"bool",
+                                                       "AccessControl":"R",
+                                                       "Default":"0",
+                                                       "DBusProperty":"Hazard",
+                                                       "DBusObjectName":"LightStatus",
+                                                       "Zone":"None"
+                                               },
+                                               {
+                                                       "AMBPropertyName":"LightBrake",
+                                                       "Type":"bool",
+                                                       "AccessControl":"R",
+                                                       "Default":"0",
+                                                       "DBusProperty":"Brake",
+                                                       "DBusObjectName":"LightStatus",
+                                                       "Zone":"None"
+                                               },
+                                               {
+                                                       "AMBPropertyName":"LightHighBeam",
+                                                       "Type":"bool",
+                                                       "AccessControl":"R",
+                                                       "Default":"0",
+                                                       "DBusProperty":"HighBeam",
+                                                       "DBusObjectName":"LightStatus",
+                                                       "Zone":"None"
+                                               }
+                                       ],
+                                       "sense":
+                                       [
+                                       ],
+                                       "event_mask":
+                                       [
+                                       ],
+                                       "Priority":1,
+                                       "DBusInterface":"org.automotive.ParkingLightStatus",
+                    "DBusObject":"LightStatus"
+                               },
+                               {
+                                       "KeyEventType":"ENGINELOAD",
+                                       "Status":
+                                       [
+                                               {
+                                                       "AMBPropertyName":"EngineLoad",
+                                                       "Type":"uint16",
+                                                       "AccessControl":"R",
+                                                       "Default":"0",
+                                                       "DBusProperty":"EngineLoad",
+                                                       "DBusObjectName":"EngineLoad",
+                                                       "Zone":"None"
+                                               }
+                                       ],
+                                       "sense":
+                                       [
+                                       ],
+                                       "event_mask":
+                                       [
+                                       ],
+                                       "Priority":1,
+                                       "DBusInterface":"Undefined",
+                    "DBusObject":"EngineLoad"
+                               },
+                               {
+                                       "KeyEventType":"HORN",
+                                       "Status":
+                                       [
+                                               {
+                                                       "AMBPropertyName":"Horn",
+                                                       "Type":"bool",
+                                                       "AccessControl":"R",
+                                                       "Default":"0",
+                                                       "DBusProperty":"On",
+                                                       "DBusObjectName":"Horn",
+                                                       "Zone":"None"
+                                               }
+                                       ],
+                                       "sense":
+                                       [
+                                       ],
+                                       "event_mask":
+                                       [
+                                       ],
+                                       "Priority":1,
+                                       "DBusInterface":"Undefined",
+                    "DBusObject":"Horn"
+                               },
+                               {
+                                       "KeyEventType":"FUEL_LEVEL",
+                                       "Status":
+                                       [
+                                               {
+                                                       "AMBPropertyName":"FuelLevel",
+                                                       "Type":"uint16",
+                                                       "AccessControl":"R",
+                                                       "Default":"0",
+                                                       "DBusProperty":"Level",
+                                                       "DBusObjectName":"Fuel",
+                                                       "Zone":"None"
+                                               }
+                                       ],
+                                       "sense":
+                                       [
+                                       ],
+                                       "event_mask":
+                                       [
+                                       ],
+                                       "Priority":1,
+                                       "DBusInterface":"org.automotive.fuel",
+                    "DBusObject":"Fuel"
+                               },
+                               {
+                                       "KeyEventType":"FUEL",
+                                       "Status":
+                                       [
+                                               {
+                                                       "AMBPropertyName":"FuelConsumption",
+                                                       "Type":"uint16_t",
+                                                       "AccessControl":"R",
+                                                       "Default":"0",
+                                                       "DBusProperty":"InstantConsumption",
+                                                       "DBusObjectName":"Fuel",
+                                                       "Zone":"None"
+                                               },
+                                               {
+                                                       "AMBPropertyName":"FuelRange",
+                                                       "Type":"uint16_t",
+                                                       "AccessControl":"R",
+                                                       "Default":"0",
+                                                       "DBusProperty":"Range",
+                                                       "DBusObjectName":"Fuel",
+                                                       "Zone":"None"
+                                               },
+                                               {
+                                                       "AMBPropertyName":"FuelEconomy",
+                                                       "Type":"uint16_t",
+                                                       "AccessControl":"R",
+                                                       "Default":"0",
+                                                       "DBusProperty":"InstantEconomy",
+                                                       "DBusObjectName":"Fuel",
+                                                       "Zone":"None"
+                                               },
+                                               {
+                                                       "AMBPropertyName":"FuelAverageEconomy",
+                                                       "Type":"uint16_t",
+                                                       "AccessControl":"R",
+                                                       "Default":"0",
+                                                       "DBusProperty":"AverageEconomy",
+                                                       "DBusObjectName":"Fuel",
+                                                       "Zone":"None"
+                                               },
+                                               {
+                                                       "AMBPropertyName":"FuelType",
+                                                       "Type":"char",
+                                                       "AccessControl":"R",
+                                                       "Default":"0",
+                                                       "DBusProperty":"Type",
+                                                       "DBusObjectName":"FuelInfo",
+                                                       "Zone":"None"
+                                               },
+                                               {
+                                                       "AMBPropertyName":"FuelPositionSide",
+                                                       "Type":"char",
+                                                       "AccessControl":"R",
+                                                       "Default":"0",
+                                                       "DBusProperty":"RefuelPosition",
+                                                       "DBusObjectName":"FuelInfo",
+                                                       "Zone":"None"
+                                               }
+                                       ],
+                                       "sense":
+                                       [
+                                       ],
+                                       "event_mask":
+                                       [
+                                       ],
+                                       "Priority":1,
+                                       "DBusInterface":"org.automotive.fuel",
+                    "DBusObject":"Fuel"
+                               },
+                               {
+                                       "KeyEventType":"EXTERIORBRIGHTNESS",
+                                       "Status":
+                                       [
+                                               {
+                                                       "AMBPropertyName":"ExteriorBrightness",
+                                                       "Type":"uint16_t",
+                                                       "AccessControl":"R",
+                                                       "Default":"0",
+                                                       "DBusProperty":"ExteriorBrightness",
+                                                       "DBusObjectName":"ExteriorBrightness",
+                                                       "Zone":"None"
+                                               }
+                                       ],
+                                       "sense":
+                                       [
+                                       ],
+                                       "event_mask":
+                                       [
+                                       ],
+                                       "Priority":1,
+                                       "DBusInterface":"org.automotive.exteriorBrightness",
+                    "DBusObject":"ExteriorBrightness"
+                               },
+                               {
+                                       "KeyEventType":"LOCATION",
+                                       "Status":
+                                       [
+                                               {
+                                                       "AMBPropertyName":"Latitude",
+                                                       "Type":"double",
+                                                       "AccessControl":"R",
+                                                       "Default":"0",
+                                                       "DBusProperty":"Latitude",
+                                                       "DBusObjectName":"Location",
+                                                       "Zone":"None"
+                                               },
+                                               {
+                                                       "AMBPropertyName":"Longitude",
+                                                       "Type":"double",
+                                                       "AccessControl":"R",
+                                                       "Default":"0",
+                                                       "DBusProperty":"Longitude",
+                                                       "DBusObjectName":"Location",
+                                                       "Zone":"None"
+                                               },
+                                               {
+                                                       "AMBPropertyName":"Altitude",
+                                                       "Type":"double",
+                                                       "AccessControl":"R",
+                                                       "Default":"0",
+                                                       "DBusProperty":"Altitude",
+                                                       "DBusObjectName":"Location",
+                                                       "Zone":"None"
+                                               }
+                                       ],
+                                       "sense":
+                                       [
+                                       ],
+                                       "event_mask":
+                                       [
+                                       ],
+                                       "Priority":1,
+                                       "DBusInterface":"org.automotive.Latitude",
+                    "DBusObject":"Location"
+                               },
+                               {
+                                       "KeyEventType":"DIRECTION",
+                                       "Status":
+                                       [
+                                               {
+                                                       "AMBPropertyName":"Direction",
+                                                       "Type":"uint16_t",
+                                                       "AccessControl":"R",
+                                                       "Default":"0",
+                                                       "DBusProperty":"Direction",
+                                                       "DBusObjectName":"Location",
+                                                       "Zone":"None"
+                                               }
+                                       ],
+                                       "sense":
+                                       [
+                                       ],
+                                       "event_mask":
+                                       [
+                                       ],
+                                       "Priority":1,
+                                       "DBusInterface":"org.automotive.Direction",
+                    "DBusObject":"Location"
+                               },
+                               {
+                                       "KeyEventType":"CUSTOM1",
+                                       "Status":
+                                       [
+                                               {
+                                                       "AMBPropertyName":"CustomA",
+                                                       "Type":"uint16_t",
+                                                       "AccessControl":"R",
+                                                       "Default":"0",
+                                                       "DBusProperty":"CustomA",
+                                                       "DBusObjectName":"CustomA",
+                                                       "Zone":"None"
+                                               }
+                                       ],
+                                       "sense":
+                                       [
+                                       ],
+                                       "event_mask":
+                                       [
+                                       ],
+                                       "Priority":1,
+                                       "DBusInterface":"org.automotive.Direction",
+                    "DBusObject":"CustomA"
+                               },
+                               {
+                                       "KeyEventType":"CUSTOM2",
+                                       "Status":
+                                       [
+                                               {
+                                                       "AMBPropertyName":"CustomB",
+                                                       "Type":"uint16_t",
+                                                       "AccessControl":"R",
+                                                       "Default":"0",
+                                                       "DBusProperty":"CustomB",
+                                                       "DBusObjectName":"CustomB",
+                                                       "Zone":"None"
+                                               }
+                                       ],
+                                       "sense":
+                                       [
+                                       ],
+                                       "event_mask":
+                                       [
+                                       ],
+                                       "Priority":1,
+                                       "DBusInterface":"org.automotive.Direction",
+                    "DBusObject":"CustomB"
+                               },
+                               {
+                                       "KeyEventType":"CUSTOM3",
+                                       "Status":
+                                       [
+                                               {
+                                                       "AMBPropertyName":"CustomC",
+                                                       "Type":"uint16_t",
+                                                       "AccessControl":"R",
+                                                       "Default":"0",
+                                                       "DBusProperty":"CustomC",
+                                                       "DBusObjectName":"CustomC",
+                                                       "Zone":"None"
+                                               }
+                                       ],
+                                       "sense":
+                                       [
+                                       ],
+                                       "event_mask":
+                                       [
+                                       ],
+                                       "Priority":1,
+                                       "DBusInterface":"org.automotive.Direction",
+                    "DBusObject":"CustomC"
+                               },
+                               {
+                                       "KeyEventType":"CUSTOM4",
+                                       "Status":
+                                       [
+                                               {
+                                                       "AMBPropertyName":"CustomD",
+                                                       "Type":"uint16_t",
+                                                       "AccessControl":"R",
+                                                       "Default":"0",
+                                                       "DBusProperty":"CustomD",
+                                                       "DBusObjectName":"CustomD",
+                                                       "Zone":"None"
+                                               }
+                                       ],
+                                       "sense":
+                                       [
+                                       ],
+                                       "event_mask":
+                                       [
+                                       ],
+                                       "Priority":1,
+                                       "DBusInterface":"org.automotive.Direction",
+                    "DBusObject":"CustomD"
+                               }
+                       ],
+            "DefaultInfoPort":
+            {
+                "DataPort":25010,
+                "CtrlPort":25011
+            },
+            "CustomizeInfoPort":
+            {
+                "DataPort":25020,
+                "CtrlPort":25021
+            }
+               },
+               {
+                       "Section":"CarSim",
+                       "VehicleInfoList":
+                       [
+                               "VELOCITY",
+                               "LOCATION",
+                               "SHIFT"
+                       ]
+               }
+       ]
+}
diff --git a/tests/etc/ambd/AMBformat_wrong4.conf b/tests/etc/ambd/AMBformat_wrong4.conf
new file mode 100644 (file)
index 0000000..2cf4179
--- /dev/null
@@ -0,0 +1,78 @@
+{
+       "Config":
+       [
+               {
+                       "Section":"Common",
+                       "VehicleInfoDefine":
+                       [
+                               {
+                                       "KeyEventType":"VELOCITY",
+                                       "Status":
+                                       [
+                                               {
+                                                       "AMBPropertyName":"VehicleSpeed",
+                                                       "Type":"uint16",
+                                                       "AccessControl":"R",
+                                                       "Default":"0",
+                                                       "DBusProperty":"VehicleSpeed",
+                                                       "DBusObjectName":"VehicleSpeed",
+                                                       "Zone":"None"
+                                               }
+                                       ],
+                                       "sense":
+                                       [
+                                       ],
+                                       "event_mask":
+                                       [
+                                       ],
+                                       "Priority":1,
+                                       "DBusInterface":"org.automotive.vehicleSpeed",
+                    "DBusObject":"VehicleSpeed"
+                               },
+                               {
+                                       "KeyEventTypo":"ENGINE_SPEED",
+                                       "Status":
+                                       [
+                                               {
+                            "AMBPropertyName":"EngineSpeed",
+                            "Type":"uint16",
+                            "AccessControl":"R",
+                            "Default":"0",
+                            "DBusProperty":"EngineSpeed",
+                            "DBusObjectName":"EngineSpeed",
+                                                       "Zone":"None"
+                                               }
+                                       ],
+                                       "sense":
+                                       [
+                                       ],
+                                       "event_mask":
+                                       [
+                                       ],
+                                       "Priority":1,
+                                       "DBusInterface":"org.automotive.engineSpeed",
+                    "DBusObject":"EngineSpeed"
+                }
+                       ],
+            "DefaultInfoPort":
+            {
+                "DataPort":25010,
+                "CtrlPort":25011
+            },
+            "CustomizeInfoPort":
+            {
+                "DataPort":25020,
+                "CtrlPort":25021
+            }
+               },
+               {
+                       "Section":"CarSim",
+                       "VehicleInfoList":
+                       [
+                               "VELOCITY",
+                               "LOCATION",
+                               "SHIFT"
+                       ]
+               }
+       ]
+}
diff --git a/tests/etc/ambd/AMBformat_wrong5.conf b/tests/etc/ambd/AMBformat_wrong5.conf
new file mode 100644 (file)
index 0000000..6d09734
--- /dev/null
@@ -0,0 +1,78 @@
+{
+       "Config":
+       [
+               {
+                       "Section":"Common",
+                       "VehicleInfoDefine":
+                       [
+                               {
+                                       "KeyEventType":"VELOCITY",
+                                       "Status":
+                                       [
+                                               {
+                                                       "AMBPropertyName":"VehicleSpeed",
+                                                       "Type":"uint16",
+                                                       "AccessControl":"R",
+                                                       "Default":"0",
+                                                       "DBusProperty":"VehicleSpeed",
+                                                       "DBusObjectName":"VehicleSpeed",
+                                                       "Zone":"None"
+                                               }
+                                       ],
+                                       "sense":
+                                       [
+                                       ],
+                                       "event_mask":
+                                       [
+                                       ],
+                                       "Priority":1,
+                                       "DBusInterface":"org.automotive.vehicleSpeed",
+                    "DBusObject":"VehicleSpeed"
+                               },
+                               {
+                                       "KeyEventType":"AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA",
+                                       "Status":
+                                       [
+                                               {
+                            "AMBPropertyName":"EngineSpeed",
+                            "Type":"uint16",
+                            "AccessControl":"R",
+                            "Default":"0",
+                            "DBusProperty":"EngineSpeed",
+                            "DBusObjectName":"EngineSpeed",
+                                                       "Zone":"None"
+                                               }
+                                       ],
+                                       "sense":
+                                       [
+                                       ],
+                                       "event_mask":
+                                       [
+                                       ],
+                                       "Priority":1,
+                                       "DBusInterface":"org.automotive.engineSpeed",
+                    "DBusObject":"EngineSpeed"
+                }
+                       ],
+            "DefaultInfoPort":
+            {
+                "DataPort":25010,
+                "CtrlPort":25011
+            },
+            "CustomizeInfoPort":
+            {
+                "DataPort":25020,
+                "CtrlPort":25021
+            }
+               },
+               {
+                       "Section":"CarSim",
+                       "VehicleInfoList":
+                       [
+                               "VELOCITY",
+                               "LOCATION",
+                               "SHIFT"
+                       ]
+               }
+       ]
+}
diff --git a/tests/etc/ambd/AMBformat_wrong6.conf b/tests/etc/ambd/AMBformat_wrong6.conf
new file mode 100644 (file)
index 0000000..3f75818
--- /dev/null
@@ -0,0 +1,78 @@
+{
+       "Config":
+       [
+               {
+                       "Section":"Common",
+                       "VehicleInfoDefine":
+                       [
+                               {
+                                       "KeyEventType":"VELOCITY",
+                                       "Status":
+                                       [
+                                               {
+                                                       "AMBPropertyName":"VehicleSpeed",
+                                                       "Type":"uint16",
+                                                       "AccessControl":"R",
+                                                       "Default":"0",
+                                                       "DBusProperty":"VehicleSpeed",
+                                                       "DBusObjectName":"VehicleSpeed",
+                                                       "Zone":"None"
+                                               }
+                                       ],
+                                       "sense":
+                                       [
+                                       ],
+                                       "event_mask":
+                                       [
+                                       ],
+                                       "Priority":1,
+                                       "DBusInterface":"org.automotive.vehicleSpeed",
+                    "DBusObject":"VehicleSpeed"
+                               },
+                               {
+                                       "KeyEventType":"ENGINE_SPEED",
+                                       "Status":
+                                       [
+                                               {
+                            "AMBPropertyNam":"EngineSpeed",
+                            "Type":"uint16",
+                            "AccessControl":"R",
+                            "Default":"0",
+                            "DBusProperty":"EngineSpeed",
+                            "DBusObjectName":"EngineSpeed",
+                                                       "Zone":"None"
+                                               }
+                                       ],
+                                       "sense":
+                                       [
+                                       ],
+                                       "event_mask":
+                                       [
+                                       ],
+                                       "Priority":1,
+                                       "DBusInterface":"org.automotive.engineSpeed",
+                    "DBusObject":"EngineSpeed"
+                }
+                       ],
+            "DefaultInfoPort":
+            {
+                "DataPort":25010,
+                "CtrlPort":25011
+            },
+            "CustomizeInfoPort":
+            {
+                "DataPort":25020,
+                "CtrlPort":25021
+            }
+               },
+               {
+                       "Section":"CarSim",
+                       "VehicleInfoList":
+                       [
+                               "VELOCITY",
+                               "LOCATION",
+                               "SHIFT"
+                       ]
+               }
+       ]
+}
diff --git a/tests/etc/ambd/AMBformat_wrong7.conf b/tests/etc/ambd/AMBformat_wrong7.conf
new file mode 100644 (file)
index 0000000..076c285
--- /dev/null
@@ -0,0 +1,78 @@
+{
+       "Config":
+       [
+               {
+                       "Section":"Common",
+                       "VehicleInfoDefine":
+                       [
+                               {
+                                       "KeyEventType":"VELOCITY",
+                                       "Status":
+                                       [
+                                               {
+                                                       "AMBPropertyName":"VehicleSpeed",
+                                                       "Type":"uint16",
+                                                       "AccessControl":"R",
+                                                       "Default":"0",
+                                                       "DBusProperty":"VehicleSpeed",
+                                                       "DBusObjectName":"VehicleSpeed",
+                                                       "Zone":"None"
+                                               }
+                                       ],
+                                       "sense":
+                                       [
+                                       ],
+                                       "event_mask":
+                                       [
+                                       ],
+                                       "Priority":1,
+                                       "DBusInterface":"org.automotive.vehicleSpeed",
+                    "DBusObject":"VehicleSpeed"
+                               },
+                               {
+                                       "KeyEventType":"ENGINE_SPEED",
+                                       "Status":
+                                       [
+                                               {
+                            "AMBPropertyName":"EngineSpeed",
+                            "Typo":"uint16",
+                            "AccessControl":"R",
+                            "Default":"0",
+                            "DBusProperty":"EngineSpeed",
+                            "DBusObjectName":"EngineSpeed",
+                                                       "Zone":"None"
+                                               }
+                                       ],
+                                       "sense":
+                                       [
+                                       ],
+                                       "event_mask":
+                                       [
+                                       ],
+                                       "Priority":1,
+                                       "DBusInterface":"org.automotive.engineSpeed",
+                    "DBusObject":"EngineSpeed"
+                }
+                       ],
+            "DefaultInfoPort":
+            {
+                "DataPort":25010,
+                "CtrlPort":25011
+            },
+            "CustomizeInfoPort":
+            {
+                "DataPort":25020,
+                "CtrlPort":25021
+            }
+               },
+               {
+                       "Section":"CarSim",
+                       "VehicleInfoList":
+                       [
+                               "VELOCITY",
+                               "LOCATION",
+                               "SHIFT"
+                       ]
+               }
+       ]
+}
diff --git a/tests/etc/ambd/AMBformat_wrong8.conf b/tests/etc/ambd/AMBformat_wrong8.conf
new file mode 100644 (file)
index 0000000..07e8551
--- /dev/null
@@ -0,0 +1,78 @@
+{
+       "Config":
+       [
+               {
+                       "Section":"Common",
+                       "VehicleInfoDefine":
+                       [
+                               {
+                                       "KeyEventType":"VELOCITY",
+                                       "Status":
+                                       [
+                                               {
+                                                       "AMBPropertyName":"VehicleSpeed",
+                                                       "Type":"uint16",
+                                                       "AccessControl":"R",
+                                                       "Default":"0",
+                                                       "DBusProperty":"VehicleSpeed",
+                                                       "DBusObjectName":"VehicleSpeed",
+                                                       "Zone":"None"
+                                               }
+                                       ],
+                                       "sense":
+                                       [
+                                       ],
+                                       "event_mask":
+                                       [
+                                       ],
+                                       "Priority":1,
+                                       "DBusInterface":"org.automotive.vehicleSpeed",
+                    "DBusObject":"VehicleSpeed"
+                               },
+                               {
+                                       "KeyEventType":"ENGINE_SPEED",
+                                       "Status":
+                                       [
+                                               {
+                            "AMBPropertyName":"EngineSpeed",
+                            "Type":"u16",
+                            "AccessControl":"R",
+                            "Default":"0",
+                            "DBusProperty":"EngineSpeed",
+                            "DBusObjectName":"EngineSpeed",
+                                                       "Zone":"None"
+                                               }
+                                       ],
+                                       "sense":
+                                       [
+                                       ],
+                                       "event_mask":
+                                       [
+                                       ],
+                                       "Priority":1,
+                                       "DBusInterface":"org.automotive.engineSpeed",
+                    "DBusObject":"EngineSpeed"
+                }
+                       ],
+            "DefaultInfoPort":
+            {
+                "DataPort":25010,
+                "CtrlPort":25011
+            },
+            "CustomizeInfoPort":
+            {
+                "DataPort":25020,
+                "CtrlPort":25021
+            }
+               },
+               {
+                       "Section":"CarSim",
+                       "VehicleInfoList":
+                       [
+                               "VELOCITY",
+                               "LOCATION",
+                               "SHIFT"
+                       ]
+               }
+       ]
+}
diff --git a/tests/etc/ambd/AMBformat_wrong9.conf b/tests/etc/ambd/AMBformat_wrong9.conf
new file mode 100644 (file)
index 0000000..2eba789
--- /dev/null
@@ -0,0 +1,30 @@
+{
+       "Config":
+       [
+               {
+                       "Section":"Common",
+                       "VehicleInfoDefine":
+                       [
+                       ],
+            "DefaultInfoPort":
+            {
+                "DataPort":25010,
+                "CtrlPort":25011
+            },
+            "CustomizeInfoPort":
+            {
+                "DataPort":25020,
+                "CtrlPort":25021
+            }
+               },
+               {
+                       "Section":"CarSim",
+                       "VehicleInfoList":
+                       [
+                               "VELOCITY",
+                               "LOCATION",
+                               "SHIFT"
+                       ]
+               }
+       ]
+}
diff --git a/tests/etc/ambd/config b/tests/etc/ambd/config
new file mode 100644 (file)
index 0000000..8772731
--- /dev/null
@@ -0,0 +1,22 @@
+{
+       "sources" : [ 
+                               {
+                        "name" : "Murphy Source",
+                        "path" : "/usr/lib/automotive-message-broker/murphysourceplugin.so",
+                        "address" : "unxs:/tmp/murphy/amb"
+                },
+                { 
+                        "name" : "VehicleSource",
+                        "path" : "/usr/lib/automotive-message-broker/vehicleplugin.so",
+                        "configfile" : "/usr/local/tests/ico/etc/ambd/AMBformat.conf"
+                }
+
+       ],
+       "sinks": [
+               {
+                       "name" : "DBusSink",
+                       "path" : "/usr/lib/automotive-message-broker/dbussinkplugin.so"
+               }
+       ]
+}
+
diff --git a/tests/etc/ambd/config.wrong b/tests/etc/ambd/config.wrong
new file mode 100644 (file)
index 0000000..7d81def
--- /dev/null
@@ -0,0 +1,22 @@
+{
+       "sources" : [ 
+                               {
+                        "name" : "Murphy Source",
+                        "path" : "/usr/lib/automotive-message-broker/murphysourceplugin.so",
+                        "address" : "unxs:/tmp/murphy/amb"
+                },
+                { 
+                        "name" : "VehicleSource",
+                        "path" : "/usr/lib/automotive-message-broker/vehicleplugin.so",
+                        "configfile" : "/usr/local/tests/ico/etc/ambd/AMBforma.conf"
+                }
+
+       ],
+       "sinks": [
+               {
+                       "name" : "DBusSink",
+                       "path" : "/usr/lib/automotive-message-broker/dbussinkplugin.so"
+               }
+       ]
+}
+
diff --git a/tests/etc/ambd/config.wrong10 b/tests/etc/ambd/config.wrong10
new file mode 100644 (file)
index 0000000..1456f4b
--- /dev/null
@@ -0,0 +1,22 @@
+{
+       "sources" : [ 
+                               {
+                        "name" : "Murphy Source",
+                        "path" : "/usr/lib/automotive-message-broker/murphysourceplugin.so",
+                        "address" : "unxs:/tmp/murphy/amb"
+                },
+                { 
+                        "name" : "VehicleSource",
+                        "path" : "/usr/lib/automotive-message-broker/vehicleplugin.so",
+                        "configfile" : "/usr/local/tests/ico/etc/ambd/AMBformat_wrong9.conf"
+                }
+
+       ],
+       "sinks": [
+               {
+                       "name" : "DBusSink",
+                       "path" : "/usr/lib/automotive-message-broker/dbussinkplugin.so"
+               }
+       ]
+}
+
diff --git a/tests/etc/ambd/config.wrong11 b/tests/etc/ambd/config.wrong11
new file mode 100644 (file)
index 0000000..7ab83b1
--- /dev/null
@@ -0,0 +1,22 @@
+{
+       "sources" : [ 
+                               {
+                        "name" : "Murphy Source",
+                        "path" : "/usr/lib/automotive-message-broker/murphysourceplugin.so",
+                        "address" : "unxs:/tmp/murphy/amb"
+                },
+                { 
+                        "name" : "VehicleSource",
+                        "path" : "/usr/lib/automotive-message-broker/vehicleplugin.so",
+                        "configfile" : "/usr/local/tests/ico/etc/ambd/AMBformat_wrong10.conf"
+                }
+
+       ],
+       "sinks": [
+               {
+                       "name" : "DBusSink",
+                       "path" : "/usr/lib/automotive-message-broker/dbussinkplugin.so"
+               }
+       ]
+}
+
diff --git a/tests/etc/ambd/config.wrong12 b/tests/etc/ambd/config.wrong12
new file mode 100644 (file)
index 0000000..601b01d
--- /dev/null
@@ -0,0 +1,22 @@
+{
+       "sources" : [ 
+                               {
+                        "name" : "Murphy Source",
+                        "path" : "/usr/lib/automotive-message-broker/murphysourceplugin.so",
+                        "address" : "unxs:/tmp/murphy/amb"
+                },
+                { 
+                        "name" : "VehicleSource",
+                        "path" : "/usr/lib/automotive-message-broker/vehicleplugin.so",
+                        "configfile" : "/usr/local/tests/ico/etc/ambd/AMBformat_wrong11.conf"
+                }
+
+       ],
+       "sinks": [
+               {
+                       "name" : "DBusSink",
+                       "path" : "/usr/lib/automotive-message-broker/dbussinkplugin.so"
+               }
+       ]
+}
+
diff --git a/tests/etc/ambd/config.wrong13 b/tests/etc/ambd/config.wrong13
new file mode 100644 (file)
index 0000000..b85b0a7
--- /dev/null
@@ -0,0 +1,22 @@
+{
+       "sources" : [ 
+                               {
+                        "name" : "Murphy Source",
+                        "path" : "/usr/lib/automotive-message-broker/murphysourceplugin.so",
+                        "address" : "unxs:/tmp/murphy/amb"
+                },
+                { 
+                        "name" : "VehicleSource",
+                        "path" : "/usr/lib/automotive-message-broker/vehicleplugin.so",
+                        "configfile" : "/usr/local/tests/ico/etc/ambd/AMBformat_wrong12.conf"
+                }
+
+       ],
+       "sinks": [
+               {
+                       "name" : "DBusSink",
+                       "path" : "/usr/lib/automotive-message-broker/dbussinkplugin.so"
+               }
+       ]
+}
+
diff --git a/tests/etc/ambd/config.wrong14 b/tests/etc/ambd/config.wrong14
new file mode 100644 (file)
index 0000000..e9b0fe5
--- /dev/null
@@ -0,0 +1,22 @@
+{
+       "sources" : [ 
+                               {
+                        "name" : "Murphy Source",
+                        "path" : "/usr/lib/automotive-message-broker/murphysourceplugin.so",
+                        "address" : "unxs:/tmp/murphy/amb"
+                },
+                { 
+                        "name" : "VehicleSource",
+                        "path" : "/usr/lib/automotive-message-broker/vehicleplugin.so",
+                        "configfile" : "/usr/local/tests/ico/etc/ambd/AMBformat_wrong13.conf"
+                }
+
+       ],
+       "sinks": [
+               {
+                       "name" : "DBusSink",
+                       "path" : "/usr/lib/automotive-message-broker/dbussinkplugin.so"
+               }
+       ]
+}
+
diff --git a/tests/etc/ambd/config.wrong15 b/tests/etc/ambd/config.wrong15
new file mode 100644 (file)
index 0000000..9af3476
--- /dev/null
@@ -0,0 +1,22 @@
+{
+       "sources" : [ 
+                               {
+                        "name" : "Murphy Source",
+                        "path" : "/usr/lib/automotive-message-broker/murphysourceplugin.so",
+                        "address" : "unxs:/tmp/murphy/amb"
+                },
+                { 
+                        "name" : "VehicleSource",
+                        "path" : "/usr/lib/automotive-message-broker/vehicleplugin.so",
+                        "configfile" : "/usr/local/tests/ico/etc/ambd/AMBformat_wrong14.conf"
+                }
+
+       ],
+       "sinks": [
+               {
+                       "name" : "DBusSink",
+                       "path" : "/usr/lib/automotive-message-broker/dbussinkplugin.so"
+               }
+       ]
+}
+
diff --git a/tests/etc/ambd/config.wrong2 b/tests/etc/ambd/config.wrong2
new file mode 100644 (file)
index 0000000..3b5b981
--- /dev/null
@@ -0,0 +1,22 @@
+{
+       "sources" : [ 
+                               {
+                        "name" : "Murphy Source",
+                        "path" : "/usr/lib/automotive-message-broker/murphysourceplugin.so",
+                        "address" : "unxs:/tmp/murphy/amb"
+                },
+                { 
+                        "name" : "VehicleSource",
+                        "path" : "/usr/lib/automotive-message-broker/vehicleplugin.so",
+                        "configfile" : "/usr/local/tests/ico/etc/ambd/AMBformat_wrong1.conf"
+                }
+
+       ],
+       "sinks": [
+               {
+                       "name" : "DBusSink",
+                       "path" : "/usr/lib/automotive-message-broker/dbussinkplugin.so"
+               }
+       ]
+}
+
diff --git a/tests/etc/ambd/config.wrong3 b/tests/etc/ambd/config.wrong3
new file mode 100644 (file)
index 0000000..4d14975
--- /dev/null
@@ -0,0 +1,22 @@
+{
+       "sources" : [ 
+                               {
+                        "name" : "Murphy Source",
+                        "path" : "/usr/lib/automotive-message-broker/murphysourceplugin.so",
+                        "address" : "unxs:/tmp/murphy/amb"
+                },
+                { 
+                        "name" : "VehicleSource",
+                        "path" : "/usr/lib/automotive-message-broker/vehicleplugin.so",
+                        "configfile" : "/usr/local/tests/ico/etc/ambd/AMBformat_wrong2.conf"
+                }
+
+       ],
+       "sinks": [
+               {
+                       "name" : "DBusSink",
+                       "path" : "/usr/lib/automotive-message-broker/dbussinkplugin.so"
+               }
+       ]
+}
+
diff --git a/tests/etc/ambd/config.wrong4 b/tests/etc/ambd/config.wrong4
new file mode 100644 (file)
index 0000000..0153987
--- /dev/null
@@ -0,0 +1,22 @@
+{
+       "sources" : [ 
+                               {
+                        "name" : "Murphy Source",
+                        "path" : "/usr/lib/automotive-message-broker/murphysourceplugin.so",
+                        "address" : "unxs:/tmp/murphy/amb"
+                },
+                { 
+                        "name" : "VehicleSource",
+                        "path" : "/usr/lib/automotive-message-broker/vehicleplugin.so",
+                        "configfile" : "/usr/local/tests/ico/etc/ambd/AMBformat_wrong3.conf"
+                }
+
+       ],
+       "sinks": [
+               {
+                       "name" : "DBusSink",
+                       "path" : "/usr/lib/automotive-message-broker/dbussinkplugin.so"
+               }
+       ]
+}
+
diff --git a/tests/etc/ambd/config.wrong5 b/tests/etc/ambd/config.wrong5
new file mode 100644 (file)
index 0000000..ba338ba
--- /dev/null
@@ -0,0 +1,22 @@
+{
+       "sources" : [ 
+                               {
+                        "name" : "Murphy Source",
+                        "path" : "/usr/lib/automotive-message-broker/murphysourceplugin.so",
+                        "address" : "unxs:/tmp/murphy/amb"
+                },
+                { 
+                        "name" : "VehicleSource",
+                        "path" : "/usr/lib/automotive-message-broker/vehicleplugin.so",
+                        "configfile" : "/usr/local/tests/ico/etc/ambd/AMBformat_wrong4.conf"
+                }
+
+       ],
+       "sinks": [
+               {
+                       "name" : "DBusSink",
+                       "path" : "/usr/lib/automotive-message-broker/dbussinkplugin.so"
+               }
+       ]
+}
+
diff --git a/tests/etc/ambd/config.wrong6 b/tests/etc/ambd/config.wrong6
new file mode 100644 (file)
index 0000000..f6c792a
--- /dev/null
@@ -0,0 +1,22 @@
+{
+       "sources" : [ 
+                               {
+                        "name" : "Murphy Source",
+                        "path" : "/usr/lib/automotive-message-broker/murphysourceplugin.so",
+                        "address" : "unxs:/tmp/murphy/amb"
+                },
+                { 
+                        "name" : "VehicleSource",
+                        "path" : "/usr/lib/automotive-message-broker/vehicleplugin.so",
+                        "configfile" : "/usr/local/tests/ico/etc/ambd/AMBformat_wrong5.conf"
+                }
+
+       ],
+       "sinks": [
+               {
+                       "name" : "DBusSink",
+                       "path" : "/usr/lib/automotive-message-broker/dbussinkplugin.so"
+               }
+       ]
+}
+
diff --git a/tests/etc/ambd/config.wrong7 b/tests/etc/ambd/config.wrong7
new file mode 100644 (file)
index 0000000..e0ca899
--- /dev/null
@@ -0,0 +1,22 @@
+{
+       "sources" : [ 
+                               {
+                        "name" : "Murphy Source",
+                        "path" : "/usr/lib/automotive-message-broker/murphysourceplugin.so",
+                        "address" : "unxs:/tmp/murphy/amb"
+                },
+                { 
+                        "name" : "VehicleSource",
+                        "path" : "/usr/lib/automotive-message-broker/vehicleplugin.so",
+                        "configfile" : "/usr/local/tests/ico/etc/ambd/AMBformat_wrong6.conf"
+                }
+
+       ],
+       "sinks": [
+               {
+                       "name" : "DBusSink",
+                       "path" : "/usr/lib/automotive-message-broker/dbussinkplugin.so"
+               }
+       ]
+}
+
diff --git a/tests/etc/ambd/config.wrong8 b/tests/etc/ambd/config.wrong8
new file mode 100644 (file)
index 0000000..1d70b67
--- /dev/null
@@ -0,0 +1,22 @@
+{
+       "sources" : [ 
+                               {
+                        "name" : "Murphy Source",
+                        "path" : "/usr/lib/automotive-message-broker/murphysourceplugin.so",
+                        "address" : "unxs:/tmp/murphy/amb"
+                },
+                { 
+                        "name" : "VehicleSource",
+                        "path" : "/usr/lib/automotive-message-broker/vehicleplugin.so",
+                        "configfile" : "/usr/local/tests/ico/etc/ambd/AMBformat_wrong7.conf"
+                }
+
+       ],
+       "sinks": [
+               {
+                       "name" : "DBusSink",
+                       "path" : "/usr/lib/automotive-message-broker/dbussinkplugin.so"
+               }
+       ]
+}
+
diff --git a/tests/etc/ambd/config.wrong9 b/tests/etc/ambd/config.wrong9
new file mode 100644 (file)
index 0000000..62c42ad
--- /dev/null
@@ -0,0 +1,22 @@
+{
+       "sources" : [ 
+                               {
+                        "name" : "Murphy Source",
+                        "path" : "/usr/lib/automotive-message-broker/murphysourceplugin.so",
+                        "address" : "unxs:/tmp/murphy/amb"
+                },
+                { 
+                        "name" : "VehicleSource",
+                        "path" : "/usr/lib/automotive-message-broker/vehicleplugin.so",
+                        "configfile" : "/usr/local/tests/ico/etc/ambd/AMBformat_wrong8.conf"
+                }
+
+       ],
+       "sinks": [
+               {
+                       "name" : "DBusSink",
+                       "path" : "/usr/lib/automotive-message-broker/dbussinkplugin.so"
+               }
+       ]
+}
+
diff --git a/tests/logresult.cc b/tests/logresult.cc
new file mode 100644 (file)
index 0000000..d1dec54
--- /dev/null
@@ -0,0 +1,50 @@
+#include <sstream>
+
+#include "logresult.h"
+
+LogResult::LogResult() {
+}
+
+LogResult::~LogResult() {
+}
+
+std::string LogResult::MakeString(enum ClientType cltype, enum CommandType cotype, std::string property) {
+    CurrentTime();
+    std::stringstream sstr;
+    sstr << tv.tv_sec << "." << std::setfill('0') << std::setw(6) << std::right << tv.tv_usec << " ";
+    switch (cltype) {
+    case CLIENT_VIC :
+        sstr << "VIC ";
+        break;
+    case CLIENT_APP :
+        sstr << "APP ";
+        break;
+    default :
+        sstr << "Unknown ";
+        break;
+    }
+    switch (cotype) {
+    case CMDTYPE_SET:
+        sstr << "SET ";
+        break;
+    case CMDTYPE_GET:
+        sstr << "GET ";
+        break;
+    case CMDTYPE_NOTIFY:
+        sstr << "NOTIFY ";
+        break;
+    case CMDTYPE_CALLBACK:
+        sstr << "CALLBACK ";
+        break;
+    default :
+        sstr << "NONE ";
+        break;
+    }
+
+    sstr << property << " ";
+    return sstr.str();
+}
+
+void LogResult::CurrentTime() {
+    gettimeofday(&tv, NULL);
+}
diff --git a/tests/logresult.h b/tests/logresult.h
new file mode 100644 (file)
index 0000000..73fc767
--- /dev/null
@@ -0,0 +1,71 @@
+#include <sys/time.h>
+
+#include <iomanip>
+#include <iostream>
+#include <string>
+#include <typeinfo>
+
+enum CommandType {
+    CMDTYPE_SET,
+    CMDTYPE_GET,
+    CMDTYPE_NOTIFY,
+    CMDTYPE_CALLBACK,
+    CMDTYPE_NONE,
+};
+
+enum ClientType {
+    CLIENT_VIC,
+    CLIENT_APP,
+    CLIENT_NONE,
+};
+
+class LogResult {
+    public:
+        LogResult();
+        ~LogResult();
+
+        template <typename T>
+        void PutOut(enum ClientType cltype, enum CommandType cotype, std::string property, T value);
+        template <typename T>
+        void PutOut(enum ClientType cltype, enum CommandType cotype, std::string property, T value, struct timeval rcvtv);
+    private:
+        std::string MakeString(enum ClientType cltype, enum CommandType cotype, std::string property);
+        void CurrentTime();
+
+        struct timeval tv;
+};
+
+template <typename T>
+void LogResult::PutOut(enum ClientType cltype, enum CommandType cotype, std::string property, T value) {
+    std::cout << MakeString(cltype, cotype, property);
+    if (typeid(T) == typeid(bool)) {
+        if (value) {
+            std::cout << "true";
+        }
+        else {
+            std::cout << "false";
+        }
+    }
+    else {
+        std::cout << value;
+    }
+    std::cout << std::endl;
+}
+
+template <typename T>
+void LogResult::PutOut(enum ClientType cltype, enum CommandType cotype, std::string property, T value, struct timeval rcvtv) {
+    std::cout << MakeString(cltype, cotype, property);
+    if (typeid(T) == typeid(bool)) {
+        if (value) {
+            std::cout << "true ";
+        }
+        else {
+            std::cout << "false ";
+        }
+    }
+    else {
+        std::cout << value << " ";
+    }
+    std::cout << rcvtv.tv_sec << "." << std::setfill('0') << std::setw(6) << std::right << tv.tv_usec << std::endl;
+}
+
diff --git a/tests/mwscenario.cc b/tests/mwscenario.cc
deleted file mode 100644 (file)
index a74dcba..0000000
+++ /dev/null
@@ -1,286 +0,0 @@
-/**
- * Copyright (C) 2012  TOYOTA MOTOR CORPORATION.
- * 
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 2.1 of the License, or (at your option) any later version.
- * 
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
- * Lesser General Public License for more details.
- * 
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
- * 
- */
-#include <string.h>
-#include <sys/time.h>
-
-#include <iostream>
-#include <list>
-
-#include "debugout.h"
-#include "vehicleproperty.h"
-
-#include "messageformat.h"
-#include "scenarioengine.h"
-
-extern std::list<VehicleProperty::Property> VehicleProperty::mCapabilities;
-extern VehicleProperty vehiclePropertyConstruct;
-const int sleeptime = 50 * 1000;
-
-MWScenarioEngine::MWScenarioEngine()
-{
-}
-
-MWScenarioEngine::~MWScenarioEngine()
-{
-    vehicleinfomap.clear();
-}
-
-void
-MWScenarioEngine::start()
-{
-    char value = 1;
-    char status[STATUSSIZE];
-    int idx = 0;
-    int server = 0;
-    timeval time;
-    DataOpt dopt;
-    EventOpt eopt;
-    int setnotifycall = 0;
-    if ((vehicleinfomap.size() % 2) == 0) {
-        setnotifycall = 1;
-    }
-    int waitcount = 0;
-    auto vehicleinfomapbeginitr = vehicleinfomap.begin();
-    DebugOut(10) << "=========" << "MW Callback" << "=========" << std::endl;
-    usleep(12 * 1000);
-    // Subscribe
-    for (; setnotifycall < vehicleinfomap.size(); setnotifycall += 2) {
-        usleep(sleeptime);
-        vehicleinfomapbeginitr = vehicleinfomap.begin();
-        advance(vehicleinfomapbeginitr, setnotifycall);
-        server = ControlWebsocket::CONTROL_STANDARD;
-        for (int i = 0; i < vehicleinfomapbeginitr->second.size(); i++) {
-            if (vehicleinfomapbeginitr->second[i].isCustom) {
-                server = ControlWebsocket::CONTROL_CUSTOM;
-            }
-        }
-        gettimeofday(&time, NULL);
-        eopt.common = 50;
-        eopt.sense = 0xff;
-        eopt.event_mask = 0;
-        client[server].send(
-                const_cast<char*>(vehicleinfomapbeginitr->first.c_str()), time,
-                &eopt, 64 + sizeof(timeval) + sizeof(EventOpt));
-        DebugOut(10) << "[S]: " << vehicleinfomapbeginitr->first << " , "
-                     << time.tv_sec << "." << time.tv_usec << " , " << eopt.common
-                     << " , " << eopt.sense << " , " << eopt.event_mask << std::endl;
-        ControlWebsocketClient::vehiclename_scenario =
-                vehicleinfomapbeginitr->first;
-        waitcount = vehicleinfomapbeginitr->second.size();
-    }
-    DebugOut(10) << "vehiclename_scenario = "
-                 << ControlWebsocketClient::vehiclename_scenario << std::endl;
-    // Wait Subscribe
-    pthread_mutex_lock(&ControlWebsocketClient::mutex_scenario);
-    pthread_cond_wait(&ControlWebsocketClient::cond_scenario,
-                      &ControlWebsocketClient::mutex_scenario);
-    pthread_mutex_unlock(&ControlWebsocketClient::mutex_scenario);
-    DebugOut(10) << "MW Next." << std::endl;
-    // Get
-    DebugOut(10) << "=========" << "MW Get" << "=========" << std::endl;
-    for (auto itr = vehicleinfomap.begin(); itr != vehicleinfomap.end();
-         itr++) {
-        usleep(sleeptime);
-        memset(status, 0, sizeof(status));
-        idx = 0;
-        server = ControlWebsocket::CONTROL_STANDARD;
-        for (auto itr2 = (*itr).second.begin(); itr2 != (*itr).second.end();
-             itr2++) {
-            memcpy(status + idx, &value, sizeof(value));
-            if ((*itr2).isCustom) {
-                server = ControlWebsocket::CONTROL_CUSTOM;
-            }
-            idx += (*itr2).typesize;
-        }
-        gettimeofday(&time, NULL);
-        eopt.common = -1;
-        eopt.sense = -1;
-        eopt.event_mask = 0;
-        client[server].send(const_cast<char*>(itr->first.c_str()), time, &eopt,
-                            64 + sizeof(timeval) + sizeof(EventOpt));
-        DebugOut(10) << "[S]: " << itr->first << " , " << time.tv_sec << "."
-                     << time.tv_usec << " , " << eopt.common << " , " << eopt.sense
-                     << " , " << eopt.event_mask << std::endl;
-    }
-    // Wait Get
-    pthread_mutex_lock(&ControlWebsocketClient::mutex_scenario);
-    pthread_cond_wait(&ControlWebsocketClient::cond_scenario,
-                      &ControlWebsocketClient::mutex_scenario);
-    pthread_mutex_unlock(&ControlWebsocketClient::mutex_scenario);
-    DebugOut(10) << "MW Next." << std::endl;
-    // Error
-    DebugOut(10) << "=========" << "MW Error" << "=========" << std::endl;
-    memset(status, 0, sizeof(status));
-    memcpy(status, &value, sizeof(value));
-    for (server = 0; server < 4; server += 2) {
-        usleep(sleeptime);
-        client[server].send(const_cast<char*>("Detarame"), time, &dopt,
-                            64 + sizeof(timeval) + sizeof(int) + sizeof(int));
-        DebugOut(10) << "[S]: " << "Detarame" << " , " << time.tv_sec << "."
-                     << time.tv_usec << std::endl;
-
-        usleep(sleeptime);
-        eopt.common = -1;
-        eopt.sense = -1;
-        client[server + 1].send(const_cast<char*>("Detarame"), time, &eopt,
-                                64 + sizeof(timeval) + sizeof(EventOpt));
-        DebugOut(10) << "[S]: " << "Detarame" << " , " << time.tv_sec << "."
-                     << time.tv_usec << " , " << eopt.common << " , " << eopt.sense
-                     << " , " << eopt.event_mask << std::endl;
-
-        usleep(sleeptime);
-        eopt.common = 50;
-        eopt.sense = 0xff;
-        client[server + 1].send(const_cast<char*>("Detarame"), time, &eopt,
-                                64 + sizeof(timeval) + sizeof(EventOpt));
-        DebugOut(10) << "[S]: " << "Detarame" << " , " << time.tv_sec << "."
-                     << time.tv_usec << " , " << eopt.common << " , " << eopt.sense
-                     << " , " << eopt.event_mask << std::endl;
-    }
-    // Set(1st)
-    DebugOut(10) << "=========" << "MW Set" << "=========" << std::endl;
-    for (auto itr = vehicleinfomap.begin(); itr != vehicleinfomap.end();
-         itr++) {
-        usleep(sleeptime);
-        memset(status, 0, sizeof(status));
-        idx = 0;
-        server = ControlWebsocket::DATA_STANDARD;
-        for (auto itr2 = (*itr).second.begin(); itr2 != (*itr).second.end();
-             itr2++) {
-            memcpy(status + idx, &value, sizeof(value));
-            if ((*itr2).isCustom) {
-                server = ControlWebsocket::DATA_CUSTOM;
-            }
-            idx += (*itr2).typesize;
-        }
-        gettimeofday(&time, NULL);
-        dopt.common_status = SUPPORT;
-        memcpy(dopt.status, status, STATUSSIZE);
-        client[server].send(const_cast<char*>(itr->first.c_str()), time, &dopt,
-                            64 + sizeof(timeval) + sizeof(int) + idx);
-        DebugOut(10) << "[S]: " << itr->first << " , " << time.tv_sec << "."
-                     << time.tv_usec << " , ";
-    }
-    value++;
-    // Wait valuechanged
-    for (int i = 0; i < waitcount; i++) {
-        pthread_mutex_lock(&ControlWebsocketClient::mutex_scenario);
-        pthread_cond_wait(&ControlWebsocketClient::cond_scenario,
-                          &ControlWebsocketClient::mutex_scenario);
-        pthread_mutex_unlock(&ControlWebsocketClient::mutex_scenario);
-        DebugOut(10) << "MW Next." << std::endl;
-    }
-    // Set(2nd)
-    DebugOut(10) << "=========" << "MW Set2" << "=========" << std::endl;
-    for (auto itr = vehicleinfomap.begin(); itr != vehicleinfomap.end();
-         itr++) {
-        usleep(sleeptime);
-        memset(status, 0, sizeof(status));
-        idx = 0;
-        server = ControlWebsocket::DATA_STANDARD;
-        for (auto itr2 = (*itr).second.begin(); itr2 != (*itr).second.end();
-             itr2++) {
-            memcpy(status + idx, &value, sizeof(value));
-            if ((*itr2).isCustom) {
-                server = ControlWebsocket::DATA_CUSTOM;
-            }
-            idx += (*itr2).typesize;
-        }
-        gettimeofday(&time, NULL);
-        dopt.common_status = SUPPORT;
-        memcpy(dopt.status, status, STATUSSIZE);
-        client[server].send(const_cast<char*>(itr->first.c_str()), time, &dopt,
-                            64 + sizeof(timeval) + sizeof(int) + idx);
-        DebugOut(10) << "[S]: " << itr->first << " , " << time.tv_sec << "."
-                     << time.tv_usec << " , ";
-    }
-    // Wait valuechanged.
-    for (int i = 0; i < waitcount; i++) {
-        pthread_mutex_lock(&ControlWebsocketClient::mutex_scenario);
-        pthread_cond_wait(&ControlWebsocketClient::cond_scenario,
-                          &ControlWebsocketClient::mutex_scenario);
-        pthread_mutex_unlock(&ControlWebsocketClient::mutex_scenario);
-        DebugOut(10) << "MW Next." << std::endl;
-    }
-    std::cerr << "=========" << "MW End" << "=========" << std::endl;
-}
-
-bool
-MWScenarioEngine::initialize()
-{
-    conf.readConfig(CONFPATH);
-
-    std::vector<VehicleInfoDefine> vehicleinfoList;
-    vehicleinfoList = conf.getVehicleInfoConfig();
-    AbstractPropertyType *type;
-    for (auto itr = vehicleinfoList.begin(); itr != vehicleinfoList.end();
-         itr++) {
-        for (auto itr2 = (*itr).status.begin(); itr2 != (*itr).status.end();
-             itr2++) {
-            MWInfo info;
-            info.type = (*itr2).type;
-            info.typesize = (*itr2).typesize;
-            info.isCustom = true;
-            type = VehicleProperty::getPropertyTypeForPropertyNameValue(
-                    (*itr2).ambPropertyName, "0");
-            DebugOut(10) << "Read config file. " << (*itr2).ambPropertyName
-                         << " is ";
-            if (type != nullptr) {
-                info.isCustom = false;
-                DebugOut(10) << "Standard." << std::endl;
-                delete type;
-            }
-            else {
-                DebugOut(10) << "Custom." << std::endl;
-            }
-            vehicleinfomap[std::string((*itr).KeyEventType)].push_back(info);
-        }
-    }
-    PortInfo portinfo = conf.getPort();
-    if (!client[0].initialize(portinfo.standard.dataPort,
-                              ControlWebsocket::DATA_STANDARD)) {
-        return false;
-    }
-    if (!client[1].initialize(portinfo.standard.controlPort,
-                              ControlWebsocket::CONTROL_STANDARD)) {
-        return false;
-    }
-    if (!client[2].initialize(portinfo.custom.dataPort,
-                              ControlWebsocket::DATA_CUSTOM)) {
-        return false;
-    }
-    if (!client[3].initialize(portinfo.custom.controlPort,
-                              ControlWebsocket::CONTROL_CUSTOM)) {
-        return false;
-    }
-    return true;
-}
-
-int
-main()
-{
-    DebugOut::setDebugThreshhold(5);
-    MWScenarioEngine mwengine;
-    if (!mwengine.initialize()) {
-        std::cerr << "Error dbusengine.initialize." << std::endl;
-        return 0;
-    }
-    mwengine.start();
-    return 0;
-}
diff --git a/tests/scenarioengine.cc b/tests/scenarioengine.cc
deleted file mode 100644 (file)
index ae877c2..0000000
+++ /dev/null
@@ -1,26 +0,0 @@
-/**
- * Copyright (C) 2012  TOYOTA MOTOR CORPORATION.
- * 
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 2.1 of the License, or (at your option) any later version.
- * 
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
- * Lesser General Public License for more details.
- * 
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
- * 
- */
-#include <boost/any.hpp>
-
-#include "scenarioengine.h"
-
-ScenarioEngine::~ScenarioEngine()
-{
-}
-
diff --git a/tests/scenarioengine.h b/tests/scenarioengine.h
deleted file mode 100644 (file)
index 1bd46f3..0000000
+++ /dev/null
@@ -1,78 +0,0 @@
-/**
- * Copyright (C) 2012  TOYOTA MOTOR CORPORATION.
- * 
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 2.1 of the License, or (at your option) any later version.
- * 
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
- * Lesser General Public License for more details.
- * 
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
- * 
- */
-#include <map>
-#include <string>
-#include <vector>
-
-#include "abstractpropertytype.h"
-#include "ambconfig.h"
-#include "controlwebsocketclient.h"
-#include "controlwebsocketclientapp.h"
-
-const std::string CONFPATH = "/etc/ambd/AMBformat.conf";
-
-struct MWInfo {
-    DataType type;
-    int typesize;
-    bool isCustom;
-};
-
-class ScenarioEngine {
-public:
-    ScenarioEngine() :
-            loadscenario(0)
-    {
-    }
-    ~ScenarioEngine();
-    virtual void
-    start() = 0;
-    virtual bool
-    initialize() = 0;
-protected:
-
-    AMBConfig conf;
-    int loadscenario;
-};
-
-class MWScenarioEngine : public ScenarioEngine {
-public:
-    MWScenarioEngine();
-    ~MWScenarioEngine();
-    void
-    start();
-    bool
-    initialize();
-private:
-    bool stopFlg;
-    std::map<std::string, std::vector<MWInfo> > vehicleinfomap;
-    ControlWebsocketClient client[4];
-};
-
-class WebsocketAppScenarioEngine : public ScenarioEngine {
-public:
-    WebsocketAppScenarioEngine();
-    ~WebsocketAppScenarioEngine();
-    void
-    start();
-    bool
-    initialize();
-private:
-    std::map<std::string, std::vector<std::string> > namelist;
-    ControlWebsocketClientApp client;
-};
diff --git a/tests/standardjsonmessage.cc b/tests/standardjsonmessage.cc
deleted file mode 100644 (file)
index 4ab6471..0000000
+++ /dev/null
@@ -1,195 +0,0 @@
-#include <string.h>
-
-#include <iostream>
-
-#include <json/json.h>
-
-#include "standardjsonmessage.h"
-
-JsonMessage::JsonMessage()
-{
-}
-
-JsonMessage::~JsonMessage()
-{
-    data.clear();
-}
-
-char *
-JsonMessage::encode(std::string type_, std::string name_,
-                    std::string transactionid_, std::vector<JsonData>& data_)
-{
-    sstr.str("");
-    sstr << "{\"type\":\"" << type_ << "\", \"name\":\"" << name_
-         << "\", \"data\":[";
-    for (auto itr = data_.begin(); itr != data_.end(); itr++) {
-        if (itr != data_.begin()) {
-            sstr << ",";
-        }
-        if (name_ != "set") {
-            sstr << "\"" << (*itr).propertyName << "\"";
-        }
-        else {
-            sstr << "{\"property\":\"" << (*itr).propertyName
-                 << "\", \"value\":\"" << (*itr).value << "\"}";
-        }
-    }
-    sstr << "],\"transactionid\":\"" << transactionid_ << "\"}";
-    //std::cout << "JsonMessage Encode Messgae is : " << sstr.str() << "[" << sstr.str().length() << "]" << std::endl;
-    memset(encodebuf, 0, sizeof(encodebuf));
-    memcpy(encodebuf, const_cast<char*>(sstr.str().c_str()), sizeof(encodebuf));
-    return &encodebuf[0];
-}
-
-void
-JsonMessage::decode(std::string msg, size_t len)
-{
-    data.clear();
-    //std::cout << "Decode message is " << msg << std::endl;
-
-    json_object *rootobject;
-    json_tokener *tokener = json_tokener_new();
-    enum json_tokener_error err;
-    do {
-        rootobject = json_tokener_parse_ex(tokener, msg.c_str(), msg.length());
-    } while ((err = json_tokener_get_error(tokener)) == json_tokener_continue);
-
-    if (err != json_tokener_success) {
-        std::cerr << "Error: " << json_tokener_error_desc(err) << "\n";
-        return;
-    }
-    json_object *object = json_object_object_get(rootobject, "type");
-    if (!object) {
-        std::cerr << "Error Get type\n";
-        return;
-    }
-    type = std::string(json_object_get_string(object));
-
-    object = json_object_object_get(rootobject, "name");
-    if (!object) {
-        std::cerr << "Error Get name\n";
-        return;
-    }
-    name = std::string(json_object_get_string(object));
-
-    object = json_object_object_get(rootobject, "transactionid");
-    if (!object) {
-        std::cerr << "Error Get transactionid\n";
-        return;
-    }
-    transactionid = std::string(json_object_get_string(object));
-
-    object = json_object_object_get(rootobject, "data");
-    if (json_object_get_type(object) == json_type_array) {
-        array_list *datalist = json_object_get_array(object);
-        for (int i = 0; i < array_list_length(datalist); i++) {
-            JsonData jdata;
-            json_object *dataarrayobject =
-                    reinterpret_cast<json_object*>(array_list_get_idx(datalist,
-                                                                      i));
-            if (json_object_get_type(dataarrayobject) == json_type_object) {
-                json_object *dataobject = json_object_object_get(
-                        dataarrayobject, "property");
-                if (dataobject) {
-                    jdata.propertyName = std::string(
-                            json_object_get_string(dataobject));
-                }
-
-                dataobject = json_object_object_get(dataarrayobject, "value");
-                if (!dataobject) {
-                    std::cerr << "Error Get value[" << i << "]\n";
-                    return;
-                }
-                jdata.value = std::string(json_object_get_string(dataobject));
-
-                dataobject = json_object_object_get(dataarrayobject,
-                                                    "timestamp");
-                if (!dataobject) {
-                    std::cerr << "Error Get timestamp[" << i << "]\n";
-                    return;
-                }
-                jdata.timestamp = json_object_get_double(dataobject);
-
-                dataobject = json_object_object_get(dataarrayobject,
-                                                    "sequence");
-                if (!dataobject) {
-                    std::cerr << "Error Get sequence[" << i << "]\n";
-                    return;
-                }
-                jdata.sequence = json_object_get_int(dataobject);
-                data.push_back(jdata);
-            }
-            else if (json_object_get_type(dataarrayobject)
-                    == json_type_string) {
-                jdata.propertyName = std::string(
-                        json_object_get_string(dataarrayobject));
-                data.push_back(jdata);
-            }
-        }
-    }
-    else {
-        JsonData jdata;
-        if (json_object_get_type(object) == json_type_object) {
-            json_object *dataobject;
-            if (type == "valuechanged") {
-                jdata.propertyName = name;
-            }
-            else {
-                dataobject = json_object_object_get(object, "property");
-                if (dataobject) {
-                    jdata.propertyName = std::string(
-                            json_object_get_string(dataobject));
-                }
-            }
-
-            dataobject = json_object_object_get(object, "value");
-            if (!dataobject) {
-                std::cerr << "Error Get value\n";
-                return;
-            }
-            jdata.value = std::string(json_object_get_string(dataobject));
-
-            dataobject = json_object_object_get(object, "timestamp");
-            if (!dataobject) {
-                std::cerr << "Error Get timestamp\n";
-                return;
-            }
-            jdata.timestamp = json_object_get_double(dataobject);
-
-            dataobject = json_object_object_get(object, "sequence");
-            if (!dataobject) {
-                std::cerr << "Error Get sequence\n";
-                return;
-            }
-            jdata.sequence = json_object_get_int(dataobject);
-        }
-        else if (json_object_get_type(object) == json_type_string) {
-            jdata.propertyName = std::string(json_object_get_string(object));
-        }
-        data.push_back(jdata);
-    }
-}
-
-std::string
-JsonMessage::getType()
-{
-    return type;
-}
-
-std::string
-JsonMessage::getName()
-{
-    return name;
-}
-
-std::string
-JsonMessage::getTransactionid()
-{
-    return transactionid;
-}
-
-std::vector<JsonData>
-JsonMessage::getData()
-{
-    return data;
-}
diff --git a/tests/standardjsonmessage.h b/tests/standardjsonmessage.h
deleted file mode 100644 (file)
index 8838b95..0000000
+++ /dev/null
@@ -1,40 +0,0 @@
-#include <sstream>
-#include <string>
-#include <vector>
-
-struct JsonData {
-    std::string propertyName;
-    std::string value;
-    double timestamp;
-    int sequence;
-};
-
-class JsonMessage {
-public:
-    JsonMessage();
-    ~JsonMessage();
-    char *
-    encode(std::string type_, std::string name_, std::string transactionid_,
-           std::vector<JsonData>& data_);
-    void
-    decode(std::string msg, size_t len);
-
-    std::string
-    getType();
-    std::string
-    getName();
-    std::string
-    getTransactionid();
-    std::vector<JsonData>
-    getData();
-
-    static const int BUFSIZE = 256;
-protected:
-    std::stringstream sstr;
-
-    std::string type;
-    std::string name;
-    std::string transactionid;
-    std::vector<JsonData> data;
-    char encodebuf[BUFSIZE];
-};
diff --git a/tests/standardvehicleinfo.txt b/tests/standardvehicleinfo.txt
new file mode 100644 (file)
index 0000000..adee3f0
--- /dev/null
@@ -0,0 +1,32 @@
+VELOCITY
+ENGINE_SPEED
+SHIFT
+ACCPEDAL_OPEN
+BRAKE_SIGNAL
+STEERING
+TURN_SIGNAL
+CLUTCH
+OIL
+WATER_TEMP
+MACHINEGUNURRET
+ACCELERATION
+MASSAIRFLOW
+BUTTON
+OUTSIDE
+BATTERY
+INSIDE
+ENGINEOIL
+TIREPRESSURE
+TIRETEMPERATURE
+POWERMODE
+TRIPMETER
+CRUISECONTROL
+LIGHTSTATUS
+INTERIORLIGHT
+ENGINELOAD
+HORN
+FUEL_LEVEL
+FUEL
+EXTERIORBRIGHTNESS
+LOCATION
+DIRECTION
diff --git a/tests/startTestSuite.sh b/tests/startTestSuite.sh
deleted file mode 100755 (executable)
index d00b742..0000000
+++ /dev/null
@@ -1,7 +0,0 @@
-#!/bin/sh
-
-echo "==========Prepare Test ico-vic-amb-plugin=========="
-./testVehiclePluginWSApp 2>&1 | tee wslog &
-sleep 10
-echo "==========Start Test ico-vic-amb-plugin=========="
-./testVehiclePluginMW 2>&1 |tee mwlog
diff --git a/tests/vic1.cc b/tests/vic1.cc
new file mode 100644 (file)
index 0000000..5ce4f3d
--- /dev/null
@@ -0,0 +1,324 @@
+#include <unistd.h>
+
+#include <algorithm>
+#include <cstdio>
+#include <fstream>
+#include <vector>
+
+#include "ambconfig.h"
+#include "controlwebsocketclient.h"
+#include "datamessage.h"
+#include "eventmessage.h"
+#include "logresult.h"
+
+std::vector<VehicleInfoDefine> vehicleinfolist;
+char NOTREGISTERED[] = "NotRegistered";
+
+class ControlWebsocketClientForControl : public ControlWebsocketClient {
+    public:
+        bool recv(char *recvbuf, const size_t len);
+    private:
+        LogResult logger;
+};
+
+bool ControlWebsocketClientForControl::recv(char *recvbuf, const size_t len) {
+    DataMessage datamsg;
+    datamsg.decode(recvbuf, len);
+    DataOpt dopt = datamsg.getDataOpt();
+
+    auto itr_end = vehicleinfolist.end();
+    ClientType cltype = CLIENT_VIC;
+    CommandType cotype = CMDTYPE_GET;
+    for (auto itr = vehicleinfolist.begin(); itr != itr_end; itr++) {
+        if (strcmp((*itr).KeyEventType, datamsg.getKeyEventType()) == 0) {
+            auto itr2_end = (*itr).status.end();
+            int idx = 0;
+            for (auto itr2 = (*itr).status.begin(); itr2 != itr2_end; itr2++) {
+                switch ((*itr2).type) {
+                case INT:
+                    int i;
+                    memcpy(&i, dopt.status + idx, sizeof(i));
+                    logger.PutOut(cltype, cotype, (*itr2).ambPropertyName, i, datamsg.getRecordtime());
+                    idx += sizeof(i);
+                    break;
+                case DOUBLE:
+                    double d;
+                    memcpy(&d, dopt.status + idx, sizeof(d));
+                    logger.PutOut(cltype, cotype, (*itr2).ambPropertyName, d, datamsg.getRecordtime());
+                    idx += sizeof(d);
+                    break;
+                case CHAR:
+                    char c;
+                    memcpy(&c, dopt.status + idx, sizeof(c));
+                    logger.PutOut(cltype, cotype, (*itr2).ambPropertyName, c, datamsg.getRecordtime());
+                    idx += sizeof(c);
+                    break;
+                case INT16:
+                    int16_t i16;
+                    memcpy(&i16, dopt.status + idx, sizeof(i16));
+                    logger.PutOut(cltype, cotype, (*itr2).ambPropertyName, i16, datamsg.getRecordtime());
+                    idx += sizeof(i16);
+                    break;
+                case UINT16:
+                    uint16_t ui16;
+                    memcpy(&ui16, dopt.status + idx, sizeof(ui16));
+                    logger.PutOut(cltype, cotype, (*itr2).ambPropertyName, ui16, datamsg.getRecordtime());
+                    idx += sizeof(ui16);
+                    break;
+                case UINT32:
+                    uint32_t ui32;
+                    memcpy(&ui32, dopt.status + idx, sizeof(ui32));
+                    logger.PutOut(cltype, cotype, (*itr2).ambPropertyName, ui32, datamsg.getRecordtime());
+                    idx += sizeof(ui32);
+                    break;
+                case INT64:
+                    int64_t i64;
+                    memcpy(&i64, dopt.status + idx, sizeof(i64));
+                    logger.PutOut(cltype, cotype, (*itr2).ambPropertyName, i64, datamsg.getRecordtime());
+                    idx += sizeof(i64);
+                    break;
+                case UINT64:
+                    uint64_t ui64;
+                    memcpy(&ui64, dopt.status + idx, sizeof(ui64));
+                    logger.PutOut(cltype, cotype, (*itr2).ambPropertyName, ui64, datamsg.getRecordtime());
+                    idx += sizeof(ui64);
+                    break;
+                case BOOL:
+                    bool b;
+                    memcpy(&b, dopt.status + idx, sizeof(b));
+                    logger.PutOut(cltype, cotype, (*itr2).ambPropertyName, b, datamsg.getRecordtime());
+                    idx += sizeof(b);
+                    break;
+                default:
+                    break;
+                }
+            }
+        }
+    }
+    return true;
+}
+
+template <typename T>
+int SetDataOpt(DataOpt *opt, int idx, T value) {
+    memcpy(opt->status + idx, &value, sizeof(value));
+    return sizeof(value);
+}
+
+int main(int argc, char *argv[]) {
+    int ret;
+    std::string configpath = "/etc/ambd/AMBformat.conf";
+    while ((ret = getopt(argc, argv, "c:")) != -1) {
+        switch (ret) {
+        case 'c':
+            configpath = std::string(optarg);
+            break;
+        default :
+            break;
+        }
+    }
+
+    ifstream fin("standardvehicleinfo.txt");
+    std::string str;
+    std::vector<std::string> standardvehicleinfolist;
+    while (!fin.eof()) {
+        fin >> str;
+        standardvehicleinfolist.push_back(str);
+    }
+
+    AMBConfig config;
+    if (!config.readConfig(configpath)) {
+        std::cerr << "Can't read VIC-Plugin config file." << std::endl;
+        return -1;
+    }
+    PortInfo portinfo = config.getPort();
+
+    ControlWebsocketClient stddataws, customdataws;
+    ControlWebsocketClientForControl stdctrlws, customctrlws;
+    if (!stddataws.initialize("ws://127.0.0.1", portinfo.standard.dataPort, "standarddatamessage-only")) {
+        std::cerr << "Can't connect standarddatamessage-only." << std::endl;
+        return -1;
+    }
+    if (!stdctrlws.initialize("ws://127.0.0.1", portinfo.standard.controlPort, "standardcontrolmessage-only")) {
+        std::cerr << "Can't connect standarddatamessage-only." << std::endl;
+        return -1;
+    }
+    if (!customdataws.initialize("ws://127.0.0.1", portinfo.custom.dataPort, "customdatamessage-only")) {
+        std::cerr << "Can't connect customdatamessage-only." << std::endl;
+        return -1;
+    }
+    if (!customctrlws.initialize("ws://127.0.0.1", portinfo.custom.controlPort, "customcontrolmessage-only")) {
+        std::cerr << "Can't connect customdatamessage-only." << std::endl;
+        return -1;
+    }
+
+    vehicleinfolist =config.getVehicleInfoConfig();
+    auto itr_end = vehicleinfolist.end();
+    int idx = 0;
+    struct timeval tv;
+    LogResult logger;
+    enum ClientType cltype = CLIENT_VIC;
+    enum CommandType cotype = CMDTYPE_SET;
+    DataMessage datamsg;
+
+    for (int i = 0; i < 10; i++) {
+        stddataws.service();
+        customdataws.service();
+        stdctrlws.service();
+        customctrlws.service();
+        usleep(50 * 1000);
+    }
+
+    for (auto itr = vehicleinfolist.begin(); itr != itr_end; itr++) {
+        stddataws.service();
+        customdataws.service();
+        stdctrlws.service();
+        customctrlws.service();
+        usleep(50 * 1000);
+
+        DataOpt dopt;
+        dopt.common_status = SUPPORT;
+        idx = 0;
+        auto itr2_end = (*itr).status.end();
+        gettimeofday(&tv, NULL);
+        for (auto itr2 = (*itr).status.begin(); itr2 != itr2_end; itr2++) {
+            switch ((*itr2).type) {
+            case INT : {
+                int i = 5;
+                idx += SetDataOpt(&dopt, idx, i);
+                logger.PutOut(cltype, cotype, (*itr2).ambPropertyName, i);
+                break;
+            }
+            case DOUBLE : {
+                double d = 5.0;
+                idx += SetDataOpt(&dopt, idx, d);
+                logger.PutOut(cltype, cotype, (*itr2).ambPropertyName, d);
+                break;
+            }
+            case CHAR : {
+                char c = 5;
+                idx += SetDataOpt(&dopt, idx, c);
+                logger.PutOut(cltype, cotype, (*itr2).ambPropertyName, c);
+                break;
+            }
+            case INT16 : {
+                int16_t i16 = 5;
+                idx += SetDataOpt(&dopt, idx, i16);
+                logger.PutOut(cltype, cotype, (*itr2).ambPropertyName, i16);
+                break;
+            }
+            case UINT16 : {
+                uint16_t ui16 = 5;
+                idx += SetDataOpt(&dopt, idx, ui16);
+                logger.PutOut(cltype, cotype, (*itr2).ambPropertyName, ui16);
+                break;
+            }
+            case UINT32 : {
+                uint32_t ui32 = 5;
+                idx += SetDataOpt(&dopt, idx, ui32);
+                logger.PutOut(cltype, cotype, (*itr2).ambPropertyName, ui32);
+                break;
+            }
+            case INT64 : {
+                int64_t i64 = 5;
+                idx += SetDataOpt(&dopt, idx, i64);
+                logger.PutOut(cltype, cotype, (*itr2).ambPropertyName, i64);
+                break;
+            }
+            case UINT64 : {
+                uint64_t ui64 = 5;
+                idx += SetDataOpt(&dopt, idx, ui64);
+                logger.PutOut(cltype, cotype, (*itr2).ambPropertyName, ui64);
+                break;
+            }
+            case BOOL : {
+                bool b = true;
+                idx += SetDataOpt(&dopt, idx, b);
+                logger.PutOut(cltype, cotype, (*itr2).ambPropertyName, b);
+                break;
+            }
+            default : {
+                break;
+            }
+            }
+        }
+        if (std::find(standardvehicleinfolist.begin(), standardvehicleinfolist.end(), std::string((*itr).KeyEventType)) != standardvehicleinfolist.end()) {
+            stddataws.send(datamsg.encode((*itr).KeyEventType, tv, dopt), StandardMessage::KEYEVENTTYPESIZE + sizeof(timeval) + sizeof(int) + idx);
+            usleep(100 * 1000);
+        }
+        else {
+            customdataws.send(datamsg.encode((*itr).KeyEventType, tv, dopt), StandardMessage::KEYEVENTTYPESIZE + sizeof(timeval) + sizeof(int) + idx);
+            usleep(100 * 1000);
+        }
+        stddataws.service();
+        customdataws.service();
+        stdctrlws.service();
+        customctrlws.service();
+        usleep(50 * 1000);
+    }
+    DataOpt dopt;
+    dopt.common_status = SUPPORT;
+    SetDataOpt(&dopt, 0, (int)5);
+    stddataws.send(datamsg.encode(NOTREGISTERED, tv, dopt), StandardMessage::KEYEVENTTYPESIZE + sizeof(timeval) + 2 * sizeof(int));
+    stddataws.service();
+    customdataws.service();
+    stdctrlws.service();
+    customctrlws.service();
+    usleep(50 * 1000);
+    customdataws.send(datamsg.encode(NOTREGISTERED, tv, dopt), StandardMessage::KEYEVENTTYPESIZE + sizeof(timeval) + 2 * sizeof(int));
+    stddataws.service();
+    customdataws.service();
+    stdctrlws.service();
+    customctrlws.service();
+    usleep(50 * 1000);
+    sleep(1);
+    EventMessage eventmsg;
+    EventOpt eopt;
+    eopt.common = -1;
+    eopt.sense = -1;
+    eopt.event_mask = -1;
+
+    for (auto itr = vehicleinfolist.begin(); itr != itr_end; itr++) {
+        stddataws.service();
+        customdataws.service();
+        stdctrlws.service();
+        customctrlws.service();
+        usleep(50 * 1000);
+
+        gettimeofday(&tv, NULL);
+        if (std::find(standardvehicleinfolist.begin(), standardvehicleinfolist.end(), std::string((*itr).KeyEventType)) != standardvehicleinfolist.end()) {
+            stdctrlws.send(eventmsg.encode((*itr).KeyEventType, tv, eopt), StandardMessage::KEYEVENTTYPESIZE + sizeof(timeval) + sizeof(EventOpt));
+            usleep(100 * 1000);
+        }
+        else {
+            customctrlws.send(eventmsg.encode((*itr).KeyEventType, tv, eopt), StandardMessage::KEYEVENTTYPESIZE + sizeof(timeval) + sizeof(EventOpt));
+            usleep(100 * 1000);
+        }
+        stddataws.service();
+        customdataws.service();
+        stdctrlws.service();
+        customctrlws.service();
+        usleep(50 * 1000);
+    }
+    stdctrlws.send(eventmsg.encode(NOTREGISTERED, tv, eopt), StandardMessage::KEYEVENTTYPESIZE + sizeof(timeval) + sizeof(EventOpt));
+    stddataws.service();
+    customdataws.service();
+    stdctrlws.service();
+    customctrlws.service();
+    usleep(50 * 1000);
+    customctrlws.send(eventmsg.encode(NOTREGISTERED, tv, eopt), StandardMessage::KEYEVENTTYPESIZE + sizeof(timeval) + sizeof(EventOpt));
+    stddataws.service();
+    customdataws.service();
+    stdctrlws.service();
+    customctrlws.service();
+    usleep(50 * 1000);
+
+    for (int i = 0; i < 10; i++) {
+        stddataws.service();
+        customdataws.service();
+        stdctrlws.service();
+        customctrlws.service();
+        usleep(50 * 1000);
+    }
+    
+    return 0;
+}
diff --git a/tests/vic3.cc b/tests/vic3.cc
new file mode 100644 (file)
index 0000000..801bcb9
--- /dev/null
@@ -0,0 +1,166 @@
+#include <unistd.h>
+
+#include <algorithm>
+#include <cstdio>
+#include <fstream>
+#include <vector>
+
+#include "ambconfig.h"
+#include "controlwebsocketclient.h"
+#include "datamessage.h"
+#include "eventmessage.h"
+#include "logresult.h"
+
+std::vector<VehicleInfoDefine> vehicleinfolist;
+
+template <typename T>
+int SetDataOpt(DataOpt *opt, int idx, T value) {
+    memcpy(opt->status + idx, &value, sizeof(value));
+    return sizeof(value);
+}
+
+int main(int argc, char *argv[]) {
+    int ret;
+    std::string configpath = "/etc/ambd/AMBformat.conf";
+    while ((ret = getopt(argc, argv, "c:")) != -1) {
+        switch (ret) {
+        case 'c':
+            configpath = std::string(optarg);
+            break;
+        default :
+            break;
+        }
+    }
+
+    ifstream fin("standardvehicleinfo.txt");
+    std::string str;
+    std::vector<std::string> standardvehicleinfolist;
+    while (!fin.eof()) {
+        fin >> str;
+        standardvehicleinfolist.push_back(str);
+    }
+
+    AMBConfig config;
+    if (!config.readConfig(configpath)) {
+        std::cerr << "Can't read VIC-Plugin config file." << std::endl;
+        return -1;
+    }
+    PortInfo portinfo = config.getPort();
+
+    ControlWebsocketClient stddataws, customdataws;
+    if (!stddataws.initialize("ws://127.0.0.1", portinfo.standard.dataPort, "standarddatamessage-only")) {
+        std::cerr << "Can't connect standarddatamessage-only." << std::endl;
+        return -1;
+    }
+    if (!customdataws.initialize("ws://127.0.0.1", portinfo.custom.dataPort, "customdatamessage-only")) {
+        std::cerr << "Can't connect customdatamessage-only." << std::endl;
+        return -1;
+    }
+
+    vehicleinfolist =config.getVehicleInfoConfig();
+    auto itr_end = vehicleinfolist.end();
+    int idx = 0;
+    struct timeval tv;
+    LogResult logger;
+    enum ClientType cltype = CLIENT_VIC;
+    enum CommandType cotype = CMDTYPE_SET;
+    DataMessage datamsg;
+
+    for (int i = 0; i < 10; i++) {
+        stddataws.service();
+        customdataws.service();
+        usleep(50 * 1000);
+    }
+
+    for (auto itr = vehicleinfolist.begin(); itr != itr_end; itr++) {
+        stddataws.service();
+        customdataws.service();
+        usleep(50 * 1000);
+
+        DataOpt dopt;
+        dopt.common_status = SUPPORT;
+        idx = 0;
+        auto itr2_end = (*itr).status.end();
+        gettimeofday(&tv, NULL);
+        for (auto itr2 = (*itr).status.begin(); itr2 != itr2_end; itr2++) {
+            switch ((*itr2).type) {
+            case INT : {
+                int i = 5;
+                idx += SetDataOpt(&dopt, idx, i);
+                logger.PutOut(cltype, cotype, (*itr2).ambPropertyName, i);
+                break;
+            }
+            case DOUBLE : {
+                double d = 5.0;
+                idx += SetDataOpt(&dopt, idx, d);
+                logger.PutOut(cltype, cotype, (*itr2).ambPropertyName, d);
+                break;
+            }
+            case CHAR : {
+                char c = 5;
+                idx += SetDataOpt(&dopt, idx, c);
+                logger.PutOut(cltype, cotype, (*itr2).ambPropertyName, c);
+                break;
+            }
+            case INT16 : {
+                int16_t i16 = 5;
+                idx += SetDataOpt(&dopt, idx, i16);
+                logger.PutOut(cltype, cotype, (*itr2).ambPropertyName, i16);
+                break;
+            }
+            case UINT16 : {
+                uint16_t ui16 = 5;
+                idx += SetDataOpt(&dopt, idx, ui16);
+                logger.PutOut(cltype, cotype, (*itr2).ambPropertyName, ui16);
+                break;
+            }
+            case UINT32 : {
+                uint32_t ui32 = 5;
+                idx += SetDataOpt(&dopt, idx, ui32);
+                logger.PutOut(cltype, cotype, (*itr2).ambPropertyName, ui32);
+                break;
+            }
+            case INT64 : {
+                int64_t i64 = 5;
+                idx += SetDataOpt(&dopt, idx, i64);
+                logger.PutOut(cltype, cotype, (*itr2).ambPropertyName, i64);
+                break;
+            }
+            case UINT64 : {
+                uint64_t ui64 = 5;
+                idx += SetDataOpt(&dopt, idx, ui64);
+                logger.PutOut(cltype, cotype, (*itr2).ambPropertyName, ui64);
+                break;
+            }
+            case BOOL : {
+                bool b = true;
+                idx += SetDataOpt(&dopt, idx, b);
+                logger.PutOut(cltype, cotype, (*itr2).ambPropertyName, b);
+                break;
+            }
+            default : {
+                break;
+            }
+            }
+        }
+        if (std::find(standardvehicleinfolist.begin(), standardvehicleinfolist.end(), std::string((*itr).KeyEventType)) != standardvehicleinfolist.end()) {
+            stddataws.send(datamsg.encode((*itr).KeyEventType, tv, dopt), StandardMessage::KEYEVENTTYPESIZE + sizeof(timeval) + sizeof(int) + idx);
+            usleep(100 * 1000);
+        }
+        else {
+            customdataws.send(datamsg.encode((*itr).KeyEventType, tv, dopt), StandardMessage::KEYEVENTTYPESIZE + sizeof(timeval) + sizeof(int) + idx);
+            usleep(100 * 1000);
+        }
+        stddataws.service();
+        customdataws.service();
+        usleep(50 * 1000);
+    }
+    
+    for (int i = 0; i < 10; i++) {
+        stddataws.service();
+        customdataws.service();
+        usleep(50 * 1000);
+    }
+
+    return 0;
+}
diff --git a/tests/vicreset.cc b/tests/vicreset.cc
new file mode 100644 (file)
index 0000000..042e052
--- /dev/null
@@ -0,0 +1,166 @@
+#include <unistd.h>
+
+#include <algorithm>
+#include <cstdio>
+#include <fstream>
+#include <vector>
+
+#include "ambconfig.h"
+#include "controlwebsocketclient.h"
+#include "datamessage.h"
+#include "eventmessage.h"
+#include "logresult.h"
+
+std::vector<VehicleInfoDefine> vehicleinfolist;
+
+template <typename T>
+int SetDataOpt(DataOpt *opt, int idx, T value) {
+    memcpy(opt->status + idx, &value, sizeof(value));
+    return sizeof(value);
+}
+
+int main(int argc, char *argv[]) {
+    int ret;
+    std::string configpath = "/etc/ambd/AMBformat.conf";
+    while ((ret = getopt(argc, argv, "c:")) != -1) {
+        switch (ret) {
+        case 'c':
+            configpath = std::string(optarg);
+            break;
+        default :
+            break;
+        }
+    }
+
+    ifstream fin("standardvehicleinfo.txt");
+    std::string str;
+    std::vector<std::string> standardvehicleinfolist;
+    while (!fin.eof()) {
+        fin >> str;
+        standardvehicleinfolist.push_back(str);
+    }
+
+    AMBConfig config;
+    if (!config.readConfig(configpath)) {
+        std::cerr << "Can't read VIC-Plugin config file." << std::endl;
+        return -1;
+    }
+    PortInfo portinfo = config.getPort();
+
+    ControlWebsocketClient stddataws, customdataws;
+    if (!stddataws.initialize("ws://127.0.0.1", portinfo.standard.dataPort, "standarddatamessage-only")) {
+        std::cerr << "Can't connect standarddatamessage-only." << std::endl;
+        return -1;
+    }
+    if (!customdataws.initialize("ws://127.0.0.1", portinfo.custom.dataPort, "customdatamessage-only")) {
+        std::cerr << "Can't connect customdatamessage-only." << std::endl;
+        return -1;
+    }
+
+    vehicleinfolist =config.getVehicleInfoConfig();
+    auto itr_end = vehicleinfolist.end();
+    int idx = 0;
+    struct timeval tv;
+    LogResult logger;
+    enum ClientType cltype = CLIENT_VIC;
+    enum CommandType cotype = CMDTYPE_SET;
+    DataMessage datamsg;
+
+    for (int i = 0; i < 10; i++) {
+        stddataws.service();
+        customdataws.service();
+        usleep(50 * 1000);
+    }
+
+    for (auto itr = vehicleinfolist.begin(); itr != itr_end; itr++) {
+        stddataws.service();
+        customdataws.service();
+        usleep(50 * 1000);
+
+        DataOpt dopt;
+        dopt.common_status = SUPPORT;
+        idx = 0;
+        auto itr2_end = (*itr).status.end();
+        gettimeofday(&tv, NULL);
+        for (auto itr2 = (*itr).status.begin(); itr2 != itr2_end; itr2++) {
+            switch ((*itr2).type) {
+            case INT : {
+                int i = 0;
+                idx += SetDataOpt(&dopt, idx, i);
+                logger.PutOut(cltype, cotype, (*itr2).ambPropertyName, i);
+                break;
+            }
+            case DOUBLE : {
+                double d = 0.0;
+                idx += SetDataOpt(&dopt, idx, d);
+                logger.PutOut(cltype, cotype, (*itr2).ambPropertyName, d);
+                break;
+            }
+            case CHAR : {
+                char c = 0;
+                idx += SetDataOpt(&dopt, idx, c);
+                logger.PutOut(cltype, cotype, (*itr2).ambPropertyName, c);
+                break;
+            }
+            case INT16 : {
+                int16_t i16 = 0;
+                idx += SetDataOpt(&dopt, idx, i16);
+                logger.PutOut(cltype, cotype, (*itr2).ambPropertyName, i16);
+                break;
+            }
+            case UINT16 : {
+                uint16_t ui16 = 0;
+                idx += SetDataOpt(&dopt, idx, ui16);
+                logger.PutOut(cltype, cotype, (*itr2).ambPropertyName, ui16);
+                break;
+            }
+            case UINT32 : {
+                uint32_t ui32 = 0;
+                idx += SetDataOpt(&dopt, idx, ui32);
+                logger.PutOut(cltype, cotype, (*itr2).ambPropertyName, ui32);
+                break;
+            }
+            case INT64 : {
+                int64_t i64 = 0;
+                idx += SetDataOpt(&dopt, idx, i64);
+                logger.PutOut(cltype, cotype, (*itr2).ambPropertyName, i64);
+                break;
+            }
+            case UINT64 : {
+                uint64_t ui64 = 0;
+                idx += SetDataOpt(&dopt, idx, ui64);
+                logger.PutOut(cltype, cotype, (*itr2).ambPropertyName, ui64);
+                break;
+            }
+            case BOOL : {
+                bool b = false;
+                idx += SetDataOpt(&dopt, idx, b);
+                logger.PutOut(cltype, cotype, (*itr2).ambPropertyName, b);
+                break;
+            }
+            default : {
+                break;
+            }
+            }
+        }
+        if (std::find(standardvehicleinfolist.begin(), standardvehicleinfolist.end(), std::string((*itr).KeyEventType)) != standardvehicleinfolist.end()) {
+            stddataws.send(datamsg.encode((*itr).KeyEventType, tv, dopt), StandardMessage::KEYEVENTTYPESIZE + sizeof(timeval) + sizeof(int) + idx);
+            usleep(100 * 1000);
+        }
+        else {
+            customdataws.send(datamsg.encode((*itr).KeyEventType, tv, dopt), StandardMessage::KEYEVENTTYPESIZE + sizeof(timeval) + sizeof(int) + idx);
+            usleep(100 * 1000);
+        }
+        stddataws.service();
+        customdataws.service();
+        usleep(50 * 1000);
+    }
+    
+    for (int i = 0; i < 10; i++) {
+        stddataws.service();
+        customdataws.service();
+        usleep(50 * 1000);
+    }
+
+    return 0;
+}
diff --git a/tests/vicseq.cc b/tests/vicseq.cc
new file mode 100644 (file)
index 0000000..fac5979
--- /dev/null
@@ -0,0 +1,222 @@
+#include <unistd.h>
+#include <sys/time.h>
+
+#include <algorithm>
+#include <cstdio>
+#include <fstream>
+#include <vector>
+
+#include "ambconfig.h"
+#include "controlwebsocketclient.h"
+#include "datamessage.h"
+#include "eventmessage.h"
+#include "logresult.h"
+
+std::vector<VehicleInfoDefine> vehicleinfolist;
+int maxstandarddatacount = 1;
+int maxcustomdatacount = 0;
+int interspace = 100;
+int testdatanum = maxstandarddatacount + maxcustomdatacount;
+
+struct TestData {
+    std::string vicproperty;
+    std::string dbusproperty;
+    DataType type;
+    bool isstd;
+};
+
+template <typename T>
+int SetDataOpt(DataOpt *opt, int idx, T value) {
+    memcpy(opt->status + idx, &value, sizeof(value));
+    return sizeof(value);
+}
+
+int main(int argc, char *argv[]) {
+    int ret;
+    std::string configpath = "/etc/ambd/AMBformat.conf";
+    std::string retstr;
+    while ((ret = getopt(argc, argv, "c:i:n:s:")) != -1) {
+        switch (ret) {
+        case 'c':
+            configpath = std::string(optarg);
+            break;
+        case 'i':
+            retstr = std::string(optarg);
+            interspace = std::stoi(retstr);
+            break;
+        case 'n':
+            retstr = std::string(optarg);
+            maxcustomdatacount = std::stoi(retstr);
+            testdatanum = maxstandarddatacount + maxcustomdatacount;
+            break;
+        case 's':
+            retstr = std::string(optarg);
+            maxstandarddatacount = std::stoi(retstr);
+            testdatanum = maxstandarddatacount + maxcustomdatacount;
+            break;
+        default :
+            break;
+        }
+    }
+
+    ifstream fin("standardvehicleinfo.txt");
+    std::string str;
+    std::vector<std::string> standardvehicleinfolist;
+    while (!fin.eof()) {
+        fin >> str;
+        standardvehicleinfolist.push_back(str);
+    }
+
+    AMBConfig config;
+    if (!config.readConfig(configpath)) {
+        std::cerr << "Can't read VIC-Plugin config file." << std::endl;
+        return -1;
+    }
+    PortInfo portinfo = config.getPort();
+
+    ControlWebsocketClient stddataws, customdataws;
+    if (!stddataws.initialize("ws://127.0.0.1", portinfo.standard.dataPort, "standarddatamessage-only")) {
+        std::cerr << "Can't connect standarddatamessage-only." << std::endl;
+        return -1;
+    }
+    if (!customdataws.initialize("ws://127.0.0.1", portinfo.custom.dataPort, "customdatamessage-only")) {
+        std::cerr << "Can't connect customdatamessage-only." << std::endl;
+        return -1;
+    }
+
+    vehicleinfolist =config.getVehicleInfoConfig();
+    auto itr_end = vehicleinfolist.end();
+    int idx = 0;
+    struct timeval tv;
+    LogResult logger;
+    enum ClientType cltype = CLIENT_VIC;
+    enum CommandType cotype = CMDTYPE_SET;
+    DataMessage datamsg;
+    struct TestData testdata[testdatanum];
+    int datacount = 0;
+    int standarddatacount = 0;
+    int customdatacount = 0;
+
+    for (int i = 0; i < 10; i++) {
+        stddataws.service();
+        customdataws.service();
+        usleep(50 * 1000);
+    }
+
+    DataOpt dopt;
+    for (auto itr = vehicleinfolist.begin(); itr != itr_end && datacount < testdatanum; itr++) {
+        if ((*itr).status.size() > 1) {
+            continue;
+        }
+        auto itr2_end = (*itr).status.end();
+        if (std::find(standardvehicleinfolist.begin(), standardvehicleinfolist.end(), std::string((*itr).KeyEventType)) != standardvehicleinfolist.end()) {
+            if (standarddatacount >= maxstandarddatacount) {
+                continue;
+            }
+            testdata[datacount].vicproperty = std::string((*itr).KeyEventType);
+            testdata[datacount].isstd = true;
+            for (auto itr2 = (*itr).status.begin(); itr2 != itr2_end; itr2++) {
+                testdata[datacount].dbusproperty = std::string((*itr2).dbusPropertyName);
+                testdata[datacount].type = (*itr2).type;
+            }
+            datacount++;
+            standarddatacount++;
+        }
+        else {
+            if (customdatacount >= maxcustomdatacount) {
+                continue;
+            }
+            testdata[datacount].vicproperty = std::string((*itr).KeyEventType);
+            testdata[datacount].isstd = false;
+            for (auto itr2 = (*itr).status.begin(); itr2 != itr2_end; itr2++) {
+                testdata[datacount].dbusproperty = std::string((*itr2).dbusPropertyName);
+                testdata[datacount].type = (*itr2).type;
+            }
+            datacount++;
+            customdatacount++;
+        }
+    }
+    
+    struct timeval starttv, endtv;
+    for (int i = 0; i < 100; i++) {
+        gettimeofday(&starttv, NULL);
+        for (int j = 0; j < testdatanum; j++) {
+            switch (testdata[j].type) {
+            case INT : {
+                static int i = 0;
+                idx = SetDataOpt(&dopt, 0, i);
+                logger.PutOut(cltype, cotype, testdata[j].dbusproperty, i++);
+                break;
+            }
+            case DOUBLE : {
+                static double d = 0.0;
+                idx = SetDataOpt(&dopt, 0, d);
+                logger.PutOut(cltype, cotype, testdata[j].dbusproperty, d);
+                d += 0.1;
+                break;
+            }
+            case CHAR : {
+                static char c = 0;
+                idx = SetDataOpt(&dopt, 0, c);
+                logger.PutOut(cltype, cotype, testdata[j].dbusproperty, c++);
+                break;
+            }
+            case INT16 : {
+                static int16_t i16 = 0;
+                idx = SetDataOpt(&dopt, 0, i16);
+                logger.PutOut(cltype, cotype, testdata[j].dbusproperty, i16++);
+                break;
+            }
+            case UINT16 : {
+                static uint16_t ui16 = 0;
+                idx = SetDataOpt(&dopt, 0, ui16);
+                logger.PutOut(cltype, cotype, testdata[j].dbusproperty, ui16++);
+                break;
+            }
+            case UINT32 : {
+                static uint32_t ui32 = 0;
+                idx = SetDataOpt(&dopt, 0, ui32);
+                logger.PutOut(cltype, cotype, testdata[j].dbusproperty, ui32++);
+                break;
+            }
+            case INT64 : {
+                static int64_t i64 = 0;
+                idx = SetDataOpt(&dopt, 0, i64);
+                logger.PutOut(cltype, cotype, testdata[j].dbusproperty, i64++);
+                break;
+            }
+            case UINT64 : {
+                static uint64_t ui64 = 0;
+                idx = SetDataOpt(&dopt, 0, ui64);
+                logger.PutOut(cltype, cotype, testdata[j].dbusproperty, ui64++);
+                break;
+            }
+            case BOOL : {
+                static bool b = true;
+                idx = SetDataOpt(&dopt, 0, b);
+                logger.PutOut(cltype, cotype, testdata[j].dbusproperty, b);
+                b = !b;
+                break;
+            }
+            default : {
+                break;
+            }
+            }
+            gettimeofday(&tv, NULL);
+            if (testdata[j].isstd) {
+                stddataws.send(datamsg.encode(const_cast<char*>(testdata[j].vicproperty.c_str()), tv, dopt), StandardMessage::KEYEVENTTYPESIZE + sizeof(timeval) + sizeof(int) + idx);
+            }
+            else {
+                customdataws.send(datamsg.encode(const_cast<char*>(testdata[j].vicproperty.c_str()), tv, dopt), StandardMessage::KEYEVENTTYPESIZE + sizeof(timeval) + sizeof(int) + idx);
+            }
+        }
+
+        stddataws.service();
+        customdataws.service();
+        gettimeofday(&endtv, NULL);
+        //std::cerr << "End - Start = " << ((endtv.tv_sec - starttv.tv_sec) * 1000 * 1000 + (endtv.tv_usec - starttv.tv_usec)) << std::endl;
+        usleep(interspace * 1000 - ((endtv.tv_sec - starttv.tv_sec) * 1000 * 1000 + (endtv.tv_usec - starttv.tv_usec)));
+    }
+
+    return 0;
+}
diff --git a/tests/websocketscenario.cc b/tests/websocketscenario.cc
deleted file mode 100644 (file)
index d202a12..0000000
+++ /dev/null
@@ -1,182 +0,0 @@
-/**
- * Copyright (C) 2012  TOYOTA MOTOR CORPORATION.
- * 
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 2.1 of the License, or (at your option) any later version.
- * 
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
- * Lesser General Public License for more details.
- * 
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
- * 
- */
-#include <sys/time.h>
-
-#include <algorithm>
-#include <iostream>
-#include <sstream>
-#include <string>
-#include <vector>
-
-#include "debugout.h"
-
-#include "configamb.h"
-#include "scenarioengine.h"
-
-std::string AMBCONFPATH = "/etc/ambd/config";
-const int sleeptime = 75 * 1000;
-
-WebsocketAppScenarioEngine::WebsocketAppScenarioEngine()
-{
-}
-
-WebsocketAppScenarioEngine::~WebsocketAppScenarioEngine()
-{
-    namelist.clear();
-}
-
-void
-WebsocketAppScenarioEngine::start()
-{
-    int value = 0;
-    std::stringstream sstr;
-    sstr.str("");
-    timeval time;
-    double timestamp = 0.0;
-
-    int setnotifycall = namelist.size() - 1;
-    DebugOut(10) << "=========" << "WebsocketApp Subscribe" << "========="
-                 << std::endl;
-    usleep(12 * 1000);
-    for (auto itr = namelist.begin(); itr != namelist.end(); itr++) {
-        for (auto itr2 = (*itr).second.begin(); itr2 != (*itr).second.end();
-             itr2++) {
-            usleep(sleeptime);
-            gettimeofday(&time, NULL);
-            timestamp = time.tv_sec + (time.tv_usec / (1000 * 1000));
-            ControlWebsocketClientApp::vehiclename_scenario = (*itr2);
-            client.send("method", "subscribe", (*itr2), sstr.str(), timestamp);
-            DebugOut(10) << "[S]: " << (*itr).first << "->" << (*itr2)
-                         << " , subscribe , " << timestamp << " , " << sstr.str()
-                         << std::endl;
-        }
-    }
-    for (int i = 0; i < 2; i++) {
-        pthread_mutex_lock(&ControlWebsocketClientApp::mutex_scenario);
-        pthread_cond_wait(&ControlWebsocketClientApp::cond_scenario,
-                          &ControlWebsocketClientApp::mutex_scenario);
-        pthread_mutex_unlock(&ControlWebsocketClientApp::mutex_scenario);
-        DebugOut(10) << "WebsocketApp Next." << std::endl;
-    }
-    DebugOut(10) << "vehiclename_scenario = "
-                 << ControlWebsocketClientApp::vehiclename_scenario 
-                 << std::endl;
-    DebugOut(10) << "=========" << "WebsocketApp Set" << "========="
-                 << std::endl;
-
-    for (auto itr = namelist.begin(); itr != namelist.end(); itr++) {
-        for (auto itr2 = (*itr).second.begin(); itr2 != (*itr).second.end();
-             itr2++) {
-            usleep(sleeptime);
-            gettimeofday(&time, NULL);
-            timestamp = time.tv_sec + (time.tv_usec / (1000 * 1000));
-            sstr.str("");
-            sstr << value;
-            DebugOut(10) << "Send Data : " << sstr.str() << "," << timestamp
-                         << std::endl;
-            client.send("method", "set", (*itr2), sstr.str(), timestamp);
-            DebugOut(10) << "[S]: " << (*itr2) << " , set , " << timestamp
-                         << " , " << sstr.str() << std::endl;
-        }
-    }
-    pthread_mutex_lock(&ControlWebsocketClientApp::mutex_scenario);
-    pthread_cond_wait(&ControlWebsocketClientApp::cond_scenario,
-                      &ControlWebsocketClientApp::mutex_scenario);
-    pthread_mutex_unlock(&ControlWebsocketClientApp::mutex_scenario);
-    DebugOut(10) << "WebsocketApp Next." << std::endl;
-    pthread_mutex_lock(&ControlWebsocketClientApp::mutex_scenario);
-    pthread_cond_wait(&ControlWebsocketClientApp::cond_scenario,
-                      &ControlWebsocketClientApp::mutex_scenario);
-    pthread_mutex_unlock(&ControlWebsocketClientApp::mutex_scenario);
-    DebugOut(10) << "WebsocketApp Next." << std::endl;
-    DebugOut(10) << "=========" << "WebsocketApp Set & Get" << "========="
-                 << std::endl;
-    for (auto itr = namelist.begin(); itr != namelist.end(); itr++) {
-        for (auto itr2 = (*itr).second.begin(); itr2 != (*itr).second.end();
-             itr2++) {
-            usleep(sleeptime);
-            gettimeofday(&time, NULL);
-            timestamp = time.tv_sec + (time.tv_usec / (1000 * 1000));
-            sstr.str("");
-            sstr << value;
-            DebugOut(10) << "Send Data : " << sstr.str() << "," << timestamp
-                         << std::endl;
-            client.send("method", "set", (*itr2), sstr.str(), timestamp);
-            DebugOut(10) << "[S]: " << (*itr2) << " , set , " << timestamp
-                         << " , " << sstr.str() << std::endl;
-            usleep(sleeptime);
-            gettimeofday(&time, NULL);
-            timestamp = time.tv_sec + (time.tv_usec / (1000 * 1000));
-            client.send("method", "get", (*itr2), sstr.str(), timestamp);
-            DebugOut(10) << "[S]: " << (*itr2) << " , get , " << timestamp
-                         << " , " << sstr.str() << std::endl;
-        }
-    }
-    // Wait Get
-    pthread_mutex_lock(&ControlWebsocketClientApp::mutex_scenario);
-    pthread_cond_wait(&ControlWebsocketClientApp::cond_scenario,
-                      &ControlWebsocketClientApp::mutex_scenario);
-    pthread_mutex_unlock(&ControlWebsocketClientApp::mutex_scenario);
-    std::cerr << "=========" << "WebsocketApp End" << "=========" << std::endl;
-}
-
-bool
-WebsocketAppScenarioEngine::initialize()
-{
-    ConfigAMB confamb;
-    if (!confamb.readConfig(AMBCONFPATH)) {
-        std::cerr << "Error configamb.initialize." << std::endl;
-        return false;
-    }
-    if (!conf.readConfig(confamb.getAMBformatPath())) {
-        std::cerr << "Error config.initialize." << std::endl;
-        return false;
-    }
-    if (!client.initialize(confamb.getPort())) {
-        std::cerr << "Error controlwebsocketclientapp.initialize("
-                  << confamb.getPort() << "." << std::endl;
-        return false;
-    }
-
-    std::vector<VehicleInfoDefine> vehicleinfoList;
-    vehicleinfoList = conf.getVehicleInfoConfig();
-    for (auto itr = vehicleinfoList.begin(); itr != vehicleinfoList.end();
-         itr++) {
-        for (auto itr2 = (*itr).status.begin(); itr2 != (*itr).status.end();
-             itr2++) {
-            namelist[std::string((*itr).KeyEventType)].push_back(
-                    (*itr2).ambPropertyName);
-        }
-    }
-    return true;
-}
-
-int
-main()
-{
-    DebugOut::setDebugThreshhold(5);
-    WebsocketAppScenarioEngine wsengine;
-    if (!wsengine.initialize()) {
-        std::cerr << "Error websocketengine.initialize." << std::endl;
-        return 0;
-    }
-    wsengine.start();
-
-    return 0;
-}
index 711b280..e5d0568 100644 (file)
@@ -34,7 +34,7 @@
 #define TYPE_UINT32 6
 #define TYPE_DOUBLE 7
 #define TYPE_STRING 8
-#define TYPE_SHIFT  12
+#define TYPE_SHIFT  15
 
 #define LWS_DEFAULTIP       "127.0.0.1" /* connection default ip(localhost) */
 #define LWS_DEFAULTPORT     25010       /* connection default port          */
 static const struct {
     char        *prop;
     char        *eventtype;
-    unsigned char   datatype[4];
+    unsigned char   datatype[5];
 }               vehicleinfo_key[] = {
-    { "VehicleSpeed", "VELOCITY", {TYPE_INT32, TYPE_NULL, 0,0} },
-    { "Speed", "VELOCITY", {TYPE_INT32, TYPE_NULL, 0,0} },
-    { "Velocity", "VELOCITY", {TYPE_INT32, TYPE_NULL, 0,0} },
-    { "Location", "LOCATION", {TYPE_DOUBLE, TYPE_DOUBLE, TYPE_DOUBLE, TYPE_NULL} },
-    { "Direction", "DIRECTION", {TYPE_INT32, TYPE_NULL, 0,0} },
-    { "EngineSpeed", "ENGINE_SPEED", {TYPE_INT32, TYPE_NULL, 0, 0} },
-    { "Engine", "ENGINE_SPEED", {TYPE_INT32, TYPE_NULL, 0, 0} },
-    { "Shift", "SHIFT", {TYPE_SHIFT, TYPE_BYTE, TYPE_NULL, 0} },
-    { "ShiftPosition", "SHIFT", {TYPE_SHIFT, TYPE_BYTE, TYPE_NULL, 0} },
-    { "Break_Signal", "BRAKE_SIGNAL", {TYPE_BOOL, TYPE_NULL, 0,0} },
-    { "BreakSignal", "BRAKE_SIGNAL", {TYPE_BOOL, TYPE_NULL, 0,0} },
-    { "Break", "BRAKE_SIGNAL", {TYPE_BOOL, TYPE_NULL, 0,0} },
-    { "Blinker", "TURN_SIGNAL", {TYPE_INT32, TYPE_NULL, 0, 0} },
-    { "Winker", "TURN_SIGNAL", {TYPE_INT32, TYPE_NULL, 0, 0} },
-    { "TurnSignal", "TURN_SIGNAL", {TYPE_INT32, TYPE_NULL, 0, 0} },
-    { "Turn", "TURN_SIGNAL", {TYPE_INT32, TYPE_NULL, 0, 0} },
-    { "lightStatus", "LIGHTSTATUS", {TYPE_BOOL, TYPE_BOOL, TYPE_BOOL, TYPE_BOOL} },
-    { "light", "LIGHTSTATUS", {TYPE_BOOL, TYPE_BOOL, TYPE_BOOL, TYPE_BOOL} },
-    { "WATER_TEMP", "WATER_TEMP", {TYPE_INT32, TYPE_NULL, 0, 0} },
-    { "EXTERIORBRIGHTNESS", "EXTERIORBRIGHTNESS", {TYPE_UINT16, TYPE_NULL, 0, 0} },
-    { "EXTERIOR", "EXTERIORBRIGHTNESS", {TYPE_UINT16, TYPE_NULL, 0, 0} },
-    { "\0", "\0", {TYPE_NULL, 0,0,0} } };
+    { "VehicleSpeed", "VELOCITY", {TYPE_INT32, TYPE_NULL, 0, 0, 0} },
+    { "Speed", "VELOCITY", {TYPE_INT32, TYPE_NULL, 0, 0, 0} },
+    { "Velocity", "VELOCITY", {TYPE_INT32, TYPE_NULL, 0, 0, 0} },
+    { "Location", "LOCATION", {TYPE_DOUBLE, TYPE_DOUBLE, TYPE_DOUBLE, TYPE_NULL, 0} },
+    { "Direction", "DIRECTION", {TYPE_INT32, TYPE_NULL, 0, 0, 0} },
+    { "EngineSpeed", "ENGINE_SPEED", {TYPE_INT32, TYPE_NULL, 0, 0, 0} },
+    { "Engine", "ENGINE_SPEED", {TYPE_INT32, TYPE_NULL, 0, 0, 0} },
+    { "Shift", "SHIFT", {TYPE_SHIFT, TYPE_INT32, TYPE_INT32, TYPE_NULL, TYPE_NULL} },
+    { "ShiftPosition", "SHIFT", {TYPE_SHIFT, TYPE_INT32, TYPE_INT32, TYPE_NULL, TYPE_NULL} },
+    { "Break_Signal", "BRAKE_SIGNAL", {TYPE_BOOL, TYPE_NULL, 0, 0, 0} },
+    { "BreakSignal", "BRAKE_SIGNAL", {TYPE_BOOL, TYPE_NULL, 0, 0, 0} },
+    { "Break", "BRAKE_SIGNAL", {TYPE_BOOL, TYPE_NULL, 0, 0, 0} },
+    { "Blinker", "TURN_SIGNAL", {TYPE_INT32, TYPE_NULL, 0, 0, 0} },
+    { "Winker", "TURN_SIGNAL", {TYPE_INT32, TYPE_NULL, 0, 0, 0} },
+    { "TurnSignal", "TURN_SIGNAL", {TYPE_INT32, TYPE_NULL, 0, 0, 0} },
+    { "Turn", "TURN_SIGNAL", {TYPE_INT32, TYPE_NULL, 0, 0, 0} },
+    { "lightStatus", "LIGHTSTATUS", {TYPE_BOOL, TYPE_BOOL, TYPE_BOOL, TYPE_BOOL, 0} },
+    { "light", "LIGHTSTATUS", {TYPE_BOOL, TYPE_BOOL, TYPE_BOOL, TYPE_BOOL, 0} },
+    { "WATER_TEMP", "WATER_TEMP", {TYPE_INT32, TYPE_NULL, 0, 0, 0} },
+    { "EXTERIORBRIGHTNESS", "EXTERIORBRIGHTNESS", {TYPE_UINT16, TYPE_NULL, 0, 0, 0} },
+    { "EXTERIOR", "EXTERIORBRIGHTNESS", {TYPE_UINT16, TYPE_NULL, 0, 0, 0} },
+    { "STEERING", "STEERING", {TYPE_INT32, TYPE_NULL, 0, 0, 0} },
+    { "steering", "STEERING", {TYPE_INT32, TYPE_NULL, 0, 0, 0} },
+    { "\0", "\0", {TYPE_NULL, 0, 0, 0, 0} } };
 
 struct KeyDataMsg_t
 {
@@ -224,46 +226,59 @@ set_vehicleinfo(const char *cmd)
             switch (vehicleinfo_key[key].datatype[idx] % 10) {
             case TYPE_BOOL:
             case TYPE_BYTE:
+                if (vehicleinfo_key[key].datatype[idx] == TYPE_BOOL){
+                    if (strcasecmp(&value[i], "true") == 0) {
+                        strcpy(&value[i], "1");
+                    }
+                    else if (strcasecmp(&value[i], "false") == 0) {
+                        strcpy(&value[i], "0");
+                    }
+                }
+                msg.msg.data.status[pt++] = strtoul(&value[i], (char **)0, 0);
+                msgsize += 1;
+                break;
+            case TYPE_INT16:
+            case TYPE_UINT16:
+                sp = (short *)&msg.msg.data.status[pt];
+                *sp = strtol(&value[i], (char **)0, 0);
+                pt += sizeof(short);
+                msgsize += sizeof(short);
+                break;
+            case TYPE_INT32:
+            case TYPE_UINT32:
+                ip = (int *)&msg.msg.data.status[pt];
                 if (vehicleinfo_key[key].datatype[idx] == TYPE_SHIFT)   {
                     if ((strcasecmp(&value[i], "sp") == 0) ||
                         (strcasecmp(&value[i], "s0") == 0)) {
-                        strcpy(&value[i], "0");
+                        *ip = strtol("0", (char **)0, 0);
                     }
                     else if (strcasecmp(&value[i], "sr") == 0)  {
-                        strcpy(&value[i], "1");
+                        *ip = strtol("1", (char **)0, 0);
                     }
                     else if (strcasecmp(&value[i], "sn") == 0)  {
-                        strcpy(&value[i], "2");
+                        *ip = strtol("2", (char **)0, 0);
                     }
                     else if ((strcasecmp(&value[i], "sd") == 0) ||
                              (strcasecmp(&value[i], "s4") == 0))    {
-                        strcpy(&value[i], "4");
+                        *ip = strtol("4", (char **)0, 0);
                     }
                     else if ((strcasecmp(&value[i], "s1") == 0) ||
                              (strcasecmp(&value[i], "sl") == 0))    {
-                        strcpy(&value[i], "5");
+                        *ip = strtol("5", (char **)0, 0);
                     }
                     else if (strcasecmp(&value[i], "s2") == 0)  {
-                        strcpy(&value[i], "6");
+                        *ip = strtol("6", (char **)0, 0);
                     }
                     else if (strcasecmp(&value[i], "s3") == 0)  {
-                        strcpy(&value[i], "7");
+                        *ip = strtol("7", (char **)0, 0);
+                    }
+                    else {
+                        *ip = strtol(&value[i], (char **)0, 0);
                     }
                 }
-                msg.msg.data.status[pt++] = strtoul(&value[i], (char **)0, 0);
-                msgsize += 1;
-                break;
-            case TYPE_INT16:
-            case TYPE_UINT16:
-                sp = (short *)&msg.msg.data.status[pt];
-                *sp = strtol(&value[i], (char **)0, 0);
-                pt += sizeof(short);
-                msgsize += sizeof(short);
-                break;
-            case TYPE_INT32:
-            case TYPE_UINT32:
-                ip = (int *)&msg.msg.data.status[pt];
-                *ip = strtol(&value[i], (char **)0, 0);
+                else {
+                    *ip = strtol(&value[i], (char **)0, 0);
+                }
                 pt += sizeof(int);
                 msgsize += sizeof(int);
                 break;