diff --git a/frameworks/include/i_dinput_context.h b/frameworks/include/i_dinput_context.h new file mode 100644 index 0000000..da061e9 --- /dev/null +++ b/frameworks/include/i_dinput_context.h @@ -0,0 +1,100 @@ +/* + * 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 OHOS_I_DINPUT_CONTEXT_H +#define OHOS_I_DINPUT_CONTEXT_H + +#include +#include + +#include "constants_dinput.h" + +namespace OHOS { +namespace DistributedHardware { +namespace DistributedInput { +struct LocalAbsInfo { + int32_t absXMin = 0; + int32_t absXMax = 0; + int32_t absYMin = 0; + int32_t absYMax = 0; + int32_t absPressureMin = 0; + int32_t absPressureMax = 0; + int32_t absMtTouchMajorMin = 0; + int32_t absMtTouchMajorMax = 0; + int32_t absMtTouchMinorMin = 0; + int32_t absMtTouchMinorMax = 0; + int32_t absMtOrientationMin = 0; + int32_t absMtOrientationMax = 0; + int32_t absMtPositionXMin = 0; + int32_t absMtPositionXMax = 0; + int32_t absMtPositionYMin = 0; + int32_t absMtPositionYMax = 0; + int32_t absMtBlobIdMin = 0; + int32_t absMtBlobIdMax = 0; + int32_t absMtTrackingIdMin = 0; + int32_t absMtTrackingIdMax = 0; + int32_t absMtPressureMin = 0; + int32_t absMtPressureMax = 0; + InputDevice deviceInfo; +}; + +struct LocalTouchScreenInfo { + uint32_t sinkShowWidth = 0; + uint32_t sinkShowHeight = 0; + uint32_t sinkPhyWidth = 0; + uint32_t sinkPhyHeight = 0; + LocalAbsInfo localAbsInfo; +}; + +struct TransformInfo { + uint32_t sinkWinPhyX = 0; // projection area X coordinate in touch coordinate + uint32_t sinkWinPhyY = 0; // projection area Y coordinate in touch coordinate + uint32_t sinkProjPhyWidth = 0; // projection area width in touch coordinate + uint32_t sinkProjPhyHeight = 0; // projection area height in touch coordinate + double coeffWidth = 0.0; // sink width transform source coefficient + double coeffHeight = 0.0; // sink height transform source coefficient +}; + +struct SrcScreenInfo { + std::string devId = ""; // source device id + std::string uuid = ""; // source device uuid + int32_t sessionId = 0; // source device session id + uint64_t sourceWinId = 0; // source projection window id + uint32_t sourceWinWidth = 0; // source projection window width + uint32_t sourceWinHeight = 0; // source projection window height + std::string sourcePhyId = ""; // source virtual screen driver id + uint32_t sourcePhyFd = 0; // source virtual screen driver fd + uint32_t sourcePhyWidth = 0; // source virtual screen driver width + uint32_t sourcePhyHeight = 0; // source virtual screen driver height +}; + +struct SinkScreenInfo { + uint32_t sinkShowWidth = 0; // sink show width + uint32_t sinkShowHeight = 0; // sink show height + uint32_t sinkPhyWidth = 0; // sink touch screen width + uint32_t sinkPhyHeight = 0; // sink touch screen height + uint64_t sinkShowWinId = 0; // sink show window id + uint32_t sinkWinShowX = 0; // sink show window x coordinate + uint32_t sinkWinShowY = 0; // sink show window y coordinate + uint32_t sinkProjShowWidth = 0; // sink show window width + uint32_t sinkProjShowHeight = 0; // sink show window height + SrcScreenInfo srcScreenInfo; + TransformInfo transformInfo; +}; +} // namespace DistributedInput +} // namespace DistributedHardware +} // namespace OHOS + +#endif // OHOS_I_DINPUT_CONTEXT_H diff --git a/frameworks/include/i_distributed_sink_input.h b/frameworks/include/i_distributed_sink_input.h index 5306b2d..fbc8f03 100644 --- a/frameworks/include/i_distributed_sink_input.h +++ b/frameworks/include/i_distributed_sink_input.h @@ -22,7 +22,7 @@ #include "iremote_object.h" #include "constants_dinput.h" -#include "dinput_context.h" +#include "i_dinput_context.h" #include "i_distributed_sink_input.h" #include "i_get_sink_screen_infos_call_back.h" #include "i_sharing_dhid_listener.h" diff --git a/interfaces/inner_kits/BUILD.gn b/interfaces/inner_kits/BUILD.gn index a055ae6..a6a992b 100644 --- a/interfaces/inner_kits/BUILD.gn +++ b/interfaces/inner_kits/BUILD.gn @@ -15,25 +15,29 @@ import("//build/ohos.gni") import( "//foundation/distributedhardware/distributed_input/distributedinput.gni") -ohos_shared_library("libdinput_sdk") { +config("input_sdk_public_config") { include_dirs = [ + "${common_path}/include", + "${frameworks_path}/include", + "${fwk_common_path}/log/include", + "${fwk_common_path}/utils/include", + "${fwk_interfaces_path}/include", + "${fwk_interfaces_path}/include/ipc", + "${fwk_utils_path}/include", + "${fwk_utils_path}/include/log", "${innerkits_path}/include", "${innerkits_path}/src", "${ipc_path}/include", "${ipc_path}/src", - "${frameworks_path}/include", - "//commonlibrary/c_utils/base/include", - "//utils/system/safwk/native/include", - "${common_path}/include", - "${fwk_common_path}/log/include", - "${fwk_common_path}/utils/include", - "${fwk_utils_path}/include/log", - "${fwk_utils_path}/include", "${utils_path}/include", + "//commonlibrary/c_utils/base/include", "//third_party/json/include", - "${fwk_interfaces_path}/include", - "${fwk_interfaces_path}/include/ipc", + "//utils/native/base/include", + "//utils/system/safwk/native/include", ] +} +ohos_shared_library("libdinput_sdk") { + public_configs = [":input_sdk_public_config"] sources = [ "${common_path}/include/white_list_util.cpp", diff --git a/interfaces/inner_kits/test/unittest/BUILD.gn b/interfaces/inner_kits/test/unittest/BUILD.gn index 935b7d0..1a2da7d 100644 --- a/interfaces/inner_kits/test/unittest/BUILD.gn +++ b/interfaces/inner_kits/test/unittest/BUILD.gn @@ -45,6 +45,7 @@ ohos_unittest("distributed_input_inner_test") { "${utils_path}/include", "${fwk_interfaces_path}/include", "${fwk_interfaces_path}/include/ipc", + "${frameworks_path}/include", ] sources = [ diff --git a/interfaces/inner_kits/test/unittest/distributed_input_inner_test.cpp b/interfaces/inner_kits/test/unittest/distributed_input_inner_test.cpp index 177689a..4cf2267 100644 --- a/interfaces/inner_kits/test/unittest/distributed_input_inner_test.cpp +++ b/interfaces/inner_kits/test/unittest/distributed_input_inner_test.cpp @@ -16,6 +16,7 @@ #include "distributed_input_inner_test.h" #include "system_ability_definition.h" +#include "dinput_context.h" #include "dinput_errcode.h" using namespace testing::ext; diff --git a/interfaces/inner_kits/test/unittest/mock/mock_distributed_input_client.cpp b/interfaces/inner_kits/test/unittest/mock/mock_distributed_input_client.cpp index acd35af..5d4e995 100644 --- a/interfaces/inner_kits/test/unittest/mock/mock_distributed_input_client.cpp +++ b/interfaces/inner_kits/test/unittest/mock/mock_distributed_input_client.cpp @@ -19,6 +19,7 @@ #include "nlohmann/json.hpp" #include "constants_dinput.h" +#include "dinput_context.h" #include "dinput_errcode.h" #include "white_list_util.h" diff --git a/interfaces/ipc/include/distributed_input_client.h b/interfaces/ipc/include/distributed_input_client.h index d89edd4..f56655b 100644 --- a/interfaces/ipc/include/distributed_input_client.h +++ b/interfaces/ipc/include/distributed_input_client.h @@ -19,6 +19,7 @@ #include #include #include +#include #include #include "event_handler.h" diff --git a/services/sink/sinkmanager/src/distributed_input_sink_manager.cpp b/services/sink/sinkmanager/src/distributed_input_sink_manager.cpp index 4422718..63a94b6 100644 --- a/services/sink/sinkmanager/src/distributed_input_sink_manager.cpp +++ b/services/sink/sinkmanager/src/distributed_input_sink_manager.cpp @@ -35,6 +35,7 @@ #include "distributed_input_sink_switch.h" #include "distributed_input_sink_transport.h" +#include "dinput_context.h" #include "dinput_errcode.h" #include "dinput_sa_process_state.h" #include "dinput_utils_tool.h" diff --git a/utils/BUILD.gn b/utils/BUILD.gn index 37c62ba..512fb51 100644 --- a/utils/BUILD.gn +++ b/utils/BUILD.gn @@ -31,6 +31,7 @@ ohos_shared_library("libdinput_utils") { "${low_latency_path}/include", "${dfx_utils_path}/include", "//commonlibrary/c_utils/base/include", + "${frameworks_path}/include", ] sources = [ diff --git a/utils/include/dinput_context.h b/utils/include/dinput_context.h index aae96fa..2e64557 100644 --- a/utils/include/dinput_context.h +++ b/utils/include/dinput_context.h @@ -33,81 +33,12 @@ #include "iservice_registry.h" #include "system_ability_definition.h" +#include "i_dinput_context.h" #include "input_hub.h" namespace OHOS { namespace DistributedHardware { namespace DistributedInput { -struct LocalAbsInfo { - int32_t absXMin = 0; - int32_t absXMax = 0; - int32_t absYMin = 0; - int32_t absYMax = 0; - int32_t absPressureMin = 0; - int32_t absPressureMax = 0; - int32_t absMtTouchMajorMin = 0; - int32_t absMtTouchMajorMax = 0; - int32_t absMtTouchMinorMin = 0; - int32_t absMtTouchMinorMax = 0; - int32_t absMtOrientationMin = 0; - int32_t absMtOrientationMax = 0; - int32_t absMtPositionXMin = 0; - int32_t absMtPositionXMax = 0; - int32_t absMtPositionYMin = 0; - int32_t absMtPositionYMax = 0; - int32_t absMtBlobIdMin = 0; - int32_t absMtBlobIdMax = 0; - int32_t absMtTrackingIdMin = 0; - int32_t absMtTrackingIdMax = 0; - int32_t absMtPressureMin = 0; - int32_t absMtPressureMax = 0; - InputDevice deviceInfo; -}; - -struct LocalTouchScreenInfo { - uint32_t sinkShowWidth = 0; - uint32_t sinkShowHeight = 0; - uint32_t sinkPhyWidth = 0; - uint32_t sinkPhyHeight = 0; - LocalAbsInfo localAbsInfo; -}; - -struct SrcScreenInfo { - std::string devId = ""; // source device id - std::string uuid = ""; // source device uuid - int32_t sessionId = 0; // source device session id - uint64_t sourceWinId = 0; // source projection window id - uint32_t sourceWinWidth = 0; // source projection window width - uint32_t sourceWinHeight = 0; // source projection window height - std::string sourcePhyId = ""; // source virtual screen driver id - uint32_t sourcePhyFd = 0; // source virtual screen driver fd - uint32_t sourcePhyWidth = 0; // source virtual screen driver width - uint32_t sourcePhyHeight = 0; // source virtual screen driver height -}; - -struct TransformInfo { - uint32_t sinkWinPhyX = 0; // projection area X coordinate in touch coordinate - uint32_t sinkWinPhyY = 0; // projection area Y coordinate in touch coordinate - uint32_t sinkProjPhyWidth = 0; // projection area width in touch coordinate - uint32_t sinkProjPhyHeight = 0; // projection area height in touch coordinate - double coeffWidth = 0.0; // sink width transform source coefficient - double coeffHeight = 0.0; // sink height transform source coefficient -}; - -struct SinkScreenInfo { - uint32_t sinkShowWidth = 0; // sink show width - uint32_t sinkShowHeight = 0; // sink show height - uint32_t sinkPhyWidth = 0; // sink touch screen width - uint32_t sinkPhyHeight = 0; // sink touch screen height - uint64_t sinkShowWinId = 0; // sink show window id - uint32_t sinkWinShowX = 0; // sink show window x coordinate - uint32_t sinkWinShowY = 0; // sink show window y coordinate - uint32_t sinkProjShowWidth = 0; // sink show window width - uint32_t sinkProjShowHeight = 0; // sink show window height - SrcScreenInfo srcScreenInfo; - TransformInfo transformInfo; -}; - class DInputContext { DECLARE_SINGLE_INSTANCE_BASE(DInputContext); public: diff --git a/utils/test/unittest/BUILD.gn b/utils/test/unittest/BUILD.gn index fe60c2e..4694811 100644 --- a/utils/test/unittest/BUILD.gn +++ b/utils/test/unittest/BUILD.gn @@ -37,6 +37,7 @@ ohos_unittest("distributed_input_utils_test") { "${fwk_interfaces_path}/include", "${fwk_interfaces_path}/include/ipc", "//commonlibrary/c_utils/base/include", + "${frameworks_path}/include", ] sources = [ "dinput_context_test.cpp" ]