PC SOFT

FORUMS PROFESSIONNELS
WINDEVWEBDEV et WINDEV Mobile

Accueil → WINDEV Mobile 2024 → BTActivate(True)
BTActivate(True)
Débuté par Werner, 10 jan. 2020 22:50 - 5 réponses
Membre enregistré
10 messages
Posté le 10 janvier 2020 - 22:50
Hello,

I want check bluetooth-connection with this code:
IF BTStatus() = btDisabled THEN
nBluetooth = BTActivate(True)
SWITCH nBluetooth
CASE btActivationInProgress:
Info("Bluetooth is being enabled on the device.")
CASE btDeactivationInProgress:
Info("Bluetooth is being disabled on the device.")
CASE btDisabled:
Info("Bluetooth is disabled on the device.")
CASE btError:
Info("The activation status of Bluetooth was not retrieved.")
END
END


if BT is deactivated, with BTActivate(True) it will be activate, but the function returns btDisabled.

--
Thanks,

Werner
Membre enregistré
10 messages
Posté le 13 janvier 2020 - 14:09
Nobody has an idea?

--
Thanks,

Werner
Membre enregistré
201 messages
Popularité : +6 (10 votes)
Posté le 13 janvier 2020 - 14:25
Hi
Why do you use switch on nBluetooth ??
You should use SWITCH BTStatus() instead
(However, sorry if I made mistakes , I'm French ^_^)
Membre enregistré
10 messages
Posté le 13 janvier 2020 - 15:21
Hello erbl,

what is wrong with my Code? nBluetooth should have the return value from BTActivate(TRUE). With switch on nBluetooth I only Show a message.
The result of BTActivate should be:
Activation status of Bluetooth after the modification


--
Thanks,

Werner
Membre enregistré
201 messages
Popularité : +6 (10 votes)
Posté le 13 janvier 2020 - 15:35
OK Sorry
BTActive returns btDisabled but it should return btEnabled that's it ?
What returns BTSTatus ?
We don't see all the code, nBluetooth is actualy an Integer ? For now I don't understand why it doesn't work
Membre enregistré
10 messages
Posté le 13 janvier 2020 - 17:01
Here more code;
nBluetooth is int

IF BTStatus() = btDisabled THEN
nBluetooth = BTActivate(True)
SWITCH nBluetooth
CASE btActivationInProgress:
Info("Bluetooth wird gerade aktiviert.")
CASE btDeactivationInProgress:
Info("Bluetooth wird gerade deaktiviert.")
CASE btDisabled:
Info("Bluetooth ist deaktiviert.")
CASE btError:
Info("Der Bluetooth-Status konnte nicht ermittelt werden.")
END
END

IF BTStatus() = btEnabled THEN

why doesn't the indentation work here? I have copied the code directly from Windev Mobile Editor...

BTStatus() returns FALSE but after that Bluetooth is on. I think, activating Bluetooth takes some time? That could be the reason, why BTActivate(True) returns FALSE...

--
Thanks,

Werner