1 /* 2 * Copyright (c) 2022-2025 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 #include "av_trans_control_center_callback.h" 17 18 #include "av_trans_errno.h" 19 #include "distributed_hardware_log.h" 20 21 namespace OHOS { 22 namespace DistributedHardware { SetParameter(uint32_t tag,const std::string & value)23int32_t AVTransControlCenterCallback::SetParameter(uint32_t tag, const std::string &value) 24 { 25 if ((static_cast<AVTransTag>(tag) == AVTransTag::START_AV_SYNC) || 26 (static_cast<AVTransTag>(tag) == AVTransTag::STOP_AV_SYNC) || 27 (static_cast<AVTransTag>(tag) == AVTransTag::TIME_SYNC_RESULT)) { 28 std::shared_ptr<IAVReceiverEngine> rcvEngine = receiverEngine_.lock(); 29 if (rcvEngine != nullptr) { 30 rcvEngine->SetParameter(static_cast<AVTransTag>(tag), value); 31 } 32 } 33 return DH_AVT_SUCCESS; 34 } 35 Notify(const AVTransEventExt & event)36int32_t AVTransControlCenterCallback::Notify(const AVTransEventExt& event) 37 { 38 DHLOGW("AVTransControlCenterCallback::Notify enter."); 39 return DH_AVT_SUCCESS; 40 } 41 SetSenderEngine(const std::shared_ptr<IAVSenderEngine> & sender)42void AVTransControlCenterCallback::SetSenderEngine(const std::shared_ptr<IAVSenderEngine> &sender) 43 { 44 if (sender != nullptr) { 45 senderEngine_ = sender; 46 } 47 } 48 SetReceiverEngine(const std::shared_ptr<IAVReceiverEngine> & receiver)49void AVTransControlCenterCallback::SetReceiverEngine(const std::shared_ptr<IAVReceiverEngine> &receiver) 50 { 51 if (receiver != nullptr) { 52 receiverEngine_ = receiver; 53 } 54 } 55 } 56 }