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 16 #ifndef OHOS_DCAMERA_SOURCE_CALLBACK_H 17 #define OHOS_DCAMERA_SOURCE_CALLBACK_H 18 19 #include <map> 20 21 #include "dcamera_source_callback_stub.h" 22 #include "idistributed_hardware_source.h" 23 24 namespace OHOS { 25 namespace DistributedHardware { 26 class DCameraSourceCallback : public DCameraSourceCallbackStub { 27 public: 28 DCameraSourceCallback() = default; 29 ~DCameraSourceCallback(); 30 31 int32_t OnNotifyRegResult(const std::string& devId, const std::string& dhId, const std::string& reqId, 32 int32_t status, std::string& data) override; 33 int32_t OnNotifyUnregResult(const std::string& devId, const std::string& dhId, const std::string& reqId, 34 int32_t status, std::string& data) override; 35 36 void PushRegCallback(std::string& reqId, std::shared_ptr<RegisterCallback>& callback); 37 void PopRegCallback(std::string& reqId); 38 void PushUnregCallback(std::string& reqId, std::shared_ptr<UnregisterCallback>& callback); 39 void PopUnregCallback(std::string& reqId); 40 private: 41 std::map<std::string, std::shared_ptr<RegisterCallback>> regCallbacks_; 42 std::map<std::string, std::shared_ptr<UnregisterCallback>> unregCallbacks_; 43 }; 44 } // namespace DistributedHardware 45 } // namespace OHOS 46 #endif // OHOS_DCAMERA_SOURCE_CALLBACK_H 47