1 /* 2 * Copyright (c) 2022-2023 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 */ 15 16 #ifndef OHOS_AVSESSION_DESCRIPTOR_H 17 #define OHOS_AVSESSION_DESCRIPTOR_H 18 19 #include "parcel.h" 20 #include "element_name.h" 21 22 namespace OHOS::AVSession { 23 struct DeviceInfo { 24 bool WriteToParcel(Parcel& out) const; 25 bool ReadFromParcel(Parcel& in); 26 27 int32_t castCategory_; 28 std::string deviceId_; 29 std::string deviceName_; 30 std::string networkId_; 31 std::string ipAddress_; 32 std::string manufacturer_; 33 std::string modelName_; 34 int32_t deviceType_; 35 int32_t providerId_; 36 int32_t supportedProtocols_ = 0; 37 int32_t authenticationStatus_ = 0; 38 std::vector<std::string> supportedDrmCapabilities_; 39 bool isLegacy_ = false; 40 int32_t mediumTypes_ = 2; 41 }; 42 43 struct OutputDeviceInfo { 44 bool WriteToParcel(Parcel& out) const; 45 bool ReadFromParcel(Parcel& in); 46 47 std::vector<DeviceInfo> deviceInfos_; 48 }; 49 50 struct AVHistoryDescriptor { 51 bool WriteToParcel(Parcel& out) const; 52 bool ReadFromParcel(Parcel& in); 53 54 std::string sessionId_; 55 std::string bundleName_; 56 std::string abilityName_; 57 }; 58 59 struct AVSessionDescriptor { 60 bool WriteToParcel(Parcel& out) const; 61 bool CheckBeforReadFromParcel(Parcel& in); 62 bool CheckBeforReadFromParcel(Parcel& in, DeviceInfo& deviceInfo); 63 bool ReadFromParcel(Parcel& in); 64 65 std::string sessionId_; 66 int32_t sessionType_ {}; 67 std::string sessionTag_; 68 AppExecFwk::ElementName elementName_; 69 pid_t pid_ {}; 70 pid_t uid_ {}; 71 bool isActive_ {}; 72 bool isTopSession_ {}; 73 bool isThirdPartyApp_ {}; 74 OutputDeviceInfo outputDeviceInfo_; 75 }; 76 77 struct AVSessionBasicInfo { 78 std::string deviceName_; 79 std::string networkId_; 80 std::string vendorId_; 81 std::string deviceType_; 82 std::string systemVersion_; 83 int32_t sessionVersion_ {}; 84 std::vector<int32_t> reserve_; 85 std::vector<int32_t> feature_; 86 std::vector<int32_t> metaDataCap_; 87 std::vector<int32_t> playBackStateCap_; 88 std::vector<int32_t> controlCommandCap_; 89 std::vector<int32_t> extendCapability_; 90 int32_t systemTime_ {}; 91 std::vector<int32_t> extend_; 92 }; 93 94 enum CastDisplayState { 95 STATE_OFF = 1, 96 STATE_ON, 97 }; 98 99 enum DeviceLogEventCode { 100 DEVICE_LOG_FULL = 1, 101 DEVICE_LOG_EXCEPTION = 2, 102 }; 103 104 struct CastDisplayInfo { 105 CastDisplayState displayState; 106 uint64_t displayId; 107 std::string name; 108 int32_t width; 109 int32_t height; 110 }; 111 } // namespace OHOS::AVSession 112 #endif // OHOS_AVSESSION_DESCRIPTOR_H