automotive-message-broker  0.14.803
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Groups Pages
websocketsource.h
1 
2 /*
3 Copyright (C) 2012 Intel Corporation
4 
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.
9 
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.
14 
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
18 */
19 
20 
21 #ifndef WEBSOCKETSOURCE_H
22 #define WEBSOCKETSOURCE_H
23 
24 #include <abstractsource.h>
25 #include <string>
26 #include <libwebsockets.h>
27 #include <QByteArray>
28 
30 {
31 
32 public:
33  WebSocketSource(AbstractRoutingEngine* re, std::map<std::string, std::string> config);
34  const std::string uuid();
38  bool m_sslEnabled;
39  void subscribeToPropertyChanges(VehicleProperty::Property property);
40  void unsubscribeToPropertyChanges(VehicleProperty::Property property);
41  PropertyList supported();
42 
43  int supportedOperations();
44 
45  lws *clientsocket;
46  PropertyList queuedRequests;
47  bool clientConnected;
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);
54 
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;
59 
60  int partialMessageIndex;
61  QByteArray incompleteMessage;
62  int expectedMessageFrames;
63 
64  PropertyInfo getPropertyInfo(const VehicleProperty::Property & property);
65 
70 private:
71 };
72 
73 #endif // WEBSOCKETSOURCE_H