From 991a5e34eb2dadb9961e31958d69d1b8ba6637d3 Mon Sep 17 00:00:00 2001 From: BrainL Date: Sat, 24 May 2025 10:08:09 +0800 Subject: [PATCH 01/11] merge idl_final Signed-off-by: BrainL Change-Id: I50f484600addf4f9e172b73475b3f3c27f4560a8 --- .../av_trans_control_center_callback.h | 8 +- .../av_trans_control_center_callback_stub.h | 40 ----- .../src/av_trans_control_center_callback.cpp | 21 ++- .../av_trans_control_center_callback_stub.cpp | 94 ------------ .../include/av_trans_control_center.h | 4 +- .../av_trans_control_center_callback_proxy.h | 44 ------ .../services/src/av_trans_control_center.cpp | 7 +- ...av_trans_control_center_callback_proxy.cpp | 141 ------------------ .../avtranscallbacknotify_fuzzer/BUILD.gn | 5 +- .../avtranscallbacknotify_fuzzer.cpp | 3 +- .../BUILD.gn | 5 +- .../avtranscallbacksetparameter_fuzzer.cpp | 2 +- .../BUILD.gn | 6 +- .../avtranscallbacksetsharedmemory_fuzzer.cpp | 3 +- .../BUILD.gn | 5 +- .../avtransstubonremoterequest_fuzzer.cpp | 6 +- .../test/unittest/BUILD.gn | 1 + ...rans_control_center_callback_stub_test.cpp | 18 +-- ..._trans_control_center_callback_stub_test.h | 8 +- .../av_trans_control_center_callback_test.cpp | 10 +- .../av_trans_control_center_callback_test.h | 1 + .../services/av_trans_control_center_test.h | 11 +- .../av_trans_engine/av_receiver/BUILD.gn | 1 + .../test/unittest/av_receiver_engine/BUILD.gn | 2 + .../av_receiver_engine_provider/BUILD.gn | 2 + .../av_trans_engine/av_sender/BUILD.gn | 1 + .../test/unittest/av_sender_engine/BUILD.gn | 2 + .../av_sender_engine_provider/BUILD.gn | 2 + av_transport/common/include/av_sync_utils.h | 42 ++++++ av_transport/common/include/av_trans_types.h | 44 ++++++ bundle.json | 1 - common/utils/include/idistributed_hardware.h | 2 +- interfaces/inner_kits/BUILD.gn | 71 ++++++++- .../IAvTransControlCenterCallback.idl | 66 +++----- .../include/distributed_hardware_fwk_kit.h | 5 +- .../inner_kits/include/ipc/dhfwk_sa_manager.h | 4 +- .../include/ipc/distributed_hardware_proxy.h | 2 +- .../src/distributed_hardware_fwk_kit.cpp | 2 +- .../inner_kits/src/ipc/dhfwk_sa_manager.cpp | 2 +- .../src/ipc/distributed_hardware_proxy.cpp | 2 +- .../src/distributed_hardware_fwk_kit_test.cpp | 2 +- .../include/dhfwk_sa_manager_test.h | 2 +- .../include/distributed_hardware_proxy_test.h | 2 +- .../src/distributed_hardware_proxy_test.cpp | 4 +- .../distributedhardwarefwkservice/BUILD.gn | 3 +- .../include/distributed_hardware_service.h | 2 +- .../src/distributed_hardware_service.cpp | 2 +- .../src/distributed_hardware_stub.cpp | 3 +- utils/BUILD.gn | 5 +- 49 files changed, 288 insertions(+), 433 deletions(-) delete mode 100644 av_transport/av_trans_control_center/inner_kits/include/av_trans_control_center_callback_stub.h delete mode 100644 av_transport/av_trans_control_center/inner_kits/src/av_trans_control_center_callback_stub.cpp delete mode 100644 av_transport/av_trans_control_center/services/include/ipc/av_trans_control_center_callback_proxy.h delete mode 100644 av_transport/av_trans_control_center/services/src/ipc/av_trans_control_center_callback_proxy.cpp rename common/utils/include/iav_trans_control_center_callback.h => interfaces/inner_kits/IAvTransControlCenterCallback.idl (43%) diff --git a/av_transport/av_trans_control_center/inner_kits/include/av_trans_control_center_callback.h b/av_transport/av_trans_control_center/inner_kits/include/av_trans_control_center_callback.h index 8ec6257c..ce9ec43e 100644 --- a/av_transport/av_trans_control_center/inner_kits/include/av_trans_control_center_callback.h +++ b/av_transport/av_trans_control_center/inner_kits/include/av_trans_control_center_callback.h @@ -23,14 +23,14 @@ namespace OHOS { namespace DistributedHardware { -class AVTransControlCenterCallback : public AVTransControlCenterCallbackStub { +class AVTransControlCenterCallback : public AvTransControlCenterCallbackStub { public: AVTransControlCenterCallback() = default; ~AVTransControlCenterCallback() override = default; - int32_t SetParameter(AVTransTag tag, const std::string &value) override; - int32_t SetSharedMemory(const AVTransSharedMemory &memory) override; - int32_t Notify(const AVTransEvent &event) override; + int32_t SetParameter(uint32_t tag, const std::string &value) override; + int32_t SetSharedMemory(const AVTransSharedMemoryExt& memory) override; + int32_t Notify(const AVTransEventExt& event) override; void SetSenderEngine(const std::shared_ptr &sender); void SetReceiverEngine(const std::shared_ptr &receiver); diff --git a/av_transport/av_trans_control_center/inner_kits/include/av_trans_control_center_callback_stub.h b/av_transport/av_trans_control_center/inner_kits/include/av_trans_control_center_callback_stub.h deleted file mode 100644 index 57327328..00000000 --- a/av_transport/av_trans_control_center/inner_kits/include/av_trans_control_center_callback_stub.h +++ /dev/null @@ -1,40 +0,0 @@ -/* - * Copyright (c) 2021 Huawei Device Co., Ltd. - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -#ifndef OHOS_AV_TRANS_CONTROL_CENTER_CALLBACK_STUB_H -#define OHOS_AV_TRANS_CONTROL_CENTER_CALLBACK_STUB_H - -#include "iremote_stub.h" -#include "iav_trans_control_center_callback.h" - -namespace OHOS { -namespace DistributedHardware { -class AVTransControlCenterCallbackStub : public IRemoteStub { -public: - AVTransControlCenterCallbackStub(); - virtual ~AVTransControlCenterCallbackStub() override; - int32_t OnRemoteRequest(uint32_t code, MessageParcel &data, MessageParcel &reply, MessageOption &option) override; - -private: - int32_t SetParameterInner(MessageParcel &data, MessageParcel &reply); - int32_t SetSharedMemoryInner(MessageParcel &data, MessageParcel &reply); - int32_t NotifyInner(MessageParcel &data, MessageParcel &reply); - -private: - DISALLOW_COPY_AND_MOVE(AVTransControlCenterCallbackStub); -}; -} // namespace DistributedHardware -} // namespace OHOS -#endif // OHOS_AV_TRANS_CONTROL_CENTER_CALLBACK_STUB_H diff --git a/av_transport/av_trans_control_center/inner_kits/src/av_trans_control_center_callback.cpp b/av_transport/av_trans_control_center/inner_kits/src/av_trans_control_center_callback.cpp index 832d0079..5acb9d5c 100644 --- a/av_transport/av_trans_control_center/inner_kits/src/av_trans_control_center_callback.cpp +++ b/av_transport/av_trans_control_center/inner_kits/src/av_trans_control_center_callback.cpp @@ -20,36 +20,41 @@ namespace OHOS { namespace DistributedHardware { -int32_t AVTransControlCenterCallback::SetParameter(AVTransTag tag, const std::string &value) +int32_t AVTransControlCenterCallback::SetParameter(uint32_t tag, const std::string &value) { - if ((tag == AVTransTag::START_AV_SYNC) || (tag == AVTransTag::STOP_AV_SYNC) || - (tag == AVTransTag::TIME_SYNC_RESULT)) { + if ((static_cast(tag) == AVTransTag::START_AV_SYNC) || (static_cast(tag) == AVTransTag::STOP_AV_SYNC) || + (static_cast(tag) == AVTransTag::TIME_SYNC_RESULT)) { std::shared_ptr rcvEngine = receiverEngine_.lock(); if (rcvEngine != nullptr) { - rcvEngine->SetParameter(tag, value); + rcvEngine->SetParameter(static_cast(tag), value); } } return DH_AVT_SUCCESS; } -int32_t AVTransControlCenterCallback::SetSharedMemory(const AVTransSharedMemory &memory) +int32_t AVTransControlCenterCallback::SetSharedMemory(const AVTransSharedMemoryExt& memory) { DHLOGW("AVTransControlCenterCallback::SetSharedMemory enter."); + AVTransSharedMemory memoryTrans; + memoryTrans.size = memory.size; + memoryTrans.fd = memory.fd; + memoryTrans.name = memory.name; + std::shared_ptr sendEngine = senderEngine_.lock(); if (sendEngine != nullptr) { - sendEngine->SetParameter(AVTransTag::SHARED_MEMORY_FD, MarshalSharedMemory(memory)); + sendEngine->SetParameter(AVTransTag::SHARED_MEMORY_FD, MarshalSharedMemory(memoryTrans)); } std::shared_ptr rcvEngine = receiverEngine_.lock(); if (rcvEngine != nullptr) { - rcvEngine->SetParameter(AVTransTag::SHARED_MEMORY_FD, MarshalSharedMemory(memory)); + rcvEngine->SetParameter(AVTransTag::SHARED_MEMORY_FD, MarshalSharedMemory(memoryTrans)); } return DH_AVT_SUCCESS; } -int32_t AVTransControlCenterCallback::Notify(const AVTransEvent& event) +int32_t AVTransControlCenterCallback::Notify(const AVTransEventExt& event) { DHLOGW("AVTransControlCenterCallback::Notify enter."); return DH_AVT_SUCCESS; diff --git a/av_transport/av_trans_control_center/inner_kits/src/av_trans_control_center_callback_stub.cpp b/av_transport/av_trans_control_center/inner_kits/src/av_trans_control_center_callback_stub.cpp deleted file mode 100644 index 696bfb12..00000000 --- a/av_transport/av_trans_control_center/inner_kits/src/av_trans_control_center_callback_stub.cpp +++ /dev/null @@ -1,94 +0,0 @@ -/* - * Copyright (c) 2022 Huawei Device Co., Ltd. - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -#include "av_trans_control_center_callback_stub.h" - -#include "av_trans_errno.h" -#include "distributed_hardware_log.h" - -namespace OHOS { -namespace DistributedHardware { -AVTransControlCenterCallbackStub::AVTransControlCenterCallbackStub() -{ -} - -AVTransControlCenterCallbackStub::~AVTransControlCenterCallbackStub() -{ -} - -int32_t AVTransControlCenterCallbackStub::OnRemoteRequest(uint32_t code, - MessageParcel &data, MessageParcel &reply, MessageOption &option) -{ - (void)option; - if (data.ReadInterfaceToken() != GetDescriptor()) { - DHLOGE("Read valid token failed"); - return ERR_INVALID_DATA; - } - switch (code) { - case (uint32_t)IAVTransControlCenterCallback::Message::SET_PARAMETER: { - return SetParameterInner(data, reply); - } - case (uint32_t)IAVTransControlCenterCallback::Message::SET_SHARED_MEMORY: { - return SetSharedMemoryInner(data, reply); - } - case (uint32_t)IAVTransControlCenterCallback::Message::NOTIFY_AV_EVENT: { - return NotifyInner(data, reply); - } - default: - return IPCObjectStub::OnRemoteRequest(code, data, reply, option); - } - - return NO_ERROR; -} - -int32_t AVTransControlCenterCallbackStub::SetParameterInner(MessageParcel &data, MessageParcel &reply) -{ - uint32_t transTag = data.ReadUint32(); - std::string tagValue = data.ReadString(); - int32_t ret = SetParameter((AVTransTag)transTag, tagValue); - if (!reply.WriteInt32(ret)) { - DHLOGE("Write ret code failed"); - return ERR_DH_AVT_SERVICE_WRITE_INFO_FAIL; - } - return NO_ERROR; -} - -int32_t AVTransControlCenterCallbackStub::SetSharedMemoryInner(MessageParcel &data, MessageParcel &reply) -{ - int32_t fd = data.ReadFileDescriptor(); - int32_t size = data.ReadInt32(); - std::string name = data.ReadString(); - int32_t ret = SetSharedMemory(AVTransSharedMemory{ fd, size, name }); - if (!reply.WriteInt32(ret)) { - DHLOGE("Write ret code failed"); - return ERR_DH_AVT_SERVICE_WRITE_INFO_FAIL; - } - return NO_ERROR; -} - -int32_t AVTransControlCenterCallbackStub::NotifyInner(MessageParcel &data, MessageParcel &reply) -{ - uint32_t type = data.ReadUint32(); - std::string content = data.ReadString(); - std::string peerDevId = data.ReadString(); - int32_t ret = Notify(AVTransEvent{(EventType)type, content, peerDevId}); - if (!reply.WriteInt32(ret)) { - DHLOGE("Write ret code failed"); - return ERR_DH_AVT_SERVICE_WRITE_INFO_FAIL; - } - return NO_ERROR; -} -} // namespace DistributedHardware -} // namespace OHOS \ No newline at end of file diff --git a/av_transport/av_trans_control_center/services/include/av_trans_control_center.h b/av_transport/av_trans_control_center/services/include/av_trans_control_center.h index 4f97415c..a537850c 100644 --- a/av_transport/av_trans_control_center/services/include/av_trans_control_center.h +++ b/av_transport/av_trans_control_center/services/include/av_trans_control_center.h @@ -35,7 +35,7 @@ public: int32_t ReleaseAVCenter(int32_t engineId); int32_t CreateControlChannel(int32_t engineId, const std::string &peerDevId); int32_t NotifyAVCenter(int32_t engineId, const AVTransEvent &event); - int32_t RegisterCtlCenterCallback(int32_t engineId, const sptr &callback); + int32_t RegisterCtlCenterCallback(int32_t engineId, const sptr &callback); // interfaces from ISoftbusChannelListener void OnChannelEvent(const AVTransEvent &event) override; @@ -64,7 +64,7 @@ private: std::vector connectedDevIds_; std::map engine2DevIdMap_; - std::map> callbackMap_; + std::map> callbackMap_; }; } } diff --git a/av_transport/av_trans_control_center/services/include/ipc/av_trans_control_center_callback_proxy.h b/av_transport/av_trans_control_center/services/include/ipc/av_trans_control_center_callback_proxy.h deleted file mode 100644 index 9b657f4b..00000000 --- a/av_transport/av_trans_control_center/services/include/ipc/av_trans_control_center_callback_proxy.h +++ /dev/null @@ -1,44 +0,0 @@ -/* - * Copyright (c) 2021 Huawei Device Co., Ltd. - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -#ifndef OHOS_AV_TRANS_CONTROL_CENTER_CALLBACK_PROXY_H -#define OHOS_AV_TRANS_CONTROL_CENTER_CALLBACK_PROXY_H - -#include - -#include "iremote_proxy.h" -#include "refbase.h" -#include "iav_trans_control_center_callback.h" - -namespace OHOS { -namespace DistributedHardware { -class AVTransControlCenterCallbackProxy : public IRemoteProxy { -public: - explicit AVTransControlCenterCallbackProxy(const sptr &impl) - : IRemoteProxy(impl) - { - } - virtual ~AVTransControlCenterCallbackProxy() {} - - int32_t SetParameter(AVTransTag tag, const std::string &value) override; - int32_t SetSharedMemory(const AVTransSharedMemory &memory) override; - int32_t Notify(const AVTransEvent &event) override; - -private: - static inline BrokerDelegator delegator_; -}; -} // namespace DistributedHardware -} // namespace OHOS -#endif // OHOS_AV_TRANS_CONTROL_CENTER_CALLBACK_PROXY_H diff --git a/av_transport/av_trans_control_center/services/src/av_trans_control_center.cpp b/av_transport/av_trans_control_center/services/src/av_trans_control_center.cpp index 525791ad..e2760eb1 100644 --- a/av_transport/av_trans_control_center/services/src/av_trans_control_center.cpp +++ b/av_transport/av_trans_control_center/services/src/av_trans_control_center.cpp @@ -17,6 +17,7 @@ #include "anonymous_string.h" #include "av_trans_log.h" +#include "av_trans_errno.h" namespace OHOS { namespace DistributedHardware { @@ -202,7 +203,7 @@ int32_t AVTransControlCenter::NotifyAVCenter(int32_t engineId, const AVTransEven } int32_t AVTransControlCenter::RegisterCtlCenterCallback(int32_t engineId, - const sptr &callback) + const sptr &callback) { TRUE_RETURN_V_MSG_E(IsInvalidEngineId(engineId), ERR_DH_AVT_INVALID_PARAM_VALUE, "Invalid input engine id = %{public}d", engineId); @@ -232,7 +233,7 @@ void AVTransControlCenter::SetParam2Engines(AVTransTag tag, const std::string &v std::lock_guard lock(callbackMutex_); for (auto iter = callbackMap_.begin(); iter != callbackMap_.end(); iter++) { if (iter->second != nullptr) { - iter->second->SetParameter(tag, value); + iter->second->SetParameter(static_cast(tag), value); } } } @@ -242,7 +243,7 @@ void AVTransControlCenter::SetParam2Engines(const AVTransSharedMemory &memory) std::lock_guard lock(callbackMutex_); for (auto iter = callbackMap_.begin(); iter != callbackMap_.end(); iter++) { if (iter->second != nullptr) { - iter->second->SetSharedMemory(memory); + iter->second->SetSharedMemory(AVTransSharedMemoryExt(memory)); } } } diff --git a/av_transport/av_trans_control_center/services/src/ipc/av_trans_control_center_callback_proxy.cpp b/av_transport/av_trans_control_center/services/src/ipc/av_trans_control_center_callback_proxy.cpp deleted file mode 100644 index 7a6268f7..00000000 --- a/av_transport/av_trans_control_center/services/src/ipc/av_trans_control_center_callback_proxy.cpp +++ /dev/null @@ -1,141 +0,0 @@ -/* - * Copyright (c) 2022 Huawei Device Co., Ltd. - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -#include "av_trans_control_center_callback_proxy.h" - -#include -#include "parcel.h" - -#include "av_trans_constants.h" -#include "av_trans_errno.h" -#include "av_trans_log.h" -#include "av_trans_types.h" - -namespace OHOS { -namespace DistributedHardware { -#undef DH_LOG_TAG -#define DH_LOG_TAG "AVTransControlCenterCallbackProxy" - -int32_t AVTransControlCenterCallbackProxy::SetParameter(AVTransTag tag, const std::string& value) -{ - sptr remote = Remote(); - if (remote == nullptr) { - AVTRANS_LOGE("remote service is null"); - return ERR_DH_AVT_SERVICE_REMOTE_IS_NULL; - } - - MessageParcel data; - MessageParcel reply; - MessageOption option; - - if (!data.WriteInterfaceToken(GetDescriptor())) { - AVTRANS_LOGE("WriteInterfaceToken fail!"); - return ERR_DH_AVT_SERVICE_WRITE_TOKEN_FAIL; - } - if (!data.WriteUint32((uint32_t)tag)) { - AVTRANS_LOGE("Write tag failed"); - return ERR_DH_AVT_SERVICE_WRITE_INFO_FAIL; - } - if (!data.WriteString(value)) { - AVTRANS_LOGE("Write value failed"); - return ERR_DH_AVT_SERVICE_WRITE_INFO_FAIL; - } - int32_t ret = remote->SendRequest((uint32_t)IAVTransControlCenterCallback::Message::SET_PARAMETER, - data, reply, option); - if (ret != NO_ERROR) { - AVTRANS_LOGE("Send Request failed, ret: %{public}d", ret); - return ERR_DH_AVT_SERVICE_IPC_SEND_REQUEST_FAIL; - } - - return reply.ReadInt32(); -} - -int32_t AVTransControlCenterCallbackProxy::SetSharedMemory(const AVTransSharedMemory &memory) -{ - sptr remote = Remote(); - if (remote == nullptr) { - AVTRANS_LOGE("remote service is null"); - return ERR_DH_AVT_SERVICE_REMOTE_IS_NULL; - } - - MessageParcel data; - MessageParcel reply; - MessageOption option; - - if (!data.WriteInterfaceToken(GetDescriptor())) { - AVTRANS_LOGE("WriteInterfaceToken fail!"); - return ERR_DH_AVT_SERVICE_WRITE_TOKEN_FAIL; - } - if (!data.WriteFileDescriptor(memory.fd)) { - AVTRANS_LOGE("Write memory fd failed"); - return ERR_DH_AVT_SERVICE_WRITE_INFO_FAIL; - } - if (!data.WriteInt32(memory.size)) { - AVTRANS_LOGE("Write memory size failed"); - return ERR_DH_AVT_SERVICE_WRITE_INFO_FAIL; - } - if (!data.WriteString(memory.name)) { - AVTRANS_LOGE("Write memory name failed"); - return ERR_DH_AVT_SERVICE_WRITE_INFO_FAIL; - } - int32_t ret = remote->SendRequest((uint32_t)IAVTransControlCenterCallback::Message::SET_SHARED_MEMORY, - data, reply, option); - if (ret != NO_ERROR) { - AVTRANS_LOGE("Send Request failed, ret: %{public}d", ret); - return ERR_DH_AVT_SERVICE_IPC_SEND_REQUEST_FAIL; - } - - return reply.ReadInt32(); -} - -int32_t AVTransControlCenterCallbackProxy::Notify(const AVTransEvent& event) -{ - sptr remote = Remote(); - if (remote == nullptr) { - AVTRANS_LOGE("remote service is null"); - return ERR_DH_AVT_SERVICE_REMOTE_IS_NULL; - } - - MessageParcel data; - MessageParcel reply; - MessageOption option; - - if (!data.WriteInterfaceToken(GetDescriptor())) { - AVTRANS_LOGE("WriteInterfaceToken fail!"); - return ERR_DH_AVT_SERVICE_WRITE_TOKEN_FAIL; - } - if (!data.WriteUint32((uint32_t)event.type)) { - AVTRANS_LOGE("Write event type failed"); - return ERR_DH_AVT_SERVICE_WRITE_INFO_FAIL; - } - if (!data.WriteString(event.content)) { - AVTRANS_LOGE("Write event content failed"); - return ERR_DH_AVT_SERVICE_WRITE_INFO_FAIL; - } - if (!data.WriteString(event.peerDevId)) { - AVTRANS_LOGE("Write event peerDevId failed"); - return ERR_DH_AVT_SERVICE_WRITE_INFO_FAIL; - } - int32_t ret = remote->SendRequest((uint32_t)IAVTransControlCenterCallback::Message::NOTIFY_AV_EVENT, - data, reply, option); - if (ret != NO_ERROR) { - AVTRANS_LOGE("Send Request failed, ret: %{public}d", ret); - return ERR_DH_AVT_SERVICE_IPC_SEND_REQUEST_FAIL; - } - - return reply.ReadInt32(); -} -} // namespace DistributedHardware -} // namespace OHOS \ No newline at end of file diff --git a/av_transport/av_trans_control_center/test/fuzztest/avtranscallbacknotify_fuzzer/BUILD.gn b/av_transport/av_trans_control_center/test/fuzztest/avtranscallbacknotify_fuzzer/BUILD.gn index b9a4c6ab..94d26625 100644 --- a/av_transport/av_trans_control_center/test/fuzztest/avtranscallbacknotify_fuzzer/BUILD.gn +++ b/av_transport/av_trans_control_center/test/fuzztest/avtranscallbacknotify_fuzzer/BUILD.gn @@ -40,7 +40,10 @@ ohos_fuzztest("AVTransCallbackNotifyFuzzTest") { sources = [ "avtranscallbacknotify_fuzzer.cpp" ] - deps = [ "${dh_fwk_sdk_path}:libdhfwk_sdk" ] + deps = [ + "${dh_fwk_sdk_path}:dhfwk_idl_hardware_head", + "${dh_fwk_sdk_path}:libdhfwk_sdk", + ] defines = [ "HI_LOG_ENABLE", diff --git a/av_transport/av_trans_control_center/test/fuzztest/avtranscallbacknotify_fuzzer/avtranscallbacknotify_fuzzer.cpp b/av_transport/av_trans_control_center/test/fuzztest/avtranscallbacknotify_fuzzer/avtranscallbacknotify_fuzzer.cpp index 50336f17..b47dab2d 100644 --- a/av_transport/av_trans_control_center/test/fuzztest/avtranscallbacknotify_fuzzer/avtranscallbacknotify_fuzzer.cpp +++ b/av_transport/av_trans_control_center/test/fuzztest/avtranscallbacknotify_fuzzer/avtranscallbacknotify_fuzzer.cpp @@ -30,11 +30,12 @@ void AVTransCallbackNotifyFuzzTest(const uint8_t *data, size_t size) std::string content(reinterpret_cast(data), size); std::string peerDevId(reinterpret_cast(data), size); AVTransEvent event = AVTransEvent{ type, content, peerDevId }; + AVTransEventExt eventExt = AVTransEventExt(event); sptr controlCenterCallback(new (std::nothrow) AVTransControlCenterCallback()); if (controlCenterCallback == nullptr) { return; } - controlCenterCallback->Notify(event); + controlCenterCallback->Notify(eventExt); } } // namespace DistributedHardware } // namespace OHOS diff --git a/av_transport/av_trans_control_center/test/fuzztest/avtranscallbacksetparameter_fuzzer/BUILD.gn b/av_transport/av_trans_control_center/test/fuzztest/avtranscallbacksetparameter_fuzzer/BUILD.gn index 63c488d7..2bba786f 100644 --- a/av_transport/av_trans_control_center/test/fuzztest/avtranscallbacksetparameter_fuzzer/BUILD.gn +++ b/av_transport/av_trans_control_center/test/fuzztest/avtranscallbacksetparameter_fuzzer/BUILD.gn @@ -40,7 +40,10 @@ ohos_fuzztest("AVTransCallbackSetParameterFuzzTest") { sources = [ "avtranscallbacksetparameter_fuzzer.cpp" ] - deps = [ "${dh_fwk_sdk_path}:libdhfwk_sdk" ] + deps = [ + "${dh_fwk_sdk_path}:dhfwk_idl_hardware_head", + "${dh_fwk_sdk_path}:libdhfwk_sdk", + ] defines = [ "HI_LOG_ENABLE", diff --git a/av_transport/av_trans_control_center/test/fuzztest/avtranscallbacksetparameter_fuzzer/avtranscallbacksetparameter_fuzzer.cpp b/av_transport/av_trans_control_center/test/fuzztest/avtranscallbacksetparameter_fuzzer/avtranscallbacksetparameter_fuzzer.cpp index 7ab4a3a9..1835c39f 100644 --- a/av_transport/av_trans_control_center/test/fuzztest/avtranscallbacksetparameter_fuzzer/avtranscallbacksetparameter_fuzzer.cpp +++ b/av_transport/av_trans_control_center/test/fuzztest/avtranscallbacksetparameter_fuzzer/avtranscallbacksetparameter_fuzzer.cpp @@ -32,7 +32,7 @@ void AVTransCallbackSetParameterFuzzTest(const uint8_t *data, size_t size) if (controlCenterCallback == nullptr) { return; } - controlCenterCallback->SetParameter(tag, value); + controlCenterCallback->SetParameter((uint32_t)tag, value); } } // namespace DistributedHardware } // namespace OHOS diff --git a/av_transport/av_trans_control_center/test/fuzztest/avtranscallbacksetsharedmemory_fuzzer/BUILD.gn b/av_transport/av_trans_control_center/test/fuzztest/avtranscallbacksetsharedmemory_fuzzer/BUILD.gn index 9f17b28c..e19d3859 100644 --- a/av_transport/av_trans_control_center/test/fuzztest/avtranscallbacksetsharedmemory_fuzzer/BUILD.gn +++ b/av_transport/av_trans_control_center/test/fuzztest/avtranscallbacksetsharedmemory_fuzzer/BUILD.gn @@ -39,8 +39,10 @@ ohos_fuzztest("AVTransCallbackSetSharedMemoryFuzzTest") { sources = [ "avtranscallbacksetsharedmemory_fuzzer.cpp" ] - deps = [ "${dh_fwk_sdk_path}:libdhfwk_sdk" ] - + deps = [ + "${dh_fwk_sdk_path}:dhfwk_idl_hardware_head", + "${dh_fwk_sdk_path}:libdhfwk_sdk", + ] defines = [ "HI_LOG_ENABLE", "DH_LOG_TAG=\"AVTransCallbackSetSharedMemoryFuzzTest\"", diff --git a/av_transport/av_trans_control_center/test/fuzztest/avtranscallbacksetsharedmemory_fuzzer/avtranscallbacksetsharedmemory_fuzzer.cpp b/av_transport/av_trans_control_center/test/fuzztest/avtranscallbacksetsharedmemory_fuzzer/avtranscallbacksetsharedmemory_fuzzer.cpp index 66c5c5ef..38d8c1d0 100644 --- a/av_transport/av_trans_control_center/test/fuzztest/avtranscallbacksetsharedmemory_fuzzer/avtranscallbacksetsharedmemory_fuzzer.cpp +++ b/av_transport/av_trans_control_center/test/fuzztest/avtranscallbacksetsharedmemory_fuzzer/avtranscallbacksetsharedmemory_fuzzer.cpp @@ -31,11 +31,12 @@ void AVTransCallbackSetSharedMemoryFuzzTest(const uint8_t *data, size_t size) int32_t len = fdp.ConsumeIntegral(); std::string name(reinterpret_cast(data), size); AVTransSharedMemory memory = AVTransSharedMemory{ fd, len, name }; + AVTransSharedMemoryExt memoryExt = AVTransSharedMemoryExt(memory); sptr controlCenterCallback(new (std::nothrow) AVTransControlCenterCallback()); if (controlCenterCallback == nullptr) { return; } - controlCenterCallback->SetSharedMemory(memory); + controlCenterCallback->SetSharedMemory(memoryExt); } } // namespace DistributedHardware } // namespace OHOS diff --git a/av_transport/av_trans_control_center/test/fuzztest/avtransstubonremoterequest_fuzzer/BUILD.gn b/av_transport/av_trans_control_center/test/fuzztest/avtransstubonremoterequest_fuzzer/BUILD.gn index 6ce4af8e..b1580d67 100644 --- a/av_transport/av_trans_control_center/test/fuzztest/avtransstubonremoterequest_fuzzer/BUILD.gn +++ b/av_transport/av_trans_control_center/test/fuzztest/avtransstubonremoterequest_fuzzer/BUILD.gn @@ -40,7 +40,10 @@ ohos_fuzztest("AVTransStubOnRemoteRequestFuzzTest") { sources = [ "avtransstubonremoterequest_fuzzer.cpp" ] - deps = [ "${dh_fwk_sdk_path}:libdhfwk_sdk" ] + deps = [ + "${dh_fwk_sdk_path}:dhfwk_idl_hardware_head", + "${dh_fwk_sdk_path}:libdhfwk_sdk", + ] defines = [ "HI_LOG_ENABLE", diff --git a/av_transport/av_trans_control_center/test/fuzztest/avtransstubonremoterequest_fuzzer/avtransstubonremoterequest_fuzzer.cpp b/av_transport/av_trans_control_center/test/fuzztest/avtransstubonremoterequest_fuzzer/avtransstubonremoterequest_fuzzer.cpp index 984fa7a6..c1ae3c63 100644 --- a/av_transport/av_trans_control_center/test/fuzztest/avtransstubonremoterequest_fuzzer/avtransstubonremoterequest_fuzzer.cpp +++ b/av_transport/av_trans_control_center/test/fuzztest/avtransstubonremoterequest_fuzzer/avtransstubonremoterequest_fuzzer.cpp @@ -47,18 +47,18 @@ void AVTransStubOnRemoteRequestFuzzTest(const uint8_t *data, size_t size) MessageOption option; pdata.WriteInterfaceToken(AVTransControlCenterCallback::GetDescriptor()); uint32_t code = *(reinterpret_cast(data)) % DC_MESSAGE_SIZE; - if (code == (uint32_t)IAVTransControlCenterCallback::Message::SET_PARAMETER) { + if (code == (uint32_t)IAvTransControlCenterCallbackIpcCode::COMMAND_SET_PARAMETER) { uint32_t tag = *(reinterpret_cast(data)); std::string value(reinterpret_cast(data), size); pdata.WriteUint32(tag); pdata.WriteString(value); - } else if (code == (uint32_t)IAVTransControlCenterCallback::Message::SET_SHARED_MEMORY) { + } else if (code == (uint32_t)IAvTransControlCenterCallbackIpcCode::COMMAND_SET_SHARED_MEMORY) { FuzzedDataProvider fdp(data, size); int32_t len = fdp.ConsumeIntegral(); std::string name(reinterpret_cast(data), size); pdata.WriteInt32(len); pdata.WriteString(name); - } else if (code == (uint32_t)IAVTransControlCenterCallback::Message::NOTIFY_AV_EVENT) { + } else if (code == (uint32_t)IAvTransControlCenterCallbackIpcCode::COMMAND_NOTIFY) { uint32_t type = *(reinterpret_cast(data)); std::string content(reinterpret_cast(data), size); std::string devId(reinterpret_cast(data), size); diff --git a/av_transport/av_trans_control_center/test/unittest/BUILD.gn b/av_transport/av_trans_control_center/test/unittest/BUILD.gn index 42b720d8..116ac0f3 100644 --- a/av_transport/av_trans_control_center/test/unittest/BUILD.gn +++ b/av_transport/av_trans_control_center/test/unittest/BUILD.gn @@ -48,6 +48,7 @@ ohos_unittest("AvTransControlCenterTest") { configs = [ ":module_private_config" ] deps = [ + "${dh_fwk_sdk_path}:dhfwk_idl_hardware_head", "${dh_fwk_sdk_path}:libdhfwk_sdk", "${dh_fwk_services_path}/distributedhardwarefwkservice:distributedhardwarefwksvr", ] diff --git a/av_transport/av_trans_control_center/test/unittest/inner_kits/av_trans_control_center_callback_stub_test.cpp b/av_transport/av_trans_control_center/test/unittest/inner_kits/av_trans_control_center_callback_stub_test.cpp index 9095fae3..c5f72b26 100644 --- a/av_transport/av_trans_control_center/test/unittest/inner_kits/av_trans_control_center_callback_stub_test.cpp +++ b/av_transport/av_trans_control_center/test/unittest/inner_kits/av_trans_control_center_callback_stub_test.cpp @@ -37,20 +37,20 @@ void AVTransControlCenterCallbackStubTest::TearDown() } int32_t AVTransControlCenterCallbackStubTest::TestControlCenterCallbackStub::SetParameter( - AVTransTag tag, const std::string &value) + uint32_t tag, const std::string &value) { (void) tag; (void) value; return DH_AVT_SUCCESS; } int32_t AVTransControlCenterCallbackStubTest::TestControlCenterCallbackStub::SetSharedMemory( - const AVTransSharedMemory &memory) + const AVTransSharedMemoryExt &memory) { (void) memory; return DH_AVT_SUCCESS; } int32_t AVTransControlCenterCallbackStubTest::TestControlCenterCallbackStub::Notify( - const AVTransEvent &event) + const AVTransEventExt &event) { (void) event; return DH_AVT_SUCCESS; @@ -65,11 +65,11 @@ int32_t AVTransControlCenterCallbackStubTest::TestControlCenterCallbackStub::Not HWTEST_F(AVTransControlCenterCallbackStubTest, set_parameter_001, TestSize.Level0) { sptr CallbackStubPtr(new TestControlCenterCallbackStub()); - AVTransControlCenterCallbackProxy callbackProxy(CallbackStubPtr); + AvTransControlCenterCallbackProxy callbackProxy(CallbackStubPtr); AVTransTag tag = AVTransTag::STOP_AV_SYNC; std::string value = "value"; - int32_t ret = callbackProxy.SetParameter(tag, value); + int32_t ret = callbackProxy.SetParameter((uint32_t)tag, value); EXPECT_EQ(NO_ERROR, ret); } @@ -82,9 +82,9 @@ HWTEST_F(AVTransControlCenterCallbackStubTest, set_parameter_001, TestSize.Level HWTEST_F(AVTransControlCenterCallbackStubTest, set_shared_memory_001, TestSize.Level1) { sptr CallbackStubPtr(new TestControlCenterCallbackStub()); - AVTransControlCenterCallbackProxy callbackProxy(CallbackStubPtr); + AvTransControlCenterCallbackProxy callbackProxy(CallbackStubPtr); - AVTransSharedMemory memory; + AVTransSharedMemoryExt memory; memory.name = "AVTransSharedMemory"; int32_t ret = callbackProxy.SetSharedMemory(memory); EXPECT_EQ(NO_ERROR, ret); @@ -99,9 +99,9 @@ HWTEST_F(AVTransControlCenterCallbackStubTest, set_shared_memory_001, TestSize.L HWTEST_F(AVTransControlCenterCallbackStubTest, notify_001, TestSize.Level0) { sptr CallbackStubPtr(new TestControlCenterCallbackStub()); - AVTransControlCenterCallbackProxy callbackProxy(CallbackStubPtr); + AvTransControlCenterCallbackProxy callbackProxy(CallbackStubPtr); - AVTransEvent event; + AVTransEventExt event; event.content = "content"; int32_t ret = callbackProxy.Notify(event); EXPECT_EQ(NO_ERROR, ret); diff --git a/av_transport/av_trans_control_center/test/unittest/inner_kits/av_trans_control_center_callback_stub_test.h b/av_transport/av_trans_control_center/test/unittest/inner_kits/av_trans_control_center_callback_stub_test.h index 7bbbaf0d..bc3680d9 100644 --- a/av_transport/av_trans_control_center/test/unittest/inner_kits/av_trans_control_center_callback_stub_test.h +++ b/av_transport/av_trans_control_center/test/unittest/inner_kits/av_trans_control_center_callback_stub_test.h @@ -28,13 +28,13 @@ public: void SetUp(); void TearDown(); - class TestControlCenterCallbackStub : public OHOS::DistributedHardware::AVTransControlCenterCallbackStub { + class TestControlCenterCallbackStub : public OHOS::DistributedHardware::AvTransControlCenterCallbackStub { public: TestControlCenterCallbackStub() = default; virtual ~TestControlCenterCallbackStub() = default; - int32_t SetParameter(AVTransTag tag, const std::string &value) override; - int32_t SetSharedMemory(const AVTransSharedMemory &memory) override; - int32_t Notify(const AVTransEvent &event) override; + int32_t SetParameter(uint32_t tag, const std::string &value) override; + int32_t SetSharedMemory(const AVTransSharedMemoryExt &memory) override; + int32_t Notify(const AVTransEventExt &event) override; }; }; } // namespace DistributedHardware diff --git a/av_transport/av_trans_control_center/test/unittest/inner_kits/av_trans_control_center_callback_test.cpp b/av_transport/av_trans_control_center/test/unittest/inner_kits/av_trans_control_center_callback_test.cpp index 3cf33725..c3408209 100644 --- a/av_transport/av_trans_control_center/test/unittest/inner_kits/av_trans_control_center_callback_test.cpp +++ b/av_transport/av_trans_control_center/test/unittest/inner_kits/av_trans_control_center_callback_test.cpp @@ -46,7 +46,7 @@ HWTEST_F(AVTransControlCenterCallbackTest, set_parameter_001, TestSize.Level0) callBack_->senderEngine_ = std::shared_ptr(); AVTransTag tag = AVTransTag::START_AV_SYNC; std::string value; - int32_t ret = callBack_->SetParameter(tag, value); + int32_t ret = callBack_->SetParameter((uint32_t)tag, value); EXPECT_EQ(DH_AVT_SUCCESS, ret); } @@ -63,7 +63,7 @@ HWTEST_F(AVTransControlCenterCallbackTest, set_parameter_002, TestSize.Level0) callBack_->senderEngine_ = std::shared_ptr(); AVTransTag tag = AVTransTag::STOP_AV_SYNC; std::string value; - int32_t ret = callBack_->SetParameter(tag, value); + int32_t ret = callBack_->SetParameter((uint32_t)tag, value); EXPECT_EQ(DH_AVT_SUCCESS, ret); } @@ -80,7 +80,7 @@ HWTEST_F(AVTransControlCenterCallbackTest, set_parameter_003, TestSize.Level0) callBack_->senderEngine_ = std::shared_ptr(); AVTransTag tag = AVTransTag::TIME_SYNC_RESULT; std::string value; - int32_t ret = callBack_->SetParameter(tag, value); + int32_t ret = callBack_->SetParameter((uint32_t)tag, value); EXPECT_EQ(DH_AVT_SUCCESS, ret); callBack_->receiverEngine_ = std::shared_ptr(); EXPECT_EQ(DH_AVT_SUCCESS, ret); @@ -97,7 +97,7 @@ HWTEST_F(AVTransControlCenterCallbackTest, set_shared_memory_001, TestSize.Level callBack_ = std::make_shared(); callBack_->receiverEngine_ = std::shared_ptr(); callBack_->senderEngine_ = std::shared_ptr(); - AVTransSharedMemory memory; + AVTransSharedMemoryExt memory; int32_t ret = callBack_->SetSharedMemory(memory); EXPECT_EQ(DH_AVT_SUCCESS, ret); callBack_->senderEngine_ = std::shared_ptr(); @@ -115,7 +115,7 @@ HWTEST_F(AVTransControlCenterCallbackTest, notify_001, TestSize.Level1) callBack_ = std::make_shared(); callBack_->receiverEngine_ = std::shared_ptr(); callBack_->senderEngine_ = std::shared_ptr(); - AVTransEvent event; + AVTransEventExt event; event.type = EventType::EVENT_ADD_STREAM; int32_t ret = callBack_->Notify(event); std::shared_ptr sender = std::shared_ptr(); diff --git a/av_transport/av_trans_control_center/test/unittest/inner_kits/av_trans_control_center_callback_test.h b/av_transport/av_trans_control_center/test/unittest/inner_kits/av_trans_control_center_callback_test.h index 664f68e8..4ed77ece 100644 --- a/av_transport/av_trans_control_center/test/unittest/inner_kits/av_trans_control_center_callback_test.h +++ b/av_transport/av_trans_control_center/test/unittest/inner_kits/av_trans_control_center_callback_test.h @@ -29,6 +29,7 @@ #include "i_av_sender_engine_callback.h" #include "av_trans_message.h" #include "av_trans_buffer.h" +#include "av_trans_errno.h" namespace OHOS { namespace DistributedHardware { class AVTransControlCenterCallbackTest : public testing::Test { diff --git a/av_transport/av_trans_control_center/test/unittest/services/av_trans_control_center_test.h b/av_transport/av_trans_control_center/test/unittest/services/av_trans_control_center_test.h index c0ab0744..6acd4d8f 100644 --- a/av_transport/av_trans_control_center/test/unittest/services/av_trans_control_center_test.h +++ b/av_transport/av_trans_control_center/test/unittest/services/av_trans_control_center_test.h @@ -24,6 +24,7 @@ #include "av_trans_control_center_callback_stub.h" #include "av_trans_types.h" #include "av_sync_utils.h" +#include "av_trans_errno.h" namespace OHOS { namespace DistributedHardware { @@ -35,26 +36,26 @@ public: void TearDown(); std::shared_ptr center_ = nullptr; }; -class CenterCallback : public AVTransControlCenterCallbackStub { +class CenterCallback : public AvTransControlCenterCallbackStub { public: CenterCallback() = default; ~CenterCallback() override = default; - int32_t SetParameter(AVTransTag tag, const std::string &value) override + int32_t SetParameter(uint32_t tag, const std::string &value) override { value_ = value; return DH_AVT_SUCCESS; } - int32_t SetSharedMemory(const AVTransSharedMemory &memory) override + int32_t SetSharedMemory(const AVTransSharedMemoryExt &memory) override { memory_ = memory; return DH_AVT_SUCCESS; } - int32_t Notify(const AVTransEvent &event) override + int32_t Notify(const AVTransEventExt &event) override { return DH_AVT_SUCCESS; } std::string value_; - AVTransSharedMemory memory_; + AVTransSharedMemoryExt memory_; }; } // namespace DistributedHardware } // namespace OHOS diff --git a/av_transport/av_trans_engine/av_receiver/BUILD.gn b/av_transport/av_trans_engine/av_receiver/BUILD.gn index 5a083660..70a96b3d 100644 --- a/av_transport/av_trans_engine/av_receiver/BUILD.gn +++ b/av_transport/av_trans_engine/av_receiver/BUILD.gn @@ -70,6 +70,7 @@ ohos_shared_library("distributed_av_receiver") { ] deps = [ + "${dh_fwk_sdk_path}:dhfwk_idl_hardware_head", "${dh_fwk_sdk_path}:libdhfwk_sdk", "${distributed_av_transport_path}/framework:distributed_av_pipeline_fwk", "${filters_path}:avtrans_input_filter", diff --git a/av_transport/av_trans_engine/av_receiver/test/unittest/av_receiver_engine/BUILD.gn b/av_transport/av_trans_engine/av_receiver/test/unittest/av_receiver_engine/BUILD.gn index 4e31909f..0ed9f0c1 100644 --- a/av_transport/av_trans_engine/av_receiver/test/unittest/av_receiver_engine/BUILD.gn +++ b/av_transport/av_trans_engine/av_receiver/test/unittest/av_receiver_engine/BUILD.gn @@ -54,6 +54,7 @@ ohos_unittest("AvReceiverEngineTest") { cflags_cc = cflags deps = [ + "${dh_fwk_sdk_path}:dhfwk_idl_hardware_head", "${dh_fwk_sdk_path}:libdhfwk_sdk", "${engine_path}/av_receiver:distributed_av_receiver", "${filters_path}:avtrans_input_filter", @@ -133,6 +134,7 @@ ohos_unittest("AvAudioReceiverEngineTest") { cflags_cc = cflags deps = [ + "${dh_fwk_sdk_path}:dhfwk_idl_hardware_head", "${dh_fwk_sdk_path}:libdhfwk_sdk", "${distributed_av_transport_path}/framework:distributed_av_pipeline_fwk", "${engine_path}/av_receiver:distributed_av_receiver", diff --git a/av_transport/av_trans_engine/av_receiver/test/unittest/av_receiver_engine_provider/BUILD.gn b/av_transport/av_trans_engine/av_receiver/test/unittest/av_receiver_engine_provider/BUILD.gn index c93f8bd3..f2d09138 100644 --- a/av_transport/av_trans_engine/av_receiver/test/unittest/av_receiver_engine_provider/BUILD.gn +++ b/av_transport/av_trans_engine/av_receiver/test/unittest/av_receiver_engine_provider/BUILD.gn @@ -53,6 +53,7 @@ ohos_unittest("AvReceiverEngineProviderTest") { cflags_cc = cflags deps = [ + "${dh_fwk_sdk_path}:dhfwk_idl_hardware_head", "${dh_fwk_sdk_path}:libdhfwk_sdk", "${engine_path}/av_receiver:distributed_av_receiver", "${filters_path}:avtrans_input_filter", @@ -134,6 +135,7 @@ ohos_unittest("AvAudioReceiverEngineProviderTest") { cflags_cc = cflags deps = [ + "${dh_fwk_sdk_path}:dhfwk_idl_hardware_head", "${dh_fwk_sdk_path}:libdhfwk_sdk", "${engine_path}/av_receiver:distributed_av_receiver", "${filters_path}:avtrans_input_filter", diff --git a/av_transport/av_trans_engine/av_sender/BUILD.gn b/av_transport/av_trans_engine/av_sender/BUILD.gn index ac2dd8a5..c086dcf6 100644 --- a/av_transport/av_trans_engine/av_sender/BUILD.gn +++ b/av_transport/av_trans_engine/av_sender/BUILD.gn @@ -65,6 +65,7 @@ ohos_shared_library("distributed_av_sender") { ] deps = [ + "${dh_fwk_sdk_path}:dhfwk_idl_hardware_head", "${dh_fwk_sdk_path}:libdhfwk_sdk", "${distributed_av_transport_path}/framework:distributed_av_pipeline_fwk", "${filters_path}:avtrans_input_filter", diff --git a/av_transport/av_trans_engine/av_sender/test/unittest/av_sender_engine/BUILD.gn b/av_transport/av_trans_engine/av_sender/test/unittest/av_sender_engine/BUILD.gn index d44da2b5..b0c8e3a5 100644 --- a/av_transport/av_trans_engine/av_sender/test/unittest/av_sender_engine/BUILD.gn +++ b/av_transport/av_trans_engine/av_sender/test/unittest/av_sender_engine/BUILD.gn @@ -53,6 +53,7 @@ ohos_unittest("AvSenderEngineTest") { cflags_cc = cflags deps = [ + "${dh_fwk_sdk_path}:dhfwk_idl_hardware_head", "${dh_fwk_sdk_path}:libdhfwk_sdk", "${engine_path}/av_sender:distributed_av_sender", "${filters_path}:avtrans_input_filter", @@ -133,6 +134,7 @@ ohos_unittest("AvAudioSenderEngineTest") { cflags_cc = cflags deps = [ + "${dh_fwk_sdk_path}:dhfwk_idl_hardware_head", "${dh_fwk_sdk_path}:libdhfwk_sdk", "${distributed_av_transport_path}/framework:distributed_av_pipeline_fwk", "${engine_path}/av_sender:distributed_av_sender", diff --git a/av_transport/av_trans_engine/av_sender/test/unittest/av_sender_engine_provider/BUILD.gn b/av_transport/av_trans_engine/av_sender/test/unittest/av_sender_engine_provider/BUILD.gn index b2c42b5c..0f01c383 100644 --- a/av_transport/av_trans_engine/av_sender/test/unittest/av_sender_engine_provider/BUILD.gn +++ b/av_transport/av_trans_engine/av_sender/test/unittest/av_sender_engine_provider/BUILD.gn @@ -53,6 +53,7 @@ ohos_unittest("AvSenderEngineProviderTest") { cflags_cc = cflags deps = [ + "${dh_fwk_sdk_path}:dhfwk_idl_hardware_head", "${dh_fwk_sdk_path}:libdhfwk_sdk", "${engine_path}/av_sender:distributed_av_sender", "${filters_path}:avtrans_input_filter", @@ -136,6 +137,7 @@ ohos_unittest("AvAudioSenderEngineProviderTest") { cflags_cc = cflags deps = [ + "${dh_fwk_sdk_path}:dhfwk_idl_hardware_head", "${dh_fwk_sdk_path}:libdhfwk_sdk", "${engine_path}/av_sender:distributed_av_sender", "${filters_path}:avtrans_input_filter", diff --git a/av_transport/common/include/av_sync_utils.h b/av_transport/common/include/av_sync_utils.h index c1cafa76..76e6c61b 100644 --- a/av_transport/common/include/av_sync_utils.h +++ b/av_transport/common/include/av_sync_utils.h @@ -18,6 +18,8 @@ #include #include +#include "parcel.h" +#include "message_parcel.h" namespace OHOS { namespace DistributedHardware { @@ -34,6 +36,46 @@ struct AVTransSharedMemory { std::string name; }; +struct AVTransSharedMemoryExt : public AVTransSharedMemory, public Parcelable { + using AVTransSharedMemory::AVTransSharedMemory; + explicit AVTransSharedMemoryExt() {} + virtual ~AVTransSharedMemoryExt() = default; + explicit AVTransSharedMemoryExt(const AVTransSharedMemory& avTransSharedMemory) + { + fd = avTransSharedMemory.fd; + size = avTransSharedMemory.size; + name = avTransSharedMemory.name; + } + virtual bool Marshalling(Parcel &parcel) const override + { + MessageParcel &messageParcel = static_cast(parcel); + if (!messageParcel.WriteFileDescriptor(fd)) { + return false; + } + if (!parcel.WriteInt32(size)) { + return false; + } + if (!parcel.WriteString(name)) { + return false; + } + return true; + } + + static AVTransSharedMemoryExt *Unmarshalling(Parcel &parcel) + { + MessageParcel &messageParcel = static_cast(parcel); + AVTransSharedMemoryExt *avTransSharedMemory = new (std::nothrow) AVTransSharedMemoryExt(); + if (avTransSharedMemory == nullptr) { + // AVTRANS_LOGE("Create avTransSharedMemory failed"); + return nullptr; + } + avTransSharedMemory->fd = messageParcel.ReadFileDescriptor(); + avTransSharedMemory->size = parcel.ReadInt32(); + avTransSharedMemory->name = parcel.ReadString(); + return avTransSharedMemory; + } +}; + struct AVSyncClockUnit { uint32_t index; uint32_t frameNum; diff --git a/av_transport/common/include/av_trans_types.h b/av_transport/common/include/av_trans_types.h index cb9ca677..fa5726fd 100644 --- a/av_transport/common/include/av_trans_types.h +++ b/av_transport/common/include/av_trans_types.h @@ -18,6 +18,8 @@ #include #include +#include "parcel.h" +#include "message_parcel.h" namespace OHOS { namespace DistributedHardware { @@ -158,6 +160,48 @@ struct AVTransEvent { std::string peerDevId; }; +struct AVTransEventExt : public AVTransEvent, public Parcelable { + using AVTransEvent::AVTransEvent; + explicit AVTransEventExt() {} + virtual ~AVTransEventExt() = default; + explicit AVTransEventExt(const AVTransEvent& AVTransEvent) + { + type = AVTransEvent.type; + content = AVTransEvent.content; + peerDevId = AVTransEvent.peerDevId; + } + + virtual bool Marshalling(Parcel &parcel) const override + { + if (!parcel.WriteUint32((uint32_t)type)) { + return false; + } + if (!parcel.WriteString(content)) { + return false; + } + if (!parcel.WriteString(peerDevId)) { + return false; + } + return true; + } + + static AVTransEventExt *Unmarshalling(Parcel &parcel) + { + AVTransEventExt *avTransEvent = new (std::nothrow) AVTransEventExt(); + if (avTransEvent == nullptr) { + return nullptr; + } + uint32_t typeValue = parcel.ReadUint32(); + std::string contentValue = parcel.ReadString(); + std::string peerDevIdValue = parcel.ReadString(); + avTransEvent->type = static_cast(typeValue); + avTransEvent->content = contentValue; + avTransEvent->peerDevId = peerDevIdValue; + + return avTransEvent; + } +}; + struct AVStreamInfo { std::string sceneType; std::string peerDevId; diff --git a/bundle.json b/bundle.json index 5b6bfe3d..d6192a1e 100644 --- a/bundle.json +++ b/bundle.json @@ -137,7 +137,6 @@ "device_type.h", "dhardware_ipc_interface_code.h", "distributed_hardware_errno.h", - "iav_trans_control_center_callback.h", "idistributed_hardware_manager.h", "idistributed_hardware_sink.h", "idistributed_hardware_source.h", diff --git a/common/utils/include/idistributed_hardware.h b/common/utils/include/idistributed_hardware.h index e17488b9..64ffee52 100644 --- a/common/utils/include/idistributed_hardware.h +++ b/common/utils/include/idistributed_hardware.h @@ -47,7 +47,7 @@ public: virtual int32_t CreateControlChannel(int32_t engineId, const std::string &peerDevId) = 0; virtual int32_t NotifyAVCenter(int32_t engineId, const AVTransEvent &event) = 0; virtual int32_t RegisterCtlCenterCallback(int32_t engineId, - const sptr callback) = 0; + const sptr callback) = 0; virtual int32_t NotifySourceRemoteSinkStarted(std::string &deviceId) = 0; virtual int32_t PauseDistributedHardware(DHType dhType, const std::string &networkId) = 0; virtual int32_t ResumeDistributedHardware(DHType dhType, const std::string &networkId) = 0; diff --git a/interfaces/inner_kits/BUILD.gn b/interfaces/inner_kits/BUILD.gn index 0d6f0583..91499361 100644 --- a/interfaces/inner_kits/BUILD.gn +++ b/interfaces/inner_kits/BUILD.gn @@ -11,6 +11,7 @@ # See the License for the specific language governing permissions and # limitations under the License. +import("//build/config/components/idl_tool/idl.gni") import("//build/ohos.gni") import( "//foundation/distributedhardware/distributed_hardware_fwk/distributedhardwarefwk.gni") @@ -22,6 +23,73 @@ config("innerkits_external_config") { ] } +idl_gen_interface("dhfwk_idl_hardware") { + sources = [ + "IAvTransControlCenterCallback.idl", + ] + log_domainid = "0xD004100" + log_tag = "distributedhardware" +} + +config("dhfwk_idl_hardware_config") { + include_dirs = [ + "include", + "${av_trans_path}/common/include", + "${innerkits_path}/include", + ".", + "${target_gen_dir}", + "${common_path}/utils/include", + ] +} + +ohos_source_set("dhfwk_idl_hardware_source") { + sanitize = { + cfi = true + cfi_cross_dso = true + debug = false + } + public_configs = [ ":dhfwk_idl_hardware_config" ] + output_values = get_target_outputs(":dhfwk_idl_hardware") + sources = filter_include(output_values, [ "*.cpp" ]) + deps = [ ":dhfwk_idl_hardware" ] + + external_deps = [ + "c_utils:utils", + "hilog:libhilog", + "hitrace:hitrace_meter", + "ipc:ipc_core", + "safwk:system_ability_fwk", + "samgr:samgr_proxy", + ] + + subsystem_name = "distributedhardware" + + part_name = "distributed_hardware_fwk" +} + +ohos_source_set("dhfwk_idl_hardware_head") { + sanitize = { + cfi = true + cfi_cross_dso = true + debug = false + } + public_configs = [ ":dhfwk_idl_hardware_config" ] + deps = [ ":dhfwk_idl_hardware" ] + + external_deps = [ + "c_utils:utils", + "hilog:libhilog", + "hitrace:hitrace_meter", + "ipc:ipc_core", + "safwk:system_ability_fwk", + "samgr:samgr_proxy", + ] + + subsystem_name = "distributedhardware" + + part_name = "distributed_hardware_fwk" +} + ohos_shared_library("libdhfwk_sdk") { sanitize = { boundary_sanitize = true @@ -48,7 +116,6 @@ ohos_shared_library("libdhfwk_sdk") { sources = [ "${av_center_kits_path}/src/av_trans_control_center_callback.cpp", - "${av_center_kits_path}/src/av_trans_control_center_callback_stub.cpp", "${innerkits_path}/src/distributed_hardware_fwk_kit.cpp", "${innerkits_path}/src/ipc/dhfwk_sa_manager.cpp", "${innerkits_path}/src/ipc/distributed_hardware_proxy.cpp", @@ -58,6 +125,7 @@ ohos_shared_library("libdhfwk_sdk") { ] deps = [ + ":dhfwk_idl_hardware_source", "${services_path}/distributedhardwarefwkservice:distributedhardwarefwksvr", "${utils_path}:distributedhardwareutils", ] @@ -79,6 +147,7 @@ ohos_shared_library("libdhfwk_sdk") { "c_utils:utils", "hilog:libhilog", "hisysevent:libhisysevent", + "hitrace:hitrace_meter", "ipc:ipc_core", "safwk:system_ability_fwk", "samgr:samgr_proxy", diff --git a/common/utils/include/iav_trans_control_center_callback.h b/interfaces/inner_kits/IAvTransControlCenterCallback.idl similarity index 43% rename from common/utils/include/iav_trans_control_center_callback.h rename to interfaces/inner_kits/IAvTransControlCenterCallback.idl index bcbe6338..123a3f56 100644 --- a/common/utils/include/iav_trans_control_center_callback.h +++ b/interfaces/inner_kits/IAvTransControlCenterCallback.idl @@ -1,43 +1,23 @@ -/* - * Copyright (c) 2023 Huawei Device Co., Ltd. - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -#ifndef OHOS_I_AV_TRANSPORT_CONTROL_CENTER_CALLBACK_H -#define OHOS_I_AV_TRANSPORT_CONTROL_CENTER_CALLBACK_H - -#include "iremote_broker.h" - -#include "av_sync_utils.h" -#include "av_trans_errno.h" -#include "av_trans_types.h" - -namespace OHOS { -namespace DistributedHardware { -class IAVTransControlCenterCallback : public IRemoteBroker { -public: - virtual int32_t SetParameter(AVTransTag tag, const std::string &value) = 0; - virtual int32_t SetSharedMemory(const AVTransSharedMemory &memory) = 0; - virtual int32_t Notify(const AVTransEvent &event) = 0; - - enum class Message : uint32_t { - SET_PARAMETER = 1, - SET_SHARED_MEMORY = 2, - NOTIFY_AV_EVENT = 3 - }; - - DECLARE_INTERFACE_DESCRIPTOR(u"ohos.distributedhardware.IAVTransControlCenterCallback"); -}; -} -} -#endif \ No newline at end of file +/* + * Copyright (c) 2023 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package OHOS.DistributedHardware; +sequenceable AvTransTypes..OHOS.DistributedHardware.AVTransEventExt; +sequenceable AvSyncUtils..OHOS.DistributedHardware.AVTransSharedMemoryExt; +interface OHOS.DistributedHardware.IAvTransControlCenterCallback { + [ipccode 1] void SetParameter([in] unsigned int tag, [in] String value); + [ipccode 2] void SetSharedMemory([in] AVTransSharedMemoryExt memory); + [ipccode 3] void Notify([in] AVTransEventExt event); +} \ No newline at end of file diff --git a/interfaces/inner_kits/include/distributed_hardware_fwk_kit.h b/interfaces/inner_kits/include/distributed_hardware_fwk_kit.h index d2744e90..3c3e3927 100644 --- a/interfaces/inner_kits/include/distributed_hardware_fwk_kit.h +++ b/interfaces/inner_kits/include/distributed_hardware_fwk_kit.h @@ -29,6 +29,9 @@ #include "idistributed_hardware.h" #include "iget_dh_descriptors_callback.h" #include "ihardware_status_listener.h" +#include "device_type.h" +#include "av_trans_types.h" +#include "iav_trans_control_center_callback.h" #ifndef API_EXPORT #define API_EXPORT __attribute__((visibility("default"))) @@ -131,7 +134,7 @@ public: * @param callback av control center callback. * @return Returns 0 if success. */ - API_EXPORT int32_t RegisterCtlCenterCallback(int32_t engineId, const sptr callback); + API_EXPORT int32_t RegisterCtlCenterCallback(int32_t engineId, const sptr callback); /** * @brief Pause distributed hardware. diff --git a/interfaces/inner_kits/include/ipc/dhfwk_sa_manager.h b/interfaces/inner_kits/include/ipc/dhfwk_sa_manager.h index 831fafeb..f5283a3a 100644 --- a/interfaces/inner_kits/include/ipc/dhfwk_sa_manager.h +++ b/interfaces/inner_kits/include/ipc/dhfwk_sa_manager.h @@ -42,7 +42,7 @@ public: int32_t AddPublisherListenerToCache(const DHTopic topic, sptr listener); void RemovePublisherListenerFromCache(const DHTopic topic, sptr listener); - void AddAVTransControlCenterCbToCache(int32_t engineId, const sptr callback); + void AddAVTransControlCenterCbToCache(int32_t engineId, const sptr callback); void RemoveAVTransControlCenterCbFromCache(int32_t engineId); public: @@ -66,7 +66,7 @@ private: std::mutex publisherListenersMutex_; std::unordered_map>> publisherListenersCache_; std::mutex avTransControlCenterCbMutex_; - std::unordered_map> avTransControlCenterCbCache_; + std::unordered_map> avTransControlCenterCbCache_; }; } // DistributedHardware } // OHOS diff --git a/interfaces/inner_kits/include/ipc/distributed_hardware_proxy.h b/interfaces/inner_kits/include/ipc/distributed_hardware_proxy.h index 90937e86..648f07be 100644 --- a/interfaces/inner_kits/include/ipc/distributed_hardware_proxy.h +++ b/interfaces/inner_kits/include/ipc/distributed_hardware_proxy.h @@ -42,7 +42,7 @@ public: int32_t ReleaseAVCenter(int32_t engineId) override; int32_t CreateControlChannel(int32_t engineId, const std::string &peerDevId) override; int32_t NotifyAVCenter(int32_t engineId, const AVTransEvent &event) override; - int32_t RegisterCtlCenterCallback(int32_t engineId, const sptr callback) override; + int32_t RegisterCtlCenterCallback(int32_t engineId, const sptr callback) override; int32_t NotifySourceRemoteSinkStarted(std::string &deviceId) override; int32_t PauseDistributedHardware(DHType dhType, const std::string &networkId) override; int32_t ResumeDistributedHardware(DHType dhType, const std::string &networkId) override; diff --git a/interfaces/inner_kits/src/distributed_hardware_fwk_kit.cpp b/interfaces/inner_kits/src/distributed_hardware_fwk_kit.cpp index 91ea88ca..0d8be356 100644 --- a/interfaces/inner_kits/src/distributed_hardware_fwk_kit.cpp +++ b/interfaces/inner_kits/src/distributed_hardware_fwk_kit.cpp @@ -206,7 +206,7 @@ int32_t DistributedHardwareFwkKit::NotifyAVCenter(int32_t engineId, const AVTran } int32_t DistributedHardwareFwkKit::RegisterCtlCenterCallback(int32_t engineId, - const sptr callback) + const sptr callback) { DHLOGI("Register av control center callback. engineId: %{public}" PRId32, engineId); diff --git a/interfaces/inner_kits/src/ipc/dhfwk_sa_manager.cpp b/interfaces/inner_kits/src/ipc/dhfwk_sa_manager.cpp index 29c30e52..d044cd97 100644 --- a/interfaces/inner_kits/src/ipc/dhfwk_sa_manager.cpp +++ b/interfaces/inner_kits/src/ipc/dhfwk_sa_manager.cpp @@ -200,7 +200,7 @@ void DHFWKSAManager::RemovePublisherListenerFromCache(const DHTopic topic, sptr< } void DHFWKSAManager::AddAVTransControlCenterCbToCache(int32_t engineId, - const sptr callback) + const sptr callback) { std::lock_guard avTransControlCenterCbLock(avTransControlCenterCbMutex_); avTransControlCenterCbCache_[engineId] = callback; diff --git a/interfaces/inner_kits/src/ipc/distributed_hardware_proxy.cpp b/interfaces/inner_kits/src/ipc/distributed_hardware_proxy.cpp index 47ee352d..41137e54 100644 --- a/interfaces/inner_kits/src/ipc/distributed_hardware_proxy.cpp +++ b/interfaces/inner_kits/src/ipc/distributed_hardware_proxy.cpp @@ -352,7 +352,7 @@ int32_t DistributedHardwareProxy::NotifyAVCenter(int32_t engineId, const AVTrans } int32_t DistributedHardwareProxy::RegisterCtlCenterCallback(int32_t engineId, - const sptr callback) + const sptr callback) { sptr remote = Remote(); if (remote == nullptr) { diff --git a/interfaces/inner_kits/test/unittest/common/distributedhardwarefwkkit/src/distributed_hardware_fwk_kit_test.cpp b/interfaces/inner_kits/test/unittest/common/distributedhardwarefwkkit/src/distributed_hardware_fwk_kit_test.cpp index eb599495..9cae45bf 100644 --- a/interfaces/inner_kits/test/unittest/common/distributedhardwarefwkkit/src/distributed_hardware_fwk_kit_test.cpp +++ b/interfaces/inner_kits/test/unittest/common/distributedhardwarefwkkit/src/distributed_hardware_fwk_kit_test.cpp @@ -390,7 +390,7 @@ HWTEST_F(DistributedHardwareFwkKitTest, RegisterCtlCenterCallback_001, testing:: { ASSERT_TRUE(dhfwkPtr_ != nullptr); int32_t engineId = 0; - sptr callback = nullptr; + sptr callback = nullptr; int32_t ret = dhfwkPtr_->RegisterCtlCenterCallback(engineId, callback); EXPECT_EQ(ERR_DH_FWK_POINTER_IS_NULL, ret); } diff --git a/interfaces/inner_kits/test/unittest/common/ipc/dhfwk_sa_manager/include/dhfwk_sa_manager_test.h b/interfaces/inner_kits/test/unittest/common/ipc/dhfwk_sa_manager/include/dhfwk_sa_manager_test.h index 7639175f..12796b55 100644 --- a/interfaces/inner_kits/test/unittest/common/ipc/dhfwk_sa_manager/include/dhfwk_sa_manager_test.h +++ b/interfaces/inner_kits/test/unittest/common/ipc/dhfwk_sa_manager/include/dhfwk_sa_manager_test.h @@ -97,7 +97,7 @@ int32_t NotifyAVCenter(int32_t engineId, const AVTransEvent &event) return DH_FWK_SUCCESS; } -int32_t RegisterCtlCenterCallback(int32_t engineId, const sptr callback) +int32_t RegisterCtlCenterCallback(int32_t engineId, const sptr callback) { (void)engineId; (void)callback; diff --git a/interfaces/inner_kits/test/unittest/common/ipc/distributed_hardware_proxy/include/distributed_hardware_proxy_test.h b/interfaces/inner_kits/test/unittest/common/ipc/distributed_hardware_proxy/include/distributed_hardware_proxy_test.h index 7466ec10..03bc7d3e 100644 --- a/interfaces/inner_kits/test/unittest/common/ipc/distributed_hardware_proxy/include/distributed_hardware_proxy_test.h +++ b/interfaces/inner_kits/test/unittest/common/ipc/distributed_hardware_proxy/include/distributed_hardware_proxy_test.h @@ -50,7 +50,7 @@ public: int32_t ReleaseAVCenter(int32_t engineId); int32_t CreateControlChannel(int32_t engineId, const std::string &peerDevId); int32_t NotifyAVCenter(int32_t engineId, const AVTransEvent &event); - int32_t RegisterCtlCenterCallback(int32_t engineId, const sptr callback); + int32_t RegisterCtlCenterCallback(int32_t engineId, const sptr callback); int32_t NotifySourceRemoteSinkStarted(std::string &deviceId); int32_t PauseDistributedHardware(DHType dhType, const std::string &networkId); int32_t ResumeDistributedHardware(DHType dhType, const std::string &networkId); diff --git a/interfaces/inner_kits/test/unittest/common/ipc/distributed_hardware_proxy/src/distributed_hardware_proxy_test.cpp b/interfaces/inner_kits/test/unittest/common/ipc/distributed_hardware_proxy/src/distributed_hardware_proxy_test.cpp index 0195307b..3a85dc52 100644 --- a/interfaces/inner_kits/test/unittest/common/ipc/distributed_hardware_proxy/src/distributed_hardware_proxy_test.cpp +++ b/interfaces/inner_kits/test/unittest/common/ipc/distributed_hardware_proxy/src/distributed_hardware_proxy_test.cpp @@ -102,7 +102,7 @@ int32_t DistributedHardwareProxyTest::TestDistributedHardwareStub::NotifyAVCente } int32_t DistributedHardwareProxyTest::TestDistributedHardwareStub::RegisterCtlCenterCallback(int32_t engineId, - const sptr callback) + const sptr callback) { (void)engineId; (void)callback; @@ -458,7 +458,7 @@ HWTEST_F(DistributedHardwareProxyTest, NotifyAVCenter_001, TestSize.Level1) HWTEST_F(DistributedHardwareProxyTest, RegisterCtlCenterCallback_001, TestSize.Level1) { int32_t engineId = 0; - sptr callback = nullptr; + sptr callback = nullptr; sptr dhStubPtr(new TestDistributedHardwareStub()); ASSERT_TRUE(dhStubPtr != nullptr); DistributedHardwareProxy dhProxy(dhStubPtr); diff --git a/services/distributedhardwarefwkservice/BUILD.gn b/services/distributedhardwarefwkservice/BUILD.gn index a5ffe399..00f2c499 100644 --- a/services/distributedhardwarefwkservice/BUILD.gn +++ b/services/distributedhardwarefwkservice/BUILD.gn @@ -55,7 +55,6 @@ ohos_shared_library("distributedhardwarefwksvr") { sources = [ "${av_center_svc_path}/src/av_sync_manager.cpp", "${av_center_svc_path}/src/av_trans_control_center.cpp", - "${av_center_svc_path}/src/ipc/av_trans_control_center_callback_proxy.cpp", "${av_trans_path}/common/src/av_sync_utils.cpp", "${av_trans_path}/common/src/av_trans_message.cpp", "${av_trans_path}/common/src/softbus_channel_adapter.cpp", @@ -172,4 +171,6 @@ ohos_shared_library("distributedhardwarefwksvr") { subsystem_name = "distributedhardware" part_name = "distributed_hardware_fwk" + + public_configs = [ "${innerkits_path}:dhfwk_idl_hardware_config" ] } diff --git a/services/distributedhardwarefwkservice/include/distributed_hardware_service.h b/services/distributedhardwarefwkservice/include/distributed_hardware_service.h index c5352615..444a260f 100644 --- a/services/distributedhardwarefwkservice/include/distributed_hardware_service.h +++ b/services/distributedhardwarefwkservice/include/distributed_hardware_service.h @@ -47,7 +47,7 @@ public: int32_t ReleaseAVCenter(int32_t engineId) override; int32_t CreateControlChannel(int32_t engineId, const std::string &peerDevId) override; int32_t NotifyAVCenter(int32_t engineId, const AVTransEvent &event) override; - int32_t RegisterCtlCenterCallback(int32_t engineId, const sptr callback) override; + int32_t RegisterCtlCenterCallback(int32_t engineId, const sptr callback) override; int32_t NotifySourceRemoteSinkStarted(std::string &deviceId) override; int32_t PauseDistributedHardware(DHType dhType, const std::string &networkId) override; int32_t ResumeDistributedHardware(DHType dhType, const std::string &networkId) override; diff --git a/services/distributedhardwarefwkservice/src/distributed_hardware_service.cpp b/services/distributedhardwarefwkservice/src/distributed_hardware_service.cpp index bc63bfd3..218f02cf 100644 --- a/services/distributedhardwarefwkservice/src/distributed_hardware_service.cpp +++ b/services/distributedhardwarefwkservice/src/distributed_hardware_service.cpp @@ -274,7 +274,7 @@ int32_t DistributedHardwareService::NotifyAVCenter(int32_t engineId, const AVTra } int32_t DistributedHardwareService::RegisterCtlCenterCallback(int32_t engineId, - const sptr callback) + const sptr callback) { return AVTransControlCenter::GetInstance().RegisterCtlCenterCallback(engineId, callback); } diff --git a/services/distributedhardwarefwkservice/src/distributed_hardware_stub.cpp b/services/distributedhardwarefwkservice/src/distributed_hardware_stub.cpp index 19c8d505..a1227236 100644 --- a/services/distributedhardwarefwkservice/src/distributed_hardware_stub.cpp +++ b/services/distributedhardwarefwkservice/src/distributed_hardware_stub.cpp @@ -31,6 +31,7 @@ #include "distributed_hardware_errno.h" #include "distributed_hardware_log.h" #include "publisher_listener_proxy.h" +#include "av_trans_errno.h" namespace OHOS { namespace DistributedHardware { @@ -264,7 +265,7 @@ int32_t DistributedHardwareStub::RegisterControlCenterCallbackInner(MessageParce } int32_t engineId = data.ReadInt32(); - sptr callback = iface_cast(data.ReadRemoteObject()); + sptr callback = iface_cast(data.ReadRemoteObject()); if (callback == nullptr) { DHLOGE("Input av control center callback is null"); return ERR_DH_FWK_PARA_INVALID; diff --git a/utils/BUILD.gn b/utils/BUILD.gn index 5064b360..a003f127 100644 --- a/utils/BUILD.gn +++ b/utils/BUILD.gn @@ -32,7 +32,10 @@ ohos_shared_library("distributedhardwareutils") { debug = false } branch_protector_ret = "pac_ret" - public_configs = [ ":utils_external_config" ] + public_configs = [ + ":utils_external_config", + "${innerkits_path}:dhfwk_idl_hardware_config" + ] include_dirs = [ "${common_path}/log/include", -- Gitee From 576c41efe1802bc9ce320f6234d001ea6fa4d9eb Mon Sep 17 00:00:00 2001 From: BrainL Date: Sat, 24 May 2025 10:48:14 +0800 Subject: [PATCH 02/11] codecheck modify. Signed-off-by: BrainL Change-Id: Ibe589d0a2382571eb7a912e7576e4c3a83fdeea6 --- .../src/av_trans_control_center_callback.cpp | 9 ++--- av_transport/common/include/av_sync_utils.h | 29 ++++++++-------- av_transport/common/include/av_trans_types.h | 34 +++++-------------- 3 files changed, 28 insertions(+), 44 deletions(-) diff --git a/av_transport/av_trans_control_center/inner_kits/src/av_trans_control_center_callback.cpp b/av_transport/av_trans_control_center/inner_kits/src/av_trans_control_center_callback.cpp index 5acb9d5c..aa0d7b7c 100644 --- a/av_transport/av_trans_control_center/inner_kits/src/av_trans_control_center_callback.cpp +++ b/av_transport/av_trans_control_center/inner_kits/src/av_trans_control_center_callback.cpp @@ -4,7 +4,7 @@ * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * - * http://www.apache.org/licenses/LICENSE-2.0 + * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, @@ -22,7 +22,8 @@ namespace OHOS { namespace DistributedHardware { int32_t AVTransControlCenterCallback::SetParameter(uint32_t tag, const std::string &value) { - if ((static_cast(tag) == AVTransTag::START_AV_SYNC) || (static_cast(tag) == AVTransTag::STOP_AV_SYNC) || + if ((static_cast(tag) == AVTransTag::START_AV_SYNC) || + (static_cast(tag) == AVTransTag::STOP_AV_SYNC) || (static_cast(tag) == AVTransTag::TIME_SYNC_RESULT)) { std::shared_ptr rcvEngine = receiverEngine_.lock(); if (rcvEngine != nullptr) { @@ -32,7 +33,7 @@ int32_t AVTransControlCenterCallback::SetParameter(uint32_t tag, const std::stri return DH_AVT_SUCCESS; } -int32_t AVTransControlCenterCallback::SetSharedMemory(const AVTransSharedMemoryExt& memory) +int32_t AVTransControlCenterCallback::SetSharedMemory(const AVTransSharedMemoryExt &memory) { DHLOGW("AVTransControlCenterCallback::SetSharedMemory enter."); @@ -54,7 +55,7 @@ int32_t AVTransControlCenterCallback::SetSharedMemory(const AVTransSharedMemoryE return DH_AVT_SUCCESS; } -int32_t AVTransControlCenterCallback::Notify(const AVTransEventExt& event) +int32_t AVTransControlCenterCallback::Notify(const AVTransEventExt &event) { DHLOGW("AVTransControlCenterCallback::Notify enter."); return DH_AVT_SUCCESS; diff --git a/av_transport/common/include/av_sync_utils.h b/av_transport/common/include/av_sync_utils.h index 76e6c61b..b09d4933 100644 --- a/av_transport/common/include/av_sync_utils.h +++ b/av_transport/common/include/av_sync_utils.h @@ -4,7 +4,7 @@ * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * - * http://www.apache.org/licenses/LICENSE-2.0 + * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, @@ -40,15 +40,15 @@ struct AVTransSharedMemoryExt : public AVTransSharedMemory, public Parcelable { using AVTransSharedMemory::AVTransSharedMemory; explicit AVTransSharedMemoryExt() {} virtual ~AVTransSharedMemoryExt() = default; - explicit AVTransSharedMemoryExt(const AVTransSharedMemory& avTransSharedMemory) + explicit AVTransSharedMemoryExt(const AVTransSharedMemory &avTransSharedMemory) { - fd = avTransSharedMemory.fd; - size = avTransSharedMemory.size; - name = avTransSharedMemory.name; + fd = avTransSharedMemory.fd; + size = avTransSharedMemory.size; + name = avTransSharedMemory.name; } virtual bool Marshalling(Parcel &parcel) const override { - MessageParcel &messageParcel = static_cast(parcel); + MessageParcel &messageParcel = static_cast(parcel); if (!messageParcel.WriteFileDescriptor(fd)) { return false; } @@ -63,10 +63,9 @@ struct AVTransSharedMemoryExt : public AVTransSharedMemory, public Parcelable { static AVTransSharedMemoryExt *Unmarshalling(Parcel &parcel) { - MessageParcel &messageParcel = static_cast(parcel); + MessageParcel &messageParcel = static_cast(parcel); AVTransSharedMemoryExt *avTransSharedMemory = new (std::nothrow) AVTransSharedMemoryExt(); if (avTransSharedMemory == nullptr) { - // AVTRANS_LOGE("Create avTransSharedMemory failed"); return nullptr; } avTransSharedMemory->fd = messageParcel.ReadFileDescriptor(); @@ -82,20 +81,20 @@ struct AVSyncClockUnit { int64_t pts; }; -/** +/* * * @brief create shared memory space for av sync. * @param name name for the shared memory. * @return shared memory struct, include fd, size and name. */ AVTransSharedMemory CreateAVTransSharedMemory(const std::string &name, size_t size); -/** +/* * * @brief close shared memory space. * @param memory shared memory. */ void CloseAVTransSharedMemory(AVTransSharedMemory &memory) noexcept; -/** +/* * * @brief write the clock unit into the shared memory space. * @param memory shared memory * @param clockUnit the clock unit @@ -103,7 +102,7 @@ void CloseAVTransSharedMemory(AVTransSharedMemory &memory) noexcept; */ int32_t WriteClockUnitToMemory(const AVTransSharedMemory &memory, AVSyncClockUnit &clockUnit); -/** +/* * * @brief read clock unit from the shared memory space. * @param memory shared memory * @param clockUnit the clock unit @@ -111,7 +110,7 @@ int32_t WriteClockUnitToMemory(const AVTransSharedMemory &memory, AVSyncClockUni */ int32_t ReadClockUnitFromMemory(const AVTransSharedMemory &memory, AVSyncClockUnit &clockUnit); -/** +/* * * @brief write frame number and pts into the shared memory space. * @param memory shared memory * @param frameNum the frame number @@ -120,7 +119,7 @@ int32_t ReadClockUnitFromMemory(const AVTransSharedMemory &memory, AVSyncClockUn */ int32_t WriteFrameInfoToMemory(const AVTransSharedMemory &memory, uint32_t frameNum, int64_t timestamp); -/** +/* * * @brief read frame number and pts from the shared memory space. * @param memory shared memory * @param frameNum the frame number @@ -129,7 +128,7 @@ int32_t WriteFrameInfoToMemory(const AVTransSharedMemory &memory, uint32_t frame */ int32_t ReadFrameInfoFromMemory(const AVTransSharedMemory &memory, uint32_t &frameNum, int64_t ×tamp); -/** +/* * * @brief reset the shared memory value to all zeros. * @param memory shared memory * @return Returns DH_AVT_SUCCESS(0) if successful, otherwise returns other error code. diff --git a/av_transport/common/include/av_trans_types.h b/av_transport/common/include/av_trans_types.h index fa5726fd..c73dedd1 100644 --- a/av_transport/common/include/av_trans_types.h +++ b/av_transport/common/include/av_trans_types.h @@ -4,7 +4,7 @@ * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * - * http://www.apache.org/licenses/LICENSE-2.0 + * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, @@ -52,22 +52,11 @@ const std::string VIDEO_FORMAT_JEPG = "jpeg"; const std::string VIDEO_FORMAT_YUVI420 = "yuvi420"; const std::string VIDEO_FORMAT_RGBA8888 = "rgba8888"; -enum struct TransRole : uint32_t { - AV_SENDER = 0, - AV_RECEIVER = 1, - UNKNOWN = 2 -}; +enum struct TransRole : uint32_t { AV_SENDER = 0, AV_RECEIVER = 1, UNKNOWN = 2 }; -enum struct AvSyncFlag : uint32_t { - MASTER = 0, - SLAVE = 1, - UNKNOWN = 2 -}; +enum struct AvSyncFlag : uint32_t { MASTER = 0, SLAVE = 1, UNKNOWN = 2 }; -enum struct TransStrategy : uint32_t { - LOW_LATANCY_STRATEGY, - LOW_JITTER_STRATEGY -}; +enum struct TransStrategy : uint32_t { LOW_LATANCY_STRATEGY, LOW_JITTER_STRATEGY }; struct ChannelAttribute { TransStrategy strategy; @@ -90,12 +79,7 @@ enum struct StateId : uint32_t { BUTT, }; -enum struct TagSection : uint8_t { - REGULAR = 1, - D_AUDIO = 2, - D_VIDEO = 3, - MAX_SECTION = 64 -}; +enum struct TagSection : uint8_t { REGULAR = 1, D_AUDIO = 2, D_VIDEO = 3, MAX_SECTION = 64 }; enum struct AVTransTag : uint32_t { INVALID = 0, @@ -164,11 +148,11 @@ struct AVTransEventExt : public AVTransEvent, public Parcelable { using AVTransEvent::AVTransEvent; explicit AVTransEventExt() {} virtual ~AVTransEventExt() = default; - explicit AVTransEventExt(const AVTransEvent& AVTransEvent) + explicit AVTransEventExt(const AVTransEvent &AVTransEvent) { - type = AVTransEvent.type; - content = AVTransEvent.content; - peerDevId = AVTransEvent.peerDevId; + type = AVTransEvent.type; + content = AVTransEvent.content; + peerDevId = AVTransEvent.peerDevId; } virtual bool Marshalling(Parcel &parcel) const override -- Gitee From 155ccf9d557e3448506dd4bb1b315d9676645dc1 Mon Sep 17 00:00:00 2001 From: BrainL Date: Sat, 24 May 2025 14:04:34 +0800 Subject: [PATCH 03/11] ut and code check modify Signed-off-by: BrainL Change-Id: I4bafa0678c577d37a1db45084e6bf0c5dfc02ade --- .../inner_kits/src/av_trans_control_center_callback.cpp | 4 ++-- av_transport/common/include/av_sync_utils.h | 6 +++--- av_transport/common/include/av_trans_types.h | 2 +- .../test/fuzztest/distributedhardwarefwkkit_fuzzer/BUILD.gn | 2 ++ .../fuzztest/distributedhardwarefwkstub_fuzzer/BUILD.gn | 2 ++ .../include/distributed_hardware_stub_test.h | 2 +- 6 files changed, 11 insertions(+), 7 deletions(-) diff --git a/av_transport/av_trans_control_center/inner_kits/src/av_trans_control_center_callback.cpp b/av_transport/av_trans_control_center/inner_kits/src/av_trans_control_center_callback.cpp index aa0d7b7c..6422975a 100644 --- a/av_transport/av_trans_control_center/inner_kits/src/av_trans_control_center_callback.cpp +++ b/av_transport/av_trans_control_center/inner_kits/src/av_trans_control_center_callback.cpp @@ -33,7 +33,7 @@ int32_t AVTransControlCenterCallback::SetParameter(uint32_t tag, const std::stri return DH_AVT_SUCCESS; } -int32_t AVTransControlCenterCallback::SetSharedMemory(const AVTransSharedMemoryExt &memory) +int32_t AVTransControlCenterCallback::SetSharedMemory(const AVTransSharedMemoryExt& memory) { DHLOGW("AVTransControlCenterCallback::SetSharedMemory enter."); @@ -55,7 +55,7 @@ int32_t AVTransControlCenterCallback::SetSharedMemory(const AVTransSharedMemoryE return DH_AVT_SUCCESS; } -int32_t AVTransControlCenterCallback::Notify(const AVTransEventExt &event) +int32_t AVTransControlCenterCallback::Notify(const AVTransEventExt& event) { DHLOGW("AVTransControlCenterCallback::Notify enter."); return DH_AVT_SUCCESS; diff --git a/av_transport/common/include/av_sync_utils.h b/av_transport/common/include/av_sync_utils.h index b09d4933..f3d63681 100644 --- a/av_transport/common/include/av_sync_utils.h +++ b/av_transport/common/include/av_sync_utils.h @@ -40,7 +40,7 @@ struct AVTransSharedMemoryExt : public AVTransSharedMemory, public Parcelable { using AVTransSharedMemory::AVTransSharedMemory; explicit AVTransSharedMemoryExt() {} virtual ~AVTransSharedMemoryExt() = default; - explicit AVTransSharedMemoryExt(const AVTransSharedMemory &avTransSharedMemory) + explicit AVTransSharedMemoryExt(const AVTransSharedMemory& avTransSharedMemory) { fd = avTransSharedMemory.fd; size = avTransSharedMemory.size; @@ -48,7 +48,7 @@ struct AVTransSharedMemoryExt : public AVTransSharedMemory, public Parcelable { } virtual bool Marshalling(Parcel &parcel) const override { - MessageParcel &messageParcel = static_cast(parcel); + MessageParcel &messageParcel = static_cast(parcel); if (!messageParcel.WriteFileDescriptor(fd)) { return false; } @@ -63,7 +63,7 @@ struct AVTransSharedMemoryExt : public AVTransSharedMemory, public Parcelable { static AVTransSharedMemoryExt *Unmarshalling(Parcel &parcel) { - MessageParcel &messageParcel = static_cast(parcel); + MessageParcel &messageParcel = static_cast(parcel); AVTransSharedMemoryExt *avTransSharedMemory = new (std::nothrow) AVTransSharedMemoryExt(); if (avTransSharedMemory == nullptr) { return nullptr; diff --git a/av_transport/common/include/av_trans_types.h b/av_transport/common/include/av_trans_types.h index c73dedd1..11a251eb 100644 --- a/av_transport/common/include/av_trans_types.h +++ b/av_transport/common/include/av_trans_types.h @@ -148,7 +148,7 @@ struct AVTransEventExt : public AVTransEvent, public Parcelable { using AVTransEvent::AVTransEvent; explicit AVTransEventExt() {} virtual ~AVTransEventExt() = default; - explicit AVTransEventExt(const AVTransEvent &AVTransEvent) + explicit AVTransEventExt(const AVTransEvent& AVTransEvent) { type = AVTransEvent.type; content = AVTransEvent.content; diff --git a/interfaces/inner_kits/test/fuzztest/distributedhardwarefwkkit_fuzzer/BUILD.gn b/interfaces/inner_kits/test/fuzztest/distributedhardwarefwkkit_fuzzer/BUILD.gn index f2d874b4..573ac110 100644 --- a/interfaces/inner_kits/test/fuzztest/distributedhardwarefwkkit_fuzzer/BUILD.gn +++ b/interfaces/inner_kits/test/fuzztest/distributedhardwarefwkkit_fuzzer/BUILD.gn @@ -55,6 +55,8 @@ ohos_fuzztest("DistributedHardwareFwkKitFuzzTest") { "ipc:ipc_core", "safwk:system_ability_fwk", ] + + public_configs = [ "${innerkits_path}:dhfwk_idl_hardware_config" ] } ############################################################################### diff --git a/interfaces/inner_kits/test/fuzztest/distributedhardwarefwkstub_fuzzer/BUILD.gn b/interfaces/inner_kits/test/fuzztest/distributedhardwarefwkstub_fuzzer/BUILD.gn index a344a08b..7ed318f6 100644 --- a/interfaces/inner_kits/test/fuzztest/distributedhardwarefwkstub_fuzzer/BUILD.gn +++ b/interfaces/inner_kits/test/fuzztest/distributedhardwarefwkstub_fuzzer/BUILD.gn @@ -54,6 +54,8 @@ ohos_fuzztest("DistributedHardwareFwkStubFuzzTest") { "ipc:ipc_core", "safwk:system_ability_fwk", ] + + public_configs = [ "${innerkits_path}:dhfwk_idl_hardware_config" ] } ############################################################################### diff --git a/services/distributedhardwarefwkservice/test/unittest/common/distributedhardwarestub/include/distributed_hardware_stub_test.h b/services/distributedhardwarefwkservice/test/unittest/common/distributedhardwarestub/include/distributed_hardware_stub_test.h index 9e6d4975..8c38da8a 100644 --- a/services/distributedhardwarefwkservice/test/unittest/common/distributedhardwarestub/include/distributed_hardware_stub_test.h +++ b/services/distributedhardwarefwkservice/test/unittest/common/distributedhardwarestub/include/distributed_hardware_stub_test.h @@ -91,7 +91,7 @@ int32_t NotifyAVCenter(int32_t engineId, const AVTransEvent &event) return DH_FWK_SUCCESS; } -int32_t RegisterCtlCenterCallback(int32_t engineId, const sptr callback) +int32_t RegisterCtlCenterCallback(int32_t engineId, const sptr callback) { (void)engineId; (void)callback; -- Gitee From f9acbf6099fc22810afed243c5d03f23f7ec0b4e Mon Sep 17 00:00:00 2001 From: BrainL Date: Sat, 24 May 2025 14:44:49 +0800 Subject: [PATCH 04/11] ut modify. Signed-off-by: BrainL Change-Id: Ida0422917997c23fe8d1c0d0066c466f58e8268a --- .../test/unittest/common/distributedhardwarefwkkit/BUILD.gn | 2 ++ 1 file changed, 2 insertions(+) diff --git a/interfaces/inner_kits/test/unittest/common/distributedhardwarefwkkit/BUILD.gn b/interfaces/inner_kits/test/unittest/common/distributedhardwarefwkkit/BUILD.gn index 913a5577..bd72a3ee 100644 --- a/interfaces/inner_kits/test/unittest/common/distributedhardwarefwkkit/BUILD.gn +++ b/interfaces/inner_kits/test/unittest/common/distributedhardwarefwkkit/BUILD.gn @@ -58,6 +58,8 @@ ohos_unittest("DistributedHardwareFwkKitTest") { "safwk:system_ability_fwk", "samgr:samgr_proxy", ] + + public_configs = [ "${innerkits_path}:dhfwk_idl_hardware_config" ] } group("distributed_hardware_fwk_kit_test") { -- Gitee From adb6a4536cbdd73c31c44e0be3cd8d9deb5e7bcf Mon Sep 17 00:00:00 2001 From: BrainL Date: Sat, 24 May 2025 16:24:50 +0800 Subject: [PATCH 05/11] ut modify. Signed-off-by: BrainL Change-Id: Ia9a32ecc4e99845144a426247fdf762a09b7c626 --- interfaces/kits/napi/BUILD.gn | 2 ++ 1 file changed, 2 insertions(+) diff --git a/interfaces/kits/napi/BUILD.gn b/interfaces/kits/napi/BUILD.gn index b57cb752..456412b6 100644 --- a/interfaces/kits/napi/BUILD.gn +++ b/interfaces/kits/napi/BUILD.gn @@ -68,4 +68,6 @@ ohos_shared_library("hardwaremanager") { subsystem_name = "distributedhardware" relative_install_dir = "module/distributedhardware" part_name = "distributed_hardware_fwk" + + public_configs = [ "${innerkits_path}:dhfwk_idl_hardware_config" ] } -- Gitee From 4825d2ffcbc107e0cb1c0705de43c44e32f39a84 Mon Sep 17 00:00:00 2001 From: BrainL Date: Sat, 24 May 2025 17:34:15 +0800 Subject: [PATCH 06/11] ut modify. Signed-off-by: BrainL Change-Id: Iec6688bad938b7e5341ca4ca73180eaf6145d9d9 --- .../src/distributed_hardware_proxy_test.cpp | 1 + .../test/unittest/common/distributedhardwarestub/BUILD.gn | 1 + 2 files changed, 2 insertions(+) diff --git a/interfaces/inner_kits/test/unittest/common/ipc/distributed_hardware_proxy/src/distributed_hardware_proxy_test.cpp b/interfaces/inner_kits/test/unittest/common/ipc/distributed_hardware_proxy/src/distributed_hardware_proxy_test.cpp index 3a85dc52..d9bf7db2 100644 --- a/interfaces/inner_kits/test/unittest/common/ipc/distributed_hardware_proxy/src/distributed_hardware_proxy_test.cpp +++ b/interfaces/inner_kits/test/unittest/common/ipc/distributed_hardware_proxy/src/distributed_hardware_proxy_test.cpp @@ -15,6 +15,7 @@ #include "distributed_hardware_proxy_test.h" #include "dhardware_ipc_interface_code.h" +#include "av_trans_errno.h" using namespace testing::ext; diff --git a/services/distributedhardwarefwkservice/test/unittest/common/distributedhardwarestub/BUILD.gn b/services/distributedhardwarefwkservice/test/unittest/common/distributedhardwarestub/BUILD.gn index 93d92848..c2b37a73 100644 --- a/services/distributedhardwarefwkservice/test/unittest/common/distributedhardwarestub/BUILD.gn +++ b/services/distributedhardwarefwkservice/test/unittest/common/distributedhardwarestub/BUILD.gn @@ -70,6 +70,7 @@ ohos_unittest("DistributedHardwareStubTest") { "googletest:gmock_main", "ipc:ipc_core", "safwk:system_ability_fwk", + "hilog:libhilog", ] } -- Gitee From 620033ebac17822194bfbc2de9eb954d0cb1b176 Mon Sep 17 00:00:00 2001 From: BrainL Date: Sun, 25 May 2025 10:29:58 +0800 Subject: [PATCH 07/11] =?UTF-8?q?=E4=BF=AE=E6=94=B9IDL=E4=BE=9D=E8=B5=96?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: BrainL --- .../test/fuzztest/avtranscallbacknotify_fuzzer/BUILD.gn | 1 + .../fuzztest/avtranscallbacksetparameter_fuzzer/BUILD.gn | 1 + .../fuzztest/avtranscallbacksetsharedmemory_fuzzer/BUILD.gn | 1 + .../test/fuzztest/avtransstubonremoterequest_fuzzer/BUILD.gn | 1 + av_transport/av_trans_control_center/test/unittest/BUILD.gn | 1 + services/distributedhardwarefwkservice/BUILD.gn | 5 ++++- 6 files changed, 9 insertions(+), 1 deletion(-) diff --git a/av_transport/av_trans_control_center/test/fuzztest/avtranscallbacknotify_fuzzer/BUILD.gn b/av_transport/av_trans_control_center/test/fuzztest/avtranscallbacknotify_fuzzer/BUILD.gn index 94d26625..08110f6e 100644 --- a/av_transport/av_trans_control_center/test/fuzztest/avtranscallbacknotify_fuzzer/BUILD.gn +++ b/av_transport/av_trans_control_center/test/fuzztest/avtranscallbacknotify_fuzzer/BUILD.gn @@ -57,6 +57,7 @@ ohos_fuzztest("AVTransCallbackNotifyFuzzTest") { "ipc:ipc_core", "safwk:system_ability_fwk", "samgr:samgr_proxy", + "hilog:libhilog", ] } diff --git a/av_transport/av_trans_control_center/test/fuzztest/avtranscallbacksetparameter_fuzzer/BUILD.gn b/av_transport/av_trans_control_center/test/fuzztest/avtranscallbacksetparameter_fuzzer/BUILD.gn index 2bba786f..fe34696f 100644 --- a/av_transport/av_trans_control_center/test/fuzztest/avtranscallbacksetparameter_fuzzer/BUILD.gn +++ b/av_transport/av_trans_control_center/test/fuzztest/avtranscallbacksetparameter_fuzzer/BUILD.gn @@ -57,6 +57,7 @@ ohos_fuzztest("AVTransCallbackSetParameterFuzzTest") { "ipc:ipc_core", "safwk:system_ability_fwk", "samgr:samgr_proxy", + "hilog:libhilog", ] } diff --git a/av_transport/av_trans_control_center/test/fuzztest/avtranscallbacksetsharedmemory_fuzzer/BUILD.gn b/av_transport/av_trans_control_center/test/fuzztest/avtranscallbacksetsharedmemory_fuzzer/BUILD.gn index e19d3859..eb06cf13 100644 --- a/av_transport/av_trans_control_center/test/fuzztest/avtranscallbacksetsharedmemory_fuzzer/BUILD.gn +++ b/av_transport/av_trans_control_center/test/fuzztest/avtranscallbacksetsharedmemory_fuzzer/BUILD.gn @@ -55,6 +55,7 @@ ohos_fuzztest("AVTransCallbackSetSharedMemoryFuzzTest") { "ipc:ipc_core", "safwk:system_ability_fwk", "samgr:samgr_proxy", + "hilog:libhilog", ] } diff --git a/av_transport/av_trans_control_center/test/fuzztest/avtransstubonremoterequest_fuzzer/BUILD.gn b/av_transport/av_trans_control_center/test/fuzztest/avtransstubonremoterequest_fuzzer/BUILD.gn index b1580d67..2607884e 100644 --- a/av_transport/av_trans_control_center/test/fuzztest/avtransstubonremoterequest_fuzzer/BUILD.gn +++ b/av_transport/av_trans_control_center/test/fuzztest/avtransstubonremoterequest_fuzzer/BUILD.gn @@ -57,6 +57,7 @@ ohos_fuzztest("AVTransStubOnRemoteRequestFuzzTest") { "ipc:ipc_core", "safwk:system_ability_fwk", "samgr:samgr_proxy", + "hilog:libhilog", ] } diff --git a/av_transport/av_trans_control_center/test/unittest/BUILD.gn b/av_transport/av_trans_control_center/test/unittest/BUILD.gn index 116ac0f3..2fbde394 100644 --- a/av_transport/av_trans_control_center/test/unittest/BUILD.gn +++ b/av_transport/av_trans_control_center/test/unittest/BUILD.gn @@ -68,6 +68,7 @@ ohos_unittest("AvTransControlCenterTest") { "c_utils:utils", "dsoftbus:softbus_client", "ipc:ipc_core", + "hilog:libhilog", ] cflags = [ diff --git a/services/distributedhardwarefwkservice/BUILD.gn b/services/distributedhardwarefwkservice/BUILD.gn index 00f2c499..ec7d55fe 100644 --- a/services/distributedhardwarefwkservice/BUILD.gn +++ b/services/distributedhardwarefwkservice/BUILD.gn @@ -111,7 +111,10 @@ ohos_shared_library("distributedhardwarefwksvr") { "src/versionmanager/version_manager.cpp", ] - deps = [ "${utils_path}:distributedhardwareutils" ] + deps = [ + "${utils_path}:distributedhardwareutils", + "${innerkits_path}:dhfwk_idl_hardware_source", + ] defines = [ "HI_LOG_ENABLE", -- Gitee From 72210ead421d1a91e3ee013581083685b98e4232 Mon Sep 17 00:00:00 2001 From: BrainL Date: Wed, 4 Jun 2025 14:31:23 +0800 Subject: [PATCH 08/11] add hilog Signed-off-by: BrainL Change-Id: I31b904e6b767819d4d79ecb30b7cf09ae27e4d98 --- .../test/fuzztest/distributedhardwarefwkstub_fuzzer/BUILD.gn | 1 + 1 file changed, 1 insertion(+) diff --git a/interfaces/inner_kits/test/fuzztest/distributedhardwarefwkstub_fuzzer/BUILD.gn b/interfaces/inner_kits/test/fuzztest/distributedhardwarefwkstub_fuzzer/BUILD.gn index 7ed318f6..397d08d5 100644 --- a/interfaces/inner_kits/test/fuzztest/distributedhardwarefwkstub_fuzzer/BUILD.gn +++ b/interfaces/inner_kits/test/fuzztest/distributedhardwarefwkstub_fuzzer/BUILD.gn @@ -53,6 +53,7 @@ ohos_fuzztest("DistributedHardwareFwkStubFuzzTest") { "c_utils:utils", "ipc:ipc_core", "safwk:system_ability_fwk", + "hilog:libhilog", ] public_configs = [ "${innerkits_path}:dhfwk_idl_hardware_config" ] -- Gitee From 71c5fca72db37d3c84480fd37b9f1eaef4972a13 Mon Sep 17 00:00:00 2001 From: BrainL Date: Thu, 5 Jun 2025 11:14:30 +0800 Subject: [PATCH 09/11] add hilog. Signed-off-by: BrainL Change-Id: If3425216f6a8ac9f5882980c8e8ca3fd3237f936 --- .../test/fuzztest/distributedhardwarefwkkit_fuzzer/BUILD.gn | 1 + 1 file changed, 1 insertion(+) diff --git a/interfaces/inner_kits/test/fuzztest/distributedhardwarefwkkit_fuzzer/BUILD.gn b/interfaces/inner_kits/test/fuzztest/distributedhardwarefwkkit_fuzzer/BUILD.gn index 573ac110..2b6dcea1 100644 --- a/interfaces/inner_kits/test/fuzztest/distributedhardwarefwkkit_fuzzer/BUILD.gn +++ b/interfaces/inner_kits/test/fuzztest/distributedhardwarefwkkit_fuzzer/BUILD.gn @@ -54,6 +54,7 @@ ohos_fuzztest("DistributedHardwareFwkKitFuzzTest") { "c_utils:utils", "ipc:ipc_core", "safwk:system_ability_fwk", + "hilog:libhilog", ] public_configs = [ "${innerkits_path}:dhfwk_idl_hardware_config" ] -- Gitee From 797a69091746d05db4edbeb1ad688df01c835541 Mon Sep 17 00:00:00 2001 From: BrainL Date: Thu, 5 Jun 2025 14:08:23 +0800 Subject: [PATCH 10/11] dhfwk gn modify. Signed-off-by: BrainL Change-Id: I2adfb4b08663fcf596003acd139ae490cc74ba06 --- .../histreamer_ability_querier/test/unittest/common/BUILD.gn | 1 + av_transport/common/test/unittest/BUILD.gn | 1 + .../test/unittest/common/ipc/dhfwk_sa_manager/BUILD.gn | 1 + .../unittest/common/ipc/hardware_status_listener_stub/BUILD.gn | 1 + .../test/unittest/common/ipc/publisher_listener_stub/BUILD.gn | 1 + .../unittest/common/componentmanager/component_privacy/BUILD.gn | 1 + .../test/unittest/common/hidumphelper/enabledcompsdump/BUILD.gn | 1 + .../test/unittest/common/ipc/BUILD.gn | 1 + .../unittest/common/ipc/hardware_status_listener_proxy/BUILD.gn | 1 + .../test/unittest/common/lowlatency/lowlatency/BUILD.gn | 1 + .../test/unittest/common/lowlatency/lowlatencylistener/BUILD.gn | 1 + .../test/unittest/common/publisher/BUILD.gn | 1 + .../test/unittest/common/versionmanager/BUILD.gn | 1 + utils/test/unittest/common/histreamer_ability_parser/BUILD.gn | 1 + utils/test/unittest/common/utilstool/BUILD.gn | 1 + 15 files changed, 15 insertions(+) diff --git a/av_transport/av_trans_handler/histreamer_ability_querier/test/unittest/common/BUILD.gn b/av_transport/av_trans_handler/histreamer_ability_querier/test/unittest/common/BUILD.gn index 1b9fa37c..a8634fa2 100644 --- a/av_transport/av_trans_handler/histreamer_ability_querier/test/unittest/common/BUILD.gn +++ b/av_transport/av_trans_handler/histreamer_ability_querier/test/unittest/common/BUILD.gn @@ -54,6 +54,7 @@ ohos_unittest("HistreamerAbilityQuerierTest") { "bounds_checking_function:libsec_shared", "cJSON:cjson", "c_utils:utils", + "hilog:libhilog", ] defines = [ diff --git a/av_transport/common/test/unittest/BUILD.gn b/av_transport/common/test/unittest/BUILD.gn index 194df3d2..3afb85ef 100644 --- a/av_transport/common/test/unittest/BUILD.gn +++ b/av_transport/common/test/unittest/BUILD.gn @@ -54,6 +54,7 @@ ohos_unittest("AvSyncUtilsTest") { "googletest:gmock", "googletest:gmock_main", "ipc:ipc_core", + "hilog:libhilog", ] cflags = [ diff --git a/interfaces/inner_kits/test/unittest/common/ipc/dhfwk_sa_manager/BUILD.gn b/interfaces/inner_kits/test/unittest/common/ipc/dhfwk_sa_manager/BUILD.gn index 2b65e96b..772eb9f8 100644 --- a/interfaces/inner_kits/test/unittest/common/ipc/dhfwk_sa_manager/BUILD.gn +++ b/interfaces/inner_kits/test/unittest/common/ipc/dhfwk_sa_manager/BUILD.gn @@ -55,6 +55,7 @@ ohos_unittest("DhfwkSaManagerTest") { "ipc:ipc_core", "safwk:system_ability_fwk", "samgr:samgr_proxy", + "hilog:libhilog", ] cflags = [ diff --git a/interfaces/inner_kits/test/unittest/common/ipc/hardware_status_listener_stub/BUILD.gn b/interfaces/inner_kits/test/unittest/common/ipc/hardware_status_listener_stub/BUILD.gn index a6fd17dc..e77d37db 100644 --- a/interfaces/inner_kits/test/unittest/common/ipc/hardware_status_listener_stub/BUILD.gn +++ b/interfaces/inner_kits/test/unittest/common/ipc/hardware_status_listener_stub/BUILD.gn @@ -54,6 +54,7 @@ ohos_unittest("HardwareStatusListenerStubTest") { "ipc:ipc_core", "safwk:system_ability_fwk", "samgr:samgr_proxy", + "hilog:libhilog", ] cflags = [ diff --git a/interfaces/inner_kits/test/unittest/common/ipc/publisher_listener_stub/BUILD.gn b/interfaces/inner_kits/test/unittest/common/ipc/publisher_listener_stub/BUILD.gn index 3da38ba0..c6c5cd6c 100644 --- a/interfaces/inner_kits/test/unittest/common/ipc/publisher_listener_stub/BUILD.gn +++ b/interfaces/inner_kits/test/unittest/common/ipc/publisher_listener_stub/BUILD.gn @@ -55,6 +55,7 @@ ohos_unittest("PublisherListenerStubTest") { "ipc:ipc_core", "safwk:system_ability_fwk", "samgr:samgr_proxy", + "hilog:libhilog", ] cflags = [ diff --git a/services/distributedhardwarefwkservice/test/unittest/common/componentmanager/component_privacy/BUILD.gn b/services/distributedhardwarefwkservice/test/unittest/common/componentmanager/component_privacy/BUILD.gn index 4b5ca7df..c1c128cb 100644 --- a/services/distributedhardwarefwkservice/test/unittest/common/componentmanager/component_privacy/BUILD.gn +++ b/services/distributedhardwarefwkservice/test/unittest/common/componentmanager/component_privacy/BUILD.gn @@ -51,6 +51,7 @@ ohos_unittest("ComponentPrivacyTest") { "ipc:ipc_core", "ipc:ipc_single", "samgr:samgr_proxy", + "hilog:libhilog", ] cflags = [ diff --git a/services/distributedhardwarefwkservice/test/unittest/common/hidumphelper/enabledcompsdump/BUILD.gn b/services/distributedhardwarefwkservice/test/unittest/common/hidumphelper/enabledcompsdump/BUILD.gn index 8f5af6b5..6fb325db 100644 --- a/services/distributedhardwarefwkservice/test/unittest/common/hidumphelper/enabledcompsdump/BUILD.gn +++ b/services/distributedhardwarefwkservice/test/unittest/common/hidumphelper/enabledcompsdump/BUILD.gn @@ -49,6 +49,7 @@ ohos_unittest("EnabledCompsDumpTest") { "eventhandler:libeventhandler", "ipc:ipc_core", "safwk:system_ability_fwk", + "hilog:libhilog", ] cflags = [ diff --git a/services/distributedhardwarefwkservice/test/unittest/common/ipc/BUILD.gn b/services/distributedhardwarefwkservice/test/unittest/common/ipc/BUILD.gn index 065abb95..e0aacd06 100644 --- a/services/distributedhardwarefwkservice/test/unittest/common/ipc/BUILD.gn +++ b/services/distributedhardwarefwkservice/test/unittest/common/ipc/BUILD.gn @@ -53,6 +53,7 @@ ohos_unittest("PublisherListenerProxyTest") { external_deps = [ "c_utils:utils", "ipc:ipc_core", + "hilog:libhilog", ] } diff --git a/services/distributedhardwarefwkservice/test/unittest/common/ipc/hardware_status_listener_proxy/BUILD.gn b/services/distributedhardwarefwkservice/test/unittest/common/ipc/hardware_status_listener_proxy/BUILD.gn index c56df971..59d1a359 100644 --- a/services/distributedhardwarefwkservice/test/unittest/common/ipc/hardware_status_listener_proxy/BUILD.gn +++ b/services/distributedhardwarefwkservice/test/unittest/common/ipc/hardware_status_listener_proxy/BUILD.gn @@ -53,6 +53,7 @@ ohos_unittest("HardwareStatusListenerProxyTest") { external_deps = [ "c_utils:utils", "ipc:ipc_core", + "hilog:libhilog", ] } diff --git a/services/distributedhardwarefwkservice/test/unittest/common/lowlatency/lowlatency/BUILD.gn b/services/distributedhardwarefwkservice/test/unittest/common/lowlatency/lowlatency/BUILD.gn index 133bf69f..99bdedfa 100644 --- a/services/distributedhardwarefwkservice/test/unittest/common/lowlatency/lowlatency/BUILD.gn +++ b/services/distributedhardwarefwkservice/test/unittest/common/lowlatency/lowlatency/BUILD.gn @@ -58,6 +58,7 @@ ohos_unittest("LowLatencyTest") { "eventhandler:libeventhandler", "ipc:ipc_core", "safwk:system_ability_fwk", + "hilog:libhilog", ] } diff --git a/services/distributedhardwarefwkservice/test/unittest/common/lowlatency/lowlatencylistener/BUILD.gn b/services/distributedhardwarefwkservice/test/unittest/common/lowlatency/lowlatencylistener/BUILD.gn index 02da53a7..27f054a2 100644 --- a/services/distributedhardwarefwkservice/test/unittest/common/lowlatency/lowlatencylistener/BUILD.gn +++ b/services/distributedhardwarefwkservice/test/unittest/common/lowlatency/lowlatencylistener/BUILD.gn @@ -58,6 +58,7 @@ ohos_unittest("LowLatencyListenerTest") { "eventhandler:libeventhandler", "ipc:ipc_core", "safwk:system_ability_fwk", + "hilog:libhilog", ] } diff --git a/services/distributedhardwarefwkservice/test/unittest/common/publisher/BUILD.gn b/services/distributedhardwarefwkservice/test/unittest/common/publisher/BUILD.gn index e34fbddd..c8b9d0ed 100644 --- a/services/distributedhardwarefwkservice/test/unittest/common/publisher/BUILD.gn +++ b/services/distributedhardwarefwkservice/test/unittest/common/publisher/BUILD.gn @@ -49,6 +49,7 @@ ohos_unittest("PublisherItemTest") { "ipc:ipc_core", "kv_store:distributeddata_inner", "safwk:system_ability_fwk", + "hilog:libhilog", ] } diff --git a/services/distributedhardwarefwkservice/test/unittest/common/versionmanager/BUILD.gn b/services/distributedhardwarefwkservice/test/unittest/common/versionmanager/BUILD.gn index 7fb04db8..2729efb9 100644 --- a/services/distributedhardwarefwkservice/test/unittest/common/versionmanager/BUILD.gn +++ b/services/distributedhardwarefwkservice/test/unittest/common/versionmanager/BUILD.gn @@ -55,6 +55,7 @@ ohos_unittest("VersionManagerTest") { "c_utils:utils", "eventhandler:libeventhandler", "kv_store:distributeddata_inner", + "hilog:libhilog", ] defines = [ diff --git a/utils/test/unittest/common/histreamer_ability_parser/BUILD.gn b/utils/test/unittest/common/histreamer_ability_parser/BUILD.gn index 2f64105f..2ff89c73 100644 --- a/utils/test/unittest/common/histreamer_ability_parser/BUILD.gn +++ b/utils/test/unittest/common/histreamer_ability_parser/BUILD.gn @@ -38,6 +38,7 @@ ohos_unittest("HistreamerAbilityParserTest") { external_deps = [ "cJSON:cjson", "c_utils:utils", + "hilog:libhilog", ] } diff --git a/utils/test/unittest/common/utilstool/BUILD.gn b/utils/test/unittest/common/utilstool/BUILD.gn index cdbc3907..2f816ac2 100644 --- a/utils/test/unittest/common/utilstool/BUILD.gn +++ b/utils/test/unittest/common/utilstool/BUILD.gn @@ -41,6 +41,7 @@ ohos_unittest("UtilsToolTest") { "cJSON:cjson", "c_utils:utils", "hitrace:hitrace_meter", + "hilog:libhilog", ] } -- Gitee From 38fd888c93abb9f826623f3df337d96149a35736 Mon Sep 17 00:00:00 2001 From: BrainL Date: Mon, 9 Jun 2025 14:15:17 +0800 Subject: [PATCH 11/11] dhfwk format and license modify Signed-off-by: BrainL --- .../av_trans_control_center_callback.h | 2 +- .../src/av_trans_control_center_callback.cpp | 6 ++-- .../include/av_trans_control_center.h | 2 +- .../services/src/av_trans_control_center.cpp | 2 +- .../avtranscallbacknotify_fuzzer/BUILD.gn | 2 +- .../avtranscallbacknotify_fuzzer.cpp | 2 +- .../BUILD.gn | 2 +- .../avtranscallbacksetparameter_fuzzer.cpp | 2 +- .../BUILD.gn | 2 +- .../avtranscallbacksetsharedmemory_fuzzer.cpp | 2 +- .../BUILD.gn | 2 +- .../avtransstubonremoterequest_fuzzer.cpp | 2 +- ...rans_control_center_callback_stub_test.cpp | 2 +- ..._trans_control_center_callback_stub_test.h | 2 +- .../av_trans_control_center_callback_test.cpp | 2 +- .../av_trans_control_center_callback_test.h | 2 +- .../services/av_trans_control_center_test.h | 2 +- .../test/unittest/common/BUILD.gn | 2 +- av_transport/common/include/av_sync_utils.h | 18 ++++++------ av_transport/common/include/av_trans_types.h | 28 +++++++++++++++---- .../IAvTransControlCenterCallback.idl | 4 +-- .../inner_kits/include/ipc/dhfwk_sa_manager.h | 2 +- .../inner_kits/src/ipc/dhfwk_sa_manager.cpp | 2 +- 23 files changed, 55 insertions(+), 39 deletions(-) diff --git a/av_transport/av_trans_control_center/inner_kits/include/av_trans_control_center_callback.h b/av_transport/av_trans_control_center/inner_kits/include/av_trans_control_center_callback.h index ce9ec43e..521da97b 100644 --- a/av_transport/av_trans_control_center/inner_kits/include/av_trans_control_center_callback.h +++ b/av_transport/av_trans_control_center/inner_kits/include/av_trans_control_center_callback.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2022 Huawei Device Co., Ltd. + * Copyright (c) 2022-2025 Huawei Device Co., Ltd. * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at diff --git a/av_transport/av_trans_control_center/inner_kits/src/av_trans_control_center_callback.cpp b/av_transport/av_trans_control_center/inner_kits/src/av_trans_control_center_callback.cpp index 6422975a..7fb896fe 100644 --- a/av_transport/av_trans_control_center/inner_kits/src/av_trans_control_center_callback.cpp +++ b/av_transport/av_trans_control_center/inner_kits/src/av_trans_control_center_callback.cpp @@ -1,10 +1,10 @@ /* - * Copyright (c) 2022 Huawei Device Co., Ltd. + * Copyright (c) 2022-2025 Huawei Device Co., Ltd. * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * - * http://www.apache.org/licenses/LICENSE-2.0 + * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, @@ -33,7 +33,7 @@ int32_t AVTransControlCenterCallback::SetParameter(uint32_t tag, const std::stri return DH_AVT_SUCCESS; } -int32_t AVTransControlCenterCallback::SetSharedMemory(const AVTransSharedMemoryExt& memory) +int32_t AVTransControlCenterCallback::SetSharedMemory(const AVTransSharedMemoryExt &memory) { DHLOGW("AVTransControlCenterCallback::SetSharedMemory enter."); diff --git a/av_transport/av_trans_control_center/services/include/av_trans_control_center.h b/av_transport/av_trans_control_center/services/include/av_trans_control_center.h index a537850c..8d31239e 100644 --- a/av_transport/av_trans_control_center/services/include/av_trans_control_center.h +++ b/av_transport/av_trans_control_center/services/include/av_trans_control_center.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2023 Huawei Device Co., Ltd. + * Copyright (c) 2023-2025 Huawei Device Co., Ltd. * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at diff --git a/av_transport/av_trans_control_center/services/src/av_trans_control_center.cpp b/av_transport/av_trans_control_center/services/src/av_trans_control_center.cpp index e2760eb1..5a888269 100644 --- a/av_transport/av_trans_control_center/services/src/av_trans_control_center.cpp +++ b/av_transport/av_trans_control_center/services/src/av_trans_control_center.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2023-2024 Huawei Device Co., Ltd. + * Copyright (c) 2023-2025 Huawei Device Co., Ltd. * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at diff --git a/av_transport/av_trans_control_center/test/fuzztest/avtranscallbacknotify_fuzzer/BUILD.gn b/av_transport/av_trans_control_center/test/fuzztest/avtranscallbacknotify_fuzzer/BUILD.gn index 08110f6e..51edaa07 100644 --- a/av_transport/av_trans_control_center/test/fuzztest/avtranscallbacknotify_fuzzer/BUILD.gn +++ b/av_transport/av_trans_control_center/test/fuzztest/avtranscallbacknotify_fuzzer/BUILD.gn @@ -1,4 +1,4 @@ -# Copyright (c) 2024 Huawei Device Co., Ltd. +# Copyright (c) 2024-2025 Huawei Device Co., Ltd. # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at diff --git a/av_transport/av_trans_control_center/test/fuzztest/avtranscallbacknotify_fuzzer/avtranscallbacknotify_fuzzer.cpp b/av_transport/av_trans_control_center/test/fuzztest/avtranscallbacknotify_fuzzer/avtranscallbacknotify_fuzzer.cpp index b47dab2d..65131eee 100644 --- a/av_transport/av_trans_control_center/test/fuzztest/avtranscallbacknotify_fuzzer/avtranscallbacknotify_fuzzer.cpp +++ b/av_transport/av_trans_control_center/test/fuzztest/avtranscallbacknotify_fuzzer/avtranscallbacknotify_fuzzer.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2024 Huawei Device Co., Ltd. + * Copyright (c) 2024-2025 Huawei Device Co., Ltd. * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at diff --git a/av_transport/av_trans_control_center/test/fuzztest/avtranscallbacksetparameter_fuzzer/BUILD.gn b/av_transport/av_trans_control_center/test/fuzztest/avtranscallbacksetparameter_fuzzer/BUILD.gn index fe34696f..d3ba3dd9 100644 --- a/av_transport/av_trans_control_center/test/fuzztest/avtranscallbacksetparameter_fuzzer/BUILD.gn +++ b/av_transport/av_trans_control_center/test/fuzztest/avtranscallbacksetparameter_fuzzer/BUILD.gn @@ -1,4 +1,4 @@ -# Copyright (c) 2024 Huawei Device Co., Ltd. +# Copyright (c) 2024-2025 Huawei Device Co., Ltd. # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at diff --git a/av_transport/av_trans_control_center/test/fuzztest/avtranscallbacksetparameter_fuzzer/avtranscallbacksetparameter_fuzzer.cpp b/av_transport/av_trans_control_center/test/fuzztest/avtranscallbacksetparameter_fuzzer/avtranscallbacksetparameter_fuzzer.cpp index 1835c39f..5d753f84 100644 --- a/av_transport/av_trans_control_center/test/fuzztest/avtranscallbacksetparameter_fuzzer/avtranscallbacksetparameter_fuzzer.cpp +++ b/av_transport/av_trans_control_center/test/fuzztest/avtranscallbacksetparameter_fuzzer/avtranscallbacksetparameter_fuzzer.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2024 Huawei Device Co., Ltd. + * Copyright (c) 2024-2025 Huawei Device Co., Ltd. * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at diff --git a/av_transport/av_trans_control_center/test/fuzztest/avtranscallbacksetsharedmemory_fuzzer/BUILD.gn b/av_transport/av_trans_control_center/test/fuzztest/avtranscallbacksetsharedmemory_fuzzer/BUILD.gn index eb06cf13..92aa39a0 100644 --- a/av_transport/av_trans_control_center/test/fuzztest/avtranscallbacksetsharedmemory_fuzzer/BUILD.gn +++ b/av_transport/av_trans_control_center/test/fuzztest/avtranscallbacksetsharedmemory_fuzzer/BUILD.gn @@ -1,4 +1,4 @@ -# Copyright (c) 2024 Huawei Device Co., Ltd. +# Copyright (c) 2024-2025 Huawei Device Co., Ltd. # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at diff --git a/av_transport/av_trans_control_center/test/fuzztest/avtranscallbacksetsharedmemory_fuzzer/avtranscallbacksetsharedmemory_fuzzer.cpp b/av_transport/av_trans_control_center/test/fuzztest/avtranscallbacksetsharedmemory_fuzzer/avtranscallbacksetsharedmemory_fuzzer.cpp index 38d8c1d0..d4cd7c42 100644 --- a/av_transport/av_trans_control_center/test/fuzztest/avtranscallbacksetsharedmemory_fuzzer/avtranscallbacksetsharedmemory_fuzzer.cpp +++ b/av_transport/av_trans_control_center/test/fuzztest/avtranscallbacksetsharedmemory_fuzzer/avtranscallbacksetsharedmemory_fuzzer.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2024 Huawei Device Co., Ltd. + * Copyright (c) 2024-2025 Huawei Device Co., Ltd. * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at diff --git a/av_transport/av_trans_control_center/test/fuzztest/avtransstubonremoterequest_fuzzer/BUILD.gn b/av_transport/av_trans_control_center/test/fuzztest/avtransstubonremoterequest_fuzzer/BUILD.gn index 2607884e..3eb21c8e 100644 --- a/av_transport/av_trans_control_center/test/fuzztest/avtransstubonremoterequest_fuzzer/BUILD.gn +++ b/av_transport/av_trans_control_center/test/fuzztest/avtransstubonremoterequest_fuzzer/BUILD.gn @@ -1,4 +1,4 @@ -# Copyright (c) 2024 Huawei Device Co., Ltd. +# Copyright (c) 2024-2025 Huawei Device Co., Ltd. # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at diff --git a/av_transport/av_trans_control_center/test/fuzztest/avtransstubonremoterequest_fuzzer/avtransstubonremoterequest_fuzzer.cpp b/av_transport/av_trans_control_center/test/fuzztest/avtransstubonremoterequest_fuzzer/avtransstubonremoterequest_fuzzer.cpp index c1ae3c63..33f196af 100644 --- a/av_transport/av_trans_control_center/test/fuzztest/avtransstubonremoterequest_fuzzer/avtransstubonremoterequest_fuzzer.cpp +++ b/av_transport/av_trans_control_center/test/fuzztest/avtransstubonremoterequest_fuzzer/avtransstubonremoterequest_fuzzer.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2024 Huawei Device Co., Ltd. + * Copyright (c) 2024-2025 Huawei Device Co., Ltd. * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at diff --git a/av_transport/av_trans_control_center/test/unittest/inner_kits/av_trans_control_center_callback_stub_test.cpp b/av_transport/av_trans_control_center/test/unittest/inner_kits/av_trans_control_center_callback_stub_test.cpp index c5f72b26..28487560 100644 --- a/av_transport/av_trans_control_center/test/unittest/inner_kits/av_trans_control_center_callback_stub_test.cpp +++ b/av_transport/av_trans_control_center/test/unittest/inner_kits/av_trans_control_center_callback_stub_test.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2023 Huawei Device Co., Ltd. + * Copyright (c) 2023-2025 Huawei Device Co., Ltd. * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at diff --git a/av_transport/av_trans_control_center/test/unittest/inner_kits/av_trans_control_center_callback_stub_test.h b/av_transport/av_trans_control_center/test/unittest/inner_kits/av_trans_control_center_callback_stub_test.h index bc3680d9..ba736d43 100644 --- a/av_transport/av_trans_control_center/test/unittest/inner_kits/av_trans_control_center_callback_stub_test.h +++ b/av_transport/av_trans_control_center/test/unittest/inner_kits/av_trans_control_center_callback_stub_test.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2023 Huawei Device Co., Ltd. + * Copyright (c) 2023-2025 Huawei Device Co., Ltd. * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at diff --git a/av_transport/av_trans_control_center/test/unittest/inner_kits/av_trans_control_center_callback_test.cpp b/av_transport/av_trans_control_center/test/unittest/inner_kits/av_trans_control_center_callback_test.cpp index c3408209..d02eff92 100644 --- a/av_transport/av_trans_control_center/test/unittest/inner_kits/av_trans_control_center_callback_test.cpp +++ b/av_transport/av_trans_control_center/test/unittest/inner_kits/av_trans_control_center_callback_test.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2023-2024 Huawei Device Co., Ltd. + * Copyright (c) 2023-2025 Huawei Device Co., Ltd. * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at diff --git a/av_transport/av_trans_control_center/test/unittest/inner_kits/av_trans_control_center_callback_test.h b/av_transport/av_trans_control_center/test/unittest/inner_kits/av_trans_control_center_callback_test.h index 4ed77ece..32511d08 100644 --- a/av_transport/av_trans_control_center/test/unittest/inner_kits/av_trans_control_center_callback_test.h +++ b/av_transport/av_trans_control_center/test/unittest/inner_kits/av_trans_control_center_callback_test.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2023-2024 Huawei Device Co., Ltd. + * Copyright (c) 2023-2025 Huawei Device Co., Ltd. * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at diff --git a/av_transport/av_trans_control_center/test/unittest/services/av_trans_control_center_test.h b/av_transport/av_trans_control_center/test/unittest/services/av_trans_control_center_test.h index 6acd4d8f..926d6bca 100644 --- a/av_transport/av_trans_control_center/test/unittest/services/av_trans_control_center_test.h +++ b/av_transport/av_trans_control_center/test/unittest/services/av_trans_control_center_test.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2023 Huawei Device Co., Ltd. + * Copyright (c) 2023-2025 Huawei Device Co., Ltd. * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at diff --git a/av_transport/av_trans_handler/histreamer_ability_querier/test/unittest/common/BUILD.gn b/av_transport/av_trans_handler/histreamer_ability_querier/test/unittest/common/BUILD.gn index a8634fa2..41d15659 100644 --- a/av_transport/av_trans_handler/histreamer_ability_querier/test/unittest/common/BUILD.gn +++ b/av_transport/av_trans_handler/histreamer_ability_querier/test/unittest/common/BUILD.gn @@ -1,4 +1,4 @@ -# Copyright (c) 2023-2024 Huawei Device Co., Ltd. +# Copyright (c) 2023-2025 Huawei Device Co., Ltd. # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at diff --git a/av_transport/common/include/av_sync_utils.h b/av_transport/common/include/av_sync_utils.h index f3d63681..c0bf8752 100644 --- a/av_transport/common/include/av_sync_utils.h +++ b/av_transport/common/include/av_sync_utils.h @@ -1,10 +1,10 @@ /* - * Copyright (C) 2023 Huawei Device Co., Ltd. + * Copyright (C) 2023-2025 Huawei Device Co., Ltd. * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * - * http://www.apache.org/licenses/LICENSE-2.0 + * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, @@ -81,20 +81,20 @@ struct AVSyncClockUnit { int64_t pts; }; -/* * +/** * @brief create shared memory space for av sync. * @param name name for the shared memory. * @return shared memory struct, include fd, size and name. */ AVTransSharedMemory CreateAVTransSharedMemory(const std::string &name, size_t size); -/* * +/** * @brief close shared memory space. * @param memory shared memory. */ void CloseAVTransSharedMemory(AVTransSharedMemory &memory) noexcept; -/* * +/** * @brief write the clock unit into the shared memory space. * @param memory shared memory * @param clockUnit the clock unit @@ -102,7 +102,7 @@ void CloseAVTransSharedMemory(AVTransSharedMemory &memory) noexcept; */ int32_t WriteClockUnitToMemory(const AVTransSharedMemory &memory, AVSyncClockUnit &clockUnit); -/* * +/** * @brief read clock unit from the shared memory space. * @param memory shared memory * @param clockUnit the clock unit @@ -110,7 +110,7 @@ int32_t WriteClockUnitToMemory(const AVTransSharedMemory &memory, AVSyncClockUni */ int32_t ReadClockUnitFromMemory(const AVTransSharedMemory &memory, AVSyncClockUnit &clockUnit); -/* * +/** * @brief write frame number and pts into the shared memory space. * @param memory shared memory * @param frameNum the frame number @@ -119,7 +119,7 @@ int32_t ReadClockUnitFromMemory(const AVTransSharedMemory &memory, AVSyncClockUn */ int32_t WriteFrameInfoToMemory(const AVTransSharedMemory &memory, uint32_t frameNum, int64_t timestamp); -/* * +/** * @brief read frame number and pts from the shared memory space. * @param memory shared memory * @param frameNum the frame number @@ -128,7 +128,7 @@ int32_t WriteFrameInfoToMemory(const AVTransSharedMemory &memory, uint32_t frame */ int32_t ReadFrameInfoFromMemory(const AVTransSharedMemory &memory, uint32_t &frameNum, int64_t ×tamp); -/* * +/** * @brief reset the shared memory value to all zeros. * @param memory shared memory * @return Returns DH_AVT_SUCCESS(0) if successful, otherwise returns other error code. diff --git a/av_transport/common/include/av_trans_types.h b/av_transport/common/include/av_trans_types.h index 11a251eb..0c0a5c00 100644 --- a/av_transport/common/include/av_trans_types.h +++ b/av_transport/common/include/av_trans_types.h @@ -1,10 +1,10 @@ /* - * Copyright (c) 2023 Huawei Device Co., Ltd. + * Copyright (c) 2023-2025 Huawei Device Co., Ltd. * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * - * http://www.apache.org/licenses/LICENSE-2.0 + * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, @@ -52,11 +52,22 @@ const std::string VIDEO_FORMAT_JEPG = "jpeg"; const std::string VIDEO_FORMAT_YUVI420 = "yuvi420"; const std::string VIDEO_FORMAT_RGBA8888 = "rgba8888"; -enum struct TransRole : uint32_t { AV_SENDER = 0, AV_RECEIVER = 1, UNKNOWN = 2 }; +enum struct TransRole : uint32_t { + AV_SENDER = 0, + AV_RECEIVER = 1, + UNKNOWN = 2 +}; -enum struct AvSyncFlag : uint32_t { MASTER = 0, SLAVE = 1, UNKNOWN = 2 }; +enum struct AvSyncFlag : uint32_t { + MASTER = 0, + SLAVE = 1, + UNKNOWN = 2 +}; -enum struct TransStrategy : uint32_t { LOW_LATANCY_STRATEGY, LOW_JITTER_STRATEGY }; +enum struct TransStrategy : uint32_t { + LOW_LATANCY_STRATEGY, + LOW_JITTER_STRATEGY +}; struct ChannelAttribute { TransStrategy strategy; @@ -79,7 +90,12 @@ enum struct StateId : uint32_t { BUTT, }; -enum struct TagSection : uint8_t { REGULAR = 1, D_AUDIO = 2, D_VIDEO = 3, MAX_SECTION = 64 }; +enum struct TagSection : uint8_t { + REGULAR = 1, + D_AUDIO = 2, + D_VIDEO = 3, + MAX_SECTION = 64 +}; enum struct AVTransTag : uint32_t { INVALID = 0, diff --git a/interfaces/inner_kits/IAvTransControlCenterCallback.idl b/interfaces/inner_kits/IAvTransControlCenterCallback.idl index 123a3f56..572afca1 100644 --- a/interfaces/inner_kits/IAvTransControlCenterCallback.idl +++ b/interfaces/inner_kits/IAvTransControlCenterCallback.idl @@ -1,5 +1,5 @@ /* - * Copyright (c) 2023 Huawei Device Co., Ltd. + * Copyright (c) 2025 Huawei Device Co., Ltd. * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at @@ -12,7 +12,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ - + package OHOS.DistributedHardware; sequenceable AvTransTypes..OHOS.DistributedHardware.AVTransEventExt; sequenceable AvSyncUtils..OHOS.DistributedHardware.AVTransSharedMemoryExt; diff --git a/interfaces/inner_kits/include/ipc/dhfwk_sa_manager.h b/interfaces/inner_kits/include/ipc/dhfwk_sa_manager.h index f5283a3a..0a7f1e59 100644 --- a/interfaces/inner_kits/include/ipc/dhfwk_sa_manager.h +++ b/interfaces/inner_kits/include/ipc/dhfwk_sa_manager.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2022 Huawei Device Co., Ltd. + * Copyright (c) 2022-2025 Huawei Device Co., Ltd. * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at diff --git a/interfaces/inner_kits/src/ipc/dhfwk_sa_manager.cpp b/interfaces/inner_kits/src/ipc/dhfwk_sa_manager.cpp index d044cd97..b1b9b2c8 100644 --- a/interfaces/inner_kits/src/ipc/dhfwk_sa_manager.cpp +++ b/interfaces/inner_kits/src/ipc/dhfwk_sa_manager.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2022-2024 Huawei Device Co., Ltd. + * Copyright (c) 2022-2025 Huawei Device Co., Ltd. * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at -- Gitee