AYUDA EN LÍNEA
 WINDEVWEBDEV Y WINDEV MOBILE

Este contenido se ha traducido automáticamente.  Haga clic aquí  para ver la versión en inglés.
Ayuda / WLanguage / Funciones WLanguage / Comunicación / Bluetooth
  • Special cases
  • Limitations
  • Required permissions
  • Threads and hourglass
WINDEV
WindowsLinuxJavaReportes y ConsultasCódigo de Usuario (UMC)
WEBDEV
WindowsLinuxPHPWEBDEV - Código Navegador
WINDEV Mobile
AndroidWidget Android iPhone/iPadIOS WidgetApple WatchMac Catalyst
Otros
Procedimientos almacenados
Returns the list of accessible Bluetooth devices.
AndroidWidget Android Caution: Bluetooth functions are not available in the Android emulator.
Ejemplo
sTmpString is string
sListDevices is string
// Returns the list of devices
HourGlass(True)
sListDevices = BTListDevice()
HourGlass(False)
// Clear the Table control where the devices are listed
TableDeleteAll(TABLE_Devices)
// Fills the Table control
IF sListDevices <> "" THEN
	FOR EACH STRING sTmpString OF sListDevices SEPARATED BY CR
		TableAdd(TABLE_Devices, sTmpString)
	END
ELSE
	Info(ErrorInfo(errFullDetails)) 
END
Sintaxis
<Result> = BTListDevice([<Level of details> [, <Type of elements to list> [, <Timeout> [, <Radio identifier>]]]])
<Result>: Character string
  • List of available Bluetooth devices,
  • Empty string ("") if an error occurred. ErrorInfo returns more details about the problem.
This list has the following format:
  • in simple mode:
    <Device Identifier 1> + TAB + <MAC Address 1> + TAB + <Name 1> + CR + ...
    + CR + <Device Identifier N> + TAB + <MAC Address N> + TAB + <Name N>
  • in detailed mode:
    <Device Identifier 1> + TAB + <MAC Address 1> + TAB + <Name 1> + TAB +
    <Class 1 Identifier> + TAB + <Connected 1> + TAB + <Stored 1> + TAB +
    <Authenticated 1> + TAB + <View Date 1> + TAB + <Used Date 1> + CR + ... + CR +
    <Device N Identifier> + TAB + <MAC Address N> + TAB + <Name N> + TAB +
    <Class N Identifier> + TAB + <Connected N> + TAB + <Stored N> + TAB +
    <Authenticated N> + TAB + <View Date N> + TAB + <Date Used N>
The following information is returned:
  • <Identifiant Périphérique> Device identifier, to be used in Bluetooth functions handling devices.
  • <Adresse Mac> Physical address of the device.
  • <Nom>: Name returned by the device (can be an empty string).
  • <Identifiant Classe> Device class (integer out of 32 to obtain information on device type). This class can correspond to one of the following constants:
    • btCoD_NetworkAccess
    • btCoD_AudioVideo
    • btCoD_pers
    • btCoD_Imaging
    • btCoD_Unknown
    • btCoD_Toy
    • btCoD_Computer
    • btCoD_Device
    • btCoD_Phone
    • btCoD_Wearable
  • <Connecté>: 1 if the device is currently "connected" to the current station, 0 otherwise..
    AndroidWidget Android This information is not supported and it will always correspond to 0.
  • <Mémorisé>: 1 if the device is currently "memorized" by the Bluetooth manager of the current station, 0 otherwise..
    AndroidWidget Android This information is not supported and it will always correspond to 0.
  • <Authentifié>: 1 if the device is currently authenticated to the current workstation, 0 otherwise..
  • <Date vue> Date and time when the device was last seen by the current workstation. This date is in DDMMYYYYHHMMSS format. This information is supplied for the remembered devices only.
    AndroidWidget Android This information is not supported and it will always correspond to an empty string ("").
  • <Date utilisé> Date and time the device was last used. This date is in DDMMYYYYHHMMSS format. This information is supplied for the remembered devices only.
    AndroidWidget Android This information is not supported and it will always correspond to an empty string ("").
