Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- bool SimpleCentral_doGattWrite(uint8_t index)
- {
- uint8_t charVals[4] = { 0x00, 0x55, 0xAA, 0xFF };
- // 0, 85, 170, 255
- //int writes = 0;
- while(index < 4){
- status_t status;
- attWriteReq_t req;
- req.pValue = GATT_bm_alloc(scConnHandle, ATT_WRITE_REQ, 1, NULL);
- if ( req.pValue != NULL )
- {
- uint8_t connIndex = SimpleCentral_getConnIndex(scConnHandle);
- // connIndex cannot be equal to or greater than MAX_NUM_BLE_CONNS
- SIMPLECENTRAL_ASSERT(connIndex < MAX_NUM_BLE_CONNS);
- req.handle = connList[connIndex].charHandle;
- req.len = 1;
- charVal = charVals[index];
- req.pValue[0] = charVal;
- req.sig = 0;
- req.cmd = 0;
- status = GATT_WriteCharValue(scConnHandle, &req, selfEntity);
- if ( status != SUCCESS )
- {
- GATT_bm_free((gattMsg_t *)&req, ATT_WRITE_REQ);
- }
- }
- Display_printf(dispHandle, SC_ROW_CUR_CONN, 0, "Byte %d ", index);
- // writes++;
- index++;
- Task_sleep(500 * (1000 / Clock_tickPeriod));
- }
- return (true);
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement