indicate need modified
This commit is contained in:
@@ -368,6 +368,9 @@ static void HostTestApp_processAttEvent(gattMsgEvent_t *message) {
|
||||
} else if (method == ATT_HANDLE_VALUE_NOTI) {
|
||||
attHandleValueNoti_t *att_notify = (attHandleValueNoti_t *)(&message->msg);
|
||||
master_handle_notify(att_notify->len, att_notify->pValue);
|
||||
} else if (method == ATT_HANDLE_VALUE_IND) {
|
||||
attHandleValueInd_t *att_indicate = (attHandleValueInd_t *)(&message->msg);
|
||||
master_handle_notify(att_indicate->len, att_indicate->pValue);
|
||||
}
|
||||
|
||||
// Free message. Needed only for ATT Protocol messages
|
||||
|
||||
+10
@@ -0,0 +1,10 @@
|
||||
@startuml
|
||||
(*) --> "check input"
|
||||
If "input is verbose" then
|
||||
--> [Yes] "turn on verbosity"
|
||||
--> "run command"
|
||||
else
|
||||
--> "run command"
|
||||
Endif
|
||||
-->(*)
|
||||
@enduml
|
||||
+24
-5
@@ -11,6 +11,13 @@ root:
|
||||
glucose.c
|
||||
glucserive.c
|
||||
|
||||
code need modifying:
|
||||
headstage_indicate.h
|
||||
simple_gatt_profile.c : WriteAtterCB -> add case "indication" to support indicate
|
||||
|
||||
sipmle_peripheral.c : find another service callback
|
||||
|
||||
use this website to construct software structure : http://plantuml.com/zh/
|
||||
|
||||
*/
|
||||
|
||||
@@ -29,12 +36,25 @@ static uint8_t headstage_indicate_buffer[BLE_NOT_BUFF_SIZE] = {0};
|
||||
|
||||
/*
|
||||
* send indicate
|
||||
* connHandle -> where to assign this parameter
|
||||
*/
|
||||
|
||||
static bStatus_t headstage_indicate (uint16_t connHandle, attHandleValueInd_t *pInd, uint8_t taskId) {
|
||||
static bStatus_t headstage_indicate(uint16_t connHandle, attHandleValueInd_t *pInd, uint8_t taskId) {
|
||||
uint16_t value = GATTServApp_ReadCharCfg(connHandle, simpleProfileChar4Config);
|
||||
|
||||
if (value & GATT_CLIENT_CFG_INDICATE)
|
||||
{
|
||||
// char4 handle access
|
||||
pInd->handle = simpleProfileAttrTbl[CHAR4_CFG_POS].handle;
|
||||
|
||||
// send the indication.
|
||||
return GATT_Indication(CONNECT_HANDLE, pInd, FALSE, taskId);
|
||||
}
|
||||
// check the meaning of this return value
|
||||
return bleNotReady;
|
||||
}
|
||||
|
||||
|
||||
static void headstage_indicate_send() {
|
||||
uint16_t buffer_size = BLE_NOT_BUFF_SIZE;
|
||||
attHandleValueInd_t ind_dataRsp;
|
||||
@@ -42,12 +62,11 @@ static void headstage_indicate_send() {
|
||||
|
||||
if (ind_dataRsp.pValue != NULL)
|
||||
{
|
||||
memcpy(ind_dataRsp.value, headstage_notify_buffer, buffer_size);
|
||||
if(headstage_indicate(connHandle, &ind_dataRsp, self)) {
|
||||
memcpy(ind_dataRsp.pValue, headstage_notify_buffer, buffer_size);
|
||||
if(headstage_indicate(CONNECT_HANDLE, &ind_dataRsp, self) != SUCCESS) {
|
||||
GATT_bm_free((gattMsg_t *)&ind_dataRsp, ATT_HANDLE_VALUE_IND);
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
#endif
|
||||
#endif
|
||||
|
||||
+1
-1
@@ -66,7 +66,7 @@ static void headstage_notify_send() {
|
||||
}
|
||||
|
||||
#else
|
||||
SimpleProfile_SetParameter(BLE_NOT_BUFF_CHAR, BLE_NOT_BUFF_SIZE, headstage_notify_buffer);
|
||||
SimpleProfile_SetParameter(BLE_NOT_BUFF_CHAR, BLE_NOT_BUFF_SIZE, headstage_notify_buffer) ;
|
||||
|
||||
#endif
|
||||
}
|
||||
|
||||
+1
-2
@@ -29,12 +29,11 @@
|
||||
|
||||
#include "population.h"
|
||||
#include "headstage_arm.h"
|
||||
#include "headstage_notify.h"
|
||||
#include "headstage_debug.h"
|
||||
#include "headstage_pin.h"
|
||||
#include "headstage_led.h"
|
||||
#include "headstage_arm.h"
|
||||
#include "headstage_watchdog.h"
|
||||
#include "headstage_notify.h"
|
||||
#include "tni/headstage_notify.h"
|
||||
#include "uni/headstage_spi.h"
|
||||
#include "uni/headstage_pwm.h"
|
||||
|
||||
+2
@@ -680,6 +680,8 @@ static uint8_t SimpleBLEPeripheral_processGATTMsg(gattMsgEvent_t *message) {
|
||||
headstage_debug_buffer[10] = 0xff;
|
||||
headstage_set_debug_information();
|
||||
// headstage_data_length_extension();
|
||||
} else if (message->method == ATT_HANDLE_VALUE_CFM) {
|
||||
headstage_led_spi_color(COLOR_WHITE);
|
||||
}
|
||||
|
||||
// Free message payload. Needed only for ATT Protocol messages
|
||||
|
||||
+1
-1
@@ -542,7 +542,7 @@ static bStatus_t simpleProfile_WriteAttrCB(uint16_t connHandle, //
|
||||
|
||||
break;
|
||||
case GATT_CLIENT_CHAR_CFG_UUID:
|
||||
status = GATTServApp_ProcessCCCWriteReq(connHandle, pAttr, pValue, len, offset, GATT_CLIENT_CFG_NOTIFY);
|
||||
status = GATTServApp_ProcessCCCWriteReq(connHandle, pAttr, pValue, len, offset, GATT_CLIENT_CFG_NOTIFY | GATT_CLIENT_CFG_INDICATE);
|
||||
break;
|
||||
|
||||
default:
|
||||
|
||||
@@ -67,6 +67,8 @@ extern "C" {
|
||||
#define SIMPLEPROFILE_CHAR4 3 // RW uint8 - Profile Characteristic 4 value
|
||||
#define SIMPLEPROFILE_CHAR5 4 // RW uint8 - Profile Characteristic 4 value
|
||||
|
||||
|
||||
|
||||
// Simple Profile Service UUID
|
||||
#define SIMPLEPROFILE_SERV_UUID 0xFFF0
|
||||
|
||||
|
||||
Reference in New Issue
Block a user