[GATT Client] Delivery ATT error code to higher layer
[platform/core/connectivity/bluetooth-frwk.git] / bt-otp / bt-otpserver.h
1 /*
2  * Copyright (c) 2017 Samsung Electronics Co., Ltd All Rights Reserved
3  *
4  * Licensed under the Apache License, Version 2.0 (the "License");
5  * you may not use this file except in compliance with the License.
6  * You may obtain a copy of the License at
7  *
8  *              http://www.apache.org/licenses/LICENSE-2.0
9  *
10  * Unless required by applicable law or agreed to in writing, software
11  * distributed under the License is distributed on an "AS IS" BASIS,
12  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13  * See the License for the specific language governing permissions and
14  * limitations under the License.
15  *
16  */
17
18 #define BT_OTP_SERVICE_NAME     "org.projectx.otp"
19 #define BT_OTP_OBJECT_PATH      "/org/projectx/otp"
20 #define BT_OTP_INTERFACE_NAME   "org.projectx.otp_service"
21
22 #define BLE_DISABLED            "LeDisabled"
23 #define PROPERTIES_CHANGED      "PropertiesChanged"
24 #define OTC_DISCONNECTED        "OtcDisconnected"
25
26 #define BT_MANAGER_PATH "/"
27 #define BT_MANAGER_INTERFACE "org.freedesktop.DBus.ObjectManager"
28 #define BT_BLUEZ_NAME "org.bluez"
29 #define BT_DEVICE_INTERFACE "org.bluez.Device1"
30
31 #define BT_OTC_INTERFACE_NAME   "org.projectx.otc_channel"
32
33 #define HEADED_PLUGIN_FILEPATH "/usr/lib/bt-plugin-headed.so"
34 #define HEADED_PLUGIN_FILEPATH64 "/usr/lib64/bt-plugin-headed.so"
35 #define FILEPATH_ARCH_64 "/usr/lib64"
36
37 #define BT_FILE_PATH_MAX_LEN 262
38 #define BT_L2CAP_BUFFER_LEN 672
39
40 #define BT_ADDRESS_STRING_SIZE 18
41
42 #define BT_OTP_BASE_DIR_PATH "/home/owner/media/otp/"
43 #define BT_OTP_EMPTY_FILENAME " "
44
45 #define BT_OACP_MAX_TIMEOUT 10000 /* Timeout for OACP operation in msec */
46
47 /* OTP Service and Chanracteristics UUID */
48 #define OTP_UUID                        "1825"
49 #define OTP_FEATURE_UUID                "2abd"
50 #define OTP_OBJECT_NAME_UUID            "2abe"
51 #define OTP_OBJECT_TYPE_UUID            "2abf"
52 #define OTP_OBJECT_SIZE_UUID            "2ac0"
53 #define OTP_OBJECT_FIRST_CREATED_UUID   "2ac1"
54 #define OTP_OBJECT_LAST_MODIFIED_UUID   "2ac2"
55 #define OTP_OBJECT_ID_UUID              "2ac3"
56 #define OTP_OBJECT_PROP_UUID            "2ac4"
57 #define OTP_OACP_UUID                   "2ac5"
58 #define OTP_OLCP_UUID                   "2ac6"
59 #define OTP_OBJECT_LIST_FILTER_UUID     "2ac7"
60 #define OTP_OBJECT_CHANGED_UUID         "2ac8"
61
62 #define OTP_CP_CCC_DESC_UUID            "2902"
63
64 /* OTP Object Type Custom UUIDs */
65 /* In SIG Assigned numbers not available */
66 #define UNSUPPORTED_OBJECT_TYPE_UUID    "000019aa-0000-1001-8000-00805f9b34fb"
67 #define FIRMWARE_UUID                   "000019ab-0000-1001-8000-00805f9b34fb"
68 #define ROUTE_GPX_UUID                  "000019ac-0000-1001-8000-00805f9b34fb"
69 #define TRACK_GPX_UUID                  "000019ad-0000-1001-8000-00805f9b34fb"
70
71 /* Object Metadata Length */
72 #define OTP_FEATURE_LENGTH              8
73 #define OTP_INDICATION_LEN_WITHOUT_RESP 3
74 #define OTP_INDICATION_LEN_WITH_RESP    7
75
76 /* Object ID range defined by SIG. */
77 #define OBJECT_START_ID 256
78 #define OBJECT_END_ID   281474976710655
79
80 /* Object Properties */
81 #define OBJECT_DELETE   0x00000001
82 #define OBJECT_EXECUTE  0x00000002
83 #define OBJECT_READ     0x00000004
84 #define OBJECT_WRITE    0x00000008
85 #define OBJECT_APPEND   0x00000010
86 #define OBJECT_TRUNCATE 0x00000020
87 #define OBJECT_PATCH    0x00000040
88 #define OBJECT_MARK     0x00000080
89
90 /* OACP opcodes */
91 #define OACP_CREATE             0x01
92 #define OACP_DELETE             0x02
93 #define OACP_CALC_CHECKSUM      0x03
94 #define OACP_EXECUTE            0x04
95 #define OACP_READ               0x05
96 #define OACP_WRITE              0x06
97 #define OACP_ABORT              0x07
98 #define OACP_RESPONSE           0x60
99
100 /* OACP error codes */
101 #define OACP_SUCCESS                    0x01
102 #define OACP_OPCODE_NOT_SUPPORTED       0x02
103 #define OACP_INVALID_PARAM              0x03
104 #define OACP_INSUFFICIENT_RESOURCES     0x04
105 #define OACP_INVALID_OBJ                0x05
106 #define OACP_CHANNEL_UNAVAILABLE        0x06
107 #define OACP_UNSUPPORTED_TYPE           0x07
108 #define OACP_PROCEDURE_NOT_SUPPORTED    0x08
109 #define OACP_OBJECT_LOCKED              0x09
110 #define OACP_OPERATION_FAILED           0x0A
111
112 /* OLCP opcodes */
113 #define OLCP_FIRST              0x01
114 #define OLCP_LAST               0x02
115 #define OLCP_PREVIOUS           0x03
116 #define OLCP_NEXT               0x04
117 #define OLCP_GOTO               0x05
118 #define OLCP_ORDER              0x06
119 #define OLCP_REQ_NO_OBJ         0x07
120 #define OLCP_CLEAR_MARKING      0x08
121 #define OLCP_RESPONSE           0x70
122
123 /* OLCP order param values */
124 #define ORDER_BY_NAME_ASCENDING                 0x01
125 #define ORDER_BY_TYPE_ASCENDING                 0x02
126 #define ORDER_BY_CURR_SIZE_ASCENDING            0x03
127 #define ORDER_BY_FIRST_CREATED_ASCENDING        0x04
128 #define ORDER_BY_LAST_MODIFIED_ASCENDING        0x05
129 #define ORDER_BY_NAME_DESCENDING                0x11
130 #define ORDER_BY_TYPE_DESCENDING                0x12
131 #define ORDER_BY_CURR_SIZE_DESCENDING           0x13
132 #define ORDER_BY_FIRST_CREATED_DESCENDING       0x14
133 #define ORDER_BY_LAST_MODIFIED_DESCENDING       0x15
134
135 /* OLCP error codes */
136 #define OLCP_SUCCESS                    0x01
137 #define OLCP_OPCODE_NOT_SUPPORTED       0x02
138 #define OLCP_INVALID_PARAM              0x03
139 #define OLCP_OPERATION_FAILED           0x04
140 #define OLCP_OUT_OF_BOUNDS              0x05
141 #define OLCP_TOO_MANY_OBJ               0x06
142 #define OLCP_NO_OBJ                     0x07
143 #define OLCP_OJECT_ID_NOT_FOUND         0x08