Description: add dinput config

Match-id-0f3fd500564870a3c9c547c539f095cb0bdb9901
This commit is contained in:
xxxx
2022-06-08 08:55:08 +08:00
parent 73512ebab7
commit 7d067bb187
93 changed files with 0 additions and 13958 deletions
-68
View File
@@ -1,68 +0,0 @@
# Copyright (c) 2021-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.
import("//build/ohos.gni")
import("//foundation/distributedhardware/distributedinput/distributedinput.gni")
ohos_shared_library("libdinput_sink_handler") {
include_dirs = [
"include",
"${innerkits_path}/include",
"${innerkits_path}/src",
"${ipc_path}/include",
"${ipc_path}/src",
"${services_sink_path}/sinkmanager/include",
"${frameworks_path}/include",
"${service_common}/include",
"${common_path}/include",
"//utils/native/base/include",
"//utils/system/safwk/native/include",
"${fwk_common_path}/log/include",
"${fwk_common_path}/utils/include",
"${fwk_utils_path}/include/log",
"${fwk_utils_path}/include",
]
sources = [
"src/distributed_input_sink_handler.cpp",
"src/load_d_input_sink_callback.cpp"
]
defines = [
"HI_LOG_ENABLE",
"DH_LOG_TAG=\"distributedinputsinkhandler\"",
"LOG_DOMAIN=0xD004100",
]
deps = [
"//foundation/bundlemanager/bundle_framework/interfaces/innerkits/libeventhandler:libeventhandler",
"//utils/native/base:utils",
"${fwk_utils_path}:distributedhardwareutils",
"${innerkits_path}:libdinput_sdk",
"${services_sink_path}/sinkmanager:libdinput_sink",
]
external_deps = [
"ipc:ipc_core",
"safwk:system_ability_fwk",
"hiviewdfx_hilog_native:libhilog",
"samgr_standard:samgr_proxy",
]
cflags_cc = [ "-DHILOG_ENABLE" ]
subsystem_name = "distributedhardware"
part_name = "distributed_input"
}
@@ -1,85 +0,0 @@
/*
* Copyright (c) 2021-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.
*/
#ifndef DISTRIBUTED_INPUT_SINK_HANDLER_H
#define DISTRIBUTED_INPUT_SINK_HANDLER_H
#include <condition_variable>
#include <mutex>
#include <string>
#include "idistributed_hardware_sink.h"
#include "iservice_registry.h"
#include "single_instance.h"
#include "system_ability_definition.h"
#include "system_ability_load_callback_stub.h"
#include "distributed_input_client.h"
namespace OHOS {
namespace DistributedHardware {
namespace DistributedInput {
class DistributedInputSinkHandler : public IDistributedHardwareSink {
DECLARE_SINGLE_INSTANCE_BASE(DistributedInputSinkHandler);
public:
int32_t InitSink(const std::string& params) override;
int32_t ReleaseSink() override;
int32_t SubscribeLocalHardware(const std::string& dhId, const std::string& parameters) override;
int32_t UnsubscribeLocalHardware(const std::string& dhId) override;
void FinishStartSA(const std::string &params, const sptr<IRemoteObject> &remoteObject);
public:
class SALoadSinkCb : public OHOS::SystemAbilityLoadCallbackStub {
public:
void OnLoadSystemAbilitySuccess(int32_t systemAbilityId,
const OHOS::sptr<IRemoteObject>& remoteObject) override;
void OnLoadSystemAbilityFail(int32_t systemAbilityId) override;
int32_t GetSystemAbilityId() const
{
return currSystemAbilityId;
}
OHOS::sptr<IRemoteObject> GetRemoteObject() const
{
return currRemoteObject;
}
private:
int32_t currSystemAbilityId = 0;
OHOS::sptr<OHOS::IRemoteObject> currRemoteObject;
};
private:
DistributedInputSinkHandler() = default;
~DistributedInputSinkHandler();
OHOS::sptr<OHOS::ISystemAbilityLoadCallback> sysSinkCallback = nullptr;
std::mutex proxyMutex_;
std::condition_variable proxyConVar_;
};
#ifdef __cplusplus
extern "C" {
#endif
__attribute__((visibility("default"))) IDistributedHardwareSink *GetSinkHardwareHandler();
#ifdef __cplusplus
}
#endif
} // namespace DistributedInput
} // namespace DistributedHardware
} // namespace OHOS
#endif // DISTRIBUTED_INPUT_SINK_HANDLER_H
@@ -1,36 +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.
*/
#ifndef LOAD_D_INPUT_SOURCE_CALLBACK_H
#define LOAD_D_INPUT_SOURCE_CALLBACK_H
#include "system_ability_load_callback_stub.h"
namespace OHOS {
namespace DistributedHardware {
namespace DistributedInput {
class LoadDInputSinkCallback : public SystemAbilityLoadCallbackStub {
public:
explicit LoadDInputSinkCallback(const std::string &params);
void OnLoadSystemAbilitySuccess(int32_t systemAbilityId,
const sptr<IRemoteObject> &remoteObject) override;
void OnLoadSystemAbilityFail(int32_t systemAbilityId) override;
private:
std::string params_;
};
}
}
}
#endif
@@ -1,107 +0,0 @@
/*
* Copyright (c) 2021-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 "distributed_input_sink_handler.h"
#include "distributed_hardware_log.h"
#include "dinput_errcode.h"
#include "i_distributed_sink_input.h"
#include "load_d_input_sink_callback.h"
namespace OHOS {
namespace DistributedHardware {
namespace DistributedInput {
IMPLEMENT_SINGLE_INSTANCE(DistributedInputSinkHandler);
DistributedInputSinkHandler::~DistributedInputSinkHandler()
{
DHLOGI("~DistributedInputSinkHandler");
}
int32_t DistributedInputSinkHandler::InitSink(const std::string &params)
{
DHLOGD("InitSource");
std::unique_lock<std::mutex> lock(proxyMutex_);
if (!DistributedInputClient::GetInstance().HasDInputSinkProxy()) {
sptr<ISystemAbilityManager> samgr = SystemAbilityManagerClient::GetInstance().GetSystemAbilityManager();
if (!samgr) {
DHLOGE("Failed to get system ability mgr.");
return ERR_DH_INPUT_SINK_HANDLER_INIT_SINK_SA_FAIL;
}
sptr<LoadDInputSinkCallback> loadCallback = new LoadDInputSinkCallback(params);
int32_t ret = samgr->LoadSystemAbility(DISTRIBUTED_HARDWARE_INPUT_SINK_SA_ID, loadCallback);
if (ret != ERR_OK) {
DHLOGE("Failed to Load systemAbility, systemAbilityId:%d, ret code:%d",
DISTRIBUTED_HARDWARE_INPUT_SINK_SA_ID, ret);
return ERR_DH_INPUT_SINK_HANDLER_INIT_SINK_SA_FAIL;
}
}
auto waitStatus = proxyConVar_.wait_for(lock, std::chrono::milliseconds(INPUT_LOADSA_TIMEOUT_MS),
[this]() { return (DistributedInputClient::GetInstance().HasDInputSinkProxy()); });
if (!waitStatus) {
DHLOGE("dinput load sa timeout.");
return ERR_DH_INPUT_SINK_HANDLER_INIT_SINK_SA_FAIL;
}
return DH_SUCCESS;
}
void DistributedInputSinkHandler::FinishStartSA(const std::string &params, const sptr<IRemoteObject> &remoteObject)
{
DHLOGD("FinishStartSA");
std::unique_lock<std::mutex> lock(proxyMutex_);
DistributedInputClient::GetInstance().SetDInputSinkProxy(remoteObject);
DistributedInputClient::GetInstance().InitSink();
proxyConVar_.notify_all();
}
int32_t DistributedInputSinkHandler::ReleaseSink()
{
return DistributedInputClient::GetInstance().ReleaseSink();
}
int32_t DistributedInputSinkHandler::SubscribeLocalHardware(const std::string &dhId, const std::string &params)
{
return DH_SUCCESS;
}
int32_t DistributedInputSinkHandler::UnsubscribeLocalHardware(const std::string &dhId)
{
return DH_SUCCESS;
}
void DistributedInputSinkHandler::SALoadSinkCb::OnLoadSystemAbilitySuccess(int32_t systemAbilityId,
const OHOS::sptr<IRemoteObject>& remoteObject)
{
currSystemAbilityId = systemAbilityId;
currRemoteObject = remoteObject;
DHLOGI("DistributedInputSinkHandler OnLoadSystemAbilitySuccess. systemAbilityId=%d", systemAbilityId);
}
void DistributedInputSinkHandler::SALoadSinkCb::OnLoadSystemAbilityFail(int32_t systemAbilityId)
{
currSystemAbilityId = systemAbilityId;
DHLOGE("DistributedInputSinkHandler OnLoadSystemAbilityFail. systemAbilityId=%d", systemAbilityId);
}
IDistributedHardwareSink *GetSinkHardwareHandler()
{
return &DistributedInputSinkHandler::GetInstance();
}
} // namespace DistributedInput
} // namespace DistributedHardware
} // namespace OHOS
@@ -1,44 +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 "distributed_hardware_log.h"
#include "distributed_input_sink_handler.h"
#include "load_d_input_sink_callback.h"
namespace OHOS {
namespace DistributedHardware {
namespace DistributedInput {
LoadDInputSinkCallback::LoadDInputSinkCallback(const std::string &params) : params_(params) {}
void LoadDInputSinkCallback::OnLoadSystemAbilitySuccess(
int32_t systemAbilityId, const sptr<IRemoteObject> &remoteObject)
{
DHLOGI("load dinput SA success, systemAbilityId:%d, remoteObject result:%s",
systemAbilityId, (remoteObject != nullptr) ? "true" : "false");
if (remoteObject == nullptr) {
DHLOGE("remoteObject is nullptr");
return;
}
DistributedInputSinkHandler::GetInstance().FinishStartSA(params_, remoteObject);
}
void LoadDInputSinkCallback::OnLoadSystemAbilityFail(int32_t systemAbilityId)
{
DHLOGE("load dinput SA failed, systemAbilityId:%d", systemAbilityId);
}
}
}
}
-18
View File
@@ -1,18 +0,0 @@
# Copyright (c) 2021-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.
group("test") {
testonly = true
deps = [ "unittest:unittest" ]
}
-86
View File
@@ -1,86 +0,0 @@
# Copyright (c) 2021-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.
import("//build/test.gni")
import("//foundation/distributedhardware/distributedinput/distributedinput.gni")
module_out_path = "distributedinput_stander/sink_handler"
group("unittest") {
testonly = true
deps = [ ":distributed_input_sink_handler_test" ]
}
## UnitTest distributed_input_manager_service_test {{{
ohos_unittest("distributed_input_sink_handler_test") {
module_out_path = module_out_path
include_dirs = [
"${distributedinput_path}/sinkhandler/include",
"${innerkits_path}/include",
"${innerkits_path}/src",
"${ipc_path}/include",
"${ipc_path}/src",
"${services_sink_path}/sinkmanager/include",
"${frameworks_path}/include",
"${service_common}/include",
"${common_path}/include",
"//utils/native/base/include",
"//utils/system/safwk/native/include",
"${fwk_common_path}/log/include",
"${fwk_common_path}/utils/include",
"${fwk_utils_path}/include/log",
"${fwk_utils_path}/include",
"//third_party/json/include",
]
sources = [
"//foundation/distributedhardware/distributedinput/sinkhandler/src/distributed_input_sink_handler.cpp",
"//foundation/distributedhardware/distributedinput/sinkhandler/src/load_d_input_sink_callback.cpp",
"distributed_input_sinkhandler_test.cpp",
"//foundation/distributedhardware/distributedinput/sinkhandler/test/unittest/mock/mock_distributed_input_client.cpp",
]
cflags = [
"-Wall",
"-Werror",
"-g3",
"-Dprivate=public",
"-Dprotected=public",
]
defines = [
"HI_LOG_ENABLE",
"DH_LOG_TAG=\"distributedinpututtest\"",
"LOG_DOMAIN=0xD004100",
]
deps = [
"//foundation/bundlemanager/bundle_framework/interfaces/innerkits/libeventhandler:libeventhandler",
"//utils/native/base:utils",
"${fwk_utils_path}:distributedhardwareutils",
"${innerkits_path}:libdinput_sdk",
"${services_source_path}/sourcemanager:libdinput_source",
]
external_deps = [
"ipc:ipc_core",
"safwk:system_ability_fwk",
"hiviewdfx_hilog_native:libhilog",
"samgr_standard:samgr_proxy",
]
cflags_cc = [ "-DHILOG_ENABLE" ]
}
## UnitTest distributed_input_manager_service_test }}}
@@ -1,109 +0,0 @@
/*
* Copyright (c) 2021-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 "distributed_input_sinkhandler_test.h"
using namespace testing::ext;
using namespace OHOS::DistributedHardware::DistributedInput;
using namespace std;
namespace OHOS {
namespace DistributedHardware {
namespace DistributedInput {
void DistributedInputSinkHandlerTest::SetUp()
{
}
void DistributedInputSinkHandlerTest::TearDown()
{
}
void DistributedInputSinkHandlerTest::SetUpTestCase()
{
}
void DistributedInputSinkHandlerTest::TearDownTestCase()
{
}
HWTEST_F(DistributedInputSinkHandlerTest, InitSink01, testing::ext::TestSize.Level0)
{
int32_t ret = DistributedInputSinkHandler::GetInstance().InitSink("params");
EXPECT_EQ(SUCCESS, ret);
}
HWTEST_F(DistributedInputSinkHandlerTest, InitSink02, testing::ext::TestSize.Level0)
{
std::string params = "";
int32_t ret = DistributedInputSinkHandler::GetInstance().InitSink(params);
EXPECT_EQ(SUCCESS, ret);
}
HWTEST_F(DistributedInputSinkHandlerTest, InitSink03, testing::ext::TestSize.Level0)
{
std::string params = "params";
int32_t ret = DistributedInputSinkHandler::GetInstance().InitSink(params);
EXPECT_EQ(SUCCESS, ret);
}
HWTEST_F(DistributedInputSinkHandlerTest, ReleaseSink01, testing::ext::TestSize.Level0)
{
int32_t ret = DistributedInputSinkHandler::GetInstance().ReleaseSink();
EXPECT_EQ(SUCCESS, ret);
}
HWTEST_F(DistributedInputSinkHandlerTest, SubscribeLocalHardware01, testing::ext::TestSize.Level0)
{
int32_t ret = DistributedInputSinkHandler::GetInstance().SubscribeLocalHardware("dhId", "params");
EXPECT_EQ(SUCCESS, ret);
}
HWTEST_F(DistributedInputSinkHandlerTest, SubscribeLocalHardware02, testing::ext::TestSize.Level0)
{
std::string dhId = "SubscribeLocalHardware02";
std::string params = "test2";
int32_t ret = DistributedInputSinkHandler::GetInstance().SubscribeLocalHardware(dhId, params);
EXPECT_EQ(SUCCESS, ret);
}
HWTEST_F(DistributedInputSinkHandlerTest, SubscribeLocalHardware03, testing::ext::TestSize.Level0)
{
std::string dhId = "SubscribeLocalHardware03";
std::string params = "test3";
int32_t ret = DistributedInputSinkHandler::GetInstance().SubscribeLocalHardware(dhId, params);
EXPECT_EQ(SUCCESS, ret);
}
HWTEST_F(DistributedInputSinkHandlerTest, UnsubscribeLocalHardware01, testing::ext::TestSize.Level0)
{
int32_t ret = DistributedInputSinkHandler::GetInstance().UnsubscribeLocalHardware("dhId");
EXPECT_EQ(SUCCESS, ret);
}
HWTEST_F(DistributedInputSinkHandlerTest, UnsubscribeLocalHardware02, testing::ext::TestSize.Level0)
{
std::string dhId = "UnsubscribeLocalHardware02";
int32_t ret = DistributedInputSinkHandler::GetInstance().UnsubscribeLocalHardware(dhId);
EXPECT_EQ(SUCCESS, ret);
}
HWTEST_F(DistributedInputSinkHandlerTest, UnsubscribeLocalHardware03, testing::ext::TestSize.Level0)
{
std::string dhId = "UnsubscribeLocalHardware03";
int32_t ret = DistributedInputSinkHandler::GetInstance().UnsubscribeLocalHardware(dhId);
EXPECT_EQ(SUCCESS, ret);
}
}
}
}
@@ -1,45 +0,0 @@
/*
* Copyright (c) 2021-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.
*/
#ifndef DISRIBUTED_INPUT_SINKHANDLER_TEST_H
#define DISRIBUTED_INPUT_SINKHANDLER_TEST_H
#include <refbase.h>
#include <gtest/gtest.h>
#include "system_ability_load_callback_stub.h"
#include "constants_dinput.h"
#include "distributed_input_sink_handler.h"
#include "i_distributed_sink_input.h"
#include "register_d_input_call_back_stub.h"
#include "unregister_d_input_call_back_stub.h"
namespace OHOS {
namespace DistributedHardware {
namespace DistributedInput {
class DistributedInputSinkHandlerTest : public testing::Test {
public:
static void SetUpTestCase();
static void TearDownTestCase();
virtual void SetUp() override;
virtual void TearDown() override;
int32_t CheckSystemAbility();
};
} // namespace DistributedInput
} // namespace DistributedHardware
} // namespace OHOS
#endif // DISRIBUTED_INPUT_SINKHANDLER_TEST_H
@@ -1,173 +0,0 @@
/*
* Copyright (c) 2021-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 "distributed_hardware_log.h"
#include "nlohmann/json.hpp"
#include "constants_dinput.h"
#include "distributed_input_client.h"
#include "white_list_util.h"
namespace OHOS {
namespace DistributedHardware {
namespace DistributedInput {
DistributedInputClient &DistributedInputClient::GetInstance()
{
static DistributedInputClient instance;
return instance;
}
void DistributedInputClient::RegisterDInputCb::OnResult(
const std::string& devId, const std::string& dhId, const int32_t& status)
{
for (std::vector<DHardWareFwkRegistInfo>::iterator iter =
DistributedInputClient::GetInstance().dHardWareFwkRstInfos.begin();
iter != DistributedInputClient::GetInstance().dHardWareFwkRstInfos.end();
iter++) {
if (iter->devId == devId && iter->dhId == dhId) {
iter->callback->OnRegisterResult(devId, dhId, status, "");
DistributedInputClient::GetInstance().dHardWareFwkRstInfos.erase(iter);
return;
}
}
}
void DistributedInputClient::UnregisterDInputCb::OnResult(
const std::string& devId, const std::string& dhId, const int32_t& status)
{
for (std::vector<DHardWareFwkUnRegistInfo>::iterator iter =
DistributedInputClient::GetInstance().dHardWareFwkUnRstInfos.begin();
iter != DistributedInputClient::GetInstance().dHardWareFwkUnRstInfos.end();
iter++) {
if (iter->devId == devId && iter->dhId == dhId) {
iter->callback->OnUnregisterResult(devId, dhId, status, "");
DistributedInputClient::GetInstance().dHardWareFwkUnRstInfos.erase(iter);
return;
}
}
}
void DistributedInputClient::StartDInputServerCb::OnResult(const int32_t& status, const uint32_t& inputTypes)
{
if (DInputServerType::SOURCE_SERVER_TYPE == static_cast<DInputServerType>(status)) {
DistributedInputClient::GetInstance().serverType = DInputServerType::SOURCE_SERVER_TYPE;
DistributedInputClient::GetInstance().inputTypes = inputTypes;
} else if (DInputServerType::SINK_SERVER_TYPE == static_cast<DInputServerType>(status)) {
DistributedInputClient::GetInstance().serverType = DInputServerType::SINK_SERVER_TYPE;
DistributedInputClient::GetInstance().inputTypes = inputTypes;
} else {
DistributedInputClient::GetInstance().serverType = DInputServerType::NULL_SERVER_TYPE;
DistributedInputClient::GetInstance().inputTypes = INPUT_TYPE_NULL;
}
}
void DistributedInputClient::AddWhiteListInfosCb::OnResult(const std::string &deviceId, const std::string &strJson)
{
nlohmann::json inputData = nlohmann::json::parse(strJson);
int jsonSize = inputData.size();
DHLOGI("AddWhiteListInfosCb OnResult json size:%d.\n", jsonSize);
TYPE_WHITE_LIST_VEC vecWhiteList = inputData;
WhiteListUtil::GetInstance().SyncWhiteList(deviceId, vecWhiteList);
}
void DistributedInputClient::DelWhiteListInfosCb::OnResult(const std::string& deviceId)
{
WhiteListUtil::GetInstance().ClearWhiteList(deviceId);
}
int32_t DistributedInputClient::InitSource()
{
return SUCCESS;
}
int32_t DistributedInputClient::InitSink()
{
return SUCCESS;
}
int32_t DistributedInputClient::ReleaseSource()
{
return SUCCESS;
}
int32_t DistributedInputClient::ReleaseSink()
{
return SUCCESS;
}
int32_t DistributedInputClient::RegisterDistributedHardware(const std::string& devId, const std::string& dhId,
const std::string& parameters, const std::shared_ptr<RegisterCallback>& callback)
{
return SUCCESS;
}
int32_t DistributedInputClient::UnregisterDistributedHardware(const std::string& devId, const std::string& dhId,
const std::shared_ptr<UnregisterCallback>& callback)
{
return SUCCESS;
}
int32_t DistributedInputClient::PrepareRemoteInput(
const std::string& deviceId, sptr<IPrepareDInputCallback> callback)
{
return SUCCESS;
}
int32_t DistributedInputClient::UnprepareRemoteInput(
const std::string& deviceId, sptr<IUnprepareDInputCallback> callback)
{
return SUCCESS;
}
int32_t DistributedInputClient::StartRemoteInput(
const std::string& deviceId, const uint32_t& inputTypes, sptr<IStartDInputCallback> callback)
{
return SUCCESS;
}
int32_t DistributedInputClient::StopRemoteInput(
const std::string& deviceId, const uint32_t& inputTypes, sptr<IStopDInputCallback> callback)
{
return SUCCESS;
}
bool DistributedInputClient::IsNeedFilterOut(const std::string& deviceId, const BusinessEvent& event)
{
return true;
}
DInputServerType DistributedInputClient::IsStartDistributedInput(const uint32_t& inputType)
{
return serverType;
}
bool DistributedInputClient::GetDInputSourceProxy()
{
return true;
}
bool DistributedInputClient::GetDInputSinkProxy()
{
return true;
}
bool DistributedInputClient::IsJsonData(std::string strData) const
{
return true;
}
} // namespace DistributedInput
} // namespace DistributedHardware
} // namespace OHOS