1 /* 2 * Copyright (c) 2021 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 #ifndef OHOS_DCAMERA_CHANNEL_INFO_H 16 #define OHOS_DCAMERA_CHANNEL_INFO_H 17 18 #include <cstdint> 19 #include <memory> 20 #include <string> 21 #include <vector> 22 #include "cJSON.h" 23 #include "v1_1/dcamera_types.h" 24 25 namespace OHOS { 26 namespace DistributedHardware { 27 using namespace OHOS::HDI::DistributedCamera::V1_1; 28 class DCameraChannelDetail { 29 public: 30 DCameraChannelDetail() = default; DCameraChannelDetail(std::string dataSessionFlag,DCStreamType streamType)31 DCameraChannelDetail(std::string dataSessionFlag, DCStreamType streamType) 32 : dataSessionFlag_(dataSessionFlag), streamType_(streamType) 33 {} 34 ~DCameraChannelDetail() = default; 35 std::string dataSessionFlag_; 36 DCStreamType streamType_; 37 }; 38 39 class DCameraChannelInfo { 40 public: 41 std::string sourceDevId_; 42 std::vector<DCameraChannelDetail> detail_; 43 }; 44 45 class DCameraChannelInfoCmd { 46 public: 47 std::string type_; 48 std::string dhId_; 49 std::string command_; 50 std::shared_ptr<DCameraChannelInfo> value_; 51 52 public: 53 int32_t Marshal(std::string& jsonStr); 54 int32_t Unmarshal(const std::string& jsonStr); 55 56 private: 57 int32_t UnmarshalDetails(cJSON *details, std::shared_ptr<DCameraChannelInfo> channelInfo); 58 }; 59 } // namespace DistributedHardware 60 } // namespace OHOS 61 #endif // OHOS_DCAMERA_CHANNEL_INFO_H 62