Skip to content

Commit 473c1c9

Browse files
sgbihueriknyquist
authored andcommitted
Implement central feature
1. Add the auto discover 2. Resolve the connect request was not scheduled issue 3. Implement the read/write request
1 parent 539af2e commit 473c1c9

21 files changed

+1303
-687
lines changed

libraries/BLE/src/BLECallbacks.cpp

+16-1
Original file line numberDiff line numberDiff line change
@@ -111,8 +111,11 @@ uint8_t profile_discover_process(bt_conn_t *conn,
111111
const bt_gatt_attr_t *attr,
112112
bt_gatt_discover_params_t *params)
113113
{
114+
uint8_t ret = BT_GATT_ITER_STOP;
114115
pr_debug(LOG_MODULE_BLE, "%s-%d", __FUNCTION__, __LINE__);
115-
return BLEProfileManager::instance()->discoverResponseProc(conn, attr, params);
116+
ret = BLEProfileManager::instance()->discoverResponseProc(conn, attr, params);
117+
pr_debug(LOG_MODULE_BLE, "%s-%d", __FUNCTION__, __LINE__);
118+
return ret;
116119
}
117120

118121
// GATT Client only
@@ -133,9 +136,21 @@ uint8_t profile_read_rsp_process(bt_conn_t *conn,
133136
chrc = BLEProfileManager::instance()->characteristic(bleDevice, params->single.handle);
134137

135138
chrc->setValue((const unsigned char *)data, length);
139+
pr_debug(LOG_MODULE_BLE, "%s-%d", __FUNCTION__, __LINE__);
136140
return BT_GATT_ITER_STOP;
137141
}
138142

143+
uint8_t profile_service_read_rsp_process(bt_conn_t *conn,
144+
int err,
145+
bt_gatt_read_params_t *params,
146+
const void *data,
147+
uint16_t length)
148+
{
149+
uint8_t ret = BLEProfileManager::instance()->serviceReadRspProc(conn, err, params, data, length);
150+
pr_debug(LOG_MODULE_BLE, "%s-%d:ret-%d", __FUNCTION__, __LINE__, ret);
151+
return ret;
152+
}
153+
139154

140155

141156
void bleConnectEventHandler(bt_conn_t *conn,

libraries/BLE/src/BLECallbacks.h

+6
Original file line numberDiff line numberDiff line change
@@ -49,5 +49,11 @@ void ble_central_device_found(const bt_addr_le_t *addr,
4949
const uint8_t *ad,
5050
uint8_t len);
5151

52+
uint8_t profile_service_read_rsp_process(bt_conn_t *conn,
53+
int err,
54+
bt_gatt_read_params_t *params,
55+
const void *data,
56+
uint16_t length);
57+
5258
#endif
5359

0 commit comments

Comments
 (0)