蓝牙连接成功后,从机如何获取主机下发的数据。
Alvin Chen:
当central 去写特征值时slave 会被通知,具体可看code:
static void SimplePeripheral_processCharValueChangeEvt(uint8_t paramId)
{uint8_t newValue;
switch(paramId){case SIMPLEPROFILE_CHAR1:SimpleProfile_GetParameter(SIMPLEPROFILE_CHAR1, &newValue);
Display_printf(dispHandle, SP_ROW_STATUS_1, 0, "Char 1: %d", (uint16_t)newValue);break;
case SIMPLEPROFILE_CHAR3:SimpleProfile_GetParameter(SIMPLEPROFILE_CHAR3, &newValue);
Display_printf(dispHandle, SP_ROW_STATUS_1, 0, "Char 3: %d", (uint16_t)newValue);break;
default:// should not reach here!break;}
}