automotive-message-broker  0.14.803
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Groups Pages
exampleplugin.h
1 /*
2 Copyright (C) 2012 Intel Corporation
3 
4 This library is free software; you can redistribute it and/or
5 modify it under the terms of the GNU Lesser General Public
6 License as published by the Free Software Foundation; either
7 version 2.1 of the License, or (at your option) any later version.
8 
9 This library is distributed in the hope that it will be useful,
10 but WITHOUT ANY WARRANTY; without even the implied warranty of
11 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12 Lesser General Public License for more details.
13 
14 You should have received a copy of the GNU Lesser General Public
15 License along with this library; if not, write to the Free Software
16 Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
17 */
18 
19 #ifndef EXAMPLEPLUGIN_H
20 #define EXAMPLEPLUGIN_H
21 
22 #include <abstractsource.h>
23 #include <string>
24 
25 using namespace std;
26 
28 {
29 
30 public:
31  ExampleSourcePlugin(): AbstractSource(nullptr, map<string, string>()) {}
32  ExampleSourcePlugin(AbstractRoutingEngine* re, map<string, string> config);
33 
34  const string uuid();
35  void getPropertyAsync(AsyncPropertyReply *reply);
36  void getRangePropertyAsync(AsyncRangePropertyReply *reply);
37  AsyncPropertyReply * setProperty(AsyncSetPropertyRequest request);
38  void subscribeToPropertyChanges(VehicleProperty::Property property);
39  void unsubscribeToPropertyChanges(VehicleProperty::Property property);
40  PropertyList supported();
41 
42  int supportedOperations();
43 
44  void supportedChanged(const PropertyList &) {}
45 
46  void randomizeProperties();
47 
48  PropertyInfo getPropertyInfo(const VehicleProperty::Property & property)
49  {
50  if(propertyInfoMap.find(property) != propertyInfoMap.end())
51  return propertyInfoMap[property];
52 
53  return PropertyInfo::invalid();
54  }
55 
56 private:
57 
58  void addPropertySupport(VehicleProperty::Property property, Zone::Type zone);
59 
60  std::map<VehicleProperty::Property, PropertyInfo> propertyInfoMap;
61  std::map<Zone::Type, Airbag::Status> airbagStatus;
62  std::map<Zone::Type, bool> acStatus;
63  PropertyList mRequests;
64  PropertyList mSupported;
65  uint16_t velocity;
66  uint16_t engineSpeed;
67 
68  VehicleProperty::VehicleSpeedType vel;
69  VehicleProperty::EngineSpeedType es;
70  VehicleProperty::AccelerationXType ac;
71  VehicleProperty::SteeringWheelAngleType swa;
72  VehicleProperty::TransmissionShiftPositionType tsp;
73  VehicleProperty::TransmissionGearPositionType tgp;
74  VehicleProperty::ThrottlePositionType tp;
75  VehicleProperty::EngineCoolantTemperatureType ec;
76  VehicleProperty::MachineGunTurretStatusType mgt;
77 };
78 
79 #endif // EXAMPLEPLUGIN_H