Merge branch 'tizen' into tizen_5.5
[platform/core/connectivity/bluetooth-frwk.git] / bt-api / bt-hid.c
index b03143b..0657cc6 100644 (file)
@@ -1,11 +1,5 @@
 /*
- * Bluetooth-frwk
- *
- * Copyright (c) 2000 - 2011 Samsung Electronics Co., Ltd. All rights reserved.
- *
- * Contact:  Hocheol Seo <hocheol.seo@samsung.com>
- *              Girishashok Joshi <girish.joshi@samsung.com>
- *              Chanyeol Park <chanyeol.park@samsung.com>
+ * Copyright (c) 2011 Samsung Electronics Co., Ltd All Rights Reserved
  *
  * Licensed under the Apache License, Version 2.0 (the "License");
  * you may not use this file except in compliance with the License.
 #include "bt-request-sender.h"
 #include "bt-event-handler.h"
 
+#ifdef TIZEN_FEATURE_BT_DPM
+#include "bt-dpm.h"
+#endif
+
 BT_EXPORT_API int bluetooth_hid_init(hid_cb_func_ptr callback_ptr, void *user_data)
 {
        int ret;
@@ -76,6 +74,17 @@ BT_EXPORT_API int bluetooth_hid_connect(hid_device_address_t *device_address)
                BT_ERR("Don't have a privilege to use this API");
                return BLUETOOTH_ERROR_PERMISSION_DEINED;
        }
+#ifdef TIZEN_FEATURE_BT_DPM
+       if (_bt_check_dpm(BT_DPM_ADDRESS, device_address) == BT_DPM_RESTRICTED) {
+               BT_ERR("Blacklist device");
+               return BLUETOOTH_ERROR_DEVICE_POLICY_RESTRICTION;
+       }
+
+       if (_bt_check_dpm(BT_DPM_UUID, BT_HID_UUID) == BT_DPM_RESTRICTED) {
+               BT_ERR("Blacklist uuid");
+               return BLUETOOTH_ERROR_DEVICE_POLICY_RESTRICTION;
+       }
+#endif
 
        user_info = _bt_get_user_data(BT_HID);
        retv_if(user_info->cb == NULL, BLUETOOTH_ERROR_INTERNAL);
@@ -125,3 +134,18 @@ BT_EXPORT_API int bluetooth_hid_disconnect(hid_device_address_t *device_address)
        return result;
 }
 
+BT_EXPORT_API int bluetooth_hid_enable_barcode_feature(void)
+{
+       int result;
+
+       BT_INIT_PARAMS();
+       BT_ALLOC_PARAMS(in_param1, in_param2, in_param3, in_param4, out_param);
+
+       result = _bt_send_request(BT_BLUEZ_SERVICE, BT_HID_ENABLE_BARCODE_FEATURE,
+               in_param1, in_param2, in_param3, in_param4, &out_param);
+
+       BT_FREE_PARAMS(in_param1, in_param2, in_param3, in_param4, out_param);
+
+       return result;
+}
+