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 #include <dbus/dbus.h>
25 #include "bluetooth-api.h"
26 #include "bt-internal-types.h"
28 #include "bt-service-common.h"
29 #include "bt-service-event.h"
30 #include "bt-service-util.h"
31 #include "bt-service-rfcomm-client.h"
32 #include "bt-service-rfcomm-server.h"
39 GDBusProxy *rfcomm_proxy;
40 } rfcomm_function_data_t;
42 rfcomm_function_data_t *rfcomm_info;
45 static int __bt_rfcomm_terminate_client(int socket_fd)
47 return BLUETOOTH_ERROR_NONE;
51 int _bt_rfcomm_connect_using_uuid(int request_id,
52 bluetooth_device_address_t *device_address,
55 return BLUETOOTH_ERROR_NONE;
58 /* Range of the Channel : 0 <= channel <= 30 */
59 int _bt_rfcomm_connect_using_channel(int request_id,
60 bluetooth_device_address_t *device_address,
63 return BLUETOOTH_ERROR_NONE;
66 /* Be used in RFCOMM client /server */
67 int _bt_rfcomm_disconnect(int socket_fd)
69 return __bt_rfcomm_terminate_client(socket_fd);
72 /* Be used in RFCOMM client /server */
73 int _bt_rfcomm_write(int socket_fd, char *buf, int length)
75 return BLUETOOTH_ERROR_NONE;
78 int _bt_rfcomm_cancel_connect(void)
80 return BLUETOOTH_ERROR_NONE;
83 int _bt_rfcomm_is_connected(gboolean *connected)
85 BT_CHECK_PARAMETER(connected, return);
87 *connected = (client_list == NULL || g_slist_length(client_list) == 0) ?
90 return BLUETOOTH_ERROR_NONE;
93 int _bt_rfcomm_is_device_connected(bluetooth_device_address_t *device_address,
97 bt_rfcomm_info_t *client_info;
98 char address[BT_ADDRESS_STRING_SIZE] = { 0 };
100 BT_CHECK_PARAMETER(device_address, return);
101 BT_CHECK_PARAMETER(connected, return);
103 _bt_convert_addr_type_to_string(address, device_address->addr);
107 for (l = client_list; l != NULL; l = l->next) {
108 client_info = l->data;
110 if (client_info == NULL)
113 if (g_strcmp0(address, client_info->address) == 0) {
115 return BLUETOOTH_ERROR_NONE;
119 return BLUETOOTH_ERROR_NONE;
122 int _bt_rfcomm_client_disconnect_all(void)
125 bt_rfcomm_info_t *client_info;
127 for (l = client_list; l != NULL; l = l->next) {
128 client_info = l->data;
130 if (client_info == NULL)
133 _bt_rfcomm_disconnect(client_info->fd);
136 return BLUETOOTH_ERROR_NONE;