btGetDeviceAddress (Function)

Top  Previous  Next

Architecture:

X32 / NX32

Device support:

MX2 pro, DX4 pro, AX9 pro, MX2 turbo/encore/warp, AX9 turbo

Firmware version:

1.05


This gets the address of a device found with btSearch.

 

Input:

device : INT

The device number found with btSearch.

 

Returns: STRING

The device address.

Blank if invalid device, library not open, etc.

 

Declaration:

FUNCTION btGetDeviceAddress : STRING;
VAR_INPUT
  device : INT;
END_VAR;

 

 

Example:

INCLUDE rtcu.inc
 
PROGRAM test;
VAR
  rc        : INT;
  i         : INT;
  headsetID : INT;
END_VAR;
 
// Open the Bluetooth library
btOpen(name := "RTCU MX2");
 
BEGIN
  ...
  DebugMsg(message:="Starting search....");
  rc:=btSearch();
  DebugFmt(message:="   btSearch=\1", v1:=rc);
  FOR i:=1 TO rc DO
    DebugMsg(message:="   ("+intToStr(v:=i)+") Addr="+btGetDeviceAddress(device:=i)+" Type="+dintToStr(v:=btGetDeviceType(device:=i))+" name="+btGetDeviceName(device:=i));
    IF btGetDeviceName(device:=i) = "Motorola H300" THEN
        headsetID:=i;
        DebugMsg(message:="   Motorola H300 found at device ->"+intToStr(v:=i));
    END_IF;
  END_FOR;
 
  ...
END;
 
END_PROGRAM;