Android-cuttlefish cvd tool
data_channels.h
Go to the documentation of this file.
1/*
2 * Copyright (C) 2022 The Android Open Source Project
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
17#pragma once
18
19#include <functional>
20#include <memory>
21
22#include <api/data_channel_interface.h>
23
25
26namespace cuttlefish {
27namespace webrtc_streaming {
28
29constexpr auto kControlChannelLabel = "device-control";
30
32
33// Groups all data channel handlers.
34// Each handler is an implementation of the DataChannelHandler abstract class
35// providing custom message handlers and calling the appropriate methods on the
36// connection observer.
38 public:
39 DataChannelHandlers(std::shared_ptr<ConnectionObserver> observer);
41
43 rtc::scoped_refptr<webrtc::DataChannelInterface> channel);
44
45 private:
46 std::unique_ptr<DataChannelHandler> input_;
47 std::unique_ptr<DataChannelHandler> control_;
48 std::unique_ptr<DataChannelHandler> adb_;
49 std::unique_ptr<DataChannelHandler> bluetooth_;
50 std::unique_ptr<DataChannelHandler> camera_;
51 std::unique_ptr<DataChannelHandler> sensors_;
52 std::unique_ptr<DataChannelHandler> lights_;
53 std::unique_ptr<DataChannelHandler> location_;
54 std::unique_ptr<DataChannelHandler> kml_location_;
55 std::unique_ptr<DataChannelHandler> gpx_location_;
56 std::vector<std::unique_ptr<DataChannelHandler>> unknown_channels_;
57
58 std::shared_ptr<ConnectionObserver> observer_;
59};
60
61} // namespace webrtc_streaming
62} // namespace cuttlefish
Definition: data_channels.cpp:30
std::unique_ptr< DataChannelHandler > adb_
Definition: data_channels.h:48
std::unique_ptr< DataChannelHandler > input_
Definition: data_channels.h:46
~DataChannelHandlers()
Definition: data_channels.cpp:453
std::unique_ptr< DataChannelHandler > gpx_location_
Definition: data_channels.h:55
DataChannelHandlers(std::shared_ptr< ConnectionObserver > observer)
Definition: data_channels.cpp:449
std::vector< std::unique_ptr< DataChannelHandler > > unknown_channels_
Definition: data_channels.h:56
std::unique_ptr< DataChannelHandler > lights_
Definition: data_channels.h:52
std::unique_ptr< DataChannelHandler > control_
Definition: data_channels.h:47
void OnDataChannelOpen(rtc::scoped_refptr< webrtc::DataChannelInterface > channel)
Definition: data_channels.cpp:455
std::unique_ptr< DataChannelHandler > camera_
Definition: data_channels.h:50
std::unique_ptr< DataChannelHandler > bluetooth_
Definition: data_channels.h:49
std::unique_ptr< DataChannelHandler > sensors_
Definition: data_channels.h:51
std::unique_ptr< DataChannelHandler > kml_location_
Definition: data_channels.h:54
std::shared_ptr< ConnectionObserver > observer_
Definition: data_channels.h:58
std::unique_ptr< DataChannelHandler > location_
Definition: data_channels.h:53
constexpr auto kControlChannelLabel
Definition: data_channels.h:29
Definition: alloc_utils.cpp:23