attempt to read CIS

This commit is contained in:
weiting2
2020-08-05 10:09:17 +08:00
parent 649c1855fa
commit 535af75e5b
2 changed files with 12 additions and 16 deletions
@@ -30,7 +30,7 @@ static void mem_recv_ins();
static void mem_connect_device();
static void mem_send_ins(uint16_t hadnle, uint8_t *value);
static void mem_read_data_and_return();
static void mem_central_get_cis();
static void mem_central_get_cis(uint8_t handle);
static void MemBoard_init(void){
mem_UART_init();
@@ -242,6 +242,9 @@ static void mem_recv_ins(){
}
case INS_READ:{
if(state == BLE_STATE_CONNECTED){
mem_central_get_cis(UART_rxBuf[1]);
}
break;
}
@@ -296,7 +299,7 @@ static void mem_send_ins(uint16_t handle, uint8_t *value){
charHdl != 0 &&
procedureInProgress == FALSE)
{
uint8_t status, wait_for_response = 0;
uint8_t status;
// Do a read or write as long as no other read or write is in progress
// Do a write
@@ -323,10 +326,6 @@ static void mem_send_ins(uint16_t handle, uint8_t *value){
req.pValue = GATT_bm_alloc(connHandle, ATT_WRITE_REQ, req.len, NULL);
if ( req.pValue != NULL )
{
// read CIS later or not
if((*value & 0xF0) == 0x70){
wait_for_response = 1;
}
// send instruction
for(int i=0 ; i < req.len ; i++){
@@ -352,14 +351,11 @@ static void mem_send_ins(uint16_t handle, uint8_t *value){
if (status == SUCCESS)
{
procedureInProgress = TRUE;
if(wait_for_response){
flag_notify(EVT_MEM_GET_CIS);
}
}
}
}
static void mem_central_get_cis(){
static void mem_central_get_cis(uint8_t handle){
// get the actual CIS data from simple_central.c > SimpleBLECentral_processGATTMsg()
if (state == BLE_STATE_CONNECTED &&
charHdl != 0 &&
@@ -369,7 +365,7 @@ static void mem_central_get_cis(){
// send read command
attReadReq_t read_cis_req;
read_cis_req.handle = BLE_CHAR2_HANDLE;
read_cis_req.handle = handle;
status = GATT_ReadCharValue(connHandle, &read_cis_req, selfEntity);
if (status == SUCCESS)
@@ -387,7 +383,7 @@ static void mem_read_data_and_return(){
CIS_data[1] == 0 &&
CIS_data[2] == 0 &&
CIS_data[3] == 0 &&
CIS_data[4] == 0 &&)
CIS_data[4] == 0)
{
flag_notify(EVT_MEM_GET_CIS);
}
@@ -4,13 +4,13 @@
#define VERSION_DATE_YEAR 20
#define VERSION_DATE_MONTH 8
#define VERSION_DATE_DAY 4
#define VERSION_DATE_HOUR 18
#define VERSION_DATE_MINUTE 4
#define VERSION_DATE_DAY 5
#define VERSION_DATE_HOUR 10
#define VERSION_DATE_MINUTE 9
// this is NOT the version hash !!
// it's the last version hash
#define VERSION_HASH 2dbc33f12f5936fbcb6f9bb88970438494d2edcc
#define VERSION_HASH 649c1855fa176247576d429920f0738c0baa3e50
#define VERSION_GIT_BRANCH simple_central_ma_pin
#endif