Class BtaGattQueue

Synopsis

#include <bta/include/bta_gatt_queue.h>

class BtaGattQueue

Description

No description yet.

Structures

gatt_operation

Methods

Clean
ReadCharacteristic
ReadDescriptor
WriteCharacteristic
WriteDescriptor

Source

Lines 35-78 in bta/include/bta_gatt_queue.h.

class BtaGattQueue {
 public:
  static void Clean(uint16_t conn_id);
  static void ReadCharacteristic(uint16_t conn_id, uint16_t handle,
                                 GATT_READ_OP_CB cb, void* cb_data);
  static void ReadDescriptor(uint16_t conn_id, uint16_t handle,
                             GATT_READ_OP_CB cb, void* cb_data);
  static void WriteCharacteristic(uint16_t conn_id, uint16_t handle,
                                  std::vector<uint8_t> value,
                                  tGATT_WRITE_TYPE write_type,
                                  GATT_WRITE_OP_CB cb, void* cb_data);
  static void WriteDescriptor(uint16_t conn_id, uint16_t handle,
                              std::vector<uint8_t> value,
                              tGATT_WRITE_TYPE write_type, GATT_WRITE_OP_CB cb,
                              void* cb_data);

  /* Holds pending GATT operations */
  struct gatt_operation {
    uint8_t type;
    uint16_t handle;
    GATT_READ_OP_CB read_cb;
    void* read_cb_data;
    GATT_WRITE_OP_CB write_cb;
    void* write_cb_data;

    /* write-specific fields */
    tGATT_WRITE_TYPE write_type;
    std::vector<uint8_t> value;
  };

 private:
  static void mark_as_not_executing(uint16_t conn_id);
  static void gatt_execute_next_op(uint16_t conn_id);
  static void gatt_read_op_finished(uint16_t conn_id, tGATT_STATUS status,
                                    uint16_t handle, uint16_t len,
                                    uint8_t* value, void* data);
  static void gatt_write_op_finished(uint16_t conn_id, tGATT_STATUS status,
                                     uint16_t handle, void* data);

  // maps connection id to operations waiting for execution
  static std::unordered_map<uint16_t, std::list<gatt_operation>> gatt_op_queue;
  // contain connection ids that currently execute operations
  static std::unordered_set<uint16_t> gatt_op_queue_executing;
};





Add Discussion as Guest

Log in to DocsForge