1. 14 Jun, 2016 1 commit
    • Jakub Pawlowski's avatar
      Fix missing GATT Characteristic from last service · 552e6304
      Jakub Pawlowski authored
      GATT Service is contained between start and end handle. If
      characteristic definition is at end handle, and it's value definition is
      after end handle, it will not be properly discovered. That's because we
      use value_handle instead of attribute_handle to identify
      characteristics.
      
      As a workaround, increase service boundary if value is defined after
      it's definition.
      
      Bug: 29253825
      Change-Id: Ib145aea4f5cf38a1fbb977c301136e16f8f900f7
      552e6304
  2. 22 Mar, 2016 2 commits
    • Jakub Pawlowski's avatar
      Use handles to identify GATT attributes (1/4) · 26f8828c
      Jakub Pawlowski authored
      Bug: 27778668
      Change-Id: Id7454450c1ce2164001a1f9ca0b91f18d84e3fd6
      26f8828c
    • Jakub Pawlowski's avatar
      Restructure GATTC · 36b67072
      Jakub Pawlowski authored
      This patch changes how GATTC is structured. Up till now, it
      contained tBTA_GATTC_CACHE and tBTA_GATTC_CACHE_ATTR. Those
      structures were so ugly, someone hide them inside internal
      header, to make sure noone would ever access them from outside
      GATTC. They are now replaced with:
      tBTA_GATTC_SERVICE,
      tBTA_GATTC_CHARACTERISTIC,
      tBTA_GATTC_DESCRIPTOR and
      tBTA_GATTC_INCLUDED_SVC.
      
      Those looks much better, and were made globally avaliable.
      Thanks to way they're build, we no longer need set of access
      methods, which were also very ugly:
      BTA_GATTC_GetFirstChar
      BTA_GATTC_GetNextChar
      BTA_GATTC_GetFirstIncludedService
      etc.
      
      This patch breaks HID, DO NOT SUBMIT without HID refactor.
      
      Bug: 27455533
      Change-Id: Ic42cfff175e0cc1a0d8e1a1216e2b4b756cbf77d
      36b67072
  3. 09 Mar, 2016 4 commits
    • Jakub Pawlowski's avatar
      Remove bta_gattc_id2handle · ac4ee3a4
      Jakub Pawlowski authored
      Now that the instance id is equal to handle, we no longer need this
      mapping function.
      
      Bug: 27455533
      Change-Id: I6760f8fc81460df8520d4ebf1899ed256ce5ad1e
      ac4ee3a4
    • Jakub Pawlowski's avatar
      Use attribute handle instead of id in GATT cache · 29feba05
      Jakub Pawlowski authored
      Currently we generate an id for each GATT attribute. Those ids
      are used to differentiate between attributes that have the same
      UUID. We need to get rid of those ids because it won't work with
      partial GATT database updates due to "service change"
      notifications. Instead, attribute handles, which are unique
      across the whole GATT database will be used.
      
      This is first patch in series to achieve that. It gets rid
      of id generation, and just assigns handle in place of ids inside
      of gatt cache. Upcoming patches will change the GATT cache API
      and eventually get rid of "id" completly.
      
      Bug: 27455533
      Change-Id: I74c10872ecc223329b8ac7fef4085963bf272624
      29feba05
    • Jakub Pawlowski's avatar
      GATT cache storage refactoring · 56658ccb
      Jakub Pawlowski authored
      Currently when storing GATT cache into file, we save it piece
      after piece, max 10 elements at once. This is not necessary,
      we have enough space to just save all at once.
      Also the logic doesn't need to be so complicated - no need
      to state machine for such simple task.
      
      Bug: 27455533
      Change-Id: I82923dbedfb317835e45e13e0ea28151eb524d37
      56658ccb
    • Jakub Pawlowski's avatar
      Simplify UUID handling in GATT cache · 390749a4
      Jakub Pawlowski authored
      Bug: 27455533
      Change-Id: I653b563d3b3c233ffe31b0a35d396a66db363459
      390749a4
  4. 18 Feb, 2016 2 commits
  5. 04 Feb, 2016 1 commit
  6. 29 Jan, 2016 1 commit
    • Jakub Pawlowski's avatar
      Add new HAL method get_gatt_db · 533fdbf4
      Jakub Pawlowski authored
      Currently getting GATT database from HAL requires multiple calls
      and iterating over each element. This is long, unnecessary
      complicated process, error prone process. This patch adds new
      method, get_gatt_db that can be used to grab whole GATT database
      for remote device just in one call.
      
      Change-Id: Ib5d88fbc28d09d5c191e7c0152ca61d6a34f7a81
      533fdbf4
  7. 04 Dec, 2015 1 commit
    • Jakub Pawlowski's avatar
      Fix race condition during simultaneous SDP · 1b3ac367
      Jakub Pawlowski authored
      Right now sdp_conn_id and p_sdp_db are stored in static global
      bta_gattc_cb between call to bta_gattc_sdp_service_disc and
      bta_gattc_sdp_callback. If multiple instances of SDP discovery
      are running simultaneously, they override this field, and free
      same memory multiple times. This patch fixes that by making sure
      sdp_conn_id and p_sdp_db are unique for each SDP discovery.
      
      Bug: 25801255
      Change-Id: I8ec52229e906e6b8748db7504f77e1f4d7006fbe
      1b3ac367
  8. 19 Oct, 2015 2 commits
    • Pavlin Radoslavov's avatar
      GKI cleanup - moved GKI buffer allocation wrappers to OSI · 258c2538
      Pavlin Radoslavov authored
      * Moved the following GKI buffer allocation functions to OSI:
        - GKI_getbuf() -> osi_getbuf()
        - GKI_freebuf() -> osi_freebuf()
        - GKI_get_buf_size() -> osi_get_buf_size()
      
        For now we need the osi_getbuf() / osi_freebuf() allocation wrapper,
        because we need to be able to call osi_get_buf_size() on the allocated
        buffer.
        In the future those should be replaced with osi_malloc() / osi_free().
        Currently, the osi_malloc() buffer size internal allocation tracker
       does not always track the size, hence we need the osi_getbuf() wrapper.
      
      * Replaced GKI_MAX_BUF_SIZE with BT_DEFAULT_BUFFER_SIZE
      
      * Added new file include/bt_common.h that can be usee to include
        few files that should be included alost everywhere (e.g. bt_target.h"
        NOTE: This file might be removed in the future and we should include
        everywhere the right set of header files.
      
      * Removed some of the GKI-related references
      
      * Removed file include/gki_target.h
      
      Change-Id: Ie87830e73143de200746d54235aa99f228a95024
      258c2538
    • Pavlin Radoslavov's avatar
      GKI cleanup - Replaced usage of GKI queue with OSI fixed_queue · 1a3844f9
      Pavlin Radoslavov authored
      * Added new functions to OSI:
        - fixed_queue_init()
        - fixed_queue_length()
        - fixed_queue_try_remove_from_queue()
        - fixed_queue_try_peek_last()
      
      * Renamed fixed_queue_try_peek() to fixed_queue_try_peek_first()
      
      * Replaced usage of GKI queue functions with OSI fixed_queue functions:
        - GKI_init_q() -> fixed_queue_new(SIZE_MAX)
          NOTE: unlike GKI_init_q(), fixed_queue_new() allocates memory /
          state that needs to be released by calling fixed_queue_free()
        - GKI_enqueue() -> fixed_queue_enqueue()
        - GKI_dequeue() -> fixed_queue_try_dequeue()
          NOTE: fixed_queue_try_dequeue() is non-blocking
        - GKI_queue_length() -> fixed_queue_length()
        - GKI_queue_is_empty() -> fixed_queue_is_empty()
        - GKI_getfirst() -> fixed_queue_try_peek_first()
        - GKI_getlast() -> fixed_queue_try_peek_last()
        - GKI_remove_from_queue() -> fixed_queue_try_remove_from_queue()
        - Queue elements iteration.
          In the fixed_queue implementation we have to use the underlying
          list_t mechanism to iterate over the elements.
          OLD:
            p = GKI_getfirst(queue);
            ...
            while ((p = GKI_getnext(p) != NULL) {
               ...
            }
          NEW:
            list_t *list = fixed_queue_get_list(queue);
            for (const list_node_t *node = list_begin(list);
                 node != list_end(list); node = list_next(node)) {
                p = list_node(node);
            }
      
      * Remove initialization of the GKI module, because it is not needed
        anymore
      
      * Removed unused files in GKI:
        gki/common/gki_common.h
        gki/ulinux/gki_int.h
        gki/ulinux/gki_ulinux.c
      
      Change-Id: I3ff9464db75252d6faf7476a9ca67c88e535c51c
      1a3844f9
  9. 06 Oct, 2015 1 commit
    • Pavlin Radoslavov's avatar
      GKI cleanup - moved GKI buffer allocation wrappers to OSI · a11035b5
      Pavlin Radoslavov authored
      * Moved the following GKI buffer allocation functions to OSI:
        - GKI_getbuf() -> osi_getbuf()
        - GKI_freebuf() -> osi_freebuf()
        - GKI_get_buf_size() -> osi_get_buf_size()
      
        For now we need the osi_getbuf() / osi_freebuf() allocation wrapper,
        because we need to be able to call osi_get_buf_size() on the allocated
        buffer.
        In the future those should be replaced with osi_malloc() / osi_free().
        Currently, the osi_malloc() buffer size internal allocation tracker
       does not always track the size, hence we need the osi_getbuf() wrapper.
      
      * Replaced GKI_MAX_BUF_SIZE with BT_DEFAULT_BUFFER_SIZE
      
      * Added new file include/bt_common.h that can be usee to include
        few files that should be included alost everywhere (e.g. bt_target.h"
        NOTE: This file might be removed in the future and we should include
        everywhere the right set of header files.
      
      * Removed some of the GKI-related references
      
      * Removed file include/gki_target.h
      
      Change-Id: Ie87830e73143de200746d54235aa99f228a95024
      a11035b5
  10. 05 Oct, 2015 1 commit
    • Pavlin Radoslavov's avatar
      GKI cleanup - Replaced usage of GKI queue with OSI fixed_queue · bba583cd
      Pavlin Radoslavov authored
      * Added new functions to OSI:
        - fixed_queue_init()
        - fixed_queue_length()
        - fixed_queue_try_remove_from_queue()
        - fixed_queue_try_peek_last()
      
      * Renamed fixed_queue_try_peek() to fixed_queue_try_peek_first()
      
      * Replaced usage of GKI queue functions with OSI fixed_queue functions:
        - GKI_init_q() -> fixed_queue_new(SIZE_MAX)
          NOTE: unlike GKI_init_q(), fixed_queue_new() allocates memory /
          state that needs to be released by calling fixed_queue_free()
        - GKI_enqueue() -> fixed_queue_enqueue()
        - GKI_dequeue() -> fixed_queue_try_dequeue()
          NOTE: fixed_queue_try_dequeue() is non-blocking
        - GKI_queue_length() -> fixed_queue_length()
        - GKI_queue_is_empty() -> fixed_queue_is_empty()
        - GKI_getfirst() -> fixed_queue_try_peek_first()
        - GKI_getlast() -> fixed_queue_try_peek_last()
        - GKI_remove_from_queue() -> fixed_queue_try_remove_from_queue()
        - Queue elements iteration.
          In the fixed_queue implementation we have to use the underlying
          list_t mechanism to iterate over the elements.
          OLD:
            p = GKI_getfirst(queue);
            ...
            while ((p = GKI_getnext(p) != NULL) {
               ...
            }
          NEW:
            list_t *list = fixed_queue_get_list(queue);
            for (const list_node_t *node = list_begin(list);
                 node != list_end(list); node = list_next(node)) {
                p = list_node(node);
            }
      
      * Remove initialization of the GKI module, because it is not needed
        anymore
      
      * Removed unused files in GKI:
        gki/common/gki_common.h
        gki/ulinux/gki_int.h
        gki/ulinux/gki_ulinux.c
      
      Change-Id: I3ff9464db75252d6faf7476a9ca67c88e535c51c
      bba583cd
  11. 08 Sep, 2014 1 commit
    • Priti Aghera's avatar
      LE: Remove stored link key if encryption fails due to missing key (remote) · d2246b6e
      Priti Aghera authored
      Remove the link key if encryption fails due to missing key or
      authentication error. When a remote device loses the bond, all
      HOGP services cached should be discarded and all client configuration
      descriptors needs to be re-enabled. This will ensure successful
      re-connection.
      
      Bug: 15022622
      Change-Id: Ie1730830c0cbbc294e2cd579d7dca69d16cf8218
      d2246b6e
  12. 10 Jul, 2014 2 commits
    • Nitin Arora's avatar
      Bluetooth: Increase number of allowed notifications · 02d9b7b4
      Nitin Arora authored
      This change increase the maximum number of notifications
      that can be registered for LE remote devices.
      This count is increase from 7 to 15.
      
      Change-Id: I422704e9bae69c48b731757526ed9ee4055aa643
      02d9b7b4
    • Mike J. Chen's avatar
      Fix GKI buffer leak in GATT event handling · 90715aad
      Mike J. Chen authored
      
      The GATT event handler was telling the BTA dispatcher that
      it would always free the GKI msg buffers itself, but in fact
      this wasn't true.  There were some cases where the buffer is
      queued and freed later (queued in p_clcb->p_q_cmd for later
      access and freeing), but many times the event handlers
      (like bta_gattc_ci_save()) don't queue the buffer and don't
      free it, causing a GKI buffer leak.
      
      Also, prevent a double free case (not certain it happens, but
      in theory it could) if bta_gattc_sm_execute() queues a buffer
      in bta_gattc_disc_cmpl().
      
      Lastly, remove held flag since it's redundant with whether
      p_q_cmd is null or not.  Just go with one source of truth and
      not have one shadow the other.
      
      Change-Id: I1bd43919b8a2e125076e26cd6a3a08480b3e7e2d
      Signed-off-by: default avatarMike J. Chen <mjchen@google.com>
      90715aad
  13. 06 May, 2014 1 commit
    • Ganesh Ganapathi Batta's avatar
      Merge BT 4.1 features · 7fa4fba6
      Ganesh Ganapathi Batta authored
      The features include:
      - LE Peripheral Mode
      - Link Layer topology (LE Central & Peripheral Concurrency)
      - Dual Mode Topology (Ability to choose LE transport when connecting with
      other Dual Mode devices)
      - Fast advertising Interval
      - Limited Discovery Time Changes
      - GAP Authentication and Lost Bond
      - Dual Mode Addressing
      - Common Profile and Service Error Code
      - 32 bit UUIDs
      
      Change-Id: Ic6701da4cf6aaa390ff2c8816b43157f36b7fb42
      
      Conflicts:
      	stack/btu/btu_hcif.c
      7fa4fba6
  14. 30 Apr, 2014 1 commit
    • Ganesh Ganapathi Batta's avatar
      Merge BT 4.1 features · 8fe58875
      Ganesh Ganapathi Batta authored
      The features include:
      - LE Peripheral Mode
      - Link Layer topology (LE Central & Peripheral Concurrency)
      - Dual Mode Topology (Ability to choose LE transport when connecting with
      other Dual Mode devices)
      - Fast advertising Interval
      - Limited Discovery Time Changes
      - GAP Authentication and Lost Bond
      - Dual Mode Addressing
      - Common Profile and Service Error Code
      - 32 bit UUIDs
      
      Change-Id: Ic6701da4cf6aaa390ff2c8816b43157f36b7fb42
      8fe58875
  15. 16 Apr, 2014 1 commit
  16. 01 Apr, 2014 1 commit
  17. 26 Mar, 2014 1 commit
  18. 19 Mar, 2014 1 commit
  19. 14 Mar, 2014 1 commit
  20. 08 Mar, 2014 1 commit
    • Zhihai Xu's avatar
      DO NOT MERGE BLE HID device connection failure due to security error. · b9912730
      Zhihai Xu authored
      When HID BLE device start encryption, if some other GATT application
      already start encryption(but not finished yet) by calling
      gatt_security_check_start. The HID BLE device will be failed to start
      encryption, which will cause it to disconnect the BLE HID connection.
      The solution is to check whether we already started the encryption
      , If the encryption is already started, wait until the encryption
      finished, then continue to start security check for BLE HID device.
      add encrytion complete event to notify all GATT client encryption done.
      filter the event just for BTA HH LE GATT client.
      
      bug:11636246
      Change-Id: If58e57c623cc8cfa05208587b010bec68c71306c
      b9912730
  21. 11 Dec, 2013 1 commit
    • Zhihai Xu's avatar
      BLE HID device connection failure due to security error. · 7051db3a
      Zhihai Xu authored
      When HID BLE device start encryption, if some other GATT application
      already start encryption(but not finished yet) by calling
      gatt_security_check_start. The HID BLE device will be failed to start
      encryption, which will cause it to disconnect the BLE HID connection.
      The solution is to check whether we already started the encryption
      , If the encryption is already started, wait until the encryption
      finished, then continue to start security check for BLE HID device.
      add encrytion complete event to notify all GATT client encryption done.
      filter the event just for BTA HH LE GATT client.
      
      bug:11636246
      Change-Id: If58e57c623cc8cfa05208587b010bec68c71306c
      7051db3a
  22. 12 Nov, 2013 1 commit
  23. 14 Aug, 2013 3 commits
    • Andre Eisenbach's avatar
      LE: Add peripheral role support (2/4) · 5c44e454
      Andre Eisenbach authored
      Initial stack support for the LE peripheral role.
      
      Change-Id: I261d751b43b7020760bff345b472b6f60caa60be
      5c44e454
    • Andre Eisenbach's avatar
      LE: UPF 45 bug fixes · 6975b4d7
      Andre Eisenbach authored
      This change fixes the following issues:
      - Second GATT-over-BR/EDR channel cannot be established when there
        already is an existing GATT-over-BR/EDR channel
      - If encryption fails for an LE connection due to a missing key,
        the security state is not being cleared and blocks all further
        security processing
      - When DM discovery of an LE Peripheral device fails with a
        connection timeout, no further discovery requests can be made
      - GATT service discovery can get into endless loop when duplicate descriptor
        definitions are found on the remote device
      - When GATT over BR/EDR fails, BTA does not give a connection
        callback to the application initiating the connection
      - BR/EDR connection to remote platform does not generate API callbacks
      - Stack crash discovered during UPF after remote disconnects
      - The host is sending HCI disconnect to invalid HCI handle when
        SMP fails because of a connection timeout
      - Possible race condition:
        If a disconnect is immediately followed by a connection complete,
        the connection complete cannot be processed in the BTA GATT state
        machine
      - Write Complete event is not triggered for Prepare Write requests
      
      Change-Id: I539cdedd68007818ff4f0d0213cee1c913f72d0f
      
      Conflicts:
      	bta/gatt/bta_gatts_act.c
      6975b4d7
    • Andre Eisenbach's avatar
      LE: Add GATT disable functions · e1202caa
      Andre Eisenbach authored
      This patch adds required disable functions to the GATT sub-system to
      properly unregister with the stack. Without the disable functions in
      place, turning Bluetooth off with a GATT device connected may lead to
      unexpected behaviour and cause GATT to fail on sub-sequent stack
      restarts.
      
      Change-Id: I7cb80e96109e2c09882991298d0487b506f5ffdd
      e1202caa
  24. 04 Apr, 2013 1 commit
  25. 28 Feb, 2013 1 commit
  26. 13 Dec, 2012 1 commit