2 * Copyright (c) 2011 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 #ifndef _BT_REQUEST_SENDER_H_
19 #define _BT_REQUEST_SENDER_H_
21 #include <sys/types.h>
34 int _bt_sync_send_request(int service_type, int service_function,
35 GArray *in_param1, GArray *in_param2,
36 GArray *in_param3, GArray *in_param4,
39 /* The caller of this should pass #define macro/enum types as the first two params */
40 #define _bt_send_request(a, b, format ...) ( \
42 if ((a != BT_CHECK_PRIVILEGE && (a == BT_BLUEZ_SERVICE || a == BT_OBEX_SERVICE)) && \
43 (b != BT_GET_LOCAL_NAME && b != BT_GET_LOCAL_ADDRESS && \
44 b != BT_GET_BONDED_DEVICE && b != BT_IS_DEVICE_CONNECTED && \
45 b != BT_RFCOMM_SEND_RX_DETAILS && b != BT_RFCOMM_SEND_TX_DETAILS && \
46 b != BT_AVRCP_SET_PROPERTY && b != BT_BATTERY_READ_DATA && \
47 b != BT_GET_BONDED_DEVICES && b != BT_GET_DISCOVERABLE_MODE)) \
48 BT_INFO_C("Sync Request => type=%s, fn=%s(0x%x)", #a, #b, b); \
50 BT_DBG("Sync Request => type=%s, fn=%s(0x%x)", #a, #b, b); \
51 _bt_sync_send_request(a, b, format); \
55 int _bt_async_send_request(int service_type, int service_function,
56 GArray *in_param1, GArray *in_param2,
57 GArray *in_param3, GArray *in_param4,
58 void *callback, void *user_data);
60 /* The caller of this should pass #define macro/enum types as the first two params */
61 #define _bt_send_request_async(a, b, format ...) ( \
63 if ((a != BT_CHECK_PRIVILEGE && (a == BT_BLUEZ_SERVICE || a == BT_OBEX_SERVICE)) && \
64 (b != BT_GET_LOCAL_NAME && b != BT_GET_LOCAL_ADDRESS && \
65 b != BT_GET_BONDED_DEVICE && b != BT_IS_DEVICE_CONNECTED && \
66 b != BT_GET_BONDED_DEVICES && b != BT_GET_DISCOVERABLE_MODE)) \
67 BT_INFO_C("Async Request => type=%s, fn=%s(0x%x)", #a, #b, b); \
69 BT_DBG("Async Request => type=%s, fn=%s(0x%x)", #a, #b, b); \
70 _bt_async_send_request(a, b, format); \
74 void _bt_gdbus_deinit_proxys(void);
76 int _bt_sync_send_request_with_unix_fd_list(
77 int service_type, int service_function,
78 GArray *in_param1, GArray *in_param2,
79 GArray *in_param3, GArray *in_param4,
80 GUnixFDList *fd_list, GArray **out_param1,
81 GUnixFDList **out_fd_list);
82 #define _bt_send_request_with_unix_fd_list(a, b, format ...) ( \
84 BT_INFO_C("Sync Request => type=%s, fn=%s(0x%x)", #a, #b, b); \
85 _bt_sync_send_request_with_unix_fd_list(a, b, format); \
89 int _bt_async_send_request_with_unix_fd_list(int service_type, int service_function,
90 GArray *in_param1, GArray *in_param2,
91 GArray *in_param3, GArray *in_param4,
92 void *callback, void *user_data,
93 GUnixFDList *fd_list, GAsyncReadyCallback __async_req_cb);
94 #define _bt_send_request_async_with_unix_fd_list(a, b, format ...) ( \
96 BT_INFO_C("Async Request => type=%s, fn=%s(0x%x)", #a, #b, b); \
97 _bt_async_send_request_with_unix_fd_list(a, b, format); \
105 #endif /* _BT_REQUEST_SENDER_H_ */