boolean getDeviceInfo( size_t index, LBTDeviceInfo* dev_info );
boolean getDeviceInfo( size_t index, LBTDeviceInfo* dev_info );
Gets scanned device information.
|
Parameters |
Description |
|
size_t index |
[IN] The device index of the scanned result. |
|
LBTDeviceInfo* dev_info |
[OUT] The acquired device information. |
true: Successful.
false: Failed. Possible causes include unreasonable index number or the device hasn't been scanned before.
#include <LBT.h> #include <LBTClient.h> void setup() { Serial.begin(9600); bool success = LBTClient.begin(); if( !success ) { Serial.println("Cannot begin Bluetooth Client successfully"); // Do nothing. while(true); } else { Serial.println("Bluetooth Client begins successfully"); // start scan, at most scan 15 seconds int num = LBTClient.scan(15); Serial.print("Scanned Device number:"); Serial.println(num); for(int i = 0; i < num; ++i) { LBTDeviceInfo info = {0}; bool success = LBTClient.getDeviceInfo(i, &info); if( success ) { Serial.print("Device"); Serial.println(i); Serial.print(" name:"); Serial.println(info.name); } } } } void loop() { }
LBTClient.h