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 <cstdint> 22 #include <string> 23 #include <vector> 24 25 #include "visibility.h" 26 27 namespace OHOS { 28 namespace ObjectStore { 29 struct PipeInfo { 30 std::string pipeId; 31 }; 32 33 struct DeviceInfo { 34 std::string deviceId; 35 std::string deviceName; 36 std::string deviceType; 37 }; 38 39 enum class MessageType { 40 DEFAULT = 0, 41 }; 42 43 struct MessageInfo { 44 MessageType msgType; 45 }; 46 47 enum class DeviceChangeType { 48 DEVICE_OFFLINE = 0, 49 DEVICE_ONLINE = 1, 50 }; 51 52 struct DeviceId { 53 std::string deviceId; 54 }; 55 56 // app_distributed_data_manager using sub error code 0 57 constexpr ErrCode APP_DISTRIBUTEDDATAMGR_ERR_OFFSET = ErrCodeOffset(SUBSYS_DISTRIBUTEDDATAMNG, 0); 58 59 enum class Status { 60 SUCCESS = ERR_OK, 61 ERROR = APP_DISTRIBUTEDDATAMGR_ERR_OFFSET, 62 INVALID_ARGUMENT = APP_DISTRIBUTEDDATAMGR_ERR_OFFSET + 1, 63 ILLEGAL_STATE = APP_DISTRIBUTEDDATAMGR_ERR_OFFSET + 2, 64 KEY_NOT_FOUND = APP_DISTRIBUTEDDATAMGR_ERR_OFFSET + 7, 65 REPEATED_REGISTER = APP_DISTRIBUTEDDATAMGR_ERR_OFFSET + 14, 66 CREATE_SESSION_ERROR = APP_DISTRIBUTEDDATAMGR_ERR_OFFSET + 15, 67 }; 68 } // namespace ObjectStore 69 } // namespace OHOS 70 #endif // APP_DISTRIBUTED_KVSTORE_TYPES_H 71