<Level of details>: Optional Integer constant
Level of result details:
btDetailedList<Result> contains the list of devices in detailed mode.
btSimpleList
(Default value)
<Result> contains the list of devices in simple mode.
<Type of elements to list>: Optional Integer constant (or combination of constants)
Status of the devices to select:
btStatusAll
(Default value)
Proposes all the devices.
btStatusAuthenticatedProposes the authenticated devices.
btStatusConnectedProposes the connected devices.
AndroidWidget Android This constant is not available.
btStatusRememberedProposes the remembered devices.
AndroidWidget Android This constant is not available.
btStatusUnknownProposes the unknown devices.
<Timeout>: Optional integer
Timeout in seconds (between 1 and 60) when searching for devices.
This parameter is set to 10 by default.
<Radio identifier>: Optional integer
Identifier of Bluetooth radio to use. This identifier is returned by BTListRadio.
AndroidWidget Android This parameter is not supported and it will be ignored if it is specified.
Observaciones

Special cases

  • An authenticated device is necessarily remembered (and not the other way around).
  • The devices are listed by interrogating the environment until the <Timeout> of the function. In this interval of time, the devices may not have sufficient time to communicate their identity. Then, all you have to do is use BTInfoDevice to get the missing information.

Limitations

  • Windows This version only supports Microsoft, Bluesoleil and Broadcom (Widcomm) bluetooth stacks. Broadcom (Widcomm) stacks are not available in 64-bit mode.
  • To know the stack used, call BTStack.
  • For more details, see Which stacks to use?
AndroidWidget Android

Required permissions

This function changes the permissions required by the application.
Required permissions:
  • BLUETOOTH: this permission allows applications to connect to Bluetooth services.
  • BLUETOOTH_ADMIN: this permission enables applications to discover and connect Bluetooth devices.
  • ACCESS_FINE_LOCATION: this permission allows an application to access an undefined location (Cell-ID, WiFi).
Android 11 specific case: This function requires the ACCESS_BACKGROUND_LOCATION permission to access the device's location.
This permission allows using the function when the application is in the background.
If the application needs to use background location:
  • Manually add the "ACCESS_BACKGROUND_LOCATION" permission in the Android application generation wizard.
  • Explicitly request background location permission with PermissionRequest. For example:
    PermissionRequest(permBackgroundLocation, Callback)
    INTERNAL PROCEDURE Callback(p is Permission)
    	IF p.Granted THEN
    		// Functions that require background location access can be used
    	END
    END
A window allows users to:
  • allow access to the device location while the application is in the background,
  • allow access to the location only while the application is in use,
  • deny access to the location. The user can also change these permissions at any time in the Android settings.

Remarks:
  • Follow Google's guidelines for applications that require background location access. For more details, see https://support.google.com/googleplay/android-developer/answer/9799150. If these conditions are not met (especially user information requirements), applications may not be accepted for publication on Google Play.
  • The background location permission should only be requested if the location permission has been granted. Otherwise, PermissionRequest will fail.
  • If the option chosen by the user for the background location access request is more restrictive than the option chosen for the location access request, the application will be automatically restarted.
  • On devices running Android 10 or earlier, if location permission has been granted to the application, the background location permission will be granted without displaying a window.
AndroidWidget Android

Threads and hourglass

If the function is run by the main thread of the application, an hourglass (infinite progress bar) will be displayed during the detection of bluetooth devices.
To specify the message that will be displayed in the hourglass, use NextTitle before the call to BTListDevice.
Componente: wd300com.dll
Versión mínima requerida
  • Versión 12
Esta página también está disponible para…
Comentarios
Haga clic en [Agregar] para publicar un comentario

Última modificación: 25/03/2025

Señalar un error o enviar una sugerencia | Ayuda local