initial add
authorKevron Rees <kevron_m_rees@linux.intel.com>
Wed, 23 May 2012 16:51:35 +0000 (09:51 -0700)
committerKevron Rees <kevron_m_rees@linux.intel.com>
Wed, 23 May 2012 16:51:35 +0000 (09:51 -0700)
46 files changed:
.kdev4/_custom.kdev4 [new file with mode: 0644]
.kdev4/nobdy2.kdev4 [new file with mode: 0644]
CMakeLists.txt
docs/drivingsafety.txt [new file with mode: 0644]
docs/electricvehicle.txt [new file with mode: 0644]
docs/environment.txt [new file with mode: 0644]
docs/maintenance.txt [new file with mode: 0644]
docs/parking.txt [new file with mode: 0644]
docs/personalization.txt [new file with mode: 0644]
docs/runningstatus.txt [new file with mode: 0644]
docs/vehicleinfo.txt [new file with mode: 0644]
lib/.runningstatusinterface.cpp.kate-swp [new file with mode: 0644]
lib/CMakeLists.txt [new file with mode: 0644]
lib/CMakeLists.txt~ [new file with mode: 0644]
lib/abstractdbusinterface.cpp [new file with mode: 0644]
lib/abstractdbusinterface.h [new file with mode: 0644]
lib/dbusinterfacemanager.cpp [new file with mode: 0644]
lib/dbusinterfacemanager.cpp~ [new file with mode: 0644]
lib/dbusinterfacemanager.h [new file with mode: 0644]
lib/nobdy2.pc.in [new file with mode: 0644]
lib/nobdy2.pc.in~ [new file with mode: 0644]
lib/pluginloader.cpp [new file with mode: 0644]
lib/pluginloader.h [new file with mode: 0644]
lib/propertytypes/AntilockBrackingSytemStatus.h~ [new file with mode: 0644]
lib/propertytypes/VehicleSpeed.h~ [new file with mode: 0644]
lib/propertytypes/VehicleType.h [new file with mode: 0644]
lib/propertytypes/VehicleType.h~ [new file with mode: 0644]
lib/propertytypes/Velocity.h~ [new file with mode: 0644]
lib/propertytypes/abstractproperty.cpp [new file with mode: 0644]
lib/propertytypes/abstractproperty.cpp~ [new file with mode: 0644]
lib/propertytypes/abstractproperty.h [new file with mode: 0644]
lib/propertytypes/vehiclespeed.cpp [new file with mode: 0644]
lib/propertytypes/vehiclespeed.h [new file with mode: 0644]
lib/runningstatusinterface.cpp [new file with mode: 0644]
lib/runningstatusinterface.h [new file with mode: 0644]
main.cpp
plugins/CMakeLists.txt [new file with mode: 0644]
plugins/CMakeLists.txt~ [new file with mode: 0644]
plugins/exampleplugin.cpp [new file with mode: 0644]
plugins/exampleplugin.cpp~ [new file with mode: 0644]
plugins/exampleplugin.h [new file with mode: 0644]
plugins/exampleplugin.h~ [new file with mode: 0644]
plugins/nobdycompatplugin.cpp [new file with mode: 0644]
plugins/nobdycompatplugin.cpp~ [new file with mode: 0644]
plugins/nobdycompatplugin.h [new file with mode: 0644]
plugins/nobdycompatplugin.h~ [new file with mode: 0644]

diff --git a/.kdev4/_custom.kdev4 b/.kdev4/_custom.kdev4
new file mode 100644 (file)
index 0000000..0f33ef8
--- /dev/null
@@ -0,0 +1,25 @@
+[Containments][1]
+ActionPluginsSource=Global
+activity=nobdy2
+activityId=
+desktop=-1
+formfactor=0
+immutability=1
+lastDesktop=-1
+lastScreen=0
+location=0
+orientation=2
+plugin=newspaper
+screen=0
+wallpaperplugin=color
+wallpaperpluginmode=
+
+[Containments][1][Wallpaper][color]
+backgroundMode=0
+color1=255,255,255
+color2=0,0,0
+
+[Project]
+Manager=KDevCMakeManager
+Name=nobdy2
+VersionControl=kdevgit
diff --git a/.kdev4/nobdy2.kdev4 b/.kdev4/nobdy2.kdev4
new file mode 100644 (file)
index 0000000..ddbfb26
--- /dev/null
@@ -0,0 +1,18 @@
+[Buildset]
+BuildItems=@Variant(\x00\x00\x00\t\x00\x00\x00\x00\x01\x00\x00\x00\x0b\x00\x00\x00\x00\x01\x00\x00\x00\x0c\x00n\x00o\x00b\x00d\x00y\x002)
+
+[CMake]
+BuildDirs=/home/tripzero/src/nobdy2/build
+CMakeDir=/usr/share/cmake-2.8/Modules
+Current CMake Binary=file:///usr/bin/cmake
+CurrentBuildDir=file:///home/tripzero/src/nobdy2/build
+CurrentBuildType=Debug
+CurrentInstallDir=file:///home/tripzero/src/nobdy2/build/$$INSTALL_ROOT/usr
+Extra Arguments=
+ProjectRootRelative=./
+
+[MakeBuilder]
+Number Of Jobs=1
+
+[Project]
+VersionControlSupport=kdevgit
index 439fe40..f6c9005 100644 (file)
@@ -1,4 +1,48 @@
 project(nobdy2)
+cmake_minimum_required(VERSION 2.8)
+
+include(FindPkgConfig)
+
+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")
+set (INCLUDE_INSTALL_DIR "${CMAKE_INSTALL_PREFIX}/include" CACHE PATH "The directory the headers are installed in")
+
+set(PROJECT_NAME "nobdy2")
+set(PROJECT_VERSION "0.0.1")
+
+option(use_qtcore "Use QCoreApplication mainloop " OFF)
+option(nobdy_compat "Build nobdy compatibility plugin" OFF)
+
+find_library(libtool_LIBRARY ltdl DOC "Libtool libraries")
+find_path(libtool_INCLUDE_DIR ltdl.h DOC "Libtool headers")
+find_package(Boost REQUIRED)
+pkg_check_modules(glib REQUIRED glib-2.0)
+pkg_check_modules(gio REQUIRED gio-2.0)
+
+set(include_dirs ${libtool_INCLUDE_DIR} ${glib_INCLUDE_DIRS} ${gio_INCLUDE_DIRS} ${Boost_INCLUDE_DIRS} ${CMAKE_CURRENT_SOURCE_DIR} "lib")
+set(link_libraries -lnobdy2 ${glib_LIBRARIES} ${gio_LIBRARIES} -L${CMAKE_CURRENT_BINARY_DIR})
 
 add_executable(nobdy2 main.cpp)
 
