1/*
2 * Copyright (C) 2022-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 BLUETOOTH_ERRORCODE_H
17#define BLUETOOTH_ERRORCODE_H
18
19namespace OHOS {
20namespace Bluetooth {
21
22/* Bluetooth errcode defines */
23enum BtErrCode {
24    // Common error codes
25    BT_ERR_PERMISSION_FAILED = 201,
26    BT_ERR_SYSTEM_PERMISSION_FAILED = 202,
27    BT_ERR_PROHIBITED_BY_EDM = 203,
28    BT_ERR_INVALID_PARAM = 401,
29    BT_ERR_API_NOT_SUPPORT = 801,
30
31    // Customized error codes
32    BT_NO_ERROR = 0,
33
34    BT_ERR_BASE_SYSCAP = 2900000,
35    BT_ERR_SERVICE_DISCONNECTED     = BT_ERR_BASE_SYSCAP + 1,
36    BT_ERR_UNBONDED_DEVICE          = BT_ERR_BASE_SYSCAP + 2,
37    BT_ERR_INVALID_STATE            = BT_ERR_BASE_SYSCAP + 3,
38    BT_ERR_PROFILE_DISABLED         = BT_ERR_BASE_SYSCAP + 4,
39    BT_ERR_DEVICE_DISCONNECTED      = BT_ERR_BASE_SYSCAP + 5,
40    BT_ERR_MAX_CONNECTION           = BT_ERR_BASE_SYSCAP + 6,
41    BT_ERR_TIMEOUT                  = BT_ERR_BASE_SYSCAP + 7,
42    BT_ERR_UNAVAILABLE_PROXY        = BT_ERR_BASE_SYSCAP + 8,
43
44    BT_ERR_INTERNAL_ERROR           = BT_ERR_BASE_SYSCAP + 99,
45    BT_ERR_IPC_TRANS_FAILED         = BT_ERR_BASE_SYSCAP + 100,
46
47    BT_ERR_GATT_READ_NOT_PERMITTED  = BT_ERR_BASE_SYSCAP + 1000,
48    BT_ERR_GATT_WRITE_NOT_PERMITTED = BT_ERR_BASE_SYSCAP + 1001,
49    BT_ERR_GATT_MAX_SERVER          = BT_ERR_BASE_SYSCAP + 1002,
50
51    BT_ERR_SPP_SERVER_STATE         = BT_ERR_BASE_SYSCAP + 1050,
52    BT_ERR_SPP_BUSY                 = BT_ERR_BASE_SYSCAP + 1051,
53    BT_ERR_SPP_DEVICE_NOT_FOUND     = BT_ERR_BASE_SYSCAP + 1052,
54    BT_ERR_SPP_IO                   = BT_ERR_BASE_SYSCAP + 1054,
55
56    BT_ERR_NO_ACTIVE_HFP_DEVICE     = BT_ERR_BASE_SYSCAP + 2000,
57    BT_ERR_NULL_HFP_STATE_MACHINE   = BT_ERR_BASE_SYSCAP + 2001,
58    BT_ERR_HFP_NOT_CONNECT          = BT_ERR_BASE_SYSCAP + 2002,
59    BT_ERR_SCO_HAS_BEEN_CONNECTED   = BT_ERR_BASE_SYSCAP + 2003,
60    BT_ERR_VR_HAS_BEEN_STARTED      = BT_ERR_BASE_SYSCAP + 2004,
61    BT_ERR_AUDIO_NOT_IDLE           = BT_ERR_BASE_SYSCAP + 2005,
62    BT_ERR_VIRTUAL_CALL_NOT_STARTED = BT_ERR_BASE_SYSCAP + 2006,
63    BT_ERR_DISCONNECT_SCO_FAILED    = BT_ERR_BASE_SYSCAP + 2007,
64
65    BT_ERR_BLE_SCAN_ALREADY_STARTED = BT_ERR_BASE_SYSCAP + 2050,
66
67    // will deprected
68    NO_ERROR = BT_NO_ERROR,
69    ERROR = BT_ERR_INTERNAL_ERROR,
70    ERR_INVALID_STATE = BT_ERR_INVALID_STATE,
71};
72}  // namespace Bluetooth
73}  // namespace OHOS
74
75#endif  // BLUETOOTH_ERRORCODE_H