/*
- * bluetooth-frwk
- *
- * Copyright (c) 2012-2013 Samsung Electronics Co., Ltd.
+ * 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.
* You may obtain a copy of the License at
*
- * http://www.apache.org/licenses/LICENSE-2.0
+ * http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
#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;
BT_CHECK_PARAMETER(device_address, return);
BT_CHECK_ENABLED(return);
- BT_INIT_PARAMS();
- BT_ALLOC_PARAMS(in_param1, in_param2, in_param3, in_param4, out_param);
+ if (_bt_check_privilege(BT_CHECK_PRIVILEGE, BT_HID_CONNECT)
+ == BLUETOOTH_ERROR_PERMISSION_DEINED) {
+ 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 == NULL, BLUETOOTH_ERROR_INTERNAL);
+ retv_if(user_info->cb == NULL, BLUETOOTH_ERROR_INTERNAL);
+
+ BT_INIT_PARAMS();
+ BT_ALLOC_PARAMS(in_param1, in_param2, in_param3, in_param4, out_param);
g_array_append_vals(in_param1, device_address, sizeof(bluetooth_device_address_t));
BT_CHECK_PARAMETER(device_address, return);
BT_CHECK_ENABLED(return);
- BT_INIT_PARAMS();
- BT_ALLOC_PARAMS(in_param1, in_param2, in_param3, in_param4, out_param);
+ if (_bt_check_privilege(BT_CHECK_PRIVILEGE, BT_HID_DISCONNECT)
+ == BLUETOOTH_ERROR_PERMISSION_DEINED) {
+ BT_ERR("Don't have a privilege to use this API");
+ return BLUETOOTH_ERROR_PERMISSION_DEINED;
+ }
user_info = _bt_get_user_data(BT_HID);
- retv_if(user_info == NULL, BLUETOOTH_ERROR_INTERNAL);
+ retv_if(user_info->cb == NULL, BLUETOOTH_ERROR_INTERNAL);
+
+ BT_INIT_PARAMS();
+ BT_ALLOC_PARAMS(in_param1, in_param2, in_param3, in_param4, out_param);
g_array_append_vals(in_param1, device_address, sizeof(bluetooth_device_address_t));
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;
+}
+