Apollo 10.0
自动驾驶开放平台
socket_manager.h
浏览该文件的文档.
1/******************************************************************************
2 * Copyright 2017 The Apollo Authors. All Rights Reserved.
3 *
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
7 *
8 * http://www.apache.org/licenses/LICENSE-2.0
9 *
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
15 *****************************************************************************/
16
24#pragma once
25
26#include <map>
27#include <set>
28#include <string>
29#include <utility>
30#include <vector>
31
32#include "nlohmann/json.hpp"
33
34#include "modules/dreamview_plus/proto/data_handler.pb.h"
35
36#include "cyber/common/log.h"
45namespace apollo {
46namespace dreamview {
47
51using Json = nlohmann::json;
52
59 public:
63 SocketManager(WebSocketHandler *websocket, UpdaterManager *updater_manager,
64 DvPluginManager *dv_plugin_manager);
70 void BrocastDataHandlerConf(bool clear_channel_msg = false);
71
72 private:
76 void RegisterDataHandlers();
77 // bool RegisterDataHandler(const DataHandlerInfo &data_handler_info);
78 // The conf stores data-proto-handler related relationship
79 DataHandlerConf data_handler_base_conf_;
80 DataHandlerConf data_handler_conf_;
81 bool enabled_;
82 // Used to obtain deduplication of all channels.
83 std::map<std::string, int> complete_channel_count_;
84 // Used to deduplicate channels under data handler info.
85 std::map<std::string, int> data_handler_channel_count_;
86 WebSocketHandler *websocket_ = nullptr;
87 UpdaterManager *updater_manager_ = nullptr;
88 DvPluginManager *dv_plugin_manager_ = nullptr;
89 void RegisterMessageHandlers();
94 bool Subscribe(const Json &json);
99 bool UnSubscribe(const Json &json);
100 bool GetDataUpdaterChannels(const std::string &updater_path,
101 std::vector<std::string> *channels);
108 bool ModifyUpdaterChannels(const std::string &updater_path,
109 const std::string &channel_name,
110 const std::string &operation);
111 Json GetDataHandlerInfo();
112 Json ClearDataHandlerChannelMsgs();
118 void RefreshChannels(const apollo::cyber::proto::ChangeMsg &change_msg);
125 bool UpdateCyberChannels(const apollo::cyber::proto::ChangeMsg &change_msg,
126 DataHandlerInfo &updater_info);
134 void RefreshDataHandlerChannels(
135 const apollo::cyber::proto::ChangeMsg &change_msg,
136 DataHandlerConf &data_handler_conf_diff, bool &flag);
142 bool UpdateUpdaterInfo(const apollo::cyber::proto::ChangeMsg &change_msg,
143 DataHandlerInfo &updater_info);
144};
145
146} // namespace dreamview
147} // namespace apollo
A class that manages dreamview plus plug-ins.
This is a major component of the Simulation backend, which manage all websockets to respond to all fr...
void BrocastDataHandlerConf(bool clear_channel_msg=false)
Broadcast data handler conf for all connections
Management for all data updater.
The WebSocketHandler, built on top of CivetWebSocketHandler, is a websocket handler that handles diff...
nlohmann::json Json
class register implement
Definition arena_queue.h:37
UpdaterManager to manage all data updater.