2 * Copyright (C) 2012 TOYOTA MOTOR CORPORATION.
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.
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.
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
19 #ifndef AMBINTERFACE_H
20 #define AMBINTERFACE_H
28 #include <abstractpropertytype.h>
29 #include <abstractsource.h>
31 #include <propertyinfo.hpp>
33 #include "ambconfig.h"
36 * Vehicle information of AMB.
38 struct AMBVehicleInfo {
40 AbstractPropertyType *value;
44 bool operator==(const AMBVehicleInfo &vi) {
45 return (this->name == vi.name);
50 class VICCommunicator;
53 * Interface of AMB-Core and Plugin.
55 class AMBIF : public AbstractSource {
60 * @param engine Instance of AMB-Core.
61 * @param config Information in a configuration file of AMB.
63 AMBIF(AbstractRoutingEngine *engine,
64 std::map<std::string, std::string> config);
71 * AMBIF class receives a request for acquisition of information from AMB-Core.
72 * Vehicle Information stored in the hold, plugin will return the data.
74 * @param reply Variable for storing the vehiclle information to be returnd to AMB-Core.
77 getPropertyAsync(AsyncPropertyReply *reply);
79 * AMBIF class receives a request for a change in the vehicle information from AMB-Core.
80 * Changes to vehicle information received from its own information.
82 * @param request Vehicle information that has been requested change.
83 * @return Vehicle information after the change.
86 setProperty(AsyncSetPropertyRequest request);
88 * AMBIF class receives a request for acquisition of vehicle information list from AMB-Core.
90 * @return Vehicle information list held by the plugin.
95 * AMBIF class receives from AMB-Core a request for obtaining the operation list.
96 * AMBIF class supports the operations(Get/Set)
101 supportedOperations();
104 * AMBIF class will issue a UUID.
115 * AMBIF class is received the vehicle information that other plugin updated.
117 * @param property the name of Vehicle information of AMB.
118 * @param value the value of Vehicle information of AMB.
119 * @param uuid UUID of the source plugin.
122 propertyChanged(VehicleProperty::Property property,
123 AbstractPropertyType *value, std::string uuid);
125 * AMBIF class reads the configuration file AMB.
127 * @param config Information in a configuration file of AMB.
130 setConfiguratin(std::map<std::string, std::string> config);
135 * @param comm Instance of VICCommunicator.
136 * @param conf Instance of Config.
137 * @return Success : true Failure : false
140 initialize(VICCommunicator *comm, AMBConfig *conf);
142 * AMBIF class is required to get the vehicle information to AMB-Core.
144 * @param propertyname The name of vehicle information of AMB.
145 * @return The value of vehicle information of AMB.
148 getPropertyRequest(std::string propertyname);
150 * AMBIF class ask AMB-Core to change the vehicle information.
151 * This request is used for vehicle information that is managed by other plugin.
153 * @param vehicleinfo Vehicle information of AMB.(name and value)
156 setPropertyRequest(AMBVehicleInfo *vehicleinfo);
158 * AMBIF class notify a change in the vehicle information to the AMB-Core.
159 * This instruction is subject to only the vehicle information that is managed by the plugin.
161 * @param vehicleinfo Vehicle information of AMB.(name and value)
164 updateProperty(AMBVehicleInfo *vehicleinfo);
166 * AMBIF class locks the vehicle information changes.
171 * AMBIF class releases the lock status of the vehicle information changes.
176 * This function is an interface with other objects in the Plugin.
177 * This interface issues a request to change the information.
179 * @param vehicleinfo Vehicle information of AMB.
182 requestUpdate(AMBVehicleInfo *vehicleinfo);
185 * Unused virtual function.
188 getRangePropertyAsync(AsyncRangePropertyReply *reply)
192 * Unused virtual function.
195 subscribeToPropertyChanges(VehicleProperty::Property property)
199 * Unused virtual function.
202 unsubscribeToPropertyChanges(VehicleProperty::Property property)
206 * Unused virtual function.
209 supportedChanged(const PropertyList &)
214 PropertyInfo getPropertyInfo(VehicleProperty::Property property);
218 registVehicleInfo(std::string propertyName, DataType type,
221 find(std::string propertyName);
223 PropertyList propertylist;
224 vector<AMBVehicleInfo> vehicleinfoArray;
226 std::map<VehicleProperty::Property, PropertyInfo> propertyInfoMap;
228 VICCommunicator *communicator;
229 pthread_mutex_t mutex;
231 #endif // #ifndef AMBINTERFACE_H