Read Information with Central device?


#1

Hi Guys!

20180530_104324[1]

How can I read that information with my Central device ?
I’m using a BLE Nano V2 as Simple Peripheral and another BLE Nano V2 as Central.
In the Simple scatch I can set this settings but where in the Central can I read this information ?

Thanks for your help!

MootSeeker


#2

So I found where I can read the Data:

image

static void discoveredCharacteristicCallBack(const DiscoveredCharacteristic *chars) {
Serial.println("\r\n----Characteristic Discovered");
Serial.print("Chars UUID type : ");
Serial.println(chars->getUUID().shortOrLong(), HEX);// 0 16bit_uuid, 1 128bit_uuid
Serial.print("Chars UUID : ");
if(chars->getUUID().shortOrLong() == UUID::UUID_TYPE_SHORT) {
Serial.println(chars->getUUID().getShortUUID(), HEX);
if(chars->getUUID().getShortUUID() == 0x2A24) {
Serial.println("Found Device Info “);
characteristic_is_fond = 1;
chars_hrm = *chars;
}
}
else {
uint8_t index;
const uint8_t *uuid = chars->getUUID().getBaseUUID();
for(index=0; index<16; index++) {
Serial.print(uuid[index], HEX);
Serial.print(” “);
}
Serial.println(” ");
}

Serial.print("properties_read : ");
Serial.println(chars->getProperties().read(), DEC);
Serial.print("properties_writeWoResp : ");
Serial.println(chars->getProperties().writeWoResp(), DEC);
Serial.print("properties_write : ");
Serial.println(chars->getProperties().write(), DEC);
Serial.print("properties_notify : ");
Serial.println(chars->getProperties().notify(), DEC);

Serial.print("declHandle : ");
Serial.println(chars->getDeclHandle(), HEX);
Serial.print("valueHandle : ");
Serial.println(chars->getValueHandle(), HEX);
Serial.print("lastHandle : ");
Serial.println(chars->getLastHandle(), HEX);

// uint16_t value = 0x0001;
//ble.gattClient().read(chars->getConnHandle(), chars->getValueHandle(), 0);
//ble.gattClient().write(GattClient::GATT_OP_WRITE_CMD,chars->getConnHandle(),chars->getValueHandle(),2,(uint8_t *)&value);
}

But how I can save the data ?


#3

hi mootseeker,
I provide one way that you can put the device_info into the advising data, and read back through calling back after scanning


#4

Hi @lucian,

thanks for your reply, whats your way to do that ?

Best Regards,
MootSeeker