3 Copyright (C) 2012 Intel Corporation
5 This library is free software; you can redistribute it and/or
6 modify it under the terms of the GNU Lesser General Public
7 License as published by the Free Software Foundation; either
8 version 2.1 of the License, or (at your option) any later version.
10 This library is distributed in the hope that it will be useful,
11 but WITHOUT ANY WARRANTY; without even the implied warranty of
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13 Lesser General Public License for more details.
15 You should have received a copy of the GNU Lesser General Public
16 License along with this library; if not, write to the Free Software
17 Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
21 #ifndef WEBSOCKETSOURCE_H
22 #define WEBSOCKETSOURCE_H
24 #include <abstractsource.h>
26 #include <libwebsockets.h>
29 class WebSocketSource : public AbstractSource
33 WebSocketSource(AbstractRoutingEngine* re, std::map<std::string, std::string> config);
34 const std::string uuid();
35 void getPropertyAsync(AsyncPropertyReply *reply);
36 void getRangePropertyAsync(AsyncRangePropertyReply *reply);
37 AsyncPropertyReply * setProperty(AsyncSetPropertyRequest request);
39 void subscribeToPropertyChanges(VehicleProperty::Property property);
40 void unsubscribeToPropertyChanges(VehicleProperty::Property property);
41 PropertyList supported();
43 int supportedOperations();
46 PropertyList queuedRequests;
48 void checkSubscriptions();
49 PropertyList activeRequests;
50 PropertyList removeRequests;
51 void updateSupported();
52 void supportedChanged(const PropertyList &) {}
53 void setConfiguration(std::map<std::string, std::string> config);
55 std::map<std::string, AsyncPropertyReply*> uuidReplyMap;
56 std::map<std::string,double> uuidTimeoutMap;
57 std::map<std::string, AsyncRangePropertyReply*> uuidRangedReplyMap;
58 std::map<std::string, AsyncPropertyReply*> setReplyMap;
60 int partialMessageIndex;
61 QByteArray incompleteMessage;
62 int expectedMessageFrames;
64 PropertyInfo getPropertyInfo(const VehicleProperty::Property & property);
67 * \brief serverTimeOffset offset between server time and local time
69 double serverTimeOffset;
73 #endif // WEBSOCKETSOURCE_H