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.
24 #include "bluetooth-api.h"
25 #include "bt-internal-types.h"
27 #include "bt-service-common.h"
28 #include "bt-service-event.h"
29 #include "bt-service-util.h"
30 #include "bt-service-rfcomm-client.h"
31 #include "bt-service-rfcomm-server.h"
38 GDBusProxy *rfcomm_proxy;
39 } rfcomm_function_data_t;
41 rfcomm_function_data_t *rfcomm_info;
44 static int __bt_rfcomm_terminate_client(int socket_fd)
46 return BLUETOOTH_ERROR_NONE;
50 int _bt_rfcomm_connect_using_uuid(int request_id,
51 bluetooth_device_address_t *device_address,
54 return BLUETOOTH_ERROR_NONE;
57 /* Range of the Channel : 0 <= channel <= 30 */
58 int _bt_rfcomm_connect_using_channel(int request_id,
59 bluetooth_device_address_t *device_address,
62 return BLUETOOTH_ERROR_NONE;
65 /* Be used in RFCOMM client /server */
66 int _bt_rfcomm_disconnect(int socket_fd)
68 return __bt_rfcomm_terminate_client(socket_fd);
71 /* Be used in RFCOMM client /server */
72 int _bt_rfcomm_write(int socket_fd, char *buf, int length)
74 return BLUETOOTH_ERROR_NONE;
77 int _bt_rfcomm_cancel_connect(void)
79 return BLUETOOTH_ERROR_NONE;
82 int _bt_rfcomm_is_connected(gboolean *connected)
84 BT_CHECK_PARAMETER(connected, return);
86 *connected = (client_list == NULL || g_slist_length(client_list) == 0) ?
89 return BLUETOOTH_ERROR_NONE;
92 int _bt_rfcomm_is_device_connected(bluetooth_device_address_t *device_address,
96 bt_rfcomm_info_t *client_info;
97 char address[BT_ADDRESS_STRING_SIZE] = { 0 };
99 BT_CHECK_PARAMETER(device_address, return);
100 BT_CHECK_PARAMETER(connected, return);
102 _bt_convert_addr_type_to_string(address, device_address->addr);
106 for (l = client_list; l != NULL; l = l->next) {
107 client_info = l->data;
109 if (client_info == NULL)
112 if (g_strcmp0(address, client_info->address) == 0) {
114 return BLUETOOTH_ERROR_NONE;
118 return BLUETOOTH_ERROR_NONE;
121 int _bt_rfcomm_client_disconnect_all(void)
124 bt_rfcomm_info_t *client_info;
126 for (l = client_list; l != NULL; l = l->next) {
127 client_info = l->data;
129 if (client_info == NULL)
132 _bt_rfcomm_disconnect(client_info->fd);
135 return BLUETOOTH_ERROR_NONE;