X-Git-Url: http://review.tizen.org/git/?a=blobdiff_plain;f=include%2Fbluetooth-hid-api.h;h=917d9f5ed335467bb6c42374a1f52bd38fa502b7;hb=05f230d0e03bce2a63f40ff796ff033fdc7c77c3;hp=3880d765c47327fb470886cba5e1821c424e0cbc;hpb=25986f9247de588fc3bb272c5acf6544434f46bf;p=platform%2Fcore%2Fconnectivity%2Fbluetooth-frwk.git diff --git a/include/bluetooth-hid-api.h b/include/bluetooth-hid-api.h old mode 100644 new mode 100755 index 3880d76..917d9f5 --- a/include/bluetooth-hid-api.h +++ b/include/bluetooth-hid-api.h @@ -1,13 +1,11 @@ /* - * 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, @@ -45,6 +43,22 @@ typedef struct { void *user_data; } hid_event_param_t; +typedef struct { + unsigned char btcode; + unsigned char rep_id; + unsigned char button; + signed char axis_x; + signed char axis_y; + signed char axis_z; +} hid_send_mouse_event_t; + +typedef struct { + unsigned char btcode; + unsigned char rep_id; + unsigned char modify; + unsigned char key[8]; +} hid_send_key_event_t; + typedef void (*hid_cb_func_ptr)(int, hid_event_param_t *, void *); typedef struct { @@ -129,6 +143,203 @@ int bluetooth_hid_connect(hid_device_address_t *device_address); */ int bluetooth_hid_disconnect(hid_device_address_t *device_address); +int bluetooth_hid_enable_barcode_feature(void); + +/** + * @fn int bluetooth_hid_device_init(hid_cb_func_ptr callback_ptr, void *user_data) + * @brief Initialize HID Device service and register the callback + * + * This function is a synchronous call. + * + * @return HID_ERROR_NONE - Success \n + * HID_ERROR_ALREADY_INITIALIZED - Aready Initialized \n + * HID_ERROR_INTERNAL - Internal Error \n + * HID_ERROR_NOT_ENABLED - Not enabled \n + * + * @remark None + * + */ +int bluetooth_hid_device_init(hid_cb_func_ptr callback, void *user_data); + +/** + * @fn int bluetooth_hid_device_deinit(void) + * @brief Initialize HID service and register the callback + * + * This function is a synchronous call. + * + * @return HID_ERROR_NONE - Success \n + * HID_ERROR_NOT_INITIALIZED - Not Initialiezed \n + * + * @remark None + * + */ +int bluetooth_hid_device_deinit(); + +/** + * @fn int bluetooth_hid_device_activate() + * + * @brief Register the HID Device UUID with bluez with RegisterProfile. + * + * This function is a asynchronous call. + * + * @return HID_ERROR_NONE - Success \n + * HID_ERROR_NOT_INITIALIZED - Internal Error \n + * HID_ERROR_NOT_ENABLED - Not enabled \n + * HID_ERROR_INTERNAL - Not enabled \n + * + * @exception None + * @remark None + */ +int bluetooth_hid_device_activate(void); + +/** + * @fn int bluetooth_hid_device_deactivate() + * + * @brief Unregister the HID Device UUID with bluez with UnRegisterProfile. + * + * This function is a asynchronous call. + * + * @return HID_ERROR_NONE - Success \n + * HID_ERROR_NOT_INITIALIZED - Internal Error \n + * HID_ERROR_NOT_ENABLED - Not enabled \n + * HID_ERROR_INTERNAL - Not enabled \n + * + * @exception None + * @remark None + */ +int bluetooth_hid_device_deactivate(void); + +/** + * @fn int bluetooth_hid_device_connect(const char *remote_addr) + * + * @brief Initiate the connection for HID device role with remote device + * address specified as parameter. + * + * This function is a asynchronous call. + * + * @return HID_ERROR_NONE - Success \n + * + * @exception None + * @param[in] remote_addr device address of remote device. + * @remark None + */ +int bluetooth_hid_device_connect(const char *remote_addr); +/** + * @fn int bluetooth_hid_device_disconnect() + * + * @brief Terminate the connection with HID host device with DisconnectProfile. + * + * This function is a asynchronous call. + * + * @return HID_ERROR_NONE - Success \n + * HID_ERROR_NOT_INITIALIZED - Internal Error \n + * HID_ERROR_NOT_ENABLED - Not enabled \n + * HID_ERROR_INTERNAL - Not enabled \n + * + * @exception None + * @param[in] remote_addr device address of remote device. + * @remark None + */ + +int bluetooth_hid_device_disconnect(const char *remote_addr); + +/** + * @fn int bluetooth_hid_send_mouse_event(hid_send_mouse_event_t send_event) + * + * @brief write the event data on the socket. + * + * This function is a asynchronous call. + * + * @return HID_ERROR_NONE - Success \n + * HID_ERROR_INVALID_PARAM - Invalid parameter \n + * HID_ERROR_NOT_INITIALIZED - Internal Error \n + * HID_ERROR_NOT_ENABLED - Not enabled \n + * HID_ERROR_INTERNAL - Not enabled \n + * + * @exception None + * @param[in] remote_addr device address of remote device. + * @param[in] send_event This indicates the event data to send to remote device. + * @remark None + */ +int bluetooth_hid_device_send_mouse_event(const char *remote_addr, + hid_send_mouse_event_t send_event); + +/** + * @fn int bluetooth_hid_device_send_key_event(hid_send_key_event_t send_event) + * + * @brief write the event data on the socket. + * + * This function is a asynchronous call. + * + * @return HID_ERROR_NONE - Success \n + * HID_ERROR_INVALID_PARAM - Invalid parameter \n + * HID_ERROR_NOT_INITIALIZED - Internal Error \n + * HID_ERROR_NOT_ENABLED - Not enabled \n + * HID_ERROR_INTERNAL - Not enabled \n + * + * @exception None + * @param[in] remote_addr device address of remote device. + * @param[in] send_event This indicates the event data to send to remote device. + * @remark None + */ +int bluetooth_hid_device_send_key_event(const char *remote_addr, + hid_send_key_event_t send_event); + +/** + * @fn int bluetooth_hid_device_send_custom_event(const char *remote_addr, + * unsigned char btcode, unsigned char report_id, + * const char *data, unsigned int data_len) + * + * @brief write the event data on the socket. + * + * This function is a asynchronous call. + * + * @return HID_ERROR_NONE - Success \n + * HID_ERROR_INVALID_PARAM - Invalid parameter \n + * HID_ERROR_NOT_INITIALIZED - Internal Error \n + * HID_ERROR_NOT_ENABLED - Not enabled \n + * HID_ERROR_INTERNAL - Not enabled \n + * + * @exception None + * @param[in] remote_addr device address of remote device. + * @param[in] btcode The btcode + * @param[in] report_id The report id + * @param[in] data This indicates the event data to send to remote device. + * @param[in] data_len The length of the data + * @remark None + */ +int bluetooth_hid_device_send_custom_event(const char *remote_addr, + unsigned char btcode, unsigned char report_id, + const char *data, unsigned int data_len); + +/** + * @fn int bluetooth_hid_device_reply_to_report(const char *remote_addr, + * bt_hid_header_type_t htype, + * bt_hid_param_type_t ptype, + * char *buffer) + * + * @brief write the event data on the socket. + * + * This function is a asynchronous call. + * + * @return HID_ERROR_NONE - Success \n + * HID_ERROR_INVALID_PARAM - Invalid parameter \n + * HID_ERROR_NOT_INITIALIZED - Internal Error \n + * HID_ERROR_NOT_ENABLED - Not enabled \n + * HID_ERROR_INTERNAL - Not enabled \n + * + * @exception None + * @param[in] remote_addr device address of remote device. + * @param[in] htype header type to be present in response + * @param[in] ptype Parameter type to be present in response. + * @param[in] buffer Data need to be send in reponse payload. + * @remark None + */ +int bluetooth_hid_device_reply_to_report(const char *remote_addr, + bt_hid_header_type_t htype, + bt_hid_param_type_t ptype, + const char *data, + unsigned int data_len); #ifdef __cplusplus }