attempt to support all function
This commit is contained in:
+49
-63
@@ -283,70 +283,56 @@ static void mem_connect_device() {
|
||||
|
||||
static void mem_send_ins(uint16_t handle, uint8_t *value){
|
||||
|
||||
uint8_t len = 0;
|
||||
if (handle == BLE_CHAR2_HANDLE){
|
||||
len = BLE_CDR_SAMLL_SIZE;
|
||||
if (state == BLE_STATE_CONNECTED &&
|
||||
charHdl != 0 &&
|
||||
procedureInProgress == FALSE)
|
||||
{
|
||||
uint8_t status;
|
||||
|
||||
// Do a read or write as long as no other read or write is in progress
|
||||
// Do a write
|
||||
attWriteReq_t req;
|
||||
req.pValue = GATT_bm_alloc(connHandle, ATT_WRITE_REQ, 2, NULL);
|
||||
if ( req.pValue != NULL )
|
||||
{
|
||||
// enable notify
|
||||
req.handle = handle;
|
||||
if (handle == BLE_CHAR2_HANDLE){
|
||||
req.len = BLE_CDR_SAMLL_SIZE;
|
||||
}
|
||||
else if(handle == BLE_CHAR3_HANDLE){
|
||||
req.len = 20;
|
||||
}
|
||||
else if(handle == BLE_CHAR4_CONFIG_HANDLE){
|
||||
req.len = 2;
|
||||
}
|
||||
else{
|
||||
status = bleMemAllocError;
|
||||
return;
|
||||
}
|
||||
|
||||
for(int i=0 ; i < req.len ; i++){
|
||||
req.pValue[i] = *(value+i);
|
||||
}
|
||||
req.sig = 0;
|
||||
req.cmd = 0;
|
||||
|
||||
status = GATT_WriteCharValue(connHandle, &req, selfEntity);
|
||||
if ( status != SUCCESS )
|
||||
{
|
||||
GATT_bm_free((gattMsg_t *)&req, ATT_WRITE_REQ);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
status = bleMemAllocError;
|
||||
}
|
||||
|
||||
if (status == SUCCESS)
|
||||
{
|
||||
procedureInProgress = TRUE;
|
||||
}
|
||||
}
|
||||
else if(handle == BLE_CHAR3_HANDLE){
|
||||
len = 20;
|
||||
}
|
||||
else if(handle == BLE_CHAR4_CONFIG_HANDLE){
|
||||
len = 2;
|
||||
}
|
||||
else{
|
||||
return;
|
||||
}
|
||||
UART_write(uart_handle, value, len);
|
||||
// if (state == BLE_STATE_CONNECTED &&
|
||||
// charHdl != 0 &&
|
||||
// procedureInProgress == FALSE)
|
||||
// {
|
||||
// uint8_t status;
|
||||
//
|
||||
// // Do a read or write as long as no other read or write is in progress
|
||||
// // Do a write
|
||||
// attWriteReq_t req;
|
||||
// req.pValue = GATT_bm_alloc(connHandle, ATT_WRITE_REQ, 2, NULL);
|
||||
// if ( req.pValue != NULL )
|
||||
// {
|
||||
// // enable notify
|
||||
// req.handle = handle;
|
||||
// if (handle == BLE_CHAR2_HANDLE){
|
||||
// req.len = BLE_CDR_SAMLL_SIZE;
|
||||
// }
|
||||
// else if(handle == BLE_CHAR3_HANDLE){
|
||||
// req.len = 20;
|
||||
// }
|
||||
// else if(handle == BLE_CHAR4_CONFIG_HANDLE){
|
||||
// req.len = 2;
|
||||
// }
|
||||
// else{
|
||||
// status = bleMemAllocError;
|
||||
// return;
|
||||
// }
|
||||
//
|
||||
// for(int i=0 ; i < req.len ; i++){
|
||||
// req.pValue[i] = *(value+i);
|
||||
// }
|
||||
// req.sig = 0;
|
||||
// req.cmd = 0;
|
||||
//
|
||||
// status = GATT_WriteCharValue(connHandle, &req, selfEntity);
|
||||
// if ( status != SUCCESS )
|
||||
// {
|
||||
// GATT_bm_free((gattMsg_t *)&req, ATT_WRITE_REQ);
|
||||
// }
|
||||
// }
|
||||
// else
|
||||
// {
|
||||
// status = bleMemAllocError;
|
||||
// }
|
||||
//
|
||||
// if (status == SUCCESS)
|
||||
// {
|
||||
// procedureInProgress = TRUE;
|
||||
// }
|
||||
// }
|
||||
}
|
||||
|
||||
static void mem_read_data_and_return(){
|
||||
|
||||
+3
-3
@@ -5,12 +5,12 @@
|
||||
#define VERSION_DATE_YEAR 20
|
||||
#define VERSION_DATE_MONTH 7
|
||||
#define VERSION_DATE_DAY 31
|
||||
#define VERSION_DATE_HOUR 16
|
||||
#define VERSION_DATE_MINUTE 17
|
||||
#define VERSION_DATE_HOUR 17
|
||||
#define VERSION_DATE_MINUTE 12
|
||||
|
||||
// this is NOT the version hash !!
|
||||
// it's the last version hash
|
||||
#define VERSION_HASH 4a3cdfb476cd2d4d0942e318e0b729041f2ec0ff
|
||||
#define VERSION_HASH b818a0d4f4a82bd2f2ad0401510694e9f4b70d83
|
||||
#define VERSION_GIT_BRANCH simple_central_ma_pin
|
||||
|
||||
#endif
|
||||
|
||||
Reference in New Issue
Block a user