diff options
author | Kevron Rees <tripzero.kev@gmail.com> | 2012-08-23 14:57:00 -0700 |
---|---|---|
committer | Kevron Rees <tripzero.kev@gmail.com> | 2012-08-23 14:57:16 -0700 |
commit | dfa41e25dd1bfebe48a60d999cf5ccd41f4dce5f (patch) | |
tree | 906c5b5ea3b563e5eb1905c2bcf1c4c0b8ae7fb4 | |
parent | 86c0565ede957c2389db1bb1d77957ab673f6860 (diff) | |
download | automotive-message-broker-dfa41e25dd1bfebe48a60d999cf5ccd41f4dce5f.tar.gz |
made VehicleProperty::Property strings
-rw-r--r-- | lib/vehicleproperty.cpp | 16 | ||||
-rw-r--r-- | lib/vehicleproperty.h | 38 | ||||
-rw-r--r-- | plugins/websocketsink/websocketsinkmanager.cpp | 4 |
3 files changed, 38 insertions, 20 deletions
diff --git a/lib/vehicleproperty.cpp b/lib/vehicleproperty.cpp index 5c194515..bd21c526 100644 --- a/lib/vehicleproperty.cpp +++ b/lib/vehicleproperty.cpp @@ -21,6 +21,22 @@ using namespace std; + const VehicleProperty::Property VehicleProperty::NoValue = "NoValue"; + const VehicleProperty::Property VehicleProperty::VehicleSpeed = "VehicleSpeed"; + const VehicleProperty::Property VehicleProperty::EngineSpeed = "EngineSpeed"; + const VehicleProperty::Property VehicleProperty::TransmissionShiftPosition = "TransmissionShiftPosition"; + const VehicleProperty::Property VehicleProperty::ThrottlePosition = "ThrottlePosition"; + const VehicleProperty::Property VehicleProperty::WheelBrake = "WheelBrake"; + const VehicleProperty::Property VehicleProperty::SteeringWheelAngle = "SteeringWheelAngle"; + const VehicleProperty::Property VehicleProperty::TurnSignal = "TurnSignal"; + const VehicleProperty::Property VehicleProperty::ClutchStatus = "ClutchStatus"; + const VehicleProperty::Property VehicleProperty::EngineOilPressure = "EngineOilPressure"; + const VehicleProperty::Property VehicleProperty::EngineCoolantTemperature = "EngineCoolantTemperature"; + const VehicleProperty::Property VehicleProperty::MachineGunTurretStatus = "MachineGunTurretStatus"; + const VehicleProperty::Property VehicleProperty::AccelerationX = "AccelerationX"; + const VehicleProperty::Property VehicleProperty::AccelerationY = "AccelerationY"; + const VehicleProperty::Property VehicleProperty::AccelerationZ = "AccelerationZ"; + VehicleProperty::VehicleProperty() { diff --git a/lib/vehicleproperty.h b/lib/vehicleproperty.h index 667a4cc4..1449091b 100644 --- a/lib/vehicleproperty.h +++ b/lib/vehicleproperty.h @@ -33,12 +33,14 @@ public: VehicleProperty(); - enum Property - { - NoValue=0, - VehicleSpeed, /**< Vehicle Velocity in km/h */ - EngineSpeed, /**< Engine Speed in rotations per minute */ - TransmissionShiftPosition, /**< Transmission Shift Position + typedef std::string Property; + + //enum Property + //{ + static const Property NoValue; + static const Property VehicleSpeed; /**< Vehicle Velocity in km/h */ + static const Property EngineSpeed;/**< Engine Speed in rotations per minute */ + static const Property TransmissionShiftPosition; /**< Transmission Shift Position * 0 = Neutral * 1 = 1st * 2 = 2nd @@ -48,18 +50,18 @@ public: * 255 = Park */ - ThrottlePosition, /**< Throttle position 0-100% */ - WheelBrake, /**< Wheel brake position. Engaged = true, Idle = false */ - SteeringWheelAngle, /**< Steering wheel angle (0-359) */ - TurnSignal, /**< 0=off, 1=right, 2=left, 3=hazard */ - ClutchStatus, /**< Clutch pedal status 0=off, 1=on */ - EngineOilPressure, /**< Oil pressure TODO: units */ - EngineCoolantTemperature, /**< Engine coolant temperature in degrees celcius **/ - MachineGunTurretStatus, /**< 0=off, 1=on */ - AccelerationX, /**< Acceleration on the 'x' axis in 1/1000 gravitational acceleration "g-force" */ - AccelerationY, /**< Acceleration on the 'y' axis in 1/1000 gravitational acceleration "g-force" */ - AccelerationZ /**< Acceleration on the 'z' axis in 1/1000 gravitational acceleration "g-force" */ - }; + static const Property ThrottlePosition; /**< Throttle position 0-100% */ + static const Property WheelBrake; /**< Wheel brake position. Engaged = true, Idle = false */ + static const Property SteeringWheelAngle; /**< Steering wheel angle (0-359) */ + static const Property TurnSignal; /**< 0=off, 1=right, 2=left, 3=hazard */ + static const Property ClutchStatus; /**< Clutch pedal status 0=off, 1=on */ + static const Property EngineOilPressure; /**< Oil pressure TODO: units */ + static const Property EngineCoolantTemperature; /**< Engine coolant temperature in degrees celcius **/ + static const Property MachineGunTurretStatus; /**< 0=off, 1=on */ + static const Property AccelerationX; /**< Acceleration on the 'x' axis in 1/1000 gravitational acceleration "g-force" */ + static const Property AccelerationY; /**< Acceleration on the 'y' axis in 1/1000 gravitational acceleration "g-force" */ + static const Property AccelerationZ; /**< Acceleration on the 'z' axis in 1/1000 gravitational acceleration "g-force" */ + //}; static std::string name(Property prop); static Property value(std::string name); diff --git a/plugins/websocketsink/websocketsinkmanager.cpp b/plugins/websocketsink/websocketsinkmanager.cpp index 9f6a9922..2a12ed54 100644 --- a/plugins/websocketsink/websocketsinkmanager.cpp +++ b/plugins/websocketsink/websocketsinkmanager.cpp @@ -223,13 +223,13 @@ static int websocket_callback(struct libwebsocket_context *context,struct libweb //m_engine->subscribeToProperty(VehicleProperty::VehicleSpeed,this); - sinkManager->addSingleShotSink(wsi,VehicleProperty::Property::VehicleSpeed,id); + sinkManager->addSingleShotSink(wsi,VehicleProperty::VehicleSpeed,id); //libwebsocket_write(wsi, (unsigned char*)new_response, strlen(new_response), LWS_WRITE_TEXT); } else if (data == "running_status_engine_speed") { - sinkManager->addSingleShotSink(wsi,VehicleProperty::Property::EngineSpeed,id); + sinkManager->addSingleShotSink(wsi,VehicleProperty::EngineSpeed,id); } //EngineSpeed //AccelerationX |