summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKevron Rees <tripzero.kev@gmail.com>2012-08-26 19:30:22 -0700
committerKevron Rees <tripzero.kev@gmail.com>2012-08-26 19:30:22 -0700
commite1d7568bcc92a6387d6534ca70165e84db943ddb (patch)
tree3a05670ca8599690b953af88bed8c9548dee5b98
parent041060b91fd1a39c4ebf84e17884a07f7d3c70c9 (diff)
downloadautomotive-message-broker-e1d7568bcc92a6387d6534ca70165e84db943ddb.tar.gz
fixed types expressed in the example source plugin
-rw-r--r--plugins/dbus/accelerationproperty.cpp6
-rw-r--r--plugins/dbus/accelerationproperty.h6
-rw-r--r--plugins/exampleplugin.cpp25
3 files changed, 28 insertions, 9 deletions
diff --git a/plugins/dbus/accelerationproperty.cpp b/plugins/dbus/accelerationproperty.cpp
index dae6d68c..6259b14f 100644
--- a/plugins/dbus/accelerationproperty.cpp
+++ b/plugins/dbus/accelerationproperty.cpp
@@ -34,7 +34,7 @@ void AccelerationPropertyInterface::supportedChanged(PropertyList supportedPrope
if(!accelerationX)
{
routingEngine->subscribeToProperty(VehicleProperty::AccelerationX, this);
- accelerationX = new BasicProperty<int>("X", "i", AbstractProperty::Read, this);
+ accelerationX = new BasicProperty<uint16_t>("X", "i", AbstractProperty::Read, this);
propertyDBusMap[VehicleProperty::AccelerationX] = accelerationX;
supported = true;
}
@@ -45,7 +45,7 @@ void AccelerationPropertyInterface::supportedChanged(PropertyList supportedPrope
if(!accelerationY)
{
routingEngine->subscribeToProperty(VehicleProperty::AccelerationY, this);
- accelerationY = new BasicProperty<int>("Y", "i", AbstractProperty::Read, this);
+ accelerationY = new BasicProperty<uint16_t>("Y", "i", AbstractProperty::Read, this);
propertyDBusMap[VehicleProperty::AccelerationY] = accelerationY;
supported = true;
}
@@ -56,7 +56,7 @@ void AccelerationPropertyInterface::supportedChanged(PropertyList supportedPrope
if(!accelerationZ)
{
routingEngine->subscribeToProperty(VehicleProperty::AccelerationZ, this);
- accelerationZ = new BasicProperty<int>("Z", "i", AbstractProperty::Read, this);
+ accelerationZ = new BasicProperty<uint16_t>("Z", "i", AbstractProperty::Read, this);
propertyDBusMap[VehicleProperty::AccelerationZ] = accelerationZ;
supported = true;
}
diff --git a/plugins/dbus/accelerationproperty.h b/plugins/dbus/accelerationproperty.h
index e07e59d2..7f657804 100644
--- a/plugins/dbus/accelerationproperty.h
+++ b/plugins/dbus/accelerationproperty.h
@@ -33,9 +33,9 @@ public:
private:
- BasicProperty<int> * accelerationX;
- BasicProperty<int> * accelerationY;
- BasicProperty<int> * accelerationZ;
+ BasicProperty<uint16_t> * accelerationX;
+ BasicProperty<uint16_t> * accelerationY;
+ BasicProperty<uint16_t> * accelerationZ;
bool supported;
};
diff --git a/plugins/exampleplugin.cpp b/plugins/exampleplugin.cpp
index f958d23f..80d90f03 100644
--- a/plugins/exampleplugin.cpp
+++ b/plugins/exampleplugin.cpp
@@ -26,6 +26,10 @@ using namespace std;
#include "debugout.h"
+uint16_t accelerationX = 0;
+uint16_t transmissionShiftPostion = 0;
+uint16_t steeringWheelAngle=0;
+
static gboolean timeoutCallback(gpointer data)
{
ExampleSourcePlugin* src = (ExampleSourcePlugin*)data;
@@ -82,6 +86,21 @@ void ExampleSourcePlugin::getPropertyAsync(AsyncPropertyReply *reply)
reply->value = engineSpeed;
reply->completed(reply);
}
+ else if(reply->property == VehicleProperty::AccelerationX)
+ {
+ reply->value = accelerationX;
+ reply->completed(reply);
+ }
+ else if(reply->property == VehicleProperty::TransmissionShiftPosition)
+ {
+ reply->value = transmissionShiftPostion;
+ reply->completed(reply);
+ }
+ else if(reply->property == VehicleProperty::SteeringWheelAngle)
+ {
+ reply->value = steeringWheelAngle;
+ reply->completed(reply);
+ }
}
void ExampleSourcePlugin::setProperty(VehicleProperty::Property , boost::any )
@@ -115,9 +134,9 @@ void ExampleSourcePlugin::randomizeProperties()
{
velocity = 1 + (255.00 * (rand() / (RAND_MAX + 1.0)));
engineSpeed = 1 + (15000.00 * (rand() / (RAND_MAX + 1.0)));
- int accelerationX = 1 + (15000.00 * (rand() / (RAND_MAX + 1.0)));
- int transmissionShiftPostion = 1 + (6.00 * (rand() / (RAND_MAX + 1.0)));
- int steeringWheelAngle = 1 + (359.00 * (rand() / (RAND_MAX + 1.0)));
+ accelerationX = 1 + (15000.00 * (rand() / (RAND_MAX + 1.0)));
+ transmissionShiftPostion = 1 + (6.00 * (rand() / (RAND_MAX + 1.0)));
+ steeringWheelAngle = 1 + (359.00 * (rand() / (RAND_MAX + 1.0)));
DebugOut()<<"setting velocity to: "<<velocity<<endl;
DebugOut()<<"setting enginespeed to: "<<engineSpeed<<endl;