12d4d9a4dSopenharmony_ci/*
22d4d9a4dSopenharmony_ci * Copyright (c) 2022 Huawei Device Co., Ltd.
32d4d9a4dSopenharmony_ci * Licensed under the Apache License, Version 2.0 (the "License");
42d4d9a4dSopenharmony_ci * you may not use this file except in compliance with the License.
52d4d9a4dSopenharmony_ci * You may obtain a copy of the License at
62d4d9a4dSopenharmony_ci *
72d4d9a4dSopenharmony_ci *     http://www.apache.org/licenses/LICENSE-2.0
82d4d9a4dSopenharmony_ci *
92d4d9a4dSopenharmony_ci * Unless required by applicable law or agreed to in writing, software
102d4d9a4dSopenharmony_ci * distributed under the License is distributed on an "AS IS" BASIS,
112d4d9a4dSopenharmony_ci * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
122d4d9a4dSopenharmony_ci * See the License for the specific language governing permissions and
132d4d9a4dSopenharmony_ci * limitations under the License.
142d4d9a4dSopenharmony_ci */
152d4d9a4dSopenharmony_ci
162d4d9a4dSopenharmony_ci#ifndef DISTRIBUTED_INPUT_SOFTBUS_DEFINE_H
172d4d9a4dSopenharmony_ci#define DISTRIBUTED_INPUT_SOFTBUS_DEFINE_H
182d4d9a4dSopenharmony_ci
192d4d9a4dSopenharmony_ci#include <string>
202d4d9a4dSopenharmony_ci#include <unistd.h>
212d4d9a4dSopenharmony_ci
222d4d9a4dSopenharmony_cinamespace OHOS {
232d4d9a4dSopenharmony_cinamespace DistributedHardware {
242d4d9a4dSopenharmony_cinamespace DistributedInput {
252d4d9a4dSopenharmony_ci    struct InnerMsgData {
262d4d9a4dSopenharmony_ci        std::string deviceId;
272d4d9a4dSopenharmony_ci        std::string dataStr;
282d4d9a4dSopenharmony_ci        InnerMsgData(std::string devId, std::string data) : deviceId(devId), dataStr(data) {};
292d4d9a4dSopenharmony_ci    };
302d4d9a4dSopenharmony_ci
312d4d9a4dSopenharmony_ci    struct SwitchStateData {
322d4d9a4dSopenharmony_ci        int32_t sessionId;
332d4d9a4dSopenharmony_ci        bool switchState;
342d4d9a4dSopenharmony_ci        SwitchStateData(int32_t session, bool state) : sessionId(session), switchState(state) {};
352d4d9a4dSopenharmony_ci    };
362d4d9a4dSopenharmony_ci
372d4d9a4dSopenharmony_ci    const int32_t ENCRYPT_TAG_LEN = 32;
382d4d9a4dSopenharmony_ci    const int32_t MSG_MAX_SIZE = 45 * 1024;
392d4d9a4dSopenharmony_ci
402d4d9a4dSopenharmony_ci    const uint32_t SESSION_NAME_SIZE_MAX = 256;
412d4d9a4dSopenharmony_ci    const uint32_t DEVICE_ID_SIZE_MAX = 65;
422d4d9a4dSopenharmony_ci    const uint32_t INTERCEPT_STRING_LENGTH = 20;
432d4d9a4dSopenharmony_ci
442d4d9a4dSopenharmony_ci    const std::string DINPUT_PKG_NAME = "ohos.dhardware.dinput";
452d4d9a4dSopenharmony_ci    const std::string SESSION_NAME = "ohos.dhardware.dinput.session";
462d4d9a4dSopenharmony_ci    const std::string GROUP_ID = "input_softbus_group_id";
472d4d9a4dSopenharmony_ci
482d4d9a4dSopenharmony_ci    #define DINPUT_SOFTBUS_KEY_CMD_TYPE "dinput_softbus_key_cmd_type"
492d4d9a4dSopenharmony_ci    #define DINPUT_SOFTBUS_KEY_DEVICE_ID "dinput_softbus_key_device_id"
502d4d9a4dSopenharmony_ci    #define DINPUT_SOFTBUS_KEY_SESSION_ID "dinput_softbus_key_session_id"
512d4d9a4dSopenharmony_ci    #define DINPUT_SOFTBUS_KEY_INPUT_TYPE "dinput_softbus_key_input_type"
522d4d9a4dSopenharmony_ci    #define DINPUT_SOFTBUS_KEY_VECTOR_DHID "dinput_softbus_key_vector_dhid"
532d4d9a4dSopenharmony_ci    #define DINPUT_SOFTBUS_KEY_RESP_VALUE "dinput_softbus_key_resp_value"
542d4d9a4dSopenharmony_ci    #define DINPUT_SOFTBUS_KEY_WHITE_LIST "dinput_softbus_key_list_list"
552d4d9a4dSopenharmony_ci    #define DINPUT_SOFTBUS_KEY_INPUT_DATA "dinput_softbus_key_input_data"
562d4d9a4dSopenharmony_ci    #define DINPUT_SOFTBUS_KEY_KEYSTATE_DHID "dinput_softbus_key_keystate_dhid"
572d4d9a4dSopenharmony_ci    #define DINPUT_SOFTBUS_KEY_KEYSTATE_TYPE "dinput_softbus_key_keystate_type"
582d4d9a4dSopenharmony_ci    #define DINPUT_SOFTBUS_KEY_KEYSTATE_CODE "dinput_softbus_key_keystate_code"
592d4d9a4dSopenharmony_ci    #define DINPUT_SOFTBUS_KEY_KEYSTATE_VALUE "dinput_softbus_key_keystate_value"
602d4d9a4dSopenharmony_ci    #define DINPUT_SOFTBUS_KEY_SRC_DEV_ID "dinput_softbus_key_src_dev_id"
612d4d9a4dSopenharmony_ci    #define DINPUT_SOFTBUS_KEY_SINK_DEV_ID "dinput_softbus_key_sink_dev_id"
622d4d9a4dSopenharmony_ci
632d4d9a4dSopenharmony_ci    // src will receive
642d4d9a4dSopenharmony_ci    const uint32_t TRANS_SINK_MSG_ONPREPARE    = 1;
652d4d9a4dSopenharmony_ci    const uint32_t TRANS_SINK_MSG_ONUNPREPARE  = 2;
662d4d9a4dSopenharmony_ci    const uint32_t TRANS_SINK_MSG_ONSTART      = 3;
672d4d9a4dSopenharmony_ci    const uint32_t TRANS_SINK_MSG_ONSTOP       = 4;
682d4d9a4dSopenharmony_ci    const uint32_t TRANS_SINK_MSG_BODY_DATA    = 5;
692d4d9a4dSopenharmony_ci    const uint32_t TRANS_SINK_MSG_LATENCY      = 6;
702d4d9a4dSopenharmony_ci    const uint32_t TRANS_SINK_MSG_DHID_ONSTART = 7;
712d4d9a4dSopenharmony_ci    const uint32_t TRANS_SINK_MSG_DHID_ONSTOP  = 8;
722d4d9a4dSopenharmony_ci    const uint32_t TRANS_SINK_MSG_KEY_STATE    = 9;
732d4d9a4dSopenharmony_ci    const uint32_t TRANS_SOURCE_TO_SOURCE_MSG_PREPARE    = 10;
742d4d9a4dSopenharmony_ci    const uint32_t TRANS_SOURCE_TO_SOURCE_MSG_UNPREPARE  = 11;
752d4d9a4dSopenharmony_ci    const uint32_t TRANS_SOURCE_TO_SOURCE_MSG_PREPARE_RESULT    = 12;
762d4d9a4dSopenharmony_ci    const uint32_t TRANS_SOURCE_TO_SOURCE_MSG_UNPREPARE_RESULT  = 13;
772d4d9a4dSopenharmony_ci    const uint32_t TRANS_SOURCE_TO_SOURCE_MSG_START_DHID    = 14;
782d4d9a4dSopenharmony_ci    const uint32_t TRANS_SOURCE_TO_SOURCE_MSG_STOP_DHID    = 15;
792d4d9a4dSopenharmony_ci    const uint32_t TRANS_SOURCE_TO_SOURCE_MSG_START_DHID_RESULT  = 16;
802d4d9a4dSopenharmony_ci    const uint32_t TRANS_SOURCE_TO_SOURCE_MSG_STOP_DHID_RESULT   = 17;
812d4d9a4dSopenharmony_ci    const uint32_t TRANS_SOURCE_TO_SOURCE_MSG_START_TYPE    = 18;
822d4d9a4dSopenharmony_ci    const uint32_t TRANS_SOURCE_TO_SOURCE_MSG_STOP_TYPE    = 19;
832d4d9a4dSopenharmony_ci    const uint32_t TRANS_SOURCE_TO_SOURCE_MSG_START_TYPE_RESULT  = 20;
842d4d9a4dSopenharmony_ci    const uint32_t TRANS_SOURCE_TO_SOURCE_MSG_STOP_TYPE_RESULT   = 21;
852d4d9a4dSopenharmony_ci    const uint32_t TRANS_SINK_MSG_ON_RELAY_PREPARE    = 22;
862d4d9a4dSopenharmony_ci    const uint32_t TRANS_SINK_MSG_ON_RELAY_UNPREPARE  = 23;
872d4d9a4dSopenharmony_ci    const uint32_t TRANS_SINK_MSG_ON_RELAY_STARTDHID  = 24;
882d4d9a4dSopenharmony_ci    const uint32_t TRANS_SINK_MSG_ON_RELAY_STOPDHID   = 25;
892d4d9a4dSopenharmony_ci    const uint32_t TRANS_SINK_MSG_ON_RELAY_STARTTYPE  = 26;
902d4d9a4dSopenharmony_ci    const uint32_t TRANS_SINK_MSG_ON_RELAY_STOPTYPE   = 27;
912d4d9a4dSopenharmony_ci    const uint32_t TRANS_SINK_MSG_KEY_STATE_BATCH     = 28;
922d4d9a4dSopenharmony_ci
932d4d9a4dSopenharmony_ci    // src or sink
942d4d9a4dSopenharmony_ci    const uint32_t TRANS_MSG_SRC_SINK_SPLIT    = 30;
952d4d9a4dSopenharmony_ci
962d4d9a4dSopenharmony_ci    // sink will receive
972d4d9a4dSopenharmony_ci    const uint32_t TRANS_SOURCE_MSG_PREPARE    = 31;
982d4d9a4dSopenharmony_ci    const uint32_t TRANS_SOURCE_MSG_UNPREPARE  = 32;
992d4d9a4dSopenharmony_ci    const uint32_t TRANS_SOURCE_MSG_START_TYPE = 33;
1002d4d9a4dSopenharmony_ci    const uint32_t TRANS_SOURCE_MSG_STOP_TYPE  = 34;
1012d4d9a4dSopenharmony_ci    const uint32_t TRANS_SOURCE_MSG_START_DHID = 35;
1022d4d9a4dSopenharmony_ci    const uint32_t TRANS_SOURCE_MSG_STOP_DHID  = 36;
1032d4d9a4dSopenharmony_ci    const uint32_t TRANS_SOURCE_MSG_LATENCY    = 37;
1042d4d9a4dSopenharmony_ci    const uint32_t TRANS_SOURCE_MSG_START_DHID_FOR_REL   = 38;
1052d4d9a4dSopenharmony_ci    const uint32_t TRANS_SOURCE_MSG_STOP_DHID_FOR_REL    = 39;
1062d4d9a4dSopenharmony_ci    const uint32_t TRANS_SOURCE_MSG_START_TYPE_FOR_REL   = 40;
1072d4d9a4dSopenharmony_ci    const uint32_t TRANS_SOURCE_MSG_STOP_TYPE_FOR_REL    = 41;
1082d4d9a4dSopenharmony_ci    const uint32_t TRANS_SOURCE_MSG_PREPARE_FOR_REL      = 42;
1092d4d9a4dSopenharmony_ci    const uint32_t TRANS_SOURCE_MSG_UNPREPARE_FOR_REL    = 43;
1102d4d9a4dSopenharmony_ci} // namespace DistributedInput
1112d4d9a4dSopenharmony_ci} // namespace DistributedHardware
1122d4d9a4dSopenharmony_ci} // namespace OHOS
1132d4d9a4dSopenharmony_ci#endif // DISTRIBUTED_INPUT_SOFTBUS_DEFINE_H
114