IPWorks Bluetooth 2020 C++ Edition

Questions / Feedback?

ListDevices Method

Lists all nearby devices.

Syntax

ANSI (Cross Platform)
char* ListDevices();

Unicode (Windows)
LPWSTR ListDevices();
#define MID_BTINFO_LISTDEVICES 6

IPWORKSBT_EXTERNAL int IPWORKSBT_CALL IPWorksBT_BTInfo_Do(void *lpObj, int methid, int cparam, void *param[], int cbparam[], int64 *lpllVal);

Remarks

This method lists all nearby devices.

After calling this method the DeviceCount property will reflect the number of devices that were found. To find details for each device set DeviceIndex to select a device. Valid values for DeviceIndex are from 0 to DeviceCount -1.

After setting DeviceIndex the following properties will be populated with information about the device:

Information about the devices may also be retrieved from the DeviceInfo event, which will fire once for each device.

Example:

btinfo.ListDevices();
for (int i = 0; i < btinfo.DeviceCount; i++)
{
	btinfo.DeviceIndex = i;	
	
	Console.WriteLine("***********************");
	Console.WriteLine("Device Address: " + btinfo.DeviceAddress);
	Console.WriteLine("Device Authenticated: " + btinfo.DeviceAuthenticated);
	Console.WriteLine("Device Class of Device: " + btinfo.DeviceClassOfDevice);
	Console.WriteLine("Device Connected: " + btinfo.DeviceConnected);
	Console.WriteLine("Device Last Seen: " + btinfo.DeviceLastSeen);
	Console.WriteLine("Device Last Used: " + btinfo.DeviceLastUsed);
	Console.WriteLine("Device Name: " + btinfo.DeviceName);
	Console.WriteLine("Device Remembered: " + btinfo.DeviceRemembered);
}

Error Handling (C++)

This method returns a String value; after it returns, call the GetLastErrorCode() method to obtain its result code; 0 indicates success, while a non-zero error code indicates that this method encountered an error during its execution. If an error occurs, the GetLastError() method can be called to retrieve the associated error message.

Copyright (c) 2021 /n software inc. - All rights reserved.
IPWorks Bluetooth 2020 C++ Edition - Version 20.0 [Build 7941]