+add_definitions(-std=c++0x)
+add_definitions(-DDBusServiceName="org.automotive")
+
+if(use_qtcore)
+
+       find_package( Qt4 REQUIRED )
+       set( QT_DONT_USE_QTGUI TRUE )
+       include(${QT_USE_FILE})
+       set(include_dirs ${include_dirs} ${qt_INCLUDE_DIRS})
+       set(link_libraries ${link_libraries} ${qt_LIBRARIES})
+
+       add_definitions(-DUSE_QT_CORE)
+
+endif(use_qtcore)
+
+include_directories(${include_dirs})
+target_link_libraries(nobdy2 ${link_libraries})
+
+add_custom_target(uninstall "${CMAKE_COMMAND}" -P "${CMAKE_CURRENT_BINARY_DIR}/cmake_uninstall.cmake")
+
+add_subdirectory(lib)
+add_subdirectory(plugins)
diff --git a/docs/drivingsafety.txt b/docs/drivingsafety.txt
new file mode 100644 (file)
index 0000000..5b8aa8f
--- /dev/null
@@ -0,0 +1,128 @@
+Driving Safety hierarchy
+=================
+
+Service         org.automotive
+Interface       org.automotive.drivingsafety
+Object path     /
+
+Properties             byte AntilockBrakingSystem [readonly]
+
+                                       Idle = 0,
+                                       Engaged = 1
+                                       
+                               byte TractionControlSystem [readonly]
+                               
+                                       Off = 0,
+                                       On = 1
+                                       
+                               uint16 VehicleTopSpeedLimit [readonly]
+                               
+                                       top rated speed in km/h. 0 = no limit
+                                       
+                               dict{ byte, byte } AirbagStatus [readonly]
+                               
+                                       Dictionary of Airbag (byte) and Status (byte)
+                                       
+                                       Airbag:
+                                       
+                                       Driver = 0,
+                                       Passenger = 1,
+                                       LeftSide = 2,
+                                       RightSide = 3
+                                       
+                                       Status:
+                                       
+                                       Active = 0,
+                                       Inactive = 1,
+                                       Deployed = 2
+                                       
+                               dict{ byte, byte } DoorStatus [readonly]
+                               
+                                       Dictionary of Door (byte) and Status (byte)
+                                       
+                                       Door:
+                                       
+                                       Driver = 0,
+                                       Passenger = 1,
+                                       LeftRear = 2,
+                                       RightRear = 3,
+                                       Trunk = 4,
+                                       FuelCap = 5,
+                                       Hood = 6
+                                       
+                                       Status:
+                                       
+                                       Closed = 0,
+                                       Open = 1,
+                                       Ajar = 2
+                               
+                               dict{ byte, bool } DoorLockStatus [readonly]
+                               
+                                       Dictionary of Door (byte) and Status (bool locked = true)
+                                       
+                                       Door:
+                                       
+                                       Driver = 0,
+                                       Passenger = 1,
+                                       LeftRear = 2,
+                                       RightRear = 3,
+                               
+                               dict{ byte, bool } SeatBeltStatus [readonly]
+                               
+                                       Dictionary of Seat Belt (byte) and Status (bool: Fasten = true)
+                                       
+                                       Seat Belt:
+                                       
+                                       Driver = 0,
+                                       Passenger = 1,
+                                       LeftRear = 2,
+                                       RightRear = 3
+                                       
+                               dict{ byte, bool } WindowLockStatus [readonly]
+                               
+                                       Dictionary of Windows (byte) and Status (bool: Locked = true)
+                                       
+                                       Window:
+                                       
+                                       Driver = 0,
+                                       Passenger = 1,
+                                       LeftRear = 2,
+                                       RightRear = 3
+                               
+                               dict{ byte, byte } OccupantStatus [readonly]
+                               
+                                       Dictionary of Occupant (byte) and Status
+                                       
+                                       Occupant:
+                                       
+                                       Driver = 0,
+                                       Passenger = 1,
+                                       LeftRear = 2,
+                                       RightRear = 3
+                                       
+                                       Status:
+                                       
+                                       Vacant = 0,
+                                       Child = 1, 
+                                       Adult = 2
+                                       
+                               dict{ byte, double } ObstacleDistance [readonly]
+                               
+                                       Dictionary of Distance Sensor and distance (double) in m
+                               
+                                       Distance Sensors:
+                                       
+                                       LeftFront = 0,
+                                       RightFront = 1,
+                                       LeftRear = 2,
+                                       RightRear = 3,
+                                       LeftBlindSpot = 4,
+                                       RightBlindSPot = 5
+                                       
+                               string CameraFrame [readonly]
+                               
+                                       string representing a shared memory key where the camera frame is stored.  
+                                       The frame is stored as a PNG encoded byte array.
+       
+                               
\ No newline at end of file
diff --git a/docs/electricvehicle.txt b/docs/electricvehicle.txt
new file mode 100644 (file)
index 0000000..18939a4
--- /dev/null
@@ -0,0 +1,35 @@
+Electric Vehicle hierarchy
+=================
+
+Service         org.automotive
+Interface       org.automotive.electricVehicle
+Object path     /
+
+Properties             byte HybridPowerSystem [readonly]
+
+                                       Hybrid power system:
+                                       
+                                       Idle = 0,
+                                       Battery Mode = 1,
+                                       Engine Mode = 2,
+                                       Hybrid Mode = 3
+                                       
+                               bool ChargingStatus [readwrite]
+                               
+                                       get or sets charging status: on = true, off = false.
+                                       
+                               struct{ double, byte } BatteryVoltage [readonly]
+                               
+                                       Voltage of battery (double) and Level of charge (0-100%) (byte).
+                                       
+                               bool BatteryChargeCord [readonly]
+                               
+                                       Cord connected (true), disconnected (false)
+                                       
+                               byte TargetChargeLevel [readonly]
+                               
+                                       Level of charge capacity relative to factory charge rating (0-100%) (byte)
+                               
+                               uint16 TimeToFullCharge [readonly]
+                               
+                                       Number of minutes remaining until fully charged.
\ No newline at end of file
diff --git a/docs/environment.txt b/docs/environment.txt
new file mode 100644 (file)
index 0000000..a072beb
--- /dev/null
@@ -0,0 +1,100 @@
+Environment hierarchy
+=================
+
+Service         org.automotive
+Interface       org.automotive.environment
+Object path     /
+
+
+Properties             double InteriorTemperature [readonly]
+
+                                       Temperature inside the vehicle in Celsius in increments of 0.1.
+                                       
+                               double ExteriorTemprature [readonly]
+                               
+                                       Temperature outside the vehicle in Celsius in increments of 0.1.
+                                       
+                               double ExteriorBrightness [readonly]
+                               
+                                       Brightness outside the vehicle in lux  (0 - 130,000)
+                                       
+                               byte RainSensor [readonly]
+                               
+                                       Level of rain intensity 0: No Rain - 10: Heaviest Rain
+                                       
+                               byte WindshieldWhiper [readwrite]
+                               
+                                       Level of windshield whiper speed:
+                                       
+                                       Off = 0,
+                                       Slowest = 1,
+                                       Fastest = 5,
+                                       Auto = 10
+                                       
+                               struct{ byte, byte, byte } HVACFan [readwrite]
+                               
+                                       Airflow Direction (byte), Fan Speed (0-7) (byte), Target Temperature in Celsius (byte)
+                                       
+                                       Airflow Direction:
+                                       
+                                       Front Panel = 0,
+                                       Floor Duct = 1,
+                                       Front + Floor = 2,
+                                       Front = 3,
+                                       Defroster + Floor = 4
+                                       
+                               bool AirConditioning [readwrite]
+                               
+                                       Air conditioning on (true) / off (false)
+                                       
+                               bool AirRecirculation [readwrite]
+                               
+                                       Air recirculation on (true) / off (false)
+                                       
+                               bool Heater [readwrite]
+                               
+                                       Heater on (true) / off (false)
+                                       
+                               dict{ byte, bool } Defrost [readwrite]
+                               
+                                       Defrost on (true) / off (false) per Postion (byte)
+                                       
+                                       Position:
+                                       
+                                       Windshield = 0,
+                                       RearWindow = 1,
+                                       SideMirrors = 2
+                                       
+                               bool SteeringWheelHeater [readwrite]
+                               
+                                       Steering wheel heater on (true) / off (false)
+                                       
+                               bool SeatHeater [readwrite]
+                               
+                                       Seat heater on (true) / off (false)
+                                       
+                               bool SeatCooler [readwrite]
+                               
+                                       Seat cooler on (true) / off (false)
+                                       
+                               dict{ byte, byte } WindowStatus [readwrite]
+                               
+                                       Percent of openness (0-100) (byte) per window (byte)
+                                       
+                                       Window:
+                                       
+                                       Driver = 0,
+                                       Passenger = 1,
+                                       LeftRear = 2,
+                                       RightRear = 3
+                                       
+                               struct{ byte, byte } Sunroof [readwrite]
+                               
+                                       Percent of sunroof openness (0: Closed - 100: Fully Opened) (byte) and percent of tilt (0: Closed - 100: Maximum Tilt) (byte)
+                                       
+                               bool ConvertibleRoof [readwrite]
+                               
+                                       Convertible roof on (true) / off (false)
+                               
+                                       
+                       
\ No newline at end of file
diff --git a/docs/maintenance.txt b/docs/maintenance.txt
new file mode 100644 (file)
index 0000000..e8d977d
--- /dev/null
@@ -0,0 +1,38 @@
+Maintenance hierarchy
+=================
+
+Service         org.automotive
+Interface       org.automotive.maintenance
+Object path     /
+
+Properties     uint32 Odometer [readonly]
+
+                               Distance in km
+                               
+                       byte TransmissionFluid [readonly]
+                       
+                               Remaining percentage
+                       
+                       byte BrakeFluid [readonly]
+                       
+                               Remaining percentage
+                               
+                       byte WasherFluid [readonly]
+                       
+                               Remaining percentage
+                               
+                       struct{ double, double } BatteryStatus [readonly]
+                       
+                               Voltage (double)
+                               Current (double)
+                               
+                       dict{ byte, double } TirePressure [readonly]
+                       
+                               Tire (byte), Pressure (kPa)
+                               Tire:
+                               RightFront = 0,
+                               LeftFront = 1,
+                               RightRear = 2,
+                               LeftRear = 3
+                               
+                       
\ No newline at end of file
diff --git a/docs/parking.txt b/docs/parking.txt
new file mode 100644 (file)
index 0000000..46ade4b
--- /dev/null
@@ -0,0 +1,28 @@
+Parking hierarchy
+=================
+
+Service         org.automotive
+Interface       org.automotive.parking
+Object path     /
+
+Properties             byte SecurityAlert [readonly]
+                               
+                                       returns status of security alert:
+
+                                       Idle = 0,
+                                       Armed = 1,
+                                       Alarm Detected = 2
+                                       
+                               bool ParkingBrake
+                               
+                                       returns whether the parking break is active (true)/inactive (false)
+                                       
+                               bool ParkingLights
+                               
+                                       returns whether the parking lights are active (true) or inactive (false)
+                                       
+                               bool HazardLights
+                               
+                                       returns whether the hazard lights are active (true)/inactive (false)
+                               
+                               
\ No newline at end of file
diff --git a/docs/personalization.txt b/docs/personalization.txt
new file mode 100644 (file)
index 0000000..4eb061a
--- /dev/null
@@ -0,0 +1,64 @@
+Running Status hierarchy
+=================
+
+Service         org.automotive
+Interface       org.automotive.runningstatus
+Object path     /
+
+
+Properties             string KeyId [readonly]
+
+                                       UUID of key in the ignition.  Unique to each key of the vehicle
+                                       
+                               string Language [readwrite]
+                               
+                                       ISO 639-1 Language Code (ie en)
+                               
+                               byte MeasurementSystem [readwrite]
+                               
+                                       Metric = 0,
+                                       Imperial(US) = 1,
+                                       Imperial(UK) = 2
+                                       
+                               dict{ byte, struct { byte, byte} }  MirrorSettings [readwrite]
+                               
+                                       Dictionary of Mirrors (byte) and the Mirrors' Tilt (byte) and Pan (byte) settings
+                                       
+                                       Mirror:
+                                       
+                                       DriverSide = 0,
+                                       PassengerSide = 1,
+                                       Inside = 2
+                                       
+                               
+                               struct { uint16, uint16 } SteeringWheelPostion [readwrite]
+                               
+                                       Dictionary of steering wheel parts and its Slide (uint16) and Tilt (uint16)
+                                       
+                               byte DrivingMode [readwrite]
+                               
+                                       Mode:
+                                       
+                                       Auto = 0,
+                                       Comfort = 1,
+                                       Sport = 2,
+                                       Eco = 3,
+                                       Manual = 4
+                                       
+                               struct{ uint16, uint16, uint16, uint16, uint16, uint16 } DriverSeatPosition [readwrite]
+                               
+                                       Driver seat positon per part: (recline seatback, slide, cushion height, headrest, back cushion, side cushion)
+                                       
+                               struct{ uint16, uint16, uint16, uint16, uint16, uint16 } PassengerSeatPosition [readwrite]
+                               
+                                       Passenger seat positon per part: (recline seatback, slide, cushion height, headrest, back cushion, side cushion)
+                                       
+                               byte DashboardIllumination [readwrite]
+                               
+                                       Percentage of illumination, 0: Darkest, 100: Brightest
+                                       
+                               byte GeneratedVehicleSoundMode [readwrite]
+                               
+                                       Normal = 0,
+                                       Quiet = 1,
+                                       Sportive = 2
\ No newline at end of file
diff --git a/docs/runningstatus.txt b/docs/runningstatus.txt
new file mode 100644 (file)
index 0000000..77653b3
--- /dev/null
@@ -0,0 +1,121 @@
+Running Status hierarchy
+=================
+
+Service         org.automotive
+Interface       org.automotive.runningstatus
+Object path     /
+
+Properties     byte VehiclePowerMode [readonly]
+                       
+                               Off = 0,
+                               Accessory1 = 1,
+                               Accessory2 = 2,
+                               Run = 3
+                               
+                       uint16 VehicleSpeed [readonly]
+                       
+                               Velocity of vehicle in kph.
+
+                       uint16 EngineSpeed [readonly]
+                       
+                               Engine speed in rotations per minute (RPM)
+                               
+                       array{uint32} TripMeter [readonly]
+                       
+                               Distance from trip meter(s) in km.
+                               
+                       byte TransmissionGearStatus [readonly]
+                       
+                               Neautral = 0,
+                               1st = 1,
+                               2nd = 2,
+                               3rd = 3,
+                               4th = 4,
+                               5th = 5,
+                               6th = 6,
+                               7th = 7,
+                               8th = 8,
+                               9th = 9,
+                               10th = 10,
+                               Reverse = 64,
+                               Auto = 128
+                               
+                       struct{bool, uint16} CruiseControlStatus [readonly]
+                       
+                               Activated/Deactivated, Speed in kph.
+                               
+                       bool WheelBrake [readonly]
+                       
+                               Engaged = true
+                               Idle = false
+                               
+                       dict{byte, bool} LightStatus [readonly]
+                       
+                               Light (uint16), On=true/Off=false
+                               Light Type:
+                               Head = 0,
+                               RightTurn = 1,
+                               LeftTurn = 2,
+                               Brake = 3,
+                               Fog = 4,
+                               Hazard = 5,
+                               Parking = 6,
+                               HighBeam = 7
+                               
+                       dict{byte, bool} InteriorLightStatus [readonly]
+                       
+                               Interior Light (uint16), On = true / Off = false
+                               Interior Light Type:
+                               Driver = 0,
+                               Passenger = 1,
+                               Center = 2
+                               
+                       bool Horn [readonly]
+                               
+                               On = true / Off = false
+                               
+                       bool Chime [readonly]
+                       
+                               On = true / Off = false
+                               
+                       byte FuelLevel [readonly]
+                       
+                               Remaining percentage of fuel.
+                               
+                       uint16 FuelRange
+                       
+                               Estimated fuel range with available fuel in km
+                               
+                       struct{ byte, byte, byte } EngineOil
+                       
+                               Remaining Oil Percentage (byte)
+                               Engine Oil Temperature (byte)
+                               Engine Oil Pressure (byte)
+                               
+                       struct{ byte, byte } EngineCoolant
+                       
+                               Level (byte)
+                               Temperature (byte)
+                               
+                       struct{ uint16, uint16, uint16 } Acceleration
+                       
+                               X, Y and Z acceleration in m/s*s
+                       
+                       struct{ uint16, uint16, byte, uint32 } VehicleOdometry
+                       
+                               x_mm (uint16)
+                               y_mm (uint16)
+                               angle (byte)
+                               timestamp (in number of seconds since unix epoch: Jan 1, 1970) (uint32)
+                               
+                       uint16 SteeringWheelAngle
+                       
+                               Angle of the steering wheel (0-360)
+                               
+                       struct{ uint16, uint16 } WheelTickSensor
+                       
+                               Left wheel rotation counter (uint16)
+                               Right wheel rotation counter (uint16)
+                               
+                               
+                               
\ No newline at end of file
diff --git a/docs/vehicleinfo.txt b/docs/vehicleinfo.txt
new file mode 100644 (file)
index 0000000..4852bed
--- /dev/null
@@ -0,0 +1,49 @@
+Vehicle Information hierarchy
+=================
+
+Service         org.automotive
+Interface       org.automotive.vehicleInfo
+Object path     /
+
+Properties     string WMI [readonly]
+
+                               World Manufacturer Identifier as defined by SAE. 3 characters.
+
+                       string VIN [readonly]
+
+                               Vehicle Identification Number as defined by ISO 3779. 17 characters.
+                               
+                       byte VehicleType [readonly]
+                               
+                               Vehicle Type: Sedan = 0,
+                               Coupe = 1,
+                               Cabriole = 2,
+                               Roadster = 3,
+                               SUV = 4,
+                               Truck = 5
+                               
+                       array{ byte } DoorType [readonly]
+                               
+                               Number of doors in each row.  The index represents the row.  Position '0'
+                               represents the first row, '1' the second row etc.
+
+                               Example a common mini-van may have DoorType[0] = 2 doors,
+                               DoorType[1] = 1 (side door), DoorType[2] = 1 (trunk).
+                               
+                       byte EngineType [readonly]
+                       
+                               Gasoline = 0,
+                               Diesel = 1,
+                               Hybrid = 2,
+                               Electric = 3
+               
+                       byte TransmissionGearType [readonly]
+                       
+                               Auto = 0,
+                               Manual = 1
+                               
+                       struct{ double, double } WheelInformation [readonly]
+                       
+                               Radius of Wheel, Wheel Track.
+                               
+                       
diff --git a/lib/.runningstatusinterface.cpp.kate-swp b/lib/.runningstatusinterface.cpp.kate-swp
new file mode 100644 (file)
index 0000000..f48cf98
Binary files /dev/null and b/lib/.runningstatusinterface.cpp.kate-swp differ
diff --git a/lib/CMakeLists.txt b/lib/CMakeLists.txt
new file mode 100644 (file)
index 0000000..f3e8333
--- /dev/null
@@ -0,0 +1,14 @@
+
+set(libnobdy_sources runningstatusinterface.cpp propertytypes/vehiclespeed.cpp abstractdbusinterface.cpp propertytypes/abstractproperty.cpp dbusinterfacemanager.cpp pluginloader.cpp )
+set(libnobdy_headers_install propertytypes/abstractproperty.h propertytypes/vehiclespeed.h)
+add_library(libnobdy2 MODULE ${libnobdy_sources})
+set_target_properties(libnobdy2 PROPERTIES PREFIX "")
+
+target_link_libraries(libnobdy2 ${libtool_LIBRARY} ${glib_LIBRARIES} ${gio_LIBRARIES})
+
+configure_file (${CMAKE_CURRENT_SOURCE_DIR}/nobdy2.pc.in ${CMAKE_CURRENT_BINARY_DIR}/nobdy2.pc @ONLY)
+install (FILES ${CMAKE_CURRENT_BINARY_DIR}/nobdy2.pc DESTINATION ${LIB_INSTALL_DIR}/${LIB_SUFFIX}/${CMAKE_LIBRARY_ARCHITECTURE}/pkgconfig)
+install (FILES ${libnobdy_headers_install} DESTINATION ${INCLUDE_INSTALL_DIR}/nobdy2 COMPONENT Devel)
+install (TARGETS libnobdy2 LIBRARY DESTINATION ${LIB_INSTALL_DIR} RUNTIME DESTINATION bin ARCHIVE DESTINATION ${LIB_INSTALL_DIR})
+
+
diff --git a/lib/CMakeLists.txt~ b/lib/CMakeLists.txt~
new file mode 100644 (file)
index 0000000..461ef68
--- /dev/null
@@ -0,0 +1,14 @@
+
+set(libnobdy_sources runningstatusinterface.cpp propertytypes/vehiclespeed.cpp abstractdbusinterface.cpp propertytypes/abstractproperty.cpp dbusinterfacemanager.cpp pluginloader.cpp )
+set(libnobdy_headers_install propertytypes/abstractproperty.h propertytypes/vehiclespeed.h)
+add_library(libnobdy2 MODULE ${libnobdy_sources})
+set_target_properties(libnobdy2 PROPERTIES PREFIX "")
+
+target_link_libraries(libnobdy2 ${libtool_LIBRARY} ${glib_LIBRARIES} ${gio_LIBRARIES})
+
+configure_file (${CMAKE_CURRENT_SOURCE_DIR}/nobdy2.pc.in ${CMAKE_CURRENT_BINARY_DIR}/nobdy2.pc @ONLY)
+install (FILES ${CMAKE_CURRENT_BINARY_DIR}/nobdy2.pc DESTINATION lib${LIB_SUFFIX}/${CMAKE_LIBRARY_ARCHITECTURE}/pkgconfig)
+install (FILES ${libnobdy_headers_install} DESTINATION ${INCLUDE_INSTALL_DIR}/nobdy2 COMPONENT Devel)
+install (TARGETS libnobdy2 LIBRARY DESTINATION ${LIB_INSTALL_DIR} RUNTIME DESTINATION bin ARCHIVE DESTINATION ${LIB_INSTALL_DIR})
+
+
diff --git a/lib/abstractdbusinterface.cpp b/lib/abstractdbusinterface.cpp
new file mode 100644 (file)
index 0000000..1aedfa0
--- /dev/null
@@ -0,0 +1,114 @@
+/*
+    Copyright 2012 Kevron Rees <email>
+
+    Licensed under the Apache License, Version 2.0 (the "License");
+    you may not use this file except in compliance with the License.
+    You may obtain a copy of the License at
+
+        http://www.apache.org/licenses/LICENSE-2.0
+
+    Unless required by applicable law or agreed to in writing, software
+    distributed under the License is distributed on an "AS IS" BASIS,
+    WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+    See the License for the specific language governing permissions and
+    limitations under the License.
+*/
+
+
+#include "abstractdbusinterface.h"
+#include <boost/algorithm/string.hpp>
+#include <gio/gio.h>
+
+unordered_map<string, AbstractDBusInterface*> AbstractDBusInterface::interfaceMap;
+
+AbstractDBusInterface::AbstractDBusInterface(string interfaceName, string objectPath)
+: mInterfaceName(interfaceName), mObjectPath(objectPath)
+{
+       interfaceMap[interfaceName] = this;
+       introspectionXml ="<node>" ;
+       introspectionXml += "<interface name='"+ interfaceName + "' >";
+}
+
+void AbstractDBusInterface::addProperty(string name, string signature)
+{
+       string nameToLower = name;
+       boost::algorithm::to_lower<string>(nameToLower);
+       
+       ///see which properties are supported:
+       introspectionXml +=     "<property type='"+ signature + "' name='"+name+"' access='read' />"
+       "<signal name='" + name + "' >"
+       "       <arg type='"+ signature + "' name='" + nameToLower + "' direction='out' />"
+       "</signal>";
+       
+       PropertyNameSignaturePair property;
+       property.name = name;
+       property.signature = signature;
+       
+       properties[name] = property;
+}
+
+void AbstractDBusInterface::addProperty(string name, string signature, SetterFunc setter)
+{
+       addProperty(name, signature);
+       
+       properties[name].setter = setter;
+}
+
+void AbstractDBusInterface::registerObject(GDBusConnection* connection)
+{
+       mConnection = connection;
+       
+       if(introspectionXml.empty())
+       {
+               cerr<<"no interface to export: "<<mInterfaceName<<endl;
+               return;
+       }
+
+       introspectionXml += "</interface>";
+       introspectionXml += "</node>";
+       
+       GError* error=NULL;
+
+       GDBusNodeInfo* introspection = g_dbus_node_info_new_for_xml(introspectionXml.c_str(), &error);
+       
+       if(!introspection)
+       {
+               cerr<<"Error in "<<__FILE__<<" - "<<__FUNCTION__<<":"<<__LINE__<<endl;
+               cerr<<error->message<<endl;
+               cerr<<"probably bad xml:"<<endl;
+               cerr<<introspectionXml<<endl;
+               return;
+       }
+
+       GDBusInterfaceInfo* mInterfaceInfo = g_dbus_node_info_lookup_interface(introspection, mInterfaceName.c_str());
+       
+       const GDBusInterfaceVTable vtable = {NULL, AbstractDBusInterface::getProperty, AbstractDBusInterface::setProperty};     
+       
+       guint regId = g_dbus_connection_register_object(connection, mObjectPath.c_str(), mInterfaceInfo, &vtable, NULL, NULL, NULL);
+       
+       g_assert(regId > 0);
+}
+
+void AbstractDBusInterface::updateValue(string name, boost::any value)
+{
+
+}
+
+GVariant* AbstractDBusInterface::getProperty(GDBusConnection* connection, const gchar* sender, const gchar* objectPath, const gchar* interfaceName, const gchar* propertyName, GError** error, gpointer userData)
+{
+       if(interfaceMap.count(interfaceName))
+               return interfaceMap[interfaceName]->getProperty(propertyName);
+       return nullptr;
+}
+
+gboolean AbstractDBusInterface::setProperty(GDBusConnection* connection, const gchar* sender, const gchar* objectPath, const gchar* interfaceName, const gchar* propertyName, GVariant* value, GError** error, gpointer userData)
+{
+       if(interfaceMap.count(interfaceName))
+       {
+               interfaceMap[interfaceName]->setProperty(propertyName, value);
+               return true;
+       }
+
+       return false;
+}
+
diff --git a/lib/abstractdbusinterface.h b/lib/abstractdbusinterface.h
new file mode 100644 (file)
index 0000000..6e5ba94
--- /dev/null
@@ -0,0 +1,69 @@
+/*
+    Copyright 2012 Kevron Rees <email>
+
+    Licensed under the Apache License, Version 2.0 (the "License");
+    you may not use this file except in compliance with the License.
+    You may obtain a copy of the License at
+
+        http://www.apache.org/licenses/LICENSE-2.0
+
+    Unless required by applicable law or agreed to in writing, software
+    distributed under the License is distributed on an "AS IS" BASIS,
+    WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+    See the License for the specific language governing permissions and
+    limitations under the License.
+*/
+
+
+#ifndef ABSTRACTDBUSINTERFACE_H
+#define ABSTRACTDBUSINTERFACE_H
+
+#include <string>
+#include <functional>
+#include <unordered_map>
+#include <gio/gio.h>
+#include <boost/any.hpp>
+
+using namespace std;
+
+typedef function<void (boost::any)> SetterFunc;
+
+struct PropertyNameSignaturePair {
+       string name;
+       string signature;
+       boost::any value;
+       SetterFunc setter;
+};
+
+class AbstractDBusInterface
+{
+
+public:
+       AbstractDBusInterface(string interfaceName, string objectPath);
+
+       
+       void registerObject(GDBusConnection* connection);
+       
+       void addProperty(string name, string signature);
+       void addProperty(string name, string signature, SetterFunc setter);
+       virtual void updateValue(string name, boost::any value);
+       
+protected:
+       
+       static GVariant *getProperty(GDBusConnection * connection, const gchar * sender, const gchar *objectPath, const gchar *interfaceName, const gchar * propertyName, GError** error, gpointer userData);
+       static gboolean setProperty(GDBusConnection * connection, const gchar * sender, const gchar *objectPath, const gchar *interfaceName, const gchar * propertyName, GVariant *value, GError** error, gpointer userData);
+    
+       virtual void setProperty(string propertyName, GVariant * value) = 0;
+       virtual GVariant * getProperty(string propertyName) = 0;
+       
+       unordered_map<string, PropertyNameSignaturePair> properties;
+
+private:
+       string mInterfaceName;
+       string mObjectPath;
+       string introspectionXml;
+       GDBusConnection * mConnection;
+       static unordered_map<string, AbstractDBusInterface*> interfaceMap;
+};
+
+#endif // ABSTRACTDBUSINTERFACE_H
diff --git a/lib/dbusinterfacemanager.cpp b/lib/dbusinterfacemanager.cpp
new file mode 100644 (file)
index 0000000..c69364f
--- /dev/null
@@ -0,0 +1,65 @@
+/*
+    Copyright 2012 Kevron Rees <email>
+
+    Licensed under the Apache License, Version 2.0 (the "License");
+    you may not use this file except in compliance with the License.
+    You may obtain a copy of the License at
+
+        http://www.apache.org/licenses/LICENSE-2.0
+
+    Unless required by applicable law or agreed to in writing, software
+    distributed under the License is distributed on an "AS IS" BASIS,
+    WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+    See the License for the specific language governing permissions and
+    limitations under the License.
+*/
+
+
+#include "dbusinterfacemanager.h"
+#include "runningstatusinterface.h"
+
+#include <string>
+
+using namespace std;
+
+static void
+on_bus_acquired (GDBusConnection *connection, const gchar *name, gpointer user_data)
+{
+       //vehicleInfoInterface->registerObject(connection);
+       RunningStatusInterface::iface->registerObject(connection);
+}
+
+static void
+on_name_acquired (GDBusConnection *connection, const gchar *name, gpointer user_data)
+{
+}
+
+static void
+on_name_lost (GDBusConnection *connection, const gchar *name, gpointer user_data)
+{
+}
+
+
+
+DBusInterfaceManager::DBusInterfaceManager()
+{
+       g_type_init();
+
+       ownerId = g_bus_own_name(G_BUS_TYPE_SESSION,
+                                       DBusServiceName,
+                                       G_BUS_NAME_OWNER_FLAGS_NONE,
+                                       on_bus_acquired,
+                                       on_name_acquired,
+                                       on_name_lost,
+                                       this,
+                                       NULL);
+
+       ///TODO: instantiate other interfaces here!
+}
+
+DBusInterfaceManager::~DBusInterfaceManager()
+{
+       g_bus_unown_name(ownerId);
+}
+
+
diff --git a/lib/dbusinterfacemanager.cpp~ b/lib/dbusinterfacemanager.cpp~
new file mode 100644 (file)
index 0000000..c69364f
--- /dev/null
@@ -0,0 +1,65 @@
+/*
+    Copyright 2012 Kevron Rees <email>
+
+    Licensed under the Apache License, Version 2.0 (the "License");
+    you may not use this file except in compliance with the License.
+    You may obtain a copy of the License at
+
+        http://www.apache.org/licenses/LICENSE-2.0
+
+    Unless required by applicable law or agreed to in writing, software
+    distributed under the License is distributed on an "AS IS" BASIS,
+    WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+    See the License for the specific language governing permissions and
+    limitations under the License.
+*/
+
+
+#include "dbusinterfacemanager.h"
+#include "runningstatusinterface.h"
+
+#include <string>
+
+using namespace std;
+
+static void
+on_bus_acquired (GDBusConnection *connection, const gchar *name, gpointer user_data)
+{
+       //vehicleInfoInterface->registerObject(connection);
+       RunningStatusInterface::iface->registerObject(connection);
+}
+
+static void
+on_name_acquired (GDBusConnection *connection, const gchar *name, gpointer user_data)
+{
+}
+
+static void
+on_name_lost (GDBusConnection *connection, const gchar *name, gpointer user_data)
+{
+}
+
+
+
+DBusInterfaceManager::DBusInterfaceManager()
+{
+       g_type_init();
+
+       ownerId = g_bus_own_name(G_BUS_TYPE_SESSION,
+                                       DBusServiceName,
+                                       G_BUS_NAME_OWNER_FLAGS_NONE,
+                                       on_bus_acquired,
+                                       on_name_acquired,
+                                       on_name_lost,
+                                       this,
+                                       NULL);
+
+       ///TODO: instantiate other interfaces here!
+}
+
+DBusInterfaceManager::~DBusInterfaceManager()
+{
+       g_bus_unown_name(ownerId);
+}
+
+
diff --git a/lib/dbusinterfacemanager.h b/lib/dbusinterfacemanager.h
new file mode 100644 (file)
index 0000000..9be0253
--- /dev/null
@@ -0,0 +1,35 @@
+/*
+    Copyright 2012 Kevron Rees <email>
+
+    Licensed under the Apache License, Version 2.0 (the "License");
+    you may not use this file except in compliance with the License.
+    You may obtain a copy of the License at
+
+        http://www.apache.org/licenses/LICENSE-2.0
+
+    Unless required by applicable law or agreed to in writing, software
+    distributed under the License is distributed on an "AS IS" BASIS,
+    WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+    See the License for the specific language governing permissions and
+    limitations under the License.
+*/
+
+
+#ifndef DBUSINTERFACEMANAGER_H
+#define DBUSINTERFACEMANAGER_H
+
+class DBusInterfaceManager
+{
+
+public:
+       DBusInterfaceManager();
+       ~DBusInterfaceManager();
+    
+    
+private:
+       
+       unsigned int ownerId;
+
+};
+
+#endif // DBUSINTERFACEMANAGER_H
diff --git a/lib/nobdy2.pc.in b/lib/nobdy2.pc.in
new file mode 100644 (file)
index 0000000..c7d0f5d
--- /dev/null
@@ -0,0 +1,11 @@
+prefix=@CMAKE_INSTALL_PREFIX@
+exec_prefix=${prefix}
+libdir=@LIB_INSTALL_DIR@
+includedir=@INCLUDE_INSTALL_DIR@
+
+Name: nobdy2
+Description: nobdy2 is awesome
+Version: 0.0.1
+Requires: gio-2.0 glib-2.0
+Libs: -L${libdir} -lnobdy
+Cflags: -I${includedir}
\ No newline at end of file
diff --git a/lib/nobdy2.pc.in~ b/lib/nobdy2.pc.in~
new file mode 100644 (file)
index 0000000..314cc20
--- /dev/null
@@ -0,0 +1,11 @@
+prefix=@CMAKE_INSTALL_PREFIX@
+exec_prefix=${prefix}
+libdir=@LIB_INSTALL_DIR@
+includedir=@INCLUDE_INSTALL_DIR@
+
+Name: nobdy2
+Description: QJson is a qt-based library that maps JSON data to QVariant objects
+Version: 0.0.1
+Requires: gio-2.0 glib-2.0
+Libs: -L${libdir} -lnobdy
+Cflags: -I${includedir}
\ No newline at end of file
diff --git a/lib/pluginloader.cpp b/lib/pluginloader.cpp
new file mode 100644 (file)
index 0000000..69b3a80
--- /dev/null
@@ -0,0 +1,65 @@
+/*
+    Copyright 2012 Kevron Rees <email>
+
+    Licensed under the Apache License, Version 2.0 (the "License");
+    you may not use this file except in compliance with the License.
+    You may obtain a copy of the License at
+
+        http://www.apache.org/licenses/LICENSE-2.0
+
+    Unless required by applicable law or agreed to in writing, software
+    distributed under the License is distributed on an "AS IS" BASIS,
+    WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+    See the License for the specific language governing permissions and
+    limitations under the License.
+*/
+
+
+#include "pluginloader.h"
+#include <iostream>
+
+using namespace std;
+
+PluginLoader::PluginLoader(std::string pluginPath)
+:mPluginPath(pluginPath),f_create(NULL)
+{
+       
+}
+
+bool PluginLoader::load()
+{
+       if(lt_dlinit())
+       {
+               mErrorString = lt_dlerror();
+               cerr<<"error initializing libtool: "<<__FILE__<<" - "<<__FUNCTION__<<":"<<__LINE__<<" "<<mErrorString<<endl;
+               return false;
+       }
+       
+       lt_dlerror();
+       
+       lt_dlhandle handle = lt_dlopenext(mPluginPath.c_str());
+       
+       if(!handle)
+       {
+               mErrorString = lt_dlerror();
+               cerr<<"error opening plugin: "<<mPluginPath<<" in "<<__FILE__<<" - "<<__FUNCTION__<<":"<<__LINE__<<" "<<mErrorString<<endl;
+               return false;
+       }
+       
+       f_create = (create_t *)lt_dlsym(handle, "create");
+       
+       //mErrorString = lt_dlerror();
+       if(f_create) 
+       {
+               f_create();
+               return true;
+       }
+       
+       return false;
+}
+
+std::string PluginLoader::errorString()
+{
+       return mErrorString;
+}
+
diff --git a/lib/pluginloader.h b/lib/pluginloader.h
new file mode 100644 (file)
index 0000000..718d468
--- /dev/null
@@ -0,0 +1,45 @@
+/*
+    Copyright 2012 Kevron Rees <email>
+
+    Licensed under the Apache License, Version 2.0 (the "License");
+    you may not use this file except in compliance with the License.
+    You may obtain a copy of the License at
+
+        http://www.apache.org/licenses/LICENSE-2.0
+
+    Unless required by applicable law or agreed to in writing, software
+    distributed under the License is distributed on an "AS IS" BASIS,
+    WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+    See the License for the specific language governing permissions and
+    limitations under the License.
+*/
+
+
+#ifndef PLUGINLOADER_H
+#define PLUGINLOADER_H
+
+#include <string>
+#include <ltdl.h>
+
+
+
+typedef void create_t();
+
+class PluginLoader
+{
+
+public:
+    PluginLoader(std::string pluginPath);
+        
+    bool load();
+    
+    std::string errorString();
+        
+private:
+       std::string mPluginPath;
+       std::string mErrorString;
+       
+       create_t * f_create;
+};
+
+#endif // PLUGINLOADER_H
diff --git a/lib/propertytypes/AntilockBrackingSytemStatus.h~ b/lib/propertytypes/AntilockBrackingSytemStatus.h~
new file mode 100644 (file)
index 0000000..a1c5901
--- /dev/null
@@ -0,0 +1,22 @@
+#ifndef _VEHICLEINFOINTERFACE_H_
+#define _VEHICLEINFOINTERFACE_H_
+
+#include "abstractproperty.h"
+
+class AntilockBrakingSystem : public AbstractProperty
+{
+       enum Status
+       {
+               Idle = 0,
+               Engaged = 1
+       };
+       
+       AntilockBrakingSystem()
+       :
+       {
+               
+       }
+}
+
+
+#endif
\ No newline at end of file
diff --git a/lib/propertytypes/VehicleSpeed.h~ b/lib/propertytypes/VehicleSpeed.h~
new file mode 100644 (file)
index 0000000..b48b7d8
--- /dev/null
@@ -0,0 +1,17 @@
+#ifndef _VehicleSpeed_H_
+#define _VehicleSpeed_H_
+
+#include "propertytypes/abstractproperty.h"
+
+class VehicleSpeed: public AbstractProperty
+{
+public:
+       VehicleSpeed(): AbstractProperty("Velocity","i")
+       {
+       
+       }
+       
+       void setValue(boost::any val );
+};
+
+#endif
\ No newline at end of file
diff --git a/lib/propertytypes/VehicleType.h b/lib/propertytypes/VehicleType.h
new file mode 100644 (file)
index 0000000..5e203d0
--- /dev/null
@@ -0,0 +1,13 @@
+
+namespace VehicleInfo
+{
+       enum VehicleType
+       {
+               Sedan=0,
+               Coupe,
+               Cabriole,
+               Roadster,
+               SUV,
+               Truck
+       };
+}
\ No newline at end of file
diff --git a/lib/propertytypes/VehicleType.h~ b/lib/propertytypes/VehicleType.h~
new file mode 100644 (file)
index 0000000..d718a06
--- /dev/null
@@ -0,0 +1,13 @@
+
+namespace VehicleType
+{
+       enum Type
+       {
+               Sedan=0,
+               Coupe,
+               Cabriole,
+               Roadster,
+               SUV,
+               Truck
+       };
+}
\ No newline at end of file
diff --git a/lib/propertytypes/Velocity.h~ b/lib/propertytypes/Velocity.h~
new file mode 100644 (file)
index 0000000..e69de29
diff --git a/lib/propertytypes/abstractproperty.cpp b/lib/propertytypes/abstractproperty.cpp
new file mode 100644 (file)
index 0000000..2208a1d
--- /dev/null
@@ -0,0 +1,25 @@
+/*
+    Copyright 2012 Kevron Rees <email>
+
+    Licensed under the Apache License, Version 2.0 (the "License");
+    you may not use this file except in compliance with the License.
+    You may obtain a copy of the License at
+
+        http://www.apache.org/licenses/LICENSE-2.0
+
+    Unless required by applicable law or agreed to in writing, software
+    distributed under the License is distributed on an "AS IS" BASIS,
+    WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+    See the License for the specific language governing permissions and
+    limitations under the License.
+*/
+
+
+#include "abstractproperty.h"
+
+AbstractProperty::AbstractProperty(string pn, string sig)
+: mPropertyName(pn), mSignature(sig)
+{
+
+}
+
diff --git a/lib/propertytypes/abstractproperty.cpp~ b/lib/propertytypes/abstractproperty.cpp~
new file mode 100644 (file)
index 0000000..dec1b1a
--- /dev/null
@@ -0,0 +1,25 @@
+/*
+    Copyright 2012 Kevron Rees <email>
+
+    Licensed under the Apache License, Version 2.0 (the "License");
+    you may not use this file except in compliance with the License.
+    You may obtain a copy of the License at
+
+        http://www.apache.org/licenses/LICENSE-2.0
+
+    Unless required by applicable law or agreed to in writing, software
+    distributed under the License is distributed on an "AS IS" BASIS,
+    WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+    See the License for the specific language governing permissions and
+    limitations under the License.
+*/
+
+
+#include "abstractproperty.h"
+
+AbstractProperty::AbstractProperty(string pn)
+: propertyName(pn)
+{
+
+}
+
diff --git a/lib/propertytypes/abstractproperty.h b/lib/propertytypes/abstractproperty.h
new file mode 100644 (file)
index 0000000..0328dd5
--- /dev/null
@@ -0,0 +1,63 @@
+/*
+    Copyright 2012 Kevron Rees <email>
+
+    Licensed under the Apache License, Version 2.0 (the "License");
+    you may not use this file except in compliance with the License.
+    You may obtain a copy of the License at
+
+        http://www.apache.org/licenses/LICENSE-2.0
+
+    Unless required by applicable law or agreed to in writing, software
+    distributed under the License is distributed on an "AS IS" BASIS,
+    WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+    See the License for the specific language governing permissions and
+    limitations under the License.
+*/
+
+
+#ifndef ABSTRACTPROPERTY_H
+#define ABSTRACTPROPERTY_H
+
+#include <string>
+#include <functional>
+#include <boost/any.hpp>
+
+#include "abstractdbusinterface.h"
+
+
+using namespace std;
+
+class AbstractProperty
+{
+
+public:
+       AbstractProperty(string propertyName, string signature);
+
+       virtual void setSetterFunction(SetterFunc setterFunc)
+       {
+               mSetterFunc = setterFunc;
+       }
+       
+       virtual void setValue(boost::any val)
+       {
+               mValue = val;
+       }
+
+       boost::any value() { return mValue; }
+
+       virtual string signature()
+       {
+               return mSignature;
+       }
+
+       virtual GVariant* toGVariant() = 0;
+       virtual void fromGVariant(GVariant *value) = 0;
+
+protected:
+       string mPropertyName;
+       string mSignature;
+       SetterFunc mSetterFunc;
+       boost::any mValue;
+};
+
+#endif // ABSTRACTPROPERTY_H
diff --git a/lib/propertytypes/vehiclespeed.cpp b/lib/propertytypes/vehiclespeed.cpp
new file mode 100644 (file)
index 0000000..12b73fc
--- /dev/null
@@ -0,0 +1,58 @@
+/*
+    Copyright 2012 Kevron Rees <email>
+
+    Licensed under the Apache License, Version 2.0 (the "License");
+    you may not use this file except in compliance with the License.
+    You may obtain a copy of the License at
+
+        http://www.apache.org/licenses/LICENSE-2.0
+
+    Unless required by applicable law or agreed to in writing, software
+    distributed under the License is distributed on an "AS IS" BASIS,
+    WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+    See the License for the specific language governing permissions and
+    limitations under the License.
+*/
+
+
+#include "vehiclespeed.h"
+#include "runningstatusinterface.h"
+
+#include <glib.h>
+
+VehicleSpeedProperty::VehicleSpeedProperty(): AbstractProperty("VehicleSpeed", "i")
+{
+       if(RunningStatusInterface::iface == nullptr)
+       {
+               new RunningStatusInterface();
+       }
+
+       RunningStatusInterface::iface->addProperty(mPropertyName, mSignature);
+}
+
+void VehicleSpeedProperty::setValue(boost::any val)
+{
+       AbstractProperty::setValue(val);
+       
+       RunningStatusInterface::iface->updateValue(mPropertyName, val);
+}
+
+GVariant* VehicleSpeedProperty::toGVariant()
+{
+       uint16_t v = 0;
+       try
+       {
+               v = boost::any_cast<uint16_t>(mValue);
+       }
+       catch (...)
+       {
+               return nullptr;
+       }
+
+       return g_variant_new_uint16(v);
+}
+
+void VehicleSpeedProperty::fromGVariant(GVariant *value)
+{
+       mValue = g_variant_get_uint16(value);
+}
diff --git a/lib/propertytypes/vehiclespeed.h b/lib/propertytypes/vehiclespeed.h
new file mode 100644 (file)
index 0000000..92daf56
--- /dev/null
@@ -0,0 +1,35 @@
+/*
+    Copyright 2012 Kevron Rees <email>
+
+    Licensed under the Apache License, Version 2.0 (the "License");
+    you may not use this file except in compliance with the License.
+    You may obtain a copy of the License at
+
+        http://www.apache.org/licenses/LICENSE-2.0
+
+    Unless required by applicable law or agreed to in writing, software
+    distributed under the License is distributed on an "AS IS" BASIS,
+    WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+    See the License for the specific language governing permissions and
+    limitations under the License.
+*/
+
+
+#ifndef VEHICLESPEED_H
+#define VEHICLESPEED_H
+
+#include "propertytypes/abstractproperty.h"
+
+class VehicleSpeedProperty : public AbstractProperty
+{
+
+public:
+       VehicleSpeedProperty();
+       void setValue(boost::any val);
+       
+
+       GVariant* toGVariant();
+       void fromGVariant(GVariant *value);
+};
+
+#endif // VEHICLESPEED_H
diff --git a/lib/runningstatusinterface.cpp b/lib/runningstatusinterface.cpp
new file mode 100644 (file)
index 0000000..37703e4
--- /dev/null
@@ -0,0 +1,47 @@
+/*
+    Copyright 2012 Kevron Rees <email>
+
+    Licensed under the Apache License, Version 2.0 (the "License");
+    you may not use this file except in compliance with the License.
+    You may obtain a copy of the License at
+
+        http://www.apache.org/licenses/LICENSE-2.0
+
+    Unless required by applicable law or agreed to in writing, software
+    distributed under the License is distributed on an "AS IS" BASIS,
+    WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+    See the License for the specific language governing permissions and
+    limitations under the License.
+*/
+
+
+#include "runningstatusinterface.h"
+#include <iostream>
+
+using namespace std;
+
+RunningStatusInterface* RunningStatusInterface::iface = nullptr;
+
+RunningStatusInterface::RunningStatusInterface(): AbstractDBusInterface(DBusServiceName".RunningStatus", "/runningStatus")
+{
+       if(iface != nullptr)
+       {
+               cerr<<"only one instance of this class may exist "<<__FUNCTION__<<" "<<__FILE__<<":"<<__LINE__<<endl;
+               throw -1;
+       }
+
+       iface = this;
+}
+
+
+GVariant* RunningStatusInterface::getProperty(std::string propertyName)
+{
+
+}
+
+void RunningStatusInterface::setProperty(std::string propertyName, GVariant* value)
+{
+
+}
+
+
diff --git a/lib/runningstatusinterface.h b/lib/runningstatusinterface.h
new file mode 100644 (file)
index 0000000..7db11c2
--- /dev/null
@@ -0,0 +1,38 @@
+/*
+    Copyright 2012 Kevron Rees <email>
+
+    Licensed under the Apache License, Version 2.0 (the "License");
+    you may not use this file except in compliance with the License.
+    You may obtain a copy of the License at
+
+        http://www.apache.org/licenses/LICENSE-2.0
+
+    Unless required by applicable law or agreed to in writing, software
+    distributed under the License is distributed on an "AS IS" BASIS,
+    WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+    See the License for the specific language governing permissions and
+    limitations under the License.
+*/
+
+
+#ifndef RUNNINGSTATUSINTERFACE_H
+#define RUNNINGSTATUSINTERFACE_H
+
+#include <lib/abstractdbusinterface.h>
+
+
+class RunningStatusInterface : public AbstractDBusInterface
+{
+public:
+    RunningStatusInterface();
+
+       static RunningStatusInterface* iface;
+       
+protected:
+    virtual GVariant* getProperty(std::string propertyName);
+    virtual void setProperty(std::string propertyName, GVariant* value);
+};
+
+
+
+#endif // RUNNINGSTATUSINTERFACE_H
index 8bb47f1..ab23890 100644 (file)
--- a/main.cpp
+++ b/main.cpp
@@ -1,6 +1,48 @@
 #include <iostream>
 
+#ifdef USE_QT_CORE
+
+#include <QCoreApplication>
+
+#else 
+
+#include <glib.h>
+
+#endif
+
+#include "pluginloader.h"
+#include "dbusinterfacemanager.h"
+
+using namespace std;
+
 int main(int argc, char **argv) {
-    std::cout << "Hello, world!" << std::endl;
-    return 0;
+    
+#ifdef USE_QT_CORE
+
+       QCoreApplication app(argc,argv);
+
+#else
+
+       GMainLoop* mainLoop = g_main_loop_new(NULL, false);
+       
+#endif
+       
+       PluginLoader loader("plugins/nobdyplugin.so");
+       
+       if(!loader.load())
+               return -1;
+       
+       DBusInterfaceManager manager;
+
+#ifdef USE_QT_CORE
+       
+       app.exec();
+       
+#else
+       
+       g_main_loop_run(mainLoop);
+       
+#endif
+       
+       return 0;
 }
diff --git a/plugins/CMakeLists.txt b/plugins/CMakeLists.txt
new file mode 100644 (file)
index 0000000..9db8811
--- /dev/null
@@ -0,0 +1,20 @@
+
+include_directories(${CMAKE_SOURCE_DIR})
+
+set(exampleplugin_headers exampleplugin.h)
+set(exampleplugin_sources exampleplugin.cpp)
+add_library(exampleplugin MODULE ${exampleplugin_sources})
+set_target_properties(exampleplugin PROPERTIES PREFIX "")
+
+if(use_qtcore)
+       if(nobdy_compat)
+               pkg_check_modules(nobdy REQUIRED nobdy)
+               set(nobdyplugin_headers nobdycompatplugin.h)
+               set(nobdyplugin_sources nobdycompatplugin.cpp)
+               qt4_wrap_cpp(nobdy_moc_sources ${nobdyplugin_headers})
+               add_library(nobdyplugin MODULE ${nobdyplugin_sources} ${nobdy_moc_sources})
+               set_target_properties(nobdyplugin PROPERTIES PREFIX "")
+               include_directories(${nobdy_INCLUDE_DIRS} ${include_dirs})
+               target_link_libraries(nobdyplugin ${nobdy_LIBRARIES} -lnobdy2 -L${CMAKE_CURRENT_BINARY_DIR} ${link_libraries})
+       endif(nobdy_compat)
+endif(use_qtcore)
\ No newline at end of file
diff --git a/plugins/CMakeLists.txt~ b/plugins/CMakeLists.txt~
new file mode 100644 (file)
index 0000000..f5a95cb
--- /dev/null
@@ -0,0 +1,20 @@
+
+include_directories(${CMAKE_SOURCE_DIR})
+
+set(exampleplugin_headers exampleplugin.h)
+set(exampleplugin_sources exampleplugin.cpp)
+add_library(exampleplugin MODULE ${exampleplugin_sources})
+set_target_properties(exampleplugin PROPERTIES PREFIX "")
+
+if(use_qtcore)
+       if(nobdy_compat)
+               pkg_check_modules(nobdy REQUIRED nobdy)
+               set(nobdyplugin_headers nobdycompatplugin.h)
+               set(nobdyplugin_sources nobdycompatplugin.cpp)
+               qt4_wrap_cpp(nobdy_moc_sources ${nobdyplugin_headers})
+               add_library(nobdyplugin MODULE ${nobdyplugin_sources} ${nobdy_moc_sources})
+               set_target_properties(nobdyplugin PROPERTIES PREFIX "")
+               include_directories(${nobdy_INCLUDE_DIRS} ${gio_INCLUDE_DIRS} ${glib_INCLUDE_DIRS})
+               target_link_libraries(nobdyplugin ${nobdy_LIBRARIES} -lnobdy2 -L${CMAKE_CURRENT_BINARY_DIR} ${link_libraries})
+       endif(nobdy_compat)
+endif(use_qtcore)
\ No newline at end of file
diff --git a/plugins/exampleplugin.cpp b/plugins/exampleplugin.cpp
new file mode 100644 (file)
index 0000000..31f599f
--- /dev/null
@@ -0,0 +1,28 @@
+/*
+    Copyright 2012 Kevron Rees <email>
+
+    Licensed under the Apache License, Version 2.0 (the "License");
+    you may not use this file except in compliance with the License.
+    You may obtain a copy of the License at
+
+        http://www.apache.org/licenses/LICENSE-2.0
+
+    Unless required by applicable law or agreed to in writing, software
+    distributed under the License is distributed on an "AS IS" BASIS,
+    WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+    See the License for the specific language governing permissions and
+    limitations under the License.
+*/
+
+
+#include "exampleplugin.h"
+
+ExamplePlugin::ExamplePlugin()
+{
+       VehicleSpeedProperty* speed = new VehicleSpeedProperty();
+}
+
+extern "C" void create()
+{
+       new ExamplePlugin;
+}
\ No newline at end of file
diff --git a/plugins/exampleplugin.cpp~ b/plugins/exampleplugin.cpp~
new file mode 100644 (file)
index 0000000..220c386
--- /dev/null
@@ -0,0 +1,28 @@
+/*
+    Copyright 2012 Kevron Rees <email>
+
+    Licensed under the Apache License, Version 2.0 (the "License");
+    you may not use this file except in compliance with the License.
+    You may obtain a copy of the License at
+
+        http://www.apache.org/licenses/LICENSE-2.0
+
+    Unless required by applicable law or agreed to in writing, software
+    distributed under the License is distributed on an "AS IS" BASIS,
+    WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+    See the License for the specific language governing permissions and
+    limitations under the License.
+*/
+
+
+#include "exampleplugin.h"
+
+ExamplePlugin::ExamplePlugin()
+{
+       VehicleSpeedProperty* speed = new VehicleSpeed();
+}
+
+extern "C" void create()
+{
+       new ExamplePlugin;
+}
\ No newline at end of file
diff --git a/plugins/exampleplugin.h b/plugins/exampleplugin.h
new file mode 100644 (file)
index 0000000..92b8cef
--- /dev/null
@@ -0,0 +1,30 @@
+/*
+    Copyright 2012 Intel Corporation
+
+    Licensed under the Apache License, Version 2.0 (the "License");
+    you may not use this file except in compliance with the License.
+    You may obtain a copy of the License at
+
+        http://www.apache.org/licenses/LICENSE-2.0
+
+    Unless required by applicable law or agreed to in writing, software
+    distributed under the License is distributed on an "AS IS" BASIS,
+    WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+    See the License for the specific language governing permissions and
+    limitations under the License.
+*/
+
+
+#ifndef EXAMPLEPLUGIN_H
+#define EXAMPLEPLUGIN_H
+
+#include "propertytypes/vehiclespeed.h"
+
+class ExamplePlugin 
+{
+
+public:
+       ExamplePlugin();
+};
+
+#endif // EXAMPLEPLUGIN_H
diff --git a/plugins/exampleplugin.h~ b/plugins/exampleplugin.h~
new file mode 100644 (file)
index 0000000..92b8cef
--- /dev/null
@@ -0,0 +1,30 @@
+/*
+    Copyright 2012 Intel Corporation
+
+    Licensed under the Apache License, Version 2.0 (the "License");
+    you may not use this file except in compliance with the License.
+    You may obtain a copy of the License at
+
+        http://www.apache.org/licenses/LICENSE-2.0
+
+    Unless required by applicable law or agreed to in writing, software
+    distributed under the License is distributed on an "AS IS" BASIS,
+    WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+    See the License for the specific language governing permissions and
+    limitations under the License.
+*/
+
+
+#ifndef EXAMPLEPLUGIN_H
+#define EXAMPLEPLUGIN_H
+
+#include "propertytypes/vehiclespeed.h"
+
+class ExamplePlugin 
+{
+
+public:
+       ExamplePlugin();
+};
+
+#endif // EXAMPLEPLUGIN_H
diff --git a/plugins/nobdycompatplugin.cpp b/plugins/nobdycompatplugin.cpp
new file mode 100644 (file)
index 0000000..7ea7e93
--- /dev/null
@@ -0,0 +1,50 @@
+/*
+    <one line to give the library's name and an idea of what it does.>
+    Copyright (C) 2012  Kevron Rees <email>
+
+    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 "propertytypes/vehiclespeed.h"
+#include "nobdycompatplugin.h"
+#include <QObject>
+
+NobdyCompatPlugin::NobdyCompatPlugin(QObject *parent): QObject(parent)
+{
+       vehicleSpeedProperty = new VehicleSpeedProperty();
+       
+       velocityStream = NobdyStreamFactory::createDefaultStream(VehicleData::Velocity);
+       engineSpeedStream = NobdyStreamFactory::createDefaultStream(VehicleData::EngineRPM);
+       
+       QObject::connect(velocityStream, SIGNAL(changed(QVariant)), this, SLOT(velocityChangedSlot(QVariant))); 
+}
+
+void NobdyCompatPlugin::engineSpeedChangedSlot(QVariant value)
+{
+       
+}
+
+void NobdyCompatPlugin::velocityChangedSlot(QVariant value)
+{
+       vehicleSpeedProperty->setValue(value.toUInt());
+}
+
+extern "C" void create()
+{
+       new NobdyCompatPlugin;
+}
+
+
diff --git a/plugins/nobdycompatplugin.cpp~ b/plugins/nobdycompatplugin.cpp~
new file mode 100644 (file)
index 0000000..12a386d
--- /dev/null
@@ -0,0 +1,50 @@
+/*
+    <one line to give the library's name and an idea of what it does.>
+    Copyright (C) 2012  Kevron Rees <email>
+
+    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 "propertytypes/vehiclespeed.h"
+#include "nobdycompatplugin.h"
+#include <QObject>
+
+NobdyCompatPlugin::NobdyCompatPlugin(QObject *parent): QObject(parent)
+{
+       vehicleSpeedProperty = new VehicleSpeedProperty();
+       
+       velocityStream = NobdyStreamFactory::createDefaultStream(VehicleData::Velocity);
+       engineSpeedStream = NobdyStreamFactory::createDefaultStream(VehicleData::EngineRPM);
+       
+       QObject::connect(velocityStream,SIGNAL(changed(QVariant)),this, SLOT(velocityChangedSlot(QVariant)));   
+}
+
+void NobdyCompatPlugin::engineSpeedChangedSlot(QVariant value)
+{
+       
+}
+
+void NobdyCompatPlugin::velocityChangedSlot(QVariant value)
+{
+       vehicleSpeedProperty->setValue(value.toUInt());
+}
+
+extern "C" void create()
+{
+       new NobdyCompatPlugin;
+}
+
+
diff --git a/plugins/nobdycompatplugin.h b/plugins/nobdycompatplugin.h
new file mode 100644 (file)
index 0000000..22d4010
--- /dev/null
@@ -0,0 +1,45 @@
+/*
+    <one line to give the library's name and an idea of what it does.>
+    Copyright (C) 2012  Kevron Rees <email>
+
+    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 NOBDYCOMPATPLUGIN_H
+#define NOBDYCOMPATPLUGIN_H
+
+#include <nobdystream.h>
+
+class VehicleSpeedProperty;
+
+class NobdyCompatPlugin : public QObject
+{
+Q_OBJECT
+public:
+       explicit NobdyCompatPlugin(QObject* parent = 0);
+       
+private slots:
+       void velocityChangedSlot(QVariant value);
+       void engineSpeedChangedSlot(QVariant value);
+    
+private: 
+       VehicleSpeedProperty * vehicleSpeedProperty;
+       NobdyStream* velocityStream;
+       NobdyStream* engineSpeedStream;
+    
+};
+
+#endif // NOBDYCOMPATPLUGIN_H
diff --git a/plugins/nobdycompatplugin.h~ b/plugins/nobdycompatplugin.h~
new file mode 100644 (file)
index 0000000..4b78ae9
--- /dev/null
@@ -0,0 +1,44 @@
+/*
+    <one line to give the library's name and an idea of what it does.>
+    Copyright (C) 2012  Kevron Rees <email>
+
+    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 NOBDYCOMPATPLUGIN_H
+#define NOBDYCOMPATPLUGIN_H
+
+#include <nobdystream.h>
+#include "propertytypes/vehiclespeed.h"
+
+class NobdyCompatPlugin : public QObject
+{
+Q_OBJECT
+public:
+       explicit NobdyCompatPlugin(QObject* parent = 0);
+       
+private slots:
+       void velocityChangedSlot(QVariant value);
+       void engineSpeedChangedSlot(QVariant value);
+    
+private: 
+       VehicleSpeedProperty * vehicleSpeedProperty;
+       NobdyStream* velocityStream;
+       NobdyStream* engineSpeedStream;
+    
+};
+
+#endif // NOBDYCOMPATPLUGIN_H