Syntax
boolean getDeviceInfo(
    size_t index, 
    LBTDeviceInfo* dev_info
);
ContentsIndex
PreviousUpNext
LBTClientClass::getDeviceInfo Method
LBTClientClass Class | Example
Syntax
boolean getDeviceInfo(
    size_t index, 
    LBTDeviceInfo* dev_info
);
Description

Gets scanned device information.

Parameters
Parameters 
Description 
size_t index 
[IN] The device index of the scanned result. 
LBTDeviceInfo* dev_info 
[OUT] The acquired device information. 
Returns

true: Successful. 

false: Failed. Possible causes include unreasonable index number or the device hasn't been scanned before.

Example
#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()
{
  
}
File

LBTClient.h

Class