Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 43758b5c authored by Chris Manton's avatar Chris Manton
Browse files

enum-ify stack/gatt/gatt_int::GATT_CH_STATE

Towards readable code

Bug: 163134718
Tag: #refactor
Test: gd/cert/run --host

Change-Id: Id0f99289b4919211056d6565abe293b0b4eee179
parent 94307684
Loading
Loading
Loading
Loading
+7 −7
Original line number Diff line number Diff line
@@ -230,13 +230,13 @@ typedef struct {
  uint16_t cid;
} tGATT_SR_CMD;

#define GATT_CH_CLOSE 0
#define GATT_CH_CLOSING 1
#define GATT_CH_CONN 2
#define GATT_CH_CFG 3
#define GATT_CH_OPEN 4

typedef uint8_t tGATT_CH_STATE;
typedef enum : uint8_t {
  GATT_CH_CLOSE = 0,
  GATT_CH_CLOSING = 1,
  GATT_CH_CONN = 2,
  GATT_CH_CFG = 3,
  GATT_CH_OPEN = 4,
} tGATT_CH_STATE;

#define GATT_GATT_START_HANDLE 1
#define GATT_GAP_START_HANDLE 20
+1 −1
Original line number Diff line number Diff line
@@ -969,7 +969,7 @@ void gatt_set_ch_state(tGATT_TCB* p_tcb, tGATT_CH_STATE ch_state) {
  if (!p_tcb) return;

  VLOG(1) << __func__ << ": old=" << +p_tcb->ch_state
          << " new=" << loghex(ch_state);
          << " new=" << loghex(static_cast<uint8_t>(ch_state));
  p_tcb->ch_state = ch_state;
}

+1 −1
Original line number Diff line number Diff line
@@ -83,7 +83,7 @@ bool BTM_GetSecurityFlagsByTransport(const RawAddress& bd_addr,
}
void gatt_act_discovery(tGATT_CLCB* p_clcb) {}
bool gatt_disconnect(tGATT_TCB* p_tcb) { return false; }
tGATT_CH_STATE gatt_get_ch_state(tGATT_TCB* p_tcb) { return 0; }
tGATT_CH_STATE gatt_get_ch_state(tGATT_TCB* p_tcb) { return GATT_CH_CLOSE; }
tGATT_STATUS gatts_db_read_attr_value_by_type(
    tGATT_TCB& tcb, uint16_t cid, tGATT_SVC_DB* p_db, uint8_t op_code,
    BT_HDR* p_rsp, uint16_t s_handle, uint16_t e_handle, const Uuid& type,
+1 −1
Original line number Diff line number Diff line
@@ -65,7 +65,7 @@ void gatt_update_app_use_link_flag(tGATT_IF gatt_if, tGATT_TCB* p_tcb,
                                   bool is_add, bool check_acl_link) {}
void gatts_proc_srv_chg_ind_ack(tGATT_TCB) {}
bool gatt_disconnect(tGATT_TCB* p_tcb) { return false; }
tGATT_CH_STATE gatt_get_ch_state(tGATT_TCB* p_tcb) { return 0; }
tGATT_CH_STATE gatt_get_ch_state(tGATT_TCB* p_tcb) { return GATT_CH_CLOSE; }
void gatt_set_ch_state(tGATT_TCB* p_tcb, tGATT_CH_STATE ch_state) {}

/** stack/gatt/gatt_sr.cc */