1 /* 2 * Copyright (c) 2024 Huawei Device Co., Ltd. 3 * Licensed under the Apache License, Version 2.0 (the "License"); 4 * you may not use this file except in compliance with the License. 5 * You may obtain a copy of the License at 6 * 7 * http://www.apache.org/licenses/LICENSE-2.0 8 * 9 * Unless required by applicable law or agreed to in writing, software 10 * distributed under the License is distributed on an "AS IS" BASIS, 11 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 * See the License for the specific language governing permissions and 13 * limitations under the License. 14 * Description: channel request 15 * Author: sunhong 16 * Create: 2022-01-19 17 */ 18 19 #ifndef CHANNEL_REQUEST_H 20 #define CHANNEL_REQUEST_H 21 22 #include <string> 23 #include "channel_info.h" 24 #include "cast_engine_common.h" 25 #include "cast_service_common.h" 26 27 namespace OHOS { 28 namespace CastEngine { 29 namespace CastEngineService { 30 struct ChannelRequest { 31 ChannelRequest() = default; 32 ~ChannelRequest() = default; 33 ChannelRequestChannelRequest34 ChannelRequest(const ModuleType moduleType, bool isReceiver, const CastLocalDevice &localDeviceInfo, 35 const CastInnerRemoteDevice &remoteDeviceInfo, const CastSessionProperty &sessionProperty) 36 : moduleType(moduleType), 37 isReceiver(isReceiver), 38 localDeviceInfo(localDeviceInfo), 39 remoteDeviceInfo(remoteDeviceInfo), 40 sessionProperty(sessionProperty) 41 { 42 linkType = 43 remoteDeviceInfo.channelType == ChannelType::SOFT_BUS ? ChannelLinkType::SOFT_BUS : ChannelLinkType::TCP; 44 }; 45 46 bool operator<(const ChannelRequest &request) const 47 { 48 return connectionId < request.connectionId; 49 }; 50 51 ChannelLinkType linkType; 52 ModuleType moduleType; 53 bool isReceiver; 54 int sessionId{ INVALID_ID }; 55 int localPort{ INVALID_PORT }; 56 int remotePort{ INVALID_PORT }; 57 int connectionId{ INVALID_ID }; 58 CastLocalDevice localDeviceInfo; 59 CastInnerRemoteDevice remoteDeviceInfo; 60 CastSessionProperty sessionProperty; 61 std::string fileReceiveRootPath; 62 }; 63 } // namespace CastEngineService 64 } // namespace CastEngine 65 } // namespace OHOS 66 67 #endif // CHANNEL_REQUEST_H 68