2 * Copyright (c) 2017 Samsung Electronics Co., Ltd All Rights Reserved
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
8 * http://www.apache.org/licenses/LICENSE-2.0
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.
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"
22 #define BLE_DISABLED "LeDisabled"
23 #define PROPERTIES_CHANGED "PropertiesChanged"
24 #define OTC_DISCONNECTED "OtcDisconnected"
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"
31 #define BT_OTC_INTERFACE_NAME "org.projectx.otc_channel"
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"
37 #define BT_FILE_PATH_MAX_LEN 262
38 #define BT_L2CAP_BUFFER_LEN 672
40 #define BT_ADDRESS_STRING_SIZE 18
42 #define BT_OTP_BASE_DIR_PATH "/home/owner/media/otp/"
43 #define BT_OTP_EMPTY_FILENAME " "
45 #define BT_OACP_MAX_TIMEOUT 10000 /* Timeout for OACP operation in msec */
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"
62 #define OTP_CP_CCC_DESC_UUID "2902"
65 #define WRITE_REQUEST_REJECTED 0X80
66 #define OBJECT_NOT_SELECTED 0X81
67 #define CONCURRENCY_LIMIT_EXCEEDED 0X82
68 #define OBJECT_NAME_ALREADY_EXISTS 0X83
70 /* OTP Object Type Custom UUIDs */
71 /* In SIG Assigned numbers not available */
72 #define UNSUPPORTED_OBJECT_TYPE_UUID "000019aa-0000-1001-8000-00805f9b34fb"
73 #define FIRMWARE_UUID "000019ab-0000-1001-8000-00805f9b34fb"
74 #define ROUTE_GPX_UUID "000019ac-0000-1001-8000-00805f9b34fb"
75 #define TRACK_GPX_UUID "000019ad-0000-1001-8000-00805f9b34fb"
77 /* Object Metadata Length */
78 #define OTP_FEATURE_LENGTH 8
79 #define OTP_INDICATION_LEN_WITHOUT_RESP 3
80 #define OTP_INDICATION_LEN_WITH_RESP 7
82 /* Object ID range defined by SIG. */
83 #define OBJECT_START_ID 256
84 #define OBJECT_END_ID 281474976710655
86 /* Object Properties */
87 #define OBJECT_DELETE 0x00000001
88 #define OBJECT_EXECUTE 0x00000002
89 #define OBJECT_READ 0x00000004
90 #define OBJECT_WRITE 0x00000008
91 #define OBJECT_APPEND 0x00000010
92 #define OBJECT_TRUNCATE 0x00000020
93 #define OBJECT_PATCH 0x00000040
94 #define OBJECT_MARK 0x00000080
97 #define OACP_CREATE 0x01
98 #define OACP_DELETE 0x02
99 #define OACP_CALC_CHECKSUM 0x03
100 #define OACP_EXECUTE 0x04
101 #define OACP_READ 0x05
102 #define OACP_WRITE 0x06
103 #define OACP_ABORT 0x07
104 #define OACP_RESPONSE 0x60
106 /* OACP error codes */
107 #define OACP_SUCCESS 0x01
108 #define OACP_OPCODE_NOT_SUPPORTED 0x02
109 #define OACP_INVALID_PARAM 0x03
110 #define OACP_INSUFFICIENT_RESOURCES 0x04
111 #define OACP_INVALID_OBJ 0x05
112 #define OACP_CHANNEL_UNAVAILABLE 0x06
113 #define OACP_UNSUPPORTED_TYPE 0x07
114 #define OACP_PROCEDURE_NOT_SUPPORTED 0x08
115 #define OACP_OBJECT_LOCKED 0x09
116 #define OACP_OPERATION_FAILED 0x0A
119 #define OLCP_FIRST 0x01
120 #define OLCP_LAST 0x02
121 #define OLCP_PREVIOUS 0x03
122 #define OLCP_NEXT 0x04
123 #define OLCP_GOTO 0x05
124 #define OLCP_ORDER 0x06
125 #define OLCP_REQ_NO_OBJ 0x07
126 #define OLCP_CLEAR_MARKING 0x08
127 #define OLCP_RESPONSE 0x70
129 /* OLCP order param values */
130 #define ORDER_BY_NAME_ASCENDING 0x01
131 #define ORDER_BY_TYPE_ASCENDING 0x02
132 #define ORDER_BY_CURR_SIZE_ASCENDING 0x03
133 #define ORDER_BY_FIRST_CREATED_ASCENDING 0x04
134 #define ORDER_BY_LAST_MODIFIED_ASCENDING 0x05
135 #define ORDER_BY_NAME_DESCENDING 0x11
136 #define ORDER_BY_TYPE_DESCENDING 0x12
137 #define ORDER_BY_CURR_SIZE_DESCENDING 0x13
138 #define ORDER_BY_FIRST_CREATED_DESCENDING 0x14
139 #define ORDER_BY_LAST_MODIFIED_DESCENDING 0x15
141 /* OLCP error codes */
142 #define OLCP_SUCCESS 0x01
143 #define OLCP_OPCODE_NOT_SUPPORTED 0x02
144 #define OLCP_INVALID_PARAM 0x03
145 #define OLCP_OPERATION_FAILED 0x04
146 #define OLCP_OUT_OF_BOUNDS 0x05
147 #define OLCP_TOO_MANY_OBJ 0x06
148 #define OLCP_NO_OBJ 0x07
149 #define OLCP_OJECT_ID_NOT_FOUND 0x08