PC SOFT

GRUPOS DE DISCUSSÃO PROFISSIONAL
WINDEVWEBDEV e WINDEV Mobile

Inicio → WINDEV Mobile 2024 → BTActivate(True)
BTActivate(True)
Iniciado por Werner, jan., 10 2020 10:50 PM - 5 respostas
Membro registado
10 mensagems
Publicado em janeiro, 10 2020 - 10:50 PM
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
Membro registado
10 mensagems
Publicado em janeiro, 13 2020 - 2:09 PM
Nobody has an idea?

--
Thanks,

Werner
Membro registado
247 mensagems
Publicado em janeiro, 13 2020 - 2:25 PM
Hi
Why do you use switch on nBluetooth ??
You should use SWITCH BTStatus() instead
(However, sorry if I made mistakes , I'm French ^_^)
Membro registado
10 mensagems
Publicado em janeiro, 13 2020 - 3:21 PM
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
Membro registado
247 mensagems
Publicado em janeiro, 13 2020 - 3:35 PM
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
Membro registado
10 mensagems
Publicado em janeiro, 13 2020 - 5:01 PM
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