4 * Copyright (c) 2000 - 2011 Samsung Electronics Co., Ltd. All rights reserved.
6 * Licensed under the Apache License, Version 2.0 (the "License");
7 * you may not use this file except in compliance with the License.
8 * You may obtain a copy of the License at
10 * http://www.apache.org/licenses/LICENSE-2.0
12 * Unless required by applicable law or agreed to in writing, software
13 * distributed under the License is distributed on an "AS IS" BASIS,
14 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15 * See the License for the specific language governing permissions and
16 * limitations under the License.
20 #ifndef __DEF_BT_HID_AGENT_H_
21 #define __DEF_BT_HID_AGENT_H_
22 #define FUNCTION_TRACE
31 #include <sys/socket.h>
33 #include <gio/gunixfdlist.h>
37 #define LOG_TAG "BLUETOOTH_HID_AGENT"
39 #define LOG_COLOR_RESET "\033[0m"
40 #define LOG_COLOR_RED "\033[31m"
41 #define LOG_COLOR_YELLOW "\033[33m"
42 #define LOG_COLOR_GREEN "\033[32m"
43 #define LOG_COLOR_BLUE "\033[36m"
44 #define LOG_COLOR_PURPLE "\033[35m"
46 #define DBG(fmt, args...) SLOGD(fmt, ##args)
47 #define INFO(fmt, args...) SLOGI(fmt, ##args)
48 #define ERR(fmt, args...) SLOGE(fmt, ##args)
49 #define DBG_SECURE(fmt, args...) SECURE_SLOGD(fmt, ##args)
50 #define INFO_SECURE(fmt, args...) SECURE_SLOGI(fmt, ##args)
51 #define ERR_SECURE(fmt, args...) SECURE_SLOGE(fmt, ##args)
52 #define DBG_SECURE(fmt, args...) SECURE_SLOGD(fmt, ##args)
53 #define INFO_C(fmt, arg...) \
54 SLOGI_IF(TRUE, LOG_COLOR_BLUE" "fmt" "LOG_COLOR_RESET, ##arg)
55 #define ERR_C(fmt, arg...) \
56 SLOGI_IF(TRUE, LOG_COLOR_RED" "fmt" "LOG_COLOR_RESET, ##arg)
59 #define FN_START DBG("[ENTER FUNC]")
60 #define FN_END DBG("[EXIT FUNC]")
66 #define BT_HID_SERVICE_NAME "org.bluez.hid_agent"
67 #define BT_HID_AGENT_OBJECT_PATH "/org/bluez/hid_agent"
68 #define BT_HID_SERVICE_INTERFACE "org.tizen.HidApp"
69 #define BT_HID_AGENT_ERROR (__bt_hid_agent_error_quark())
71 #define BT_HID_BLUEZ_OBJECT_PATH "/org/tizen/hid"
72 #define BT_HID_BLUEZ_INTERFACE "org.bluez.HidAgent"
74 #define BLUEZ_SERVICE_NAME "org.bluez"
75 #define BLUEZ_HID_INTERFACE_NAME "org.bluez.hid_device"
77 #define BLUEZ_PROFILE_MGMT_INTERFACE "org.bluez.ProfileManager1"
78 #define BT_MANAGER_INTERFACE "org.freedesktop.DBus.ObjectManager"
79 #define BT_ADAPTER_INTERFACE "org.bluez.Adapter1"
81 #define BT_PROPERTIES_INTERFACE "org.freedesktop.DBus.Properties"
82 #define BT_INTERFACES_ADDED "InterfacesAdded"
83 #define BT_INTERFACES_REMOVED "InterfacesRemoved"
84 #define BT_PROPERTY_CHANGED "PropertiesChanged"
86 #define BLUEZ_MEDIA_TRANSPORT_INTERFACE "org.bluez.MediaTransport1"
87 #define BLUEZ_MEDIA_ENDPOINT_INTERFACE "org.bluez.MediaEndpoint1"
88 #define BLUEZ_DEVICE_INTERFACE "org.bluez.Device1"
89 #define A2DP_SOURCE_ENDPOINT "/MediaEndpoint/A2DPSource"
91 #define BT_ADDRESS_STRING_SIZE 18
92 #define BT_ADAPTER_OBJECT_PATH_MAX 50
93 #define BT_HID_DATA_BUF_SIZE 1024
95 #define BT_ERROR_INTERNAL "InternalError"
96 #define BT_ERROR_NOT_AVAILABLE "NotAvailable"
97 #define BT_ERROR_NOT_CONNECTED "NotConnected"
98 #define BT_ERROR_NOT_CONNECTION_FAILED "ConnectionFailed"
99 #define BT_ERROR_BUSY "InProgress"
100 #define BT_ERROR_INVALID_PARAM "InvalidArguments"
101 #define BT_ERROR_ALREADY_EXIST "AlreadyExists"
102 #define BT_ERROR_ALREADY_CONNECTED "Already Connected"
103 #define BT_ERROR_NO_MEMORY "No memory"
104 #define BT_ERROR_NO_DATA "No data"
105 #define BT_ERROR_I_O_ERROR "I/O error"
106 #define BT_ERROR_OPERATION_NOT_AVAILABLE "Operation currently not available"
107 #define BT_ERROR_OPERATION_NOT_ALLOWED "Operation not allowed"
108 #define BT_ERROR_OPERATION_NOT_SUPPORTED "Operation not supported"
109 #define BT_ERROR_INVALID_FILE_DESCRIPTOR "Invalid File Descriptor"
111 #define ret_if(expr) \
114 ERR("(%s) return", #expr); \
120 BT_HID_AGENT_ERROR_NONE,
121 BT_HID_AGENT_ERROR_INTERNAL,
122 BT_HID_AGENT_ERROR_NOT_AVAILABLE,
123 BT_HID_AGENT_ERROR_NOT_CONNECTED,
124 BT_HID_AGENT_ERROR_CONNECTION_FAILED,
125 BT_HID_AGENT_ERROR_BUSY,
126 BT_HID_AGENT_ERROR_INVALID_PARAM,
127 BT_HID_AGENT_ERROR_ALREADY_EXIST,
128 BT_HID_AGENT_ERROR_ALREADY_CONNECTED,
129 BT_HID_AGENT_ERROR_NO_MEMORY,
130 BT_HID_AGENT_ERROR_NO_DATA,
131 BT_HID_AGENT_ERROR_I_O_ERROR,
132 BT_HID_AGENT_ERROR_APPLICATION,
133 BT_HID_AGENT_ERROR_NOT_ALLOWED,
134 BT_HID_AGENT_ERROR_NOT_SUPPORTED,
135 BT_HID_AGENT_ERROR_INVALID_FILE_DESCRIPTOR,
136 } bt_hid_agent_error_t;
139 BT_HID_STATE_UNAVAILABLE,
140 BT_HID_STATE_DISCONNECTED,
141 BT_HID_STATE_CONNECTING,
142 BT_HID_STATE_CONNECTED,
143 BT_HID_STATE_DISCONNECTING,
148 char remote_addr[BT_ADDRESS_STRING_SIZE];
150 GDBusMethodInvocation *context;
152 } bt_hid_agent_info_t;
154 bt_hid_agent_error_t _bt_hid_disconnect_profile(void);
159 #endif /* __DEF_BT_HID_AGENT_H_ */