Merge "TFIVE-12640: fixed the size of handle string" into tizen
[platform/core/connectivity/bluetooth-frwk.git] / bt-api / bt-dpm.c
1 /*
2  * Copyright (c) 2011 Samsung Electronics Co., Ltd All Rights Reserved
3  *
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
7  *
8  *              http://www.apache.org/licenses/LICENSE-2.0
9  *
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.
15  *
16  */
17
18 #ifdef TIZEN_FEATURE_BT_DPM
19 #include <vconf.h>
20
21 #include "bluetooth-api.h"
22 #include "bt-internal-types.h"
23 #include "bt-common.h"
24 #include "bt-request-sender.h"
25 #include "bt-event-handler.h"
26 #include "bt-event-handler.h"
27 #include "bt-dpm.h"
28
29 #ifdef TIZEN_FEATURE_BT_DPM
30 BT_EXPORT_API int bluetooth_dpm_is_mode_allowed(void)
31 {
32         int value;
33         /* check VCONFKEY_BT_STATUS */
34         if (vconf_get_int(VCONFKEY_BT_DPM_STATUS, &value) != 0) {
35                 BT_ERR("fail to get vconf key!");
36                 return BLUETOOTH_ERROR_INTERNAL;
37         }
38         if (value != VCONFKEY_BT_DPM_STATUS_RESTRICTED)
39                 return BLUETOOTH_ERROR_NONE;
40         else
41                 return BLUETOOTH_ERROR_PERMISSION_DEINED;
42 }
43 #endif
44
45 #if 0
46 static bt_dpm_status_e _bt_check_dpm_allow_restriction(void)
47 {
48         bt_dpm_allow_t mode;
49
50         bluetooth_dpm_get_allow_mode(&mode);
51
52         return (mode == BLUETOOTH_DPM_BT_RESTRICTED) ? BT_DPM_RESTRICTED : BT_DPM_ALLOWED;
53 }
54 #endif
55
56 static bt_dpm_status_e _bt_check_dpm_handsfree_only(void)
57 {
58         bt_dpm_allow_t mode;
59
60         bluetooth_dpm_get_allow_mode(&mode);
61
62         return (mode == BLUETOOTH_DPM_HANDSFREE_ONLY ? BT_DPM_RESTRICTED : BT_DPM_ALLOWED);
63 }
64
65 static bt_dpm_status_e _bt_check_dpm_pairing_restriction(void)
66 {
67         bt_dpm_status_t dpm_status = BLUETOOTH_DPM_ALLOWED;
68
69         bluetooth_dpm_get_pairing_state(&dpm_status);
70
71         return (dpm_status == BLUETOOTH_DPM_RESTRICTED ? BT_DPM_RESTRICTED : BT_DPM_ALLOWED);
72 }
73
74 static bt_dpm_status_e _bt_check_dpm_desktop_connectivity_restriction(void)
75 {
76         bt_dpm_status_t dpm_status = BLUETOOTH_DPM_ALLOWED;
77
78         bluetooth_dpm_get_desktop_connectivity_state(&dpm_status);
79
80         return (dpm_status == BLUETOOTH_DPM_RESTRICTED ? BT_DPM_RESTRICTED : BT_DPM_ALLOWED);
81 }
82
83 #if 0
84 static bt_dpm_status_e _bt_check_dpm_visible_restriction(void)
85 {
86         bt_dpm_status_t dpm_status = BLUETOOTH_DPM_ALLOWED;
87
88         bluetooth_dpm_get_desktop_connectivity_state(&dpm_status);
89
90         return (dpm_status == BLUETOOTH_DPM_RESTRICTED ? BT_DPM_RESTRICTED : BT_DPM_ALLOWED);
91 }
92
93 static bt_dpm_status_e _bt_check_dpm_limited_discoverable_mode(void)
94 {
95         bt_dpm_status_t dpm_status = BLUETOOTH_DPM_ALLOWED;
96
97         bluetooth_dpm_get_limited_discoverable_state(&dpm_status);
98
99         return (dpm_status == BLUETOOTH_DPM_RESTRICTED ? BT_DPM_RESTRICTED : BT_DPM_ALLOWED);
100 }
101 #endif
102
103 static bt_dpm_status_e _bt_check_dpm_blacklist_device(bluetooth_device_address_t *address)
104 {
105         int ret = BLUETOOTH_DPM_RESULT_SUCCESS;
106         bt_dpm_device_list_t dev_list;
107         char device_address[BT_ADDRESS_STRING_SIZE] = { 0 };
108
109         _bt_convert_addr_type_to_string(device_address,
110                         (unsigned char *)address->addr);
111
112         ret = bluetooth_dpm_get_devices_from_blacklist(&dev_list);
113         if (ret == BLUETOOTH_DPM_RESULT_SUCCESS) {
114                 int i = 0;
115                 for (i = 0; i < dev_list.count; i++) {
116                         char temp_address[BT_ADDRESS_STRING_SIZE] = { 0 };
117                         _bt_convert_addr_type_to_string(temp_address,
118                         (unsigned char *)dev_list.addresses[i].addr);
119                         if (g_strcmp0(device_address, temp_address) == 0)
120                                 return BT_DPM_RESTRICTED;
121                         else
122                                 return BT_DPM_ALLOWED;
123                 }
124         } else {
125                 return BT_DPM_NO_SERVICE;
126         }
127         return BT_DPM_ALLOWED;
128 }
129
130 static bt_dpm_status_e _bt_check_dpm_blacklist_uuid(char *uuid)
131 {
132         bt_dpm_status_e bt_dpm_status = BT_DPM_ALLOWED;
133         bt_dpm_status_t dpm_status = BLUETOOTH_DPM_ALLOWED;
134         bt_dpm_profile_t dpm_profile = BLUETOOTH_DPM_PROFILE_NONE;
135         bt_dpm_uuids_list_t uuid_list;
136         int ret = BLUETOOTH_DPM_RESULT_SUCCESS;
137         retv_if(!uuid, bt_dpm_status);
138
139         ret = bluetooth_dpm_get_uuids_from_blacklist(&uuid_list);
140         if (ret == BLUETOOTH_DPM_RESULT_SUCCESS) {
141                 int i = 0;
142                 for (i = 0; i < uuid_list.count; i++) {
143                         if (g_strcmp0(uuid, uuid_list.uuids[i]) == 0)
144                                 return BT_DPM_RESTRICTED;
145                         else
146                                 return BT_DPM_ALLOWED;
147                 }
148         } else {
149                 return BT_DPM_NO_SERVICE;
150         }
151
152         if (g_strcmp0(BT_OPP_UUID, uuid) == 0) {
153                 bt_dpm_status_t dpm_status = BLUETOOTH_DPM_ALLOWED;
154                 bluetooth_dpm_get_data_transfer_state(&dpm_status);
155                 return (dpm_status == BLUETOOTH_DPM_RESTRICTED ? BT_DPM_RESTRICTED : BT_DPM_ALLOWED);
156         }
157         /* TODO: MAP? see above */
158
159         /* ++ check MDM profile restriction ++ */
160         if (g_strcmp0(BT_A2DP_UUID, uuid) == 0)
161                 dpm_profile = BLUETOOTH_DPM_POLICY_A2DP_PROFILE_STATE;
162         else if (g_strcmp0(BT_AVRCP_TARGET_UUID, uuid) == 0)
163                 dpm_profile = BLUETOOTH_DPM_POLICY_AVRCP_PROFILE_STATE;
164         else if (g_strcmp0(BT_HFP_AUDIO_GATEWAY_UUID, uuid) == 0)
165                 dpm_profile = BLUETOOTH_DPM_POLICY_HFP_PROFILE_STATE;
166         else if (g_strcmp0(BT_HSP_AUDIO_GATEWAY_UUID, uuid) == 0)
167                 dpm_profile = BLUETOOTH_DPM_POLICY_HSP_PROFILE_STATE;
168         else if (g_strcmp0(BT_OBEX_PSE_UUID, uuid) == 0)
169                 dpm_profile = BLUETOOTH_DPM_POLICY_PBAP_PROFILE_STATE;
170
171         if (dpm_profile != BLUETOOTH_DPM_PROFILE_NONE) {
172                 ret = bluetooth_dpm_get_profile_state(dpm_profile, &dpm_status);
173                 return (dpm_status == BLUETOOTH_DPM_RESTRICTED ? BT_DPM_RESTRICTED : BT_DPM_ALLOWED);
174         }
175         /* -- check DPM profile restriction -- */
176
177         return bt_dpm_status;
178 }
179
180 static bt_dpm_status_e _bt_check_dpm_transfer_restriction(void)
181 {
182         bt_dpm_status_e dpm_status = BT_DPM_ALLOWED;
183         bt_dpm_status_t dpm_value = BLUETOOTH_DPM_ALLOWED;
184
185         dpm_status = _bt_check_dpm_blacklist_uuid(BT_OPP_UUID);
186         /* TODO: MAP? see above */
187
188         if (dpm_status == BT_DPM_NO_SERVICE || dpm_status == BT_DPM_RESTRICTED)
189                 return dpm_status;
190
191         bluetooth_dpm_get_data_transfer_state(&dpm_value);
192
193         return (dpm_value == BLUETOOTH_DPM_RESTRICTED ? BT_DPM_RESTRICTED : BT_DPM_ALLOWED);
194 }
195
196 static bt_dpm_status_e _bt_check_dpm_hsp_restriction(void)
197 {
198         bt_dpm_status_e dpm_status = BT_DPM_ALLOWED;
199
200         dpm_status = _bt_check_dpm_blacklist_uuid(BT_HFP_AUDIO_GATEWAY_UUID);
201
202         if (dpm_status == BT_DPM_NO_SERVICE || dpm_status == BT_DPM_RESTRICTED)
203                 return dpm_status;
204
205         dpm_status = _bt_check_dpm_blacklist_uuid(BT_HSP_AUDIO_GATEWAY_UUID);
206         if (dpm_status == BT_DPM_NO_SERVICE || dpm_status == BT_DPM_RESTRICTED)
207                 return dpm_status;
208
209         return dpm_status;
210 }
211
212 static bt_dpm_status_e _bt_check_dpm_a2dp_restriction(void)
213 {
214         bt_dpm_status_e dpm_status = BT_DPM_ALLOWED;
215
216         dpm_status = _bt_check_dpm_blacklist_uuid(BT_A2DP_UUID);
217
218         if (dpm_status == BT_DPM_NO_SERVICE || dpm_status == BT_DPM_RESTRICTED)
219                 return dpm_status;
220
221         return dpm_status;
222 }
223
224 static bt_dpm_status_e _bt_check_dpm_avrcp_restriction(void)
225 {
226         bt_dpm_status_e dpm_status = BT_DPM_ALLOWED;
227
228         dpm_status = _bt_check_dpm_blacklist_uuid(BT_AVRCP_TARGET_UUID);
229
230         if (dpm_status == BT_DPM_NO_SERVICE || dpm_status == BT_DPM_RESTRICTED)
231                 return dpm_status;
232
233         return dpm_status;
234 }
235
236 static bt_dpm_status_e _bt_check_dpm_spp_restriction(void)
237 {
238         bt_dpm_status_e dpm_status = BT_DPM_ALLOWED;
239
240         dpm_status = _bt_check_dpm_blacklist_uuid(BT_SPP_UUID);
241
242         if (dpm_status == BT_DPM_NO_SERVICE || dpm_status == BT_DPM_RESTRICTED)
243                 return dpm_status;
244
245         return dpm_status;
246 }
247
248 int _bt_check_dpm(int service, void *param)
249 {
250         bt_dpm_status_e status = BT_DPM_ALLOWED;
251         BT_CHECK_ENABLED_ANY(return);
252
253         switch (service) {
254         case BT_DPM_HF_ONLY:
255                 status = _bt_check_dpm_handsfree_only();
256                 break;
257         case BT_DPM_PAIRING:
258                 status = _bt_check_dpm_pairing_restriction();
259                 break;
260         case BT_DPM_DESKTOP:
261                 status = _bt_check_dpm_desktop_connectivity_restriction();
262                 break;
263         case BT_DPM_ADDRESS: {
264                 status = _bt_check_dpm_blacklist_device((bluetooth_device_address_t *)param);
265                 }
266                 break;
267         case BT_DPM_UUID: {
268                 char *uuid;
269                 uuid = (char *)param;
270                 status = _bt_check_dpm_blacklist_uuid(uuid);
271                 }
272                 break;
273         case BT_DPM_OPP:
274                 status = _bt_check_dpm_transfer_restriction();
275                 break;
276         /* TODO: MAP? see above */
277         case BT_DPM_HSP:
278                 status = _bt_check_dpm_hsp_restriction();
279                 break;
280         case BT_DPM_A2DP:
281                 status = _bt_check_dpm_a2dp_restriction();
282                 break;
283         case BT_DPM_AVRCP:
284                 status = _bt_check_dpm_avrcp_restriction();
285                 break;
286         case BT_DPM_SPP:
287                 status = _bt_check_dpm_spp_restriction();
288                 break;
289         default:
290                 BT_ERR("Unknown service");
291                 return status;
292         }
293
294         return status;
295 }
296
297 BT_EXPORT_API int bluetooth_dpm_set_allow_mode(bt_dpm_allow_t value)
298 {
299         int result =  BLUETOOTH_ERROR_NONE;
300 #ifdef TIZEN_FEATURE_BT_DPM
301         int bt_status;
302 #endif
303
304 #ifdef TIZEN_FEATURE_BT_DPM
305         if (value >= BLUETOOTH_DPM_BT_ALLOWED &&
306                 value <= BLUETOOTH_DPM_BT_RESTRICTED) {
307                 if (vconf_set_int(VCONFKEY_BT_DPM_STATUS, value) != 0) {
308                         BT_ERR("Set VCONFKEY_BT_DPM_STATUS failed\n");
309                         result = BLUETOOTH_ERROR_INTERNAL;
310                 } else
311                         result = BLUETOOTH_ERROR_NONE;
312         } else
313                 result = BLUETOOTH_ERROR_INVALID_PARAM;
314
315         if (vconf_get_int(VCONFKEY_BT_STATUS, &bt_status) < 0)
316                 BT_ERR("Error in reading VCONFKEY_BT_STATUS");
317
318         if (bt_status == VCONFKEY_BT_STATUS_ON) {
319                 BT_INIT_PARAMS();
320                 BT_ALLOC_PARAMS(in_param1, in_param2, in_param3, in_param4, out_param);
321
322                 g_array_append_vals(in_param1, &value, sizeof(int));
323
324                 result = _bt_send_request(BT_BLUEZ_SERVICE, BT_DPM_SET_ALLOW_BT_MODE,
325                         in_param1, in_param2, in_param3, in_param4, &out_param);
326
327                 BT_FREE_PARAMS(in_param1, in_param2, in_param3, in_param4, out_param);
328
329                 if (result == BLUETOOTH_ERROR_NONE &&
330                         value == BLUETOOTH_DPM_BT_RESTRICTED) {
331                         result = bluetooth_disable_adapter();
332                 }
333         }
334 #else
335         BT_INIT_PARAMS();
336         BT_ALLOC_PARAMS(in_param1, in_param2, in_param3, in_param4, out_param);
337
338         g_array_append_vals(in_param1, &value, sizeof(int));
339
340         result = _bt_send_request(BT_BLUEZ_SERVICE, BT_DPM_SET_ALLOW_BT_MODE,
341                 in_param1, in_param2, in_param3, in_param4, &out_param);
342
343         BT_FREE_PARAMS(in_param1, in_param2, in_param3, in_param4, out_param);
344 #endif
345
346         return result;
347
348 }
349
350 BT_EXPORT_API int bluetooth_dpm_get_allow_mode(bt_dpm_allow_t *value)
351 {
352         int result;
353
354 #ifdef TIZEN_FEATURE_BT_DPM
355         if (vconf_get_int(VCONFKEY_BT_DPM_STATUS, value) != 0) {
356                 BT_ERR("fail to get vconf key!");
357                 return BLUETOOTH_ERROR_INTERNAL;
358         }
359         result = BLUETOOTH_ERROR_NONE;
360 #else
361         BT_CHECK_ENABLED_ANY(return);
362
363         BT_INIT_PARAMS();
364         BT_ALLOC_PARAMS(in_param1, in_param2, in_param3, in_param4, out_param);
365
366         result = _bt_send_request(BT_BLUEZ_SERVICE, BT_DPM_GET_ALLOW_BT_MODE,
367                 in_param1, in_param2, in_param3, in_param4, &out_param);
368
369         if (result == BLUETOOTH_ERROR_NONE) {
370                 if (out_param->len > 0) {
371                         *value = g_array_index(out_param,
372                                         int, 0);
373                 } else {
374                         BT_ERR("out_param length is 0!!");
375                 }
376         }
377
378         BT_FREE_PARAMS(in_param1, in_param2, in_param3, in_param4, out_param);
379 #endif
380
381         return result;
382 }
383
384
385 BT_EXPORT_API int bluetooth_dpm_activate_device_restriction(bt_dpm_status_t value)
386 {
387         int result;
388
389         BT_CHECK_ENABLED_ANY(return);
390
391         BT_INIT_PARAMS();
392         BT_ALLOC_PARAMS(in_param1, in_param2, in_param3, in_param4, out_param);
393
394         g_array_append_vals(in_param1, &value, sizeof(int));
395
396         result = _bt_send_request(BT_BLUEZ_SERVICE, BT_DPM_SET_DEVICE_RESTRITION,
397                 in_param1, in_param2, in_param3, in_param4, &out_param);
398
399         BT_FREE_PARAMS(in_param1, in_param2, in_param3, in_param4, out_param);
400
401         return result;
402 }
403
404
405 BT_EXPORT_API int bluetooth_dpm_is_device_restriction_active(bt_dpm_status_t *value)
406 {
407         int result;
408
409         BT_CHECK_ENABLED_ANY(return);
410
411         BT_INIT_PARAMS();
412         BT_ALLOC_PARAMS(in_param1, in_param2, in_param3, in_param4, out_param);
413
414         result = _bt_send_request(BT_BLUEZ_SERVICE, BT_DPM_GET_DEVICE_RESTRITION,
415                 in_param1, in_param2, in_param3, in_param4, &out_param);
416
417         if (result == BLUETOOTH_ERROR_NONE) {
418                 if (out_param->len > 0) {
419                         *value = g_array_index(out_param,
420                                         int, 0);
421                 } else {
422                         BT_ERR("out_param length is 0!!");
423                 }
424         }
425
426         BT_FREE_PARAMS(in_param1, in_param2, in_param3, in_param4, out_param);
427
428         return result;
429 }
430
431
432 BT_EXPORT_API int bluetooth_dpm_activate_uuid_restriction(bt_dpm_status_t value)
433 {
434         int result;
435
436         BT_CHECK_ENABLED_ANY(return);
437
438         BT_INIT_PARAMS();
439         BT_ALLOC_PARAMS(in_param1, in_param2, in_param3, in_param4, out_param);
440
441         g_array_append_vals(in_param1, &value, sizeof(int));
442
443         result = _bt_send_request(BT_BLUEZ_SERVICE, BT_DPM_SET_UUID_RESTRITION,
444                 in_param1, in_param2, in_param3, in_param4, &out_param);
445
446         BT_FREE_PARAMS(in_param1, in_param2, in_param3, in_param4, out_param);
447
448         return result;
449 }
450
451
452 BT_EXPORT_API int bluetooth_dpm_is_uuid_restriction_active(bt_dpm_status_t *value)
453 {
454         int result;
455
456         BT_CHECK_ENABLED_ANY(return);
457
458         BT_INIT_PARAMS();
459         BT_ALLOC_PARAMS(in_param1, in_param2, in_param3, in_param4, out_param);
460
461         result = _bt_send_request(BT_BLUEZ_SERVICE, BT_DPM_GET_UUID_RESTRITION,
462                 in_param1, in_param2, in_param3, in_param4, &out_param);
463
464         if (result == BLUETOOTH_ERROR_NONE) {
465                 if (out_param->len > 0) {
466                         *value = g_array_index(out_param,
467                                         int, 0);
468                 } else {
469                         BT_ERR("out_param length is 0!!");
470                 }
471         }
472
473         BT_FREE_PARAMS(in_param1, in_param2, in_param3, in_param4, out_param);
474
475         return result;
476
477 }
478
479
480 BT_EXPORT_API int bluetooth_dpm_add_devices_to_blacklist(const bluetooth_device_address_t *device_address)
481 {
482         int result;
483
484         BT_CHECK_PARAMETER(device_address, return);
485         BT_CHECK_ENABLED_ANY(return);
486
487         BT_INIT_PARAMS();
488         BT_ALLOC_PARAMS(in_param1, in_param2, in_param3, in_param4, out_param);
489
490         g_array_append_vals(in_param1, device_address, sizeof(bluetooth_device_address_t));
491
492
493         result = _bt_send_request(BT_BLUEZ_SERVICE, BT_DPM_ADD_DEVICES_BLACKLIST,
494                 in_param1, in_param2, in_param3, in_param4, &out_param);
495
496         BT_FREE_PARAMS(in_param1, in_param2, in_param3, in_param4, out_param);
497
498         return result;
499 }
500
501
502 BT_EXPORT_API int bluetooth_dpm_add_devices_to_whitelist(const bluetooth_device_address_t *device_address)
503 {
504         int result;
505
506         BT_CHECK_PARAMETER(device_address, return);
507         BT_CHECK_ENABLED_ANY(return);
508
509         BT_INIT_PARAMS();
510         BT_ALLOC_PARAMS(in_param1, in_param2, in_param3, in_param4, out_param);
511
512         g_array_append_vals(in_param1, device_address, sizeof(bluetooth_device_address_t));
513
514         result = _bt_send_request(BT_BLUEZ_SERVICE, BT_DPM_ADD_DEVICES_WHITELIST,
515                 in_param1, in_param2, in_param3, in_param4, &out_param);
516
517         BT_FREE_PARAMS(in_param1, in_param2, in_param3, in_param4, out_param);
518
519         return result;
520
521 }
522
523
524 BT_EXPORT_API int bluetooth_dpm_add_uuids_to_blacklist(const char *service_uuid)
525 {
526         int result;
527         char uuid[BLUETOOTH_UUID_STRING_MAX];
528
529         BT_CHECK_PARAMETER(service_uuid, return);
530         BT_CHECK_ENABLED_ANY(return);
531
532
533         BT_INIT_PARAMS();
534         BT_ALLOC_PARAMS(in_param1, in_param2, in_param3, in_param4, out_param);
535
536         g_strlcpy(uuid, service_uuid, sizeof(uuid));
537         g_array_append_vals(in_param1, uuid, BLUETOOTH_UUID_STRING_MAX);
538
539         result = _bt_send_request(BT_BLUEZ_SERVICE, BT_DPM_ADD_UUIDS_BLACKLIST,
540                 in_param1, in_param2, in_param3, in_param4, &out_param);
541
542         BT_FREE_PARAMS(in_param1, in_param2, in_param3, in_param4, out_param);
543
544         return result;
545
546 }
547
548
549 BT_EXPORT_API int bluetooth_dpm_add_uuids_to_whitelist(const char *service_uuid)
550 {
551         int result;
552         char uuid[BLUETOOTH_UUID_STRING_MAX];
553
554         BT_CHECK_PARAMETER(service_uuid, return);
555         BT_CHECK_ENABLED_ANY(return);
556
557         BT_INIT_PARAMS();
558         BT_ALLOC_PARAMS(in_param1, in_param2, in_param3, in_param4, out_param);
559
560         g_strlcpy(uuid, service_uuid, sizeof(uuid));
561         g_array_append_vals(in_param1, uuid, BLUETOOTH_UUID_STRING_MAX);
562
563         result = _bt_send_request(BT_BLUEZ_SERVICE, BT_DPM_ADD_UUIDS_WHITELIST,
564                 in_param1, in_param2, in_param3, in_param4, &out_param);
565
566         BT_FREE_PARAMS(in_param1, in_param2, in_param3, in_param4, out_param);
567
568         return result;
569 }
570
571
572 BT_EXPORT_API int bluetooth_dpm_clear_devices_from_blacklist(void)
573 {
574         int result;
575
576         BT_CHECK_ENABLED_ANY(return);
577
578         BT_INIT_PARAMS();
579         BT_ALLOC_PARAMS(in_param1, in_param2, in_param3, in_param4, out_param);
580
581         result = _bt_send_request(BT_BLUEZ_SERVICE, BT_DPM_CLEAR_DEVICES_BLACKLIST,
582                 in_param1, in_param2, in_param3, in_param4, &out_param);
583
584         BT_FREE_PARAMS(in_param1, in_param2, in_param3, in_param4, out_param);
585
586         return result;
587 }
588
589
590 BT_EXPORT_API int bluetooth_dpm_clear_devices_from_whitelist(void)
591 {
592         int result;
593
594         BT_CHECK_ENABLED_ANY(return);
595
596         BT_INIT_PARAMS();
597         BT_ALLOC_PARAMS(in_param1, in_param2, in_param3, in_param4, out_param);
598
599         result = _bt_send_request(BT_BLUEZ_SERVICE, BT_DPM_CLEAR_DEVICES_WHITELIST,
600                 in_param1, in_param2, in_param3, in_param4, &out_param);
601
602         BT_FREE_PARAMS(in_param1, in_param2, in_param3, in_param4, out_param);
603
604         return result;
605 }
606
607
608 BT_EXPORT_API int bluetooth_dpm_clear_uuids_from_blacklist(void)
609 {
610         int result;
611
612         BT_CHECK_ENABLED_ANY(return);
613
614         BT_INIT_PARAMS();
615         BT_ALLOC_PARAMS(in_param1, in_param2, in_param3, in_param4, out_param);
616
617         result = _bt_send_request(BT_BLUEZ_SERVICE, BT_DPM_CLEAR_UUIDS_BLACKLIST,
618                 in_param1, in_param2, in_param3, in_param4, &out_param);
619
620         BT_FREE_PARAMS(in_param1, in_param2, in_param3, in_param4, out_param);
621
622         return result;
623 }
624
625
626 BT_EXPORT_API int bluetooth_dpm_clear_uuids_from_whitelist(void)
627 {
628         int result;
629
630         BT_CHECK_ENABLED_ANY(return);
631
632         BT_INIT_PARAMS();
633         BT_ALLOC_PARAMS(in_param1, in_param2, in_param3, in_param4, out_param);
634
635         result = _bt_send_request(BT_BLUEZ_SERVICE, BT_DPM_CLEAR_UUIDS_WHITELIST,
636                 in_param1, in_param2, in_param3, in_param4, &out_param);
637
638         BT_FREE_PARAMS(in_param1, in_param2, in_param3, in_param4, out_param);
639
640         return result;
641 }
642
643
644 static void _bluetooth_extract_dpm_device_info(int count,
645                                                         bt_dpm_device_list_t *dst_info,
646                                                         bt_dpm_device_list_t *src_info)
647 {
648         int i;
649
650         for (i = 0; i < count; i++) {
651                 memset(dst_info->addresses[i].addr, 0,
652                         BLUETOOTH_ADDRESS_LENGTH);
653
654                 g_strlcpy((gchar *)dst_info->addresses[i].addr, (gchar *)src_info->addresses[i].addr,
655                         BLUETOOTH_ADDRESS_LENGTH);
656
657 //              BT_DBG("address[%d] : %s", i, dst_info->addresses[i].addr);
658         }
659 }
660
661 static void _bluetooth_extract_dpm_uuid_info(int count,
662                                                         bt_dpm_uuids_list_t *dst_info,
663                                                         bt_dpm_uuids_list_t *src_info)
664 {
665         int i;
666
667         for (i = 0; i < count; i++) {
668                 memset(dst_info->uuids[i], 0,
669                         BLUETOOTH_UUID_STRING_MAX);
670
671                 g_strlcpy(dst_info->uuids[i], src_info->uuids[i],
672                         BLUETOOTH_UUID_STRING_MAX);
673
674                 BT_DBG("uuids[%d] : %s", i, dst_info->uuids[i]);
675         }
676 }
677
678 BT_EXPORT_API int bluetooth_dpm_get_devices_from_blacklist(bt_dpm_device_list_t *device_list)
679 {
680         int result;
681         bt_dpm_device_list_t *devices = NULL;
682
683         BT_CHECK_ENABLED_ANY(return);
684
685         BT_INIT_PARAMS();
686         BT_ALLOC_PARAMS(in_param1, in_param2, in_param3, in_param4, out_param);
687
688         result = _bt_send_request(BT_BLUEZ_SERVICE, BT_DPM_GET_DEVICES_BLACKLIST,
689                 in_param1, in_param2, in_param3, in_param4, &out_param);
690
691         if (result == BLUETOOTH_ERROR_NONE) {
692                 devices = &g_array_index(out_param, bt_dpm_device_list_t, 0);
693                 BT_DBG("device_list->count : %d", devices->count);
694
695                 if (devices->count == 0) {
696                         BT_ERR("device_list->count is zero !");
697                         result = BLUETOOTH_ERROR_NOT_FOUND;
698                 }
699
700                 device_list->count = devices->count;
701
702                 _bluetooth_extract_dpm_device_info(devices->count,
703                                 device_list, devices);
704         } else {
705                 BT_ERR("Get Devices list Failed");
706         }
707
708         BT_FREE_PARAMS(in_param1, in_param2, in_param3, in_param4, out_param);
709
710         return result;
711 }
712
713 BT_EXPORT_API int bluetooth_dpm_get_devices_from_whitelist(bt_dpm_device_list_t *device_list)
714 {
715         int result;
716         bt_dpm_device_list_t *devices = NULL;
717
718         BT_CHECK_ENABLED_ANY(return);
719
720         BT_INIT_PARAMS();
721         BT_ALLOC_PARAMS(in_param1, in_param2, in_param3, in_param4, out_param);
722
723         result = _bt_send_request(BT_BLUEZ_SERVICE, BT_DPM_GET_DEVICES_WHITELIST,
724                 in_param1, in_param2, in_param3, in_param4, &out_param);
725
726         if (result == BLUETOOTH_ERROR_NONE) {
727                 devices = &g_array_index(out_param, bt_dpm_device_list_t, 0);
728                 BT_DBG("device_list->count : %d", devices->count);
729
730                 if (devices->count == 0) {
731                         BT_ERR("device_list->count is zero !");
732                         result = BLUETOOTH_ERROR_NOT_FOUND;
733                 }
734
735                 device_list->count = devices->count;
736
737                 _bluetooth_extract_dpm_device_info(devices->count,
738                                 device_list, devices);
739
740         } else {
741                 BT_ERR("Get Devices list Failed");
742         }
743         BT_FREE_PARAMS(in_param1, in_param2, in_param3, in_param4, out_param);
744
745         return result;
746 }
747
748 BT_EXPORT_API int bluetooth_dpm_get_uuids_from_blacklist(bt_dpm_uuids_list_t *uuid_list)
749 {
750         int result;
751         bt_dpm_uuids_list_t *uuids;
752
753         BT_CHECK_ENABLED_ANY(return);
754
755         BT_INIT_PARAMS();
756         BT_ALLOC_PARAMS(in_param1, in_param2, in_param3, in_param4, out_param);
757
758         result = _bt_send_request(BT_BLUEZ_SERVICE, BT_DPM_GET_UUIDS_BLACKLIST,
759                 in_param1, in_param2, in_param3, in_param4, &out_param);
760
761         if (result == BLUETOOTH_ERROR_NONE) {
762                 uuids = &g_array_index(out_param, bt_dpm_uuids_list_t, 0);
763                 BT_DBG("uuids->count : %d", uuids->count);
764
765                 if (uuids->count == 0) {
766                         BT_ERR("uuids->count is zero !");
767                         result = BLUETOOTH_ERROR_NOT_FOUND;
768                 }
769
770                 uuid_list->count = uuids->count;
771                 _bluetooth_extract_dpm_uuid_info(uuids->count,
772                                 uuid_list, uuids);
773         } else {
774                 BT_ERR("Get UUIDS list Failed");
775         }
776
777         BT_FREE_PARAMS(in_param1, in_param2, in_param3, in_param4, out_param);
778
779         return result;
780 }
781
782 BT_EXPORT_API int bluetooth_dpm_get_uuids_from_whitelist(bt_dpm_uuids_list_t *uuid_list)
783 {
784         int result;
785         bt_dpm_uuids_list_t *uuids;
786
787         BT_CHECK_ENABLED_ANY(return);
788
789         BT_INIT_PARAMS();
790         BT_ALLOC_PARAMS(in_param1, in_param2, in_param3, in_param4, out_param);
791
792         result = _bt_send_request(BT_BLUEZ_SERVICE, BT_DPM_GET_UUIDS_WHITELIST,
793                 in_param1, in_param2, in_param3, in_param4, &out_param);
794
795         if (result == BLUETOOTH_ERROR_NONE) {
796                 uuids = &g_array_index(out_param, bt_dpm_uuids_list_t, 0);
797                 BT_DBG("uuids->count : %d", uuids->count);
798
799                 if (uuids->count == 0) {
800                         BT_ERR("uuids->count is zero !");
801                         result = BLUETOOTH_ERROR_NOT_FOUND;
802                 }
803
804                 uuid_list->count = uuids->count;
805
806                 _bluetooth_extract_dpm_uuid_info(uuids->count,
807                                 uuid_list, uuids);
808         } else {
809                 BT_ERR("Get UUIDS list Failed");
810         }
811
812         BT_FREE_PARAMS(in_param1, in_param2, in_param3, in_param4, out_param);
813
814         return result;
815 }
816
817 BT_EXPORT_API int bluetooth_dpm_remove_device_from_whitelist(const bluetooth_device_address_t *device_address)
818 {
819         int result;
820
821         BT_CHECK_PARAMETER(device_address, return);
822         BT_CHECK_ENABLED_ANY(return);
823
824         BT_INIT_PARAMS();
825         BT_ALLOC_PARAMS(in_param1, in_param2, in_param3, in_param4, out_param);
826
827         g_array_append_vals(in_param1, device_address, sizeof(bluetooth_device_address_t));
828
829         result = _bt_send_request(BT_BLUEZ_SERVICE, BT_DPM_REMOVE_DEVICE_WHITELIST,
830                 in_param1, in_param2, in_param3, in_param4, &out_param);
831
832         BT_FREE_PARAMS(in_param1, in_param2, in_param3, in_param4, out_param);
833
834         return result;
835 }
836
837 BT_EXPORT_API int bluetooth_dpm_remove_device_from_blacklist(const bluetooth_device_address_t *device_address)
838 {
839         int result;
840
841         BT_CHECK_PARAMETER(device_address, return);
842         BT_CHECK_ENABLED_ANY(return);
843
844         BT_INIT_PARAMS();
845         BT_ALLOC_PARAMS(in_param1, in_param2, in_param3, in_param4, out_param);
846
847         g_array_append_vals(in_param1, device_address, sizeof(bluetooth_device_address_t));
848
849         result = _bt_send_request(BT_BLUEZ_SERVICE, BT_DPM_REMOVE_DEVICE_BLACKLIST,
850                 in_param1, in_param2, in_param3, in_param4, &out_param);
851
852         BT_FREE_PARAMS(in_param1, in_param2, in_param3, in_param4, out_param);
853
854         return result;
855 }
856
857 BT_EXPORT_API int bluetooth_dpm_remove_uuid_from_whitelist(const char *service_uuid)
858 {
859         int result;
860         char uuid[BLUETOOTH_UUID_STRING_MAX];
861
862         BT_CHECK_PARAMETER(service_uuid, return);
863         BT_CHECK_ENABLED_ANY(return);
864
865         BT_INIT_PARAMS();
866         BT_ALLOC_PARAMS(in_param1, in_param2, in_param3, in_param4, out_param);
867
868         g_strlcpy(uuid, service_uuid, sizeof(uuid));
869         g_array_append_vals(in_param1, uuid, BLUETOOTH_UUID_STRING_MAX);
870
871         result = _bt_send_request(BT_BLUEZ_SERVICE, BT_DPM_REMOVE_UUID_WHITELIST,
872                 in_param1, in_param2, in_param3, in_param4, &out_param);
873
874         BT_FREE_PARAMS(in_param1, in_param2, in_param3, in_param4, out_param);
875
876         return result;
877 }
878
879 BT_EXPORT_API int bluetooth_dpm_remove_uuid_from_blacklist(const char *service_uuid)
880 {
881         int result;
882         char uuid[BLUETOOTH_UUID_STRING_MAX];
883
884         BT_CHECK_PARAMETER(service_uuid, return);
885         BT_CHECK_ENABLED_ANY(return);
886
887         BT_INIT_PARAMS();
888         BT_ALLOC_PARAMS(in_param1, in_param2, in_param3, in_param4, out_param);
889
890         g_strlcpy(uuid, service_uuid, sizeof(uuid));
891         g_array_append_vals(in_param1, uuid, BLUETOOTH_UUID_STRING_MAX);
892
893         result = _bt_send_request(BT_BLUEZ_SERVICE, BT_DPM_REMOVE_UUID_BLACKLIST,
894                 in_param1, in_param2, in_param3, in_param4, &out_param);
895
896         BT_FREE_PARAMS(in_param1, in_param2, in_param3, in_param4, out_param);
897
898         return result;
899
900 }
901
902 BT_EXPORT_API int bluetooth_dpm_set_allow_outgoing_call(bt_dpm_status_t value)
903 {
904         int result;
905
906         BT_CHECK_ENABLED_ANY(return);
907
908         BT_INIT_PARAMS();
909         BT_ALLOC_PARAMS(in_param1, in_param2, in_param3, in_param4, out_param);
910
911         g_array_append_vals(in_param1, &value, sizeof(int));
912
913         result = _bt_send_request(BT_BLUEZ_SERVICE, BT_DPM_SET_ALLOW_OUTGOING_CALL,
914                 in_param1, in_param2, in_param3, in_param4, &out_param);
915
916         BT_FREE_PARAMS(in_param1, in_param2, in_param3, in_param4, out_param);
917
918         return result;
919 }
920
921 BT_EXPORT_API int bluetooth_dpm_get_allow_outgoing_call(bt_dpm_status_t *value)
922 {
923         int result;
924
925         BT_CHECK_ENABLED_ANY(return);
926
927         BT_INIT_PARAMS();
928         BT_ALLOC_PARAMS(in_param1, in_param2, in_param3, in_param4, out_param);
929
930         result = _bt_send_request(BT_BLUEZ_SERVICE, BT_DPM_GET_ALLOW_OUTGOING_CALL,
931                 in_param1, in_param2, in_param3, in_param4, &out_param);
932
933         if (result == BLUETOOTH_ERROR_NONE) {
934                 if (out_param->len > 0) {
935                         *value = g_array_index(out_param,
936                                         int, 0);
937                 } else {
938                         BT_ERR("out_param length is 0!!");
939                 }
940         }
941
942         BT_FREE_PARAMS(in_param1, in_param2, in_param3, in_param4, out_param);
943
944         return result;
945 }
946
947 BT_EXPORT_API int bluetooth_dpm_set_pairing_state(bt_dpm_status_t value)
948 {
949         int result;
950
951         BT_CHECK_ENABLED_ANY(return);
952
953         BT_INIT_PARAMS();
954         BT_ALLOC_PARAMS(in_param1, in_param2, in_param3, in_param4, out_param);
955
956         g_array_append_vals(in_param1, &value, sizeof(int));
957
958         result = _bt_send_request(BT_BLUEZ_SERVICE, BT_DPM_SET_PAIRING_STATE,
959                 in_param1, in_param2, in_param3, in_param4, &out_param);
960
961         BT_FREE_PARAMS(in_param1, in_param2, in_param3, in_param4, out_param);
962
963         return result;
964 }
965
966 BT_EXPORT_API int bluetooth_dpm_get_pairing_state(bt_dpm_status_t *value)
967 {
968         int result;
969
970         BT_CHECK_ENABLED_ANY(return);
971
972         BT_INIT_PARAMS();
973         BT_ALLOC_PARAMS(in_param1, in_param2, in_param3, in_param4, out_param);
974
975         result = _bt_send_request(BT_BLUEZ_SERVICE, BT_DPM_GET_ALLOW_BT_MODE,
976                 in_param1, in_param2, in_param3, in_param4, &out_param);
977
978         if (result == BLUETOOTH_ERROR_NONE) {
979                 if (out_param->len > 0) {
980                         *value = g_array_index(out_param,
981                                         int, 0);
982                 } else {
983                         BT_ERR("out_param length is 0!!");
984                 }
985         }
986
987         BT_FREE_PARAMS(in_param1, in_param2, in_param3, in_param4, out_param);
988
989         return result;
990 }
991
992 BT_EXPORT_API int bluetooth_dpm_set_profile_state(bt_dpm_profile_t profile, bt_dpm_status_t value)
993 {
994         int result;
995
996         BT_CHECK_ENABLED_ANY(return);
997
998         BT_INIT_PARAMS();
999         BT_ALLOC_PARAMS(in_param1, in_param2, in_param3, in_param4, out_param);
1000
1001         g_array_append_vals(in_param1, &profile, sizeof(int));
1002         g_array_append_vals(in_param2, &value, sizeof(int));
1003
1004         result = _bt_send_request(BT_BLUEZ_SERVICE, BT_DPM_SET_PROFILE_STATE,
1005                 in_param1, in_param2, in_param3, in_param4, &out_param);
1006
1007         BT_FREE_PARAMS(in_param1, in_param2, in_param3, in_param4, out_param);
1008
1009         return result;
1010 }
1011
1012 BT_EXPORT_API int bluetooth_dpm_get_profile_state(bt_dpm_profile_t profile, bt_dpm_status_t *value)
1013 {
1014         int result;
1015
1016         BT_CHECK_ENABLED_ANY(return);
1017
1018         BT_INIT_PARAMS();
1019         BT_ALLOC_PARAMS(in_param1, in_param2, in_param3, in_param4, out_param);
1020
1021         g_array_append_vals(in_param1, &profile, sizeof(int));
1022
1023         result = _bt_send_request(BT_BLUEZ_SERVICE, BT_DPM_GET_PROFILE_STATE,
1024                 in_param1, in_param2, in_param3, in_param4, &out_param);
1025
1026         if (result == BLUETOOTH_ERROR_NONE) {
1027                 if (out_param->len > 0) {
1028                         *value = g_array_index(out_param,
1029                                         int, 0);
1030                 } else {
1031                         BT_ERR("out_param length is 0!!");
1032                 }
1033         }
1034
1035         BT_FREE_PARAMS(in_param1, in_param2, in_param3, in_param4, out_param);
1036
1037         return result;
1038 }
1039
1040 BT_EXPORT_API int bluetooth_dpm_set_desktop_connectivity_state(bt_dpm_status_t value)
1041 {
1042         int result;
1043
1044         BT_CHECK_ENABLED_ANY(return);
1045
1046         BT_INIT_PARAMS();
1047         BT_ALLOC_PARAMS(in_param1, in_param2, in_param3, in_param4, out_param);
1048
1049         g_array_append_vals(in_param1, &value, sizeof(int));
1050
1051         result = _bt_send_request(BT_BLUEZ_SERVICE, BT_DPM_SET_DESKROP_CONNECTIVITY_STATE,
1052                 in_param1, in_param2, in_param3, in_param4, &out_param);
1053
1054         BT_FREE_PARAMS(in_param1, in_param2, in_param3, in_param4, out_param);
1055
1056         return result;
1057 }
1058
1059 BT_EXPORT_API int bluetooth_dpm_get_desktop_connectivity_state(bt_dpm_status_t *value)
1060 {
1061         int result;
1062
1063         BT_CHECK_ENABLED_ANY(return);
1064
1065         BT_INIT_PARAMS();
1066         BT_ALLOC_PARAMS(in_param1, in_param2, in_param3, in_param4, out_param);
1067
1068         result = _bt_send_request(BT_BLUEZ_SERVICE, BT_DPM_GET_DESKROP_CONNECTIVITY_STATE,
1069                 in_param1, in_param2, in_param3, in_param4, &out_param);
1070
1071         if (result == BLUETOOTH_ERROR_NONE) {
1072                 if (out_param->len > 0) {
1073                         *value = g_array_index(out_param,
1074                                         int, 0);
1075                 } else {
1076                         BT_ERR("out_param length is 0!!");
1077                 }
1078         }
1079
1080         BT_FREE_PARAMS(in_param1, in_param2, in_param3, in_param4, out_param);
1081
1082         return result;
1083 }
1084
1085 BT_EXPORT_API int bluetooth_dpm_set_discoverable_state(bt_dpm_status_t value)
1086 {
1087         int result;
1088
1089         BT_CHECK_ENABLED_ANY(return);
1090
1091         BT_INIT_PARAMS();
1092         BT_ALLOC_PARAMS(in_param1, in_param2, in_param3, in_param4, out_param);
1093
1094         g_array_append_vals(in_param1, &value, sizeof(int));
1095
1096         result = _bt_send_request(BT_BLUEZ_SERVICE, BT_DPM_SET_DISCOVERABLE_STATE,
1097                 in_param1, in_param2, in_param3, in_param4, &out_param);
1098
1099         BT_FREE_PARAMS(in_param1, in_param2, in_param3, in_param4, out_param);
1100
1101         return result;
1102 }
1103
1104 BT_EXPORT_API int bluetooth_dpm_get_discoverable_state(bt_dpm_status_t *value)
1105 {
1106         int result;
1107
1108         BT_CHECK_ENABLED_ANY(return);
1109
1110         BT_INIT_PARAMS();
1111         BT_ALLOC_PARAMS(in_param1, in_param2, in_param3, in_param4, out_param);
1112
1113         result = _bt_send_request(BT_BLUEZ_SERVICE, BT_DPM_GET_DISCOVERABLE_STATE,
1114                 in_param1, in_param2, in_param3, in_param4, &out_param);
1115
1116         if (result == BLUETOOTH_ERROR_NONE) {
1117                 if (out_param->len > 0) {
1118                         *value = g_array_index(out_param,
1119                                         int, 0);
1120                 } else {
1121                         BT_ERR("out_param length is 0!!");
1122                 }
1123         }
1124
1125         BT_FREE_PARAMS(in_param1, in_param2, in_param3, in_param4, out_param);
1126
1127         return result;
1128 }
1129
1130 BT_EXPORT_API int bluetooth_dpm_set_limited_discoverable_state(bt_dpm_status_t value)
1131 {
1132         int result;
1133
1134         BT_CHECK_ENABLED_ANY(return);
1135
1136         BT_INIT_PARAMS();
1137         BT_ALLOC_PARAMS(in_param1, in_param2, in_param3, in_param4, out_param);
1138
1139         g_array_append_vals(in_param1, &value, sizeof(int));
1140
1141         result = _bt_send_request(BT_BLUEZ_SERVICE, BT_DPM_SET_LIMITED_DISCOVERABLE_STATE,
1142                 in_param1, in_param2, in_param3, in_param4, &out_param);
1143
1144         BT_FREE_PARAMS(in_param1, in_param2, in_param3, in_param4, out_param);
1145
1146         return result;
1147 }
1148
1149 BT_EXPORT_API int bluetooth_dpm_get_limited_discoverable_state(bt_dpm_status_t *value)
1150 {
1151         int result;
1152
1153         BT_CHECK_ENABLED_ANY(return);
1154
1155         BT_INIT_PARAMS();
1156         BT_ALLOC_PARAMS(in_param1, in_param2, in_param3, in_param4, out_param);
1157
1158         g_array_append_vals(in_param1, &value, sizeof(int));
1159
1160         result = _bt_send_request(BT_BLUEZ_SERVICE, BT_DPM_GET_LIMITED_DISCOVERABLE_STATE,
1161                 in_param1, in_param2, in_param3, in_param4, &out_param);
1162
1163         if (result == BLUETOOTH_ERROR_NONE) {
1164                 if (out_param->len > 0) {
1165                         *value = g_array_index(out_param,
1166                                         int, 0);
1167                 } else {
1168                         BT_ERR("out_param length is 0!!");
1169                 }
1170         }
1171
1172         BT_FREE_PARAMS(in_param1, in_param2, in_param3, in_param4, out_param);
1173
1174         return result;
1175 }
1176
1177 BT_EXPORT_API int bluetooth_dpm_set_data_transfer_state(bt_dpm_status_t value)
1178 {
1179         int result;
1180
1181         BT_CHECK_ENABLED_ANY(return);
1182
1183         BT_INIT_PARAMS();
1184         BT_ALLOC_PARAMS(in_param1, in_param2, in_param3, in_param4, out_param);
1185
1186         g_array_append_vals(in_param1, &value, sizeof(int));
1187
1188         result = _bt_send_request(BT_BLUEZ_SERVICE, BT_DPM_SET_DATA_TRANSFER_STATE,
1189                 in_param1, in_param2, in_param3, in_param4, &out_param);
1190
1191         BT_FREE_PARAMS(in_param1, in_param2, in_param3, in_param4, out_param);
1192
1193         return result;
1194 }
1195
1196 BT_EXPORT_API int bluetooth_dpm_get_data_transfer_state(bt_dpm_status_t *value)
1197 {
1198         int result;
1199
1200         BT_CHECK_ENABLED_ANY(return);
1201
1202         BT_INIT_PARAMS();
1203         BT_ALLOC_PARAMS(in_param1, in_param2, in_param3, in_param4, out_param);
1204
1205         result = _bt_send_request(BT_BLUEZ_SERVICE, BT_DPM_GET_DATA_TRANSFER_STATE,
1206                 in_param1, in_param2, in_param3, in_param4, &out_param);
1207
1208         if (result == BLUETOOTH_ERROR_NONE) {
1209                 if (out_param->len > 0) {
1210                         *value = g_array_index(out_param,
1211                                         int, 0);
1212                 } else {
1213                         BT_ERR("out_param length is 0!!");
1214                 }
1215         }
1216
1217         BT_FREE_PARAMS(in_param1, in_param2, in_param3, in_param4, out_param);
1218
1219         return result;
1220 }
1221 #endif /* #ifdef TIZEN_FEATURE_BT_DPM */