Merge pull request #69 from fredcadete/master
[profile/ivi/automotive-message-broker.git] / plugins / exampleplugin.cpp
index 6ad6622..6ea63cd 100644 (file)
@@ -33,15 +33,17 @@ uint16_t accelerationX = 0;
 Transmission::TransmissionPositions transmissionShiftPostion = Transmission::Neutral;
 uint16_t steeringWheelAngle=0;
 uint16_t throttlePos = 0;
-uint16_t engineCoolant = 40;
+int engineCoolant = 40;
 bool machineGun = false;
 
+const char* id = "6dd4268a-c605-4a06-9034-59c1e8344c8e";
+
 static gboolean timeoutCallback(gpointer data)
 {
        ExampleSourcePlugin* src = (ExampleSourcePlugin*)data;
-       
+
        src->randomizeProperties();
-       
+
        return true;
 }
 
@@ -105,15 +107,14 @@ ExampleSourcePlugin::ExampleSourcePlugin(AbstractRoutingEngine* re, map<string,
 
 
 
-extern "C" AbstractSource * create(AbstractRoutingEngine* routingengine, map<string, string> config)
+extern "C" void create(AbstractRoutingEngine* routingengine, map<string, string> config)
 {
-       return new ExampleSourcePlugin(routingengine, config);
-       
+       new ExampleSourcePlugin(routingengine, config);
 }
 
 const string ExampleSourcePlugin::uuid()
 {
-       return "6dd4268a-c605-4a06-9034-59c1e8344c8e";
+       return id;
 }
 
 
@@ -195,13 +196,9 @@ void ExampleSourcePlugin::getPropertyAsync(AsyncPropertyReply *reply)
        {
                VehicleProperty::DoorsPerRowType temp;
 
-               BasicPropertyType<uint16_t> row1(2);
-               BasicPropertyType<uint16_t> row2(2);
-               BasicPropertyType<uint16_t> row3(1);
-
-               temp.append(&row1);
-               temp.append(&row2);
-               temp.append(&row3);
+               temp.append(2);
+               temp.append(2);
+               temp.append(1);
 
                reply->value = &temp;
                reply->success = true;
@@ -359,19 +356,24 @@ void ExampleSourcePlugin::randomizeProperties()
        steeringWheelAngle = 1 + (359.00 * (rand() / (RAND_MAX + 1.0)));
        throttlePos = 1 + (100.00 * (rand() / (RAND_MAX + 1.0)));
        engineCoolant = 1 + (40.00 * (rand() / (RAND_MAX + 140.0)));
-       
+
        DebugOut()<<"setting velocity to: "<<velocity<<endl;
        DebugOut()<<"setting enginespeed to: "<<engineSpeed<<endl;
-       
-       VehicleProperty::VehicleSpeedType vel(velocity);
-       VehicleProperty::EngineSpeedType es(engineSpeed);
-       VehicleProperty::AccelerationXType ac(accelerationX);
-       VehicleProperty::SteeringWheelAngleType swa(steeringWheelAngle);
-       VehicleProperty::TransmissionShiftPositionType tsp(transmissionShiftPostion);
-       VehicleProperty::TransmissionGearPositionType tgp(transmissionShiftPostion);
-       VehicleProperty::ThrottlePositionType tp(throttlePos);
-       VehicleProperty::EngineCoolantTemperatureType ec(engineCoolant);
-       VehicleProperty::MachineGunTurretStatusType mgt(machineGun);
+
+       vel.setValue(velocity);
+       vel.sequence++;
+       vel.priority = AbstractPropertyType::High;
+       es.setValue(engineSpeed);
+       es.sequence++;
+       es.priority = AbstractPropertyType::Low;
+       ac.setValue(accelerationX);
+       swa.setValue(steeringWheelAngle);
+       tsp.setValue(transmissionShiftPostion);
+       tgp.setValue(transmissionShiftPostion);
+       tsp.priority = AbstractPropertyType::Low;
+       tp.setValue(throttlePos);
+       ec.setValue(engineCoolant);
+       mgt.setValue(machineGun);
 
        machineGun = !machineGun;
 
@@ -390,7 +392,7 @@ void ExampleSourcePlugin::addPropertySupport(VehicleProperty::Property property,
 {
        mSupported.push_back(property);
 
-       std::list<Zone::Type> zones;
+       Zone::ZoneList zones;
 
        zones.push_back(zone);