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 
19 namespace OHOS {
20 namespace Bluetooth {
21 
22 /* Bluetooth errcode defines */
23 enum 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     BT_ERR_DIALOG_FOR_USER_CONFIRM  = BT_ERR_BASE_SYSCAP + 9,
44 
45     BT_ERR_INTERNAL_ERROR           = BT_ERR_BASE_SYSCAP + 99,
46     BT_ERR_IPC_TRANS_FAILED         = BT_ERR_BASE_SYSCAP + 100,
47 
48     BT_ERR_GATT_READ_NOT_PERMITTED  = BT_ERR_BASE_SYSCAP + 1000,
49     BT_ERR_GATT_WRITE_NOT_PERMITTED = BT_ERR_BASE_SYSCAP + 1001,
50     BT_ERR_GATT_MAX_SERVER          = BT_ERR_BASE_SYSCAP + 1002,
51 
52     BT_ERR_SPP_SERVER_STATE         = BT_ERR_BASE_SYSCAP + 1050,
53     BT_ERR_SPP_BUSY                 = BT_ERR_BASE_SYSCAP + 1051,
54     BT_ERR_SPP_DEVICE_NOT_FOUND     = BT_ERR_BASE_SYSCAP + 1052,
55     BT_ERR_SPP_IO                   = BT_ERR_BASE_SYSCAP + 1054,
56 
57     BT_ERR_NO_ACTIVE_HFP_DEVICE     = BT_ERR_BASE_SYSCAP + 2000,
58     BT_ERR_NULL_HFP_STATE_MACHINE   = BT_ERR_BASE_SYSCAP + 2001,
59     BT_ERR_HFP_NOT_CONNECT          = BT_ERR_BASE_SYSCAP + 2002,
60     BT_ERR_SCO_HAS_BEEN_CONNECTED   = BT_ERR_BASE_SYSCAP + 2003,
61     BT_ERR_VR_HAS_BEEN_STARTED      = BT_ERR_BASE_SYSCAP + 2004,
62     BT_ERR_AUDIO_NOT_IDLE           = BT_ERR_BASE_SYSCAP + 2005,
63     BT_ERR_VIRTUAL_CALL_NOT_STARTED = BT_ERR_BASE_SYSCAP + 2006,
64     BT_ERR_DISCONNECT_SCO_FAILED    = BT_ERR_BASE_SYSCAP + 2007,
65 
66     BT_ERR_BLE_SCAN_ALREADY_STARTED = BT_ERR_BASE_SYSCAP + 2050,
67 
68     // will deprected
69     NO_ERROR = BT_NO_ERROR,
70     ERROR = BT_ERR_INTERNAL_ERROR,
71     ERR_INVALID_STATE = BT_ERR_INVALID_STATE,
72 };
73 }  // namespace Bluetooth
74 }  // namespace OHOS
75 
76 #endif  // BLUETOOTH_ERRORCODE_H