[OTP] Add support for OACP Read
[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 BT_FILE_PATH_MAX_LEN 262
34 #define BT_L2CAP_BUFFER_LEN 672
35
36 #define BT_ADDRESS_STRING_SIZE 18
37
38 /* OTP Service and Chanracteristics UUID */
39 #define OTP_UUID                        "1825"
40 #define OTP_FEATURE_UUID                "2abd"
41 #define OTP_OBJECT_NAME_UUID            "2abe"
42 #define OTP_OBJECT_TYPE_UUID            "2abf"
43 #define OTP_OBJECT_SIZE_UUID            "2ac0"
44 #define OTP_OBJECT_FIRST_CREATED_UUID   "2ac1"
45 #define OTP_OBJECT_LAST_MODIFIED_UUID   "2ac2"
46 #define OTP_OBJECT_ID_UUID              "2ac3"
47 #define OTP_OBJECT_PROP_UUID            "2ac4"
48 #define OTP_OACP_UUID                   "2ac5"
49 #define OTP_OLCP_UUID                   "2ac6"
50 #define OTP_OBJECT_LIST_FILTER_UUID     "2ac7"
51 #define OTP_OBJECT_CHANGED_UUID         "2ac8"
52
53 #define OTP_CP_CCC_DESC_UUID            "2902"
54
55 /* OTP Error codes */
56 #define WRITE_REQUEST_REJECTED          0X80
57 #define OBJECT_NOT_SELECTED             0X81
58 #define CONCURRENCY_LIMIT_EXCEEDED      0X82
59 #define OBJECT_NAME_ALREADY_EXISTS      0X83
60
61 /* OTP Object Type Custom UUIDs */
62 /* In SIG Assigned numbers not available */
63 #define UNSUPPORTED_OBJECT_TYPE_UUID    "000019aa-0000-1001-8000-00805f9b34fb"
64 #define FIRMWARE_UUID                   "000019ab-0000-1001-8000-00805f9b34fb"
65 #define ROUTE_GPX_UUID                  "000019ac-0000-1001-8000-00805f9b34fb"
66 #define TRACK_GPX_UUID                  "000019ad-0000-1001-8000-00805f9b34fb"
67
68 /* Object Metadata Length */
69 #define OTP_FEATURE_LENGTH              8
70 #define ABSOLUTE_PATH_MAX_LENGTH        200
71
72 /* Object ID range defined by SIG. */
73 #define OBJECT_START_ID 256
74 #define OBJECT_END_ID   281474976710655
75
76 /* Object Properties */
77 #define OBJECT_DELETE   0x00000001
78 #define OBJECT_EXECUTE  0x00000002
79 #define OBJECT_READ     0x00000004
80 #define OBJECT_WRITE    0x00000008
81 #define OBJECT_APPEND   0x00000010
82 #define OBJECT_TRUNCATE 0x00000020
83 #define OBJECT_PATCH    0x00000040
84 #define OBJECT_MARK     0x00000080
85
86 /* OACP opcodes */
87 #define OACP_CREATE             0x01
88 #define OACP_DELETE             0x02
89 #define OACP_CALC_CHECKSUM      0x03
90 #define OACP_EXECUTE            0x04
91 #define OACP_READ               0x05
92 #define OACP_WRITE              0x06
93 #define OACP_ABORT              0x07
94 #define OACP_RESPONSE           0x60
95
96 /* OACP error codes */
97 #define OACP_SUCCESS                    0x01
98 #define OACP_OPCODE_NOT_SUPPORTED       0x02
99 #define OACP_INVALID_PARAM              0x03
100 #define OACP_INSUFFICIENT_RESOURCES     0x04
101 #define OACP_INVALID_OBJ                0x05
102 #define OACP_CHANNEL_UNAVAILABLE        0x06
103 #define OACP_UNSUPPORTED_TYPE           0x07
104 #define OACP_PROCEDURE_NOT_SUPPORTED    0x08
105 #define OACP_OBJECT_LOCKED              0x09
106 #define OACP_OPERATION_FAILED           0x0A
107
108 /* OLCP opcodes */
109 #define OLCP_FIRST              0x01
110 #define OLCP_LAST               0x02
111 #define OLCP_PREVIOUS           0x03
112 #define OLCP_NEXT               0x04
113 #define OLCP_GOTO               0x05
114 #define OLCP_ORDER              0x06
115 #define OLCP_REQ_NO_OBJ         0x07
116 #define OLCP_CLEAR_MARKING      0x08
117 #define OLCP_RESPONSE           0x70
118
119 /* OLCP order param values */
120 #define ORDER_BY_NAME_ASCENDING                 0x01
121 #define ORDER_BY_TYPE_ASCENDING                 0x02
122 #define ORDER_BY_CURR_SIZE_ASCENDING            0x03
123 #define ORDER_BY_FIRST_CREATED_ASCENDING        0x04
124 #define ORDER_BY_LAST_MODIFIED_ASCENDING        0x05
125 #define ORDER_BY_NAME_DESCENDING                0x11
126 #define ORDER_BY_TYPE_DESCENDING                0x12
127 #define ORDER_BY_CURR_SIZE_DESCENDING           0x13
128 #define ORDER_BY_FIRST_CREATED_DESCENDING       0x14
129 #define ORDER_BY_LAST_MODIFIED_DESCENDING       0x15
130
131 /* OLCP error codes */
132 #define OLCP_SUCCESS                    0x01
133 #define OLCP_OPCODE_NOT_SUPPORTED       0x02
134 #define OLCP_INVALID_PARAM              0x03
135 #define OLCP_OPERATION_FAILED           0x04
136 #define OLCP_OUT_OF_BOUNDS              0x05
137 #define OLCP_TOO_MANY_OBJ               0x06
138 #define OLCP_NO_OBJ                     0x07
139 #define OLCP_OJECT_ID_NOT_FOUND         0x08