diff options
author | Priti Aghera <paghera@broadcom.com> | 2012-04-09 22:39:41 -0700 |
---|---|---|
committer | Matthew Xie <mattx@google.com> | 2012-07-14 11:19:15 -0700 |
commit | 9ec880cfeeb929342357b63f99e971d8e10ba2ff (patch) | |
tree | d2715a916ab97d9074589f823e35840c0d7bc52d /bta | |
parent | a5c380dbe1419e077bf6a3a8a30359ce74958350 (diff) | |
download | external_bluetooth_bluedroid-9ec880cfeeb929342357b63f99e971d8e10ba2ff.zip external_bluetooth_bluedroid-9ec880cfeeb929342357b63f99e971d8e10ba2ff.tar.gz external_bluetooth_bluedroid-9ec880cfeeb929342357b63f99e971d8e10ba2ff.tar.bz2 |
HID-PTS:Support for Hid Pts tests
Change-Id: I18cedbcee1d592faa76ab1859facaabf24d52b37
Diffstat (limited to 'bta')
-rwxr-xr-x[-rw-r--r--] | bta/hh/bta_hh_act.c | 27 | ||||
-rwxr-xr-x[-rw-r--r--] | bta/hh/bta_hh_api.c | 34 | ||||
-rwxr-xr-x[-rw-r--r--] | bta/include/bta_hh_api.h | 9 |
3 files changed, 47 insertions, 23 deletions
diff --git a/bta/hh/bta_hh_act.c b/bta/hh/bta_hh_act.c index 483e79c..163597e 100644..100755 --- a/bta/hh/bta_hh_act.c +++ b/bta/hh/bta_hh_act.c @@ -621,6 +621,7 @@ void bta_hh_handsk_act(tBTA_HH_DEV_CB *p_cb, tBTA_HH_DATA * p_data) hs_data.rsp_data.proto_mode = BTA_HH_PROTO_UNKNOWN; /* fall through */ case BTA_HH_GET_RPT_EVT: + case BTA_HH_GET_IDLE_EVT : hs_data.handle = p_cb->hid_handle; /* if handshake gives an OK code for these transaction, fill in UNSUPT */ if ((hs_data.status = bta_hh_get_trans_status(p_data->hid_cback.data)) == BTA_HH_OK) @@ -633,6 +634,7 @@ void bta_hh_handsk_act(tBTA_HH_DEV_CB *p_cb, tBTA_HH_DATA * p_data) /* acknoledgement from HID device for SET_ transaction */ case BTA_HH_SET_RPT_EVT: case BTA_HH_SET_PROTO_EVT: + case BTA_HH_SET_IDLE_EVT : cback_data.handle = p_cb->hid_handle; cback_data.status = bta_hh_get_trans_status(p_data->hid_cback.data); (* bta_hh_cb.p_cback)(p_cb->w4_evt, (tBTA_HH *)&cback_data); @@ -659,7 +661,6 @@ void bta_hh_handsk_act(tBTA_HH_DEV_CB *p_cb, tBTA_HH_DATA * p_data) /* transaction achknoledgement received, inform PM for mode change */ bta_sys_idle(BTA_ID_HH, p_cb->app_id, p_cb->addr); - return; } /******************************************************************************* @@ -687,13 +688,16 @@ void bta_hh_ctrl_dat_act(tBTA_HH_DEV_CB *p_cb, tBTA_HH_DATA * p_data) switch (p_cb->w4_evt) { + case BTA_HH_GET_IDLE_EVT: + hs_data.rsp_data.idle_rate = *data; + break; case BTA_HH_GET_RPT_EVT: hs_data.rsp_data.p_rpt_data = pdata; break; case BTA_HH_GET_PROTO_EVT: /* match up BTE/BTA report/boot mode def*/ hs_data.rsp_data.proto_mode = ((*data) == HID_PAR_PROTOCOL_REPORT)? \ - BTA_HH_PROTO_RPT_MODE : BTA_HH_PROTO_BOOT_MODE; + BTA_HH_PROTO_RPT_MODE : BTA_HH_PROTO_BOOT_MODE; #if BTA_HH_DEBUG APPL_TRACE_DEBUG1("GET_PROTOCOL Mode = [%s]", (hs_data.rsp_data.proto_mode == BTA_HH_PROTO_RPT_MODE)? "Report" : "Boot"); @@ -704,6 +708,8 @@ void bta_hh_ctrl_dat_act(tBTA_HH_DEV_CB *p_cb, tBTA_HH_DATA * p_data) /* fall through */ case BTA_HH_SET_RPT_EVT: /* fall through */ + case BTA_HH_SET_IDLE_EVT : + /* fall through */ default: #if BTA_HH_DEBUG APPL_TRACE_DEBUG1("invalid transaction type for DATA payload: 4_evt[%s]", @@ -715,7 +721,7 @@ void bta_hh_ctrl_dat_act(tBTA_HH_DEV_CB *p_cb, tBTA_HH_DATA * p_data) /* inform PM for mode change */ bta_sys_busy(BTA_ID_HH, p_cb->app_id, p_cb->addr); bta_sys_idle(BTA_ID_HH, p_cb->app_id, p_cb->addr); - + (* bta_hh_cb.p_cback)(p_cb->w4_evt, (tBTA_HH *)&hs_data); p_cb->w4_evt = 0; @@ -937,7 +943,7 @@ void bta_hh_write_dev_act(tBTA_HH_DEV_CB *p_cb, tBTA_HH_DATA *p_data) cbdata.status = BTA_HH_ERR; if (p_data->api_sndcmd.t_type != HID_TRANS_CONTROL && - p_data->api_sndcmd.t_type != HID_TRANS_DATA) + p_data->api_sndcmd.t_type != HID_TRANS_DATA) (* bta_hh_cb.p_cback)(event, (tBTA_HH *)&cbdata); else if (p_data->api_sndcmd.param == BTA_HH_CTRL_VIRTUAL_CABLE_UNPLUG) (* bta_hh_cb.p_cback)(BTA_HH_VC_UNPLUG_EVT, (tBTA_HH *)&cbdata); @@ -953,7 +959,11 @@ void bta_hh_write_dev_act(tBTA_HH_DEV_CB *p_cb, tBTA_HH_DATA *p_data) /* fall through */ case HID_TRANS_SET_REPORT: /* fall through */ - case HID_TRANS_GET_PROTOCOL:/* set w4_handsk event name for callback function use */ + case HID_TRANS_GET_PROTOCOL: + /* fall through */ + case HID_TRANS_GET_IDLE: + /* fall through */ + case HID_TRANS_SET_IDLE:/* set w4_handsk event name for callback function use */ p_cb->w4_evt = event; break; case HID_TRANS_DATA: /* output report */ @@ -965,13 +975,6 @@ void bta_hh_write_dev_act(tBTA_HH_DEV_CB *p_cb, tBTA_HH_DATA *p_data) p_cb->vp = TRUE; break; - /* deprecated for HID 1.1, shall not be sent out */ - case HID_TRANS_GET_IDLE: - /* fall through */ - case HID_TRANS_SET_IDLE: - APPL_TRACE_ERROR0("SET_IDLE, GET_IDLE is deprecated in HID 1.1") - break; - /* currently not expected */ case HID_TRANS_DATAC: default: diff --git a/bta/hh/bta_hh_api.c b/bta/hh/bta_hh_api.c index b1af978..c84243d 100644..100755 --- a/bta/hh/bta_hh_api.c +++ b/bta/hh/bta_hh_api.c @@ -231,18 +231,38 @@ void BTA_HhGetProtoMode(UINT8 dev_handle) { bta_hh_snd_write_dev(dev_handle, HID_TRANS_GET_PROTOCOL, 0, 0, 0, NULL); } +/******************************************************************************* +** +** Function BTA_HhSetIdle +** +** Description send SET_IDLE to device. +** +** Returns void +** +*******************************************************************************/ +void BTA_HhSetIdle(UINT8 dev_handle, UINT16 idle_rate) +{ + bta_hh_snd_write_dev(dev_handle, HID_TRANS_SET_IDLE, 0, idle_rate, 0, NULL); +} -// btla-specific ++ -// ATTENTION: -// BTA_HH_GET_IDLE_EVT and BTA_HH_SET_IDLE_EVT had been deprecated in the newer stack -// btla apps will need to be changed accordingly for this -// btla-specific -- - +/******************************************************************************* +** +** Function BTA_HhGetIdle +** +** Description Send a GET_IDLE from HID device. +** +** Returns void +** +*******************************************************************************/ +void BTA_HhGetIdle(UINT8 dev_handle) +{ + bta_hh_snd_write_dev(dev_handle, HID_TRANS_GET_IDLE, 0, 0, 0, NULL); +} /******************************************************************************* ** ** Function BTA_HhSendCtrl ** -** Description Send a control command to HID device. +** Description Send a control command to HID device. ** ** Returns void ** diff --git a/bta/include/bta_hh_api.h b/bta/include/bta_hh_api.h index 11dc35e..41af74c 100644..100755 --- a/bta/include/bta_hh_api.h +++ b/bta/include/bta_hh_api.h @@ -35,11 +35,12 @@ #define BTA_HH_OPEN_EVT 2 /* connection opened */ #define BTA_HH_CLOSE_EVT 3 /* connection closed */ #define BTA_HH_GET_RPT_EVT 4 /* BTA_HhGetReport callback */ -#define BTA_HH_SET_RPT_EVT 5 /* BTA_HhSetReport callback */ +#define BTA_HH_SET_RPT_EVT 5 /* BTA_HhSetReport callback */ #define BTA_HH_GET_PROTO_EVT 6 /* BTA_GetProtoMode callback */ -#define BTA_HH_SET_PROTO_EVT 7 /* BTA_HhSetProtoMode callback */ -/* leave 8, 9 gap due to deprecate of GET_IDLE and SET_IDLE */ -#define BTA_HH_GET_DSCP_EVT 10 /* Get report descripotor */ +#define BTA_HH_SET_PROTO_EVT 7 /* BTA_HhSetProtoMode callback */ +#define BTA_HH_GET_IDLE_EVT 8 /* BTA_HhGetIdle comes callback */ +#define BTA_HH_SET_IDLE_EVT 9 /* BTA_HhSetIdle finish callback */ +#define BTA_HH_GET_DSCP_EVT 10 /* Get report descripotor */ #define BTA_HH_ADD_DEV_EVT 11 /* Add Device callback */ #define BTA_HH_RMV_DEV_EVT 12 /* remove device finished */ #define BTA_HH_VC_UNPLUG_EVT 13 /* virtually unplugged */ |