1 /* 2 * Copyright (c) 2022 Huawei Device Co., Ltd. 3 * Licensed under the Apache License, Version 2.0 (the "License"); 4 * you may not use this file except in compliance with the License. 5 * You may obtain a copy of the License at 6 * 7 * http://www.apache.org/licenses/LICENSE-2.0 8 * 9 * Unless required by applicable law or agreed to in writing, software 10 * distributed under the License is distributed on an "AS IS" BASIS, 11 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 * See the License for the specific language governing permissions and 13 * limitations under the License. 14 */ 15 16 #ifndef APP_DISTRIBUTED_KVSTORE_APP_TYPES_H 17 #define APP_DISTRIBUTED_KVSTORE_APP_TYPES_H 18 19 #include <errors.h> 20 21 #include <string> 22 23 namespace OHOS { 24 namespace ObjectStore { 25 struct PipeInfo { 26 std::string pipeId; 27 }; 28 29 struct DeviceInfo { 30 std::string deviceId; 31 std::string deviceName; 32 std::string deviceType; 33 }; 34 35 enum class MessageType : int8_t { 36 DEFAULT = 0, 37 }; 38 39 struct MessageInfo { 40 MessageType msgType; 41 }; 42 43 enum class DeviceChangeType : int8_t { 44 DEVICE_OFFLINE = 0, 45 DEVICE_ONLINE = 1, 46 }; 47 48 struct DeviceId { 49 std::string deviceId; 50 }; 51 52 enum RouteType : int8_t { 53 INVALID_ROUTE_TYPE = -1, 54 ROUTE_TYPE_ALL = 0, 55 WIFI_STA = 1, 56 WIFI_P2P = 2, 57 BT_BR = 3, 58 BT_BLE = 4, 59 BUTT = 5, 60 }; 61 62 enum RecOperate : int32_t { 63 KEEP, 64 CHANGE_TO_P2P, 65 CHANGE_TO_BLUETOOTH, 66 }; 67 68 struct DataInfo { 69 uint8_t *data; 70 uint32_t length; 71 }; 72 73 // app_distributed_data_manager using sub error code 0 74 constexpr ErrCode APP_DISTRIBUTEDDATAMGR_ERR_OFFSET = ErrCodeOffset(SUBSYS_DISTRIBUTEDDATAMNG, 0); 75 76 enum class Status { 77 SUCCESS = ERR_OK, 78 ERROR = APP_DISTRIBUTEDDATAMGR_ERR_OFFSET, 79 INVALID_ARGUMENT = APP_DISTRIBUTEDDATAMGR_ERR_OFFSET + 1, 80 ILLEGAL_STATE = APP_DISTRIBUTEDDATAMGR_ERR_OFFSET + 2, 81 KEY_NOT_FOUND = APP_DISTRIBUTEDDATAMGR_ERR_OFFSET + 7, 82 REPEATED_REGISTER = APP_DISTRIBUTEDDATAMGR_ERR_OFFSET + 14, 83 }; 84 } // namespace ObjectStore 85 } // namespace OHOS 86 #endif // APP_DISTRIBUTED_KVSTORE_TYPES_H 87