1
3

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 5 years have passed since last update.

Android 4.4 に HID over GATT が追加されたときのcommit

Last updated at Posted at 2016-09-17

メモです。

AndroidのHID over GATTの実装を理解するために、Android 4.4 KitKat に HID over GATT (HOGP)が追加されたときのcommitを探してみました。

external/bluetooth/bluedroid と frameworks/base と packages/apps/Settings に変更がありました。

ソースコードはbroadcomの人が書いてました。

external/bluetooth/bluedroid

LE: Add support for the HID-over-GATT profile (1/3)
  • bluetoothプロトコルスタックを色々と修正。
  • HID over GATT のために、Device Information Service と Battery Service の Central側を追加。

追加された内部API

bta_hh_api.h

  • BTA_HhUpdateLeScanParam()
    • Update the scan paramteters if connected to a LE hid device as report host.
    • BTA_HH_API_SCPP_UPDATE_EVTを下位に通知

hidh_api.h

  • hid_known_hid_device()
    • This function checks if this device is of type HID Device

srvc_api.h

  • srvc_eng_init()
    • Initializa the GATT Service engine, register a GATT application as for a central service management.
    • GATT_Register()でサービスを登録
  • DIS_SrInit()
    • Initializa the Device Information Service Server.
    • どこからも呼ばれていない
  • DIS_SrUpdate()
    • Update the DIS server attribute values
    • どこからも呼ばれていない
  • DIS_ReadDISInfo()
    • Read remote device DIS information.
    • dis_gatt_c_read_dis_req()で読む
  • Battery_Instantiate()
    • Instantiate a Battery service
    • GATTS_CreateService()
    • GATTS_AddCharDescriptor()
    • GATTS_StartService()
  • Battery_Rsp()
    • Respond to a battery service request
    • 引数eventに応じて、srvc_sr_rsp()で応答する
  • Battery_Notify()
    • Send battery level notification
    • srvc_sr_notify()

srvc_batter_int.h

  • battery_valid_handle_range()
    • validate a handle to be a battery attribute handle or not.
  • battery_s_write_attr_value()
    • Process write DIS attribute request.
  • battery_s_read_attr_value()
    • Process read attribute request.

srvc_dis_int.h

  • dis_valid_handle_range()
    • validate a handle to be a DIS attribute handle or not.
  • dis_read_attr_value()
    • Process read DIS attribute request.
  • dis_write_attr_value()
    • Process write DIS attribute request.
  • dis_c_cmpl_cback()
    • Client read DIS database complete callback.

srvc_eng_int.h

  • srvc_eng_find_clcb_by_conn_id()
    • The function searches all LCBs with macthing connection ID.
  • srvc_eng_find_clcb_by_bd_addr()
    • The function searches all LCBs with macthing bd address.
  • srvc_eng_find_conn_id_by_bd_addr()
    • The function searches all LCB with macthing bd address
  • srvc_eng_release_channel()
    • Client operation complete callback.
  • srvc_eng_request_channel()
    • Client operation complete callback.
  • srvc_sr_rsp()
    • sever response
  • srvc_sr_notify()
    • send notification

frameworks/base

LE: Add support for the HID-over-GATT profile (2/3)
  • HogpのUUIDを追加

packages/apps/Settings

LE: Add support for the HID-over-GATT profile (3/3)
  • SettingsにHogpのUUIDをチェックする処理を追加し、HOGPのデバイスを選べるようにした。
1
3
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
1
3

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?