summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--include/hardware/bluetooth.h1
-rw-r--r--include/hardware/bt_hd.h204
2 files changed, 78 insertions, 127 deletions
diff --git a/include/hardware/bluetooth.h b/include/hardware/bluetooth.h
index 3427213..138f4f8 100644
--- a/include/hardware/bluetooth.h
+++ b/include/hardware/bluetooth.h
@@ -44,6 +44,7 @@ __BEGIN_DECLS
#define BT_PROFILE_HEALTH_ID "health"
#define BT_PROFILE_SOCKETS_ID "socket"
#define BT_PROFILE_HIDHOST_ID "hidhost"
+#define BT_PROFILE_HIDDEV_ID "hiddev"
#define BT_PROFILE_PAN_ID "pan"
#define BT_PROFILE_MAP_CLIENT_ID "map_client"
#define BT_PROFILE_SDP_CLIENT_ID "sdp"
diff --git a/include/hardware/bt_hd.h b/include/hardware/bt_hd.h
index 09f547b..6ba5b09 100644
--- a/include/hardware/bt_hd.h
+++ b/include/hardware/bt_hd.h
@@ -1,4 +1,6 @@
/*
+ * Copyright (c) 2013, The Linux Foundation. All rights reserved.
+ * Not a Contribution
* Copyright (C) 2012 The Android Open Source Project
*
* Licensed under the Apache License, Version 2.0 (the "License");
@@ -14,166 +16,114 @@
* limitations under the License.
*/
-#ifndef ANDROID_INCLUDE_BT_HH_H
-#define ANDROID_INCLUDE_BT_HH_H
+#ifndef ANDROID_INCLUDE_BT_HD_H
+#define ANDROID_INCLUDE_BT_HD_H
#include <stdint.h>
__BEGIN_DECLS
-#define BTHH_MAX_DSC_LEN 884
+typedef enum
+{
+ BTHD_REPORT_TYPE_OTHER = 0,
+ BTHD_REPORT_TYPE_INPUT,
+ BTHD_REPORT_TYPE_OUTPUT,
+ BTHD_REPORT_TYPE_FEATURE,
+ BTHD_REPORT_TYPE_INTRDATA // special value for reports to be sent on INTR (INPUT is assumed)
+} bthd_report_type_t;
-/* HH connection states */
typedef enum
{
- BTHH_CONN_STATE_CONNECTED = 0,
- BTHH_CONN_STATE_CONNECTING,
- BTHH_CONN_STATE_DISCONNECTED,
- BTHH_CONN_STATE_DISCONNECTING,
- BTHH_CONN_STATE_FAILED_MOUSE_FROM_HOST,
- BTHH_CONN_STATE_FAILED_KBD_FROM_HOST,
- BTHH_CONN_STATE_FAILED_TOO_MANY_DEVICES,
- BTHH_CONN_STATE_FAILED_NO_BTHID_DRIVER,
- BTHH_CONN_STATE_FAILED_GENERIC,
- BTHH_CONN_STATE_UNKNOWN
-} bthh_connection_state_t;
+ BTHD_APP_STATE_NOT_REGISTERED,
+ BTHD_APP_STATE_REGISTERED
+} bthd_application_state_t;
typedef enum
{
- BTHH_OK = 0,
- BTHH_HS_HID_NOT_READY, /* handshake error : device not ready */
- BTHH_HS_INVALID_RPT_ID, /* handshake error : invalid report ID */
- BTHH_HS_TRANS_NOT_SPT, /* handshake error : transaction not spt */
- BTHH_HS_INVALID_PARAM, /* handshake error : invalid paremter */
- BTHH_HS_ERROR, /* handshake error : unspecified HS error */
- BTHH_ERR, /* general BTA HH error */
- BTHH_ERR_SDP, /* SDP error */
- BTHH_ERR_PROTO, /* SET_Protocol error,
- only used in BTA_HH_OPEN_EVT callback */
- BTHH_ERR_DB_FULL, /* device database full error, used */
- BTHH_ERR_TOD_UNSPT, /* type of device not supported */
- BTHH_ERR_NO_RES, /* out of system resources */
- BTHH_ERR_AUTH_FAILED, /* authentication fail */
- BTHH_ERR_HDL
-}bthh_status_t;
-
-/* Protocol modes */
-typedef enum {
- BTHH_REPORT_MODE = 0x00,
- BTHH_BOOT_MODE = 0x01,
- BTHH_UNSUPPORTED_MODE = 0xff
-}bthh_protocol_mode_t;
-
-/* Report types */
-typedef enum {
- BTHH_INPUT_REPORT = 1,
- BTHH_OUTPUT_REPORT,
- BTHH_FEATURE_REPORT
-}bthh_report_type_t;
+ BTHD_CONN_STATE_CONNECTED,
+ BTHD_CONN_STATE_CONNECTING,
+ BTHD_CONN_STATE_DISCONNECTED,
+ BTHD_CONN_STATE_DISCONNECTING,
+ BTHD_CONN_STATE_UNKNOWN
+} bthd_connection_state_t;
typedef struct
{
- int attr_mask;
- uint8_t sub_class;
- uint8_t app_id;
- int vendor_id;
- int product_id;
- int version;
- uint8_t ctry_code;
- int dl_len;
- uint8_t dsc_list[BTHH_MAX_DSC_LEN];
-} bthh_hid_info_t;
-
-/** Callback for connection state change.
- * state will have one of the values from bthh_connection_state_t
- */
-typedef void (* bthh_connection_state_callback)(bt_bdaddr_t *bd_addr, bthh_connection_state_t state);
-
-/** Callback for vitual unplug api.
- * the status of the vitual unplug
- */
-typedef void (* bthh_virtual_unplug_callback)(bt_bdaddr_t *bd_addr, bthh_status_t hh_status);
-
-/** Callback for get hid info
- * hid_info will contain attr_mask, sub_class, app_id, vendor_id, product_id, version, ctry_code, len
- */
-typedef void (* bthh_hid_info_callback)(bt_bdaddr_t *bd_addr, bthh_hid_info_t hid_info);
-
-/** Callback for get/set protocal api.
- * the protocol mode is one of the value from bthh_protocol_mode_t
- */
-typedef void (* bthh_protocol_mode_callback)(bt_bdaddr_t *bd_addr, bthh_status_t hh_status,bthh_protocol_mode_t mode);
-
-/** Callback for get/set_idle_time api.
- */
-typedef void (* bthh_idle_time_callback)(bt_bdaddr_t *bd_addr, bthh_status_t hh_status, int idle_rate);
+ const char *name;
+ const char *description;
+ const char *provider;
+ uint8_t subclass;
+ uint8_t *desc_list;
+ int desc_list_len;
+} bthd_app_param_t;
-
-/** Callback for get report api.
- * if staus is ok rpt_data contains the report data
- */
-typedef void (* bthh_get_report_callback)(bt_bdaddr_t *bd_addr, bthh_status_t hh_status, uint8_t* rpt_data, int rpt_size);
-
-
-/** BT-HH callback structure. */
+typedef struct
+{
+ uint8_t service_type;
+ uint32_t token_rate;
+ uint32_t token_bucket_size;
+ uint32_t peak_bandwidth;
+ uint32_t access_latency;
+ uint32_t delay_variation;
+} bthd_qos_param_t;
+
+typedef void (* bthd_application_state_callback)(bt_bdaddr_t *bd_addr, bthd_application_state_t state);
+typedef void (* bthd_connection_state_callback)(bt_bdaddr_t *bd_addr, bthd_connection_state_t state);
+typedef void (* bthd_get_report_callback)(uint8_t type, uint8_t id, uint16_t buffer_size);
+typedef void (* bthd_set_report_callback)(uint8_t type, uint8_t id, uint16_t len, uint8_t *p_data);
+typedef void (* bthd_set_protocol_callback)(uint8_t protocol);
+typedef void (* bthd_intr_data_callback)(uint8_t report_id, uint16_t len, uint8_t *p_data);
+typedef void (* bthd_vc_unplug_callback)(void);
+
+/** BT-HD callbacks */
typedef struct {
- /** set to sizeof(BtHfCallbacks) */
size_t size;
- bthh_connection_state_callback connection_state_cb;
- bthh_hid_info_callback hid_info_cb;
- bthh_protocol_mode_callback protocol_mode_cb;
- bthh_idle_time_callback idle_time_cb;
- bthh_get_report_callback get_report_cb;
- bthh_virtual_unplug_callback virtual_unplug_cb;
-
-} bthh_callbacks_t;
-
+ bthd_application_state_callback application_state_cb;
+ bthd_connection_state_callback connection_state_cb;
+ bthd_get_report_callback get_report_cb;
+ bthd_set_report_callback set_report_cb;
+ bthd_set_protocol_callback set_protocol_cb;
+ bthd_intr_data_callback intr_data_cb;
+ bthd_vc_unplug_callback vc_unplug_cb;
+} bthd_callbacks_t;
-/** Represents the standard BT-HH interface. */
+/** BT-HD interface */
typedef struct {
- /** set to sizeof(BtHhInterface) */
size_t size;
- /**
- * Register the BtHh callbacks
- */
- bt_status_t (*init)( bthh_callbacks_t* callbacks );
+ /** init interface and register callbacks */
+ bt_status_t (*init)(bthd_callbacks_t* callbacks);
- /** connect to hid device */
- bt_status_t (*connect)( bt_bdaddr_t *bd_addr);
+ /** close interface */
+ void (*cleanup)(void);
- /** dis-connect from hid device */
- bt_status_t (*disconnect)( bt_bdaddr_t *bd_addr );
+ /** register application */
+ bt_status_t (*register_app)(bthd_app_param_t *app_param, bthd_qos_param_t *in_qos,
+ bthd_qos_param_t *out_qos);
- /** Virtual UnPlug (VUP) the specified HID device */
- bt_status_t (*virtual_unplug)(bt_bdaddr_t *bd_addr);
+ /** unregister application */
+ bt_status_t (*unregister_app)(void);
- /** Set the HID device descriptor for the specified HID device. */
- bt_status_t (*set_info)(bt_bdaddr_t *bd_addr, bthh_hid_info_t hid_info );
+ /** connects to host with virtual cable */
+ bt_status_t (*connect)(void);
- /** Get the HID proto mode. */
- bt_status_t (*get_protocol) (bt_bdaddr_t *bd_addr, bthh_protocol_mode_t protocolMode);
+ /** disconnects from currently connected host */
+ bt_status_t (*disconnect)(void);
- /** Set the HID proto mode. */
- bt_status_t (*set_protocol)(bt_bdaddr_t *bd_addr, bthh_protocol_mode_t protocolMode);
+ /** send report */
+ bt_status_t (*send_report)(bthd_report_type_t type, uint8_t id, uint16_t len, uint8_t *p_data);
- /** Send a GET_REPORT to HID device. */
- bt_status_t (*get_report)(bt_bdaddr_t *bd_addr, bthh_report_type_t reportType, uint8_t reportId, int bufferSize);
+ /** notifies error for invalid SET_REPORT */
+ bt_status_t (*report_error)(uint8_t error);
- /** Send a SET_REPORT to HID device. */
- bt_status_t (*set_report)(bt_bdaddr_t *bd_addr, bthh_report_type_t reportType, char* report);
+ /** send Virtual Cable Unplug */
+ bt_status_t (*virtual_cable_unplug)(void);
- /** Send data to HID device. */
- bt_status_t (*send_data)(bt_bdaddr_t *bd_addr, char* data);
+} bthd_interface_t;
- /** Closes the interface. */
- void (*cleanup)( void );
-
-} bthh_interface_t;
__END_DECLS
-#endif /* ANDROID_INCLUDE_BT_HH_H */
-
+#endif /* ANDROID_INCLUDE_BT_HD_H */