mirror of
https://github.com/openharmony/distributedhardware_distributed_input.git
synced 2026-07-20 21:41:02 -04:00
Description: add dinput
Match-id-6ec09e2db7d48b950233b79da514e34ac7803070
This commit is contained in:
@@ -0,0 +1,35 @@
|
||||
/*
|
||||
* 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_DISTRIBUTED_INPUT_SINK_TANTS_H
|
||||
#define OHOS_DISTRIBUTED_INPUT_SINK_TANTS_H
|
||||
|
||||
#include <string>
|
||||
|
||||
namespace OHOS {
|
||||
namespace DistributedHardware {
|
||||
namespace DistributedInput {
|
||||
class DInputSinkTransCallback {
|
||||
public:
|
||||
virtual void onPrepareRemoteInput(const int32_t& sessionId, const std::string &deviceId) = 0;
|
||||
virtual void onUnprepareRemoteInput(const int32_t& sessionId) = 0;
|
||||
virtual void onStartRemoteInput(const int32_t& sessionId, const uint32_t& inputTypes) = 0;
|
||||
virtual void onStopRemoteInput(const int32_t& sessionId, const uint32_t& inputTypes) = 0;
|
||||
virtual ~DInputSinkTransCallback() {}
|
||||
};
|
||||
}
|
||||
}
|
||||
}
|
||||
#endif
|
||||
@@ -0,0 +1,70 @@
|
||||
/*
|
||||
* 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 DISTRIBUTED_INPUT_SOFTBUS_DEFINE_H
|
||||
#define DISTRIBUTED_INPUT_SOFTBUS_DEFINE_H
|
||||
|
||||
#include <string>
|
||||
#include <unistd.h>
|
||||
|
||||
namespace OHOS {
|
||||
namespace DistributedHardware {
|
||||
namespace DistributedInput {
|
||||
struct InnerMsgData {
|
||||
std::string deviceId;
|
||||
std::string dataStr;
|
||||
InnerMsgData(std::string devId, std::string data) : deviceId(devId), dataStr(data) {};
|
||||
};
|
||||
|
||||
struct SwitchStateData {
|
||||
int32_t sessionId;
|
||||
bool switchState;
|
||||
SwitchStateData(int32_t session, bool state) : sessionId(session), switchState(state) {};
|
||||
};
|
||||
|
||||
const int32_t ENCRYPT_TAG_LEN = 32;
|
||||
const int32_t MSG_MAX_SIZE = 45 * 1024;
|
||||
|
||||
const uint32_t SESSION_NAME_SIZE_MAX = 256;
|
||||
const uint32_t DEVICE_ID_SIZE_MAX = 65;
|
||||
const uint32_t INTERCEPT_STRING_LENGTH = 20;
|
||||
|
||||
const std::string DINPUT_PKG_NAME = "DBinderBus_" + std::to_string(getpid());
|
||||
const std::string SESSION_NAME_SOURCE = "DBinderInput_so_";
|
||||
const std::string SESSION_NAME_SINK = "DBinderInput_si_";
|
||||
const std::string GROUP_ID = "input_softbus_group_id";
|
||||
|
||||
#define DINPUT_SOFTBUS_KEY_CMD_TYPE "dinput_softbus_key_cmd_type"
|
||||
#define DINPUT_SOFTBUS_KEY_DEVICE_ID "dinput_softbus_key_device_id"
|
||||
#define DINPUT_SOFTBUS_KEY_SESSION_ID "dinput_softbus_key_session_id"
|
||||
#define DINPUT_SOFTBUS_KEY_INPUT_TYPE "dinput_softbus_key_input_type"
|
||||
#define DINPUT_SOFTBUS_KEY_RESP_VALUE "dinput_softbus_key_resp_value"
|
||||
#define DINPUT_SOFTBUS_KEY_WHITE_LIST "dinput_softbus_key_list_list"
|
||||
#define DINPUT_SOFTBUS_KEY_INPUT_DATA "dinput_softbus_key_input_data"
|
||||
|
||||
// json value
|
||||
const uint32_t TRANS_SINK_MSG_ONPREPARE = 1;
|
||||
const uint32_t TRANS_SINK_MSG_ONUNPREPARE = 2;
|
||||
const uint32_t TRANS_SINK_MSG_ONSTART = 3;
|
||||
const uint32_t TRANS_SINK_MSG_ONSTOP = 4;
|
||||
const uint32_t TRANS_SINK_MSG_BODY_DATA = 5;
|
||||
const uint32_t TRANS_SOURCE_MSG_PREPARE = 11;
|
||||
const uint32_t TRANS_SOURCE_MSG_UNPREPARE = 12;
|
||||
const uint32_t TRANS_SOURCE_MSG_START = 13;
|
||||
const uint32_t TRANS_SOURCE_MSG_STOP = 14;
|
||||
} // namespace DistributedInput
|
||||
} // namespace DistributedHardware
|
||||
} // namespace OHOS
|
||||
#endif // DISTRIBUTED_INPUT_SOFTBUS_DEFINE_H
|
||||
@@ -0,0 +1,37 @@
|
||||
/*
|
||||
* 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_DISTRIBUTED_INPUT_SOURCE_TRANS_H
|
||||
#define OHOS_DISTRIBUTED_INPUT_SOURCE_TRANS_H
|
||||
|
||||
#include <string>
|
||||
|
||||
namespace OHOS {
|
||||
namespace DistributedHardware {
|
||||
namespace DistributedInput {
|
||||
class DInputSourceTransCallback {
|
||||
public:
|
||||
virtual void onResponseRegisterDistributedHardware(const std::string deviceId, const std::string dhId,
|
||||
bool result) = 0;
|
||||
virtual void onResponsePrepareRemoteInput(const std::string deviceId, bool result, const std::string &object) = 0;
|
||||
virtual void onResponseUnprepareRemoteInput(const std::string deviceId, bool result) = 0;
|
||||
virtual void onResponseStartRemoteInput(const std::string deviceId, const uint32_t inputTypes, bool result) = 0;
|
||||
virtual void onResponseStopRemoteInput(const std::string deviceId, const uint32_t inputTypes, bool result) = 0;
|
||||
virtual void onReceivedEventRemoteInput(const std::string deviceId, const std::string &object) = 0;
|
||||
};
|
||||
}
|
||||
}
|
||||
}
|
||||
#endif
|
||||
Reference in New Issue
Block a user