iOS Question BLE and wierd situation when device is inactive

fbritop

Well-Known Member
Licensed User
Longtime User
I have got an v.BTTN device (small wearable BLE button)
http://www.vsnmobil.com/products/v-bttn-wearable-bluetooth-le-4-0-device

First of all, this problem does not happens on debug, only on Release App and when the device window is locked, so I cannot get anything from the releaseLogger!

First I start the app, detect the BLE button, connects to it OK, so I register to the notification service and characteristic

B4X:
Dim data() As Byte
                Dim bc As ByteConverter
                'Verificaction code write to device
                data=bc.HexToBytes("80BEF5ACFF")
                BLE.WriteData("FFFFFFF0-00F7-4000-B000-000000000000", "FFFFFFF5-00F7-4000-B000-000000000000", data)
                'set Stelath Mode (NO LED, JUST BEEP)
                data=bc.HexToBytes("02")
                BLE.WriteData("FFFFFFF0-00F7-4000-B000-000000000000", "FFFFFFF1-00F7-4000-B000-000000000000", data)
               
                'Detection Configuration for button press, detect only press and release, no long click detect
                data=bc.HexToBytes("01")
                BLE.WriteData("FFFFFFF0-00F7-4000-B000-000000000000", "FFFFFFF2-00F7-4000-B000-000000000000", data)
                'Set the BLE to notify me when service and characteristc of button press is detected
                BLE.SetNotify("FFFFFFF0-00F7-4000-B000-000000000000", "FFFFFFF4-00F7-4000-B000-000000000000", True)
                'Just reading the battery level
                BLE.ReadData("180F") ', "Battery Level")

Until here everything is fine, if I press the button, the notification arrives OK. But if I press the screen lock button, and then press the BLE button, the button gets disconnected (double beep) and the application crashes.

I have this code upon notification arrival:
B4X:
            If Characteristics.ContainsKey("FFFFFFF4-00F7-4000-B000-000000000000") Then
                Try
                    Dim data() As Byte
                    Try
                        data=Characteristics.Get("FFFFFFF4-00F7-4000-B000-000000000000")
                    Catch
                        Log(LastException.Description)
                    End Try


If I comment "data=Characteristics.Get("FFFFFFF4-00F7-4000-B000-000000000000")" then the application runs fine. Have no clue here where to start.

Has anyone has some experience or experienced something like this?

Thanks FBP
 

fbritop

Well-Known Member
Licensed User
Longtime User
Erel,
The main function of this button is to enable an action when peolple dont have their phone at hand (inside a purse for example). So in that case, we cannot leave the phone without locking the screen, and also I cannot close the connection, as I need it 24/7 arround the button.

Gonna give it a try to make this proyect just with the BLE files in case their are interfiereng with something else
 
Upvote 0

fbritop

Well-Known Member
Licensed User
Longtime User
OK I understand, but why when I comment this line

data=Characteristics.Get("FFFFFFF4-00F7-4000-B000-000000000000")

The application runs fine, as I can see it in the release logger?
 
Upvote 0
Top