I have an Argon setup as a BLE Central connecting with a CSR1010 device setup as a Peripheral. I am able to get the UUID of the Peripheral, then connect to it and fetch two Characteristics by name (by ID doesn’t seem to work). I am trying to write to one of the Characteristics using the BlePeerDevice setValue() function that returns a value of -210 which is not documented. The CSR1010 is not “seeing” the write request or any other event. The characteristic on the CSR1010 is “writable”. Any ideas what this error is?
Some code:
device = BleScanResult; // Which after scanning = CSR1010 advertising device
BlePeerDevice peer;
BleCharacteristic peerRxCharacteristic, peerTxCharacteristic;
// Once scanned and CSR1010 found... //
device.advertisingData.get(BleAdvertisingDataType::SERVICE_UUID_16BIT_COMPLETE, buf, BLE_MAX_ADV_DATA_LEN);
// Produces the UUID sent from the CSR1010 => buf == 0x4921
peer = BLE.connect(device.address);
// This works and confirmed on both Argon and CRS1010
peer.getCharacteristicByDescription(peerRxCharacteristic, "rx");
// This returns TRUE (so looks good)
peer.getCharacteristicByDescription(peerTxCharacteristic, "tx");
// This returns TRUE (also looks good)
According to the example on Particle.io site, to send data:
const uint8_t data[] = "This is a test";
ssize_t e = peerRxCharacteristic.setValue(data, sizeof(data));
// This should send data to CSR1010, but the CSR1010 does not "see" the write or any other even
Serial1.printf("e: %d\r\n", e);
// This prints out e: -210 which is not documented