summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSatya Calloji <satyac@broadcom.com>2014-07-03 10:59:16 -0700
committerPrerepa Viswanadham <dham@google.com>2014-07-23 18:52:50 +0000
commitbe7f044b64c9448324fa791294135468e12e5a9b (patch)
tree1eae0733ba4df500e8eef055e9f49221101ea250
parent941c928d9d19e3bd9bdd253923fb909dbb08a72e (diff)
downloadhardware_libhardware-be7f044b64c9448324fa791294135468e12e5a9b.zip
hardware_libhardware-be7f044b64c9448324fa791294135468e12e5a9b.tar.gz
hardware_libhardware-be7f044b64c9448324fa791294135468e12e5a9b.tar.bz2
LE energy info feature
Header changes for energy info feature Change-Id: Ic341ad9089b444960c36beff726fa9ddb5c901a2
-rw-r--r--include/hardware/bluetooth.h25
-rw-r--r--include/hardware/bt_gatt_client.h7
2 files changed, 28 insertions, 4 deletions
diff --git a/include/hardware/bluetooth.h b/include/hardware/bluetooth.h
index 4d38ff7..7c17b64 100644
--- a/include/hardware/bluetooth.h
+++ b/include/hardware/bluetooth.h
@@ -98,6 +98,15 @@ typedef struct {
uint8_t pin[16];
} __attribute__((packed))bt_pin_code_t;
+typedef struct {
+ uint8_t status;
+ uint8_t ctrl_state; /* stack reported state */
+ uint64_t tx_time; /* in ms */
+ uint64_t rx_time; /* in ms */
+ uint64_t idle_time; /* in ms */
+ uint64_t energy_used; /* a product of mA, V and ms */
+} __attribute__((packed))bt_activity_energy_info;
+
/** Bluetooth Adapter Discovery state */
typedef enum {
BT_DISCOVERY_STOPPED,
@@ -140,6 +149,7 @@ typedef struct
uint8_t max_irk_list_size;
uint8_t max_adv_filter_supported;
uint8_t scan_result_storage_size;
+ uint8_t activity_energy_info_supported;
}bt_local_le_features_t;
/* Bluetooth Adapter and Remote Device property types */
@@ -345,6 +355,15 @@ typedef void (*dut_mode_recv_callback)(uint16_t opcode, uint8_t *buf, uint8_t le
* This callback shall be invoked whenever the le_tx_test, le_rx_test or le_test_end is invoked
* The num_packets is valid only for le_test_end command */
typedef void (*le_test_mode_callback)(bt_status_t status, uint16_t num_packets);
+
+/** Callback invoked when energy details are obtained */
+/* Ctrl_state-Current controller state-Active-1,scan-2,or idle-3 state as defined by HCI spec.
+ * If the ctrl_state value is 0, it means the API call failed
+ * Time values-In milliseconds as returned by the controller
+ * Energy used-Value as returned by the controller
+ * Status-Provides the status of the read_energy_info API call */
+typedef void (*energy_info_callback)(bt_activity_energy_info *energy_info);
+
/** TODO: Add callbacks for Link Up/Down and other generic
* notifications/callbacks */
@@ -364,6 +383,7 @@ typedef struct {
callback_thread_event thread_evt_cb;
dut_mode_recv_callback dut_mode_recv_cb;
le_test_mode_callback le_test_mode_cb;
+ energy_info_callback energy_info_cb;
} bt_callbacks_t;
typedef void (*alarm_cb)(void *data);
@@ -507,6 +527,11 @@ typedef struct {
* This should be called immediately after a successful |init|.
*/
int (*set_os_callouts)(bt_os_callouts_t *callouts);
+
+ /** Read Energy info details - return value indicates BT_STATUS_SUCCESS or BT_STATUS_NOT_READY
+ * Success indicates that the VSC command was sent to controller
+ */
+ int (*read_energy_info)();
} bt_interface_t;
/** TODO: Need to add APIs for Service Discovery, Service authorization and
diff --git a/include/hardware/bt_gatt_client.h b/include/hardware/bt_gatt_client.h
index 64c51ab..2f72d3a 100644
--- a/include/hardware/bt_gatt_client.h
+++ b/include/hardware/bt_gatt_client.h
@@ -170,10 +170,6 @@ typedef void (*scan_filter_param_callback)(int action, int client_if, int status
/** Callback invoked when a scan filter configuration command has completed */
typedef void (*scan_filter_status_callback)(int enable, int client_if, int status);
-/** Track ADV VSE callback invoked when tracked device is found or lost */
-typedef void (*track_adv_event_callback)(int client_if, int filt_index, int addr_type,
- bt_bdaddr_t* bda, int adv_state);
-
/** Callback invoked when multi-adv enable operation has completed */
typedef void (*multi_adv_enable_callback)(int client_if, int status);
@@ -205,6 +201,9 @@ typedef void (*batchscan_reports_callback)(int client_if, int status, int report
/** Callback invoked when batchscan storage threshold limit is crossed */
typedef void (*batchscan_threshold_callback)(int client_if);
+/** Track ADV VSE callback invoked when tracked device is found or lost */
+typedef void (*track_adv_event_callback)(int client_if, int filt_index, int addr_type,
+ bt_bdaddr_t* bda, int adv_state);
typedef struct {
register_client_callback register_client_cb;