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_GET_BONDED_DEVICES && b != BT_GET_DISCOVERABLE_MODE)) \
46 BT_INFO_C("Sync Request => type=%s, fn=%s(0x%x)", #a, #b, b); \
48 BT_DBG("Sync Request => type=%s, fn=%s(0x%x)", #a, #b, b); \
49 _bt_sync_send_request(a, b, format); \
53 int _bt_async_send_request(int service_type, int service_function,
54 GArray *in_param1, GArray *in_param2,
55 GArray *in_param3, GArray *in_param4,
56 void *callback, void *user_data);
58 /* The caller of this should pass #define macro/enum types as the first two params */
59 #define _bt_send_request_async(a, b, format ...) ( \
61 if ((a != BT_CHECK_PRIVILEGE && (a == BT_BLUEZ_SERVICE || a == BT_OBEX_SERVICE)) && \
62 (b != BT_GET_LOCAL_NAME && b != BT_GET_LOCAL_ADDRESS && \
63 b != BT_GET_BONDED_DEVICE && b != BT_IS_DEVICE_CONNECTED && \
64 b != BT_GET_BONDED_DEVICES && b != BT_GET_DISCOVERABLE_MODE)) \
65 BT_INFO_C("Async Request => type=%s, fn=%s(0x%x)", #a, #b, b); \
67 BT_DBG("Async Request => type=%s, fn=%s(0x%x)", #a, #b, b); \
68 _bt_async_send_request(a, b, format); \
72 void _bt_gdbus_deinit_proxys(void);
74 int _bt_sync_send_request_with_unix_fd_list(
75 int service_type, int service_function,
76 GArray *in_param1, GArray *in_param2,
77 GArray *in_param3, GArray *in_param4,
78 GUnixFDList *fd_list, GArray **out_param1,
79 GUnixFDList **out_fd_list);
80 #define _bt_send_request_with_unix_fd_list(a, b, format ...) ( \
82 BT_INFO_C("Async Request => type=%s, fn=%s(0x%x)", #a, #b, b); \
83 _bt_sync_send_request_with_unix_fd_list(a, b, format); \
87 int _bt_async_send_request_with_unix_fd_list(int service_type, int service_function,
88 GArray *in_param1, GArray *in_param2,
89 GArray *in_param3, GArray *in_param4,
90 void *callback, void *user_data,
91 GUnixFDList *fd_list, GAsyncReadyCallback __async_req_cb);
92 #define _bt_send_request_async_with_unix_fd_list(a, b, format ...) ( \
94 BT_INFO_C("Async Request => type=%s, fn=%s(0x%x)", #a, #b, b); \
95 _bt_async_send_request_with_unix_fd_list(a, b, format); \
103 #endif /* _BT_REQUEST_SENDER_H_ */