I have a weird issue that I am having a difficult time narrowing down. It doesnt do this all the time, only once in awhile. Otherwise it works fine.
Occasionally, my bluetooth adapter will sometimes repeat back to the droid device of what I sent out if the BT connection drops or caches the sent data. Why I dunno, but it does.
When this happens, it causes a crash of this:
That is were debug hangs up at.
Here is what I have during the crash: ( i have to type manually, IDE doenst give me an option to copy out of these boxes which sucks)
under local variables, I have:
Buffer [0=33, 1=3, 2=1, 3=-1, 4=7, 5=-37, 6=0, 7=0
LastException: java.lang.NumberFormatException: Invalid double: "�"
Gives me some funny diamond character on the exception, Well, if you look at buffer, its actually "21 03 01 FF 07 DB" in HEX which is the previous command I had sent during a last session. It got bounced back at me by the BT adapter, or some type of caching.
Every time it does, it craps out the app with the above exception.
any ideas?
Occasionally, my bluetooth adapter will sometimes repeat back to the droid device of what I sent out if the BT connection drops or caches the sent data. Why I dunno, but it does.
When this happens, it causes a crash of this:
B4X:
Sub AStream_NewData (Buffer() As Byte) 'Serial Receive interrupt routine
If RxEnabled = False Then
Return
End If
RxPacket = RxPacket & BytesToString(Buffer, 0, Buffer.Length, "UTF8")
'Since we arnt using Prefix mode, The entire packet may not have arrived when this event is triggered.
'Since we are doing length and checksummed packets, We test for a valid packet and length before releasing the packet.
If Len(RxPacket) > 4 Then
PacketLength = Len(RxPacket) / 2 'Length of packet
'***************************************************************
> TestLength = HexString(Mid(RxPacket, 3, 2)) 'Send Length byte <error location
'**************************************************************
TestLength = TestLength + 4 'Include header byte, Length byte, checksum byte, and character return (AVR Print) as part of the length. Ensure full data packet recpetion.
If TestLength = PacketLength Then
RxHandler
RxPacket = ""
End If
End If
'if the start of the packet doesnt have the correct header, just throw it away until we do.
If Left(RxPacket, 1) <> "1" Then
RxPacket = ""
End If
Return
End Sub
That is were debug hangs up at.
Here is what I have during the crash: ( i have to type manually, IDE doenst give me an option to copy out of these boxes which sucks)
under local variables, I have:
Buffer [0=33, 1=3, 2=1, 3=-1, 4=7, 5=-37, 6=0, 7=0
LastException: java.lang.NumberFormatException: Invalid double: "�"
Gives me some funny diamond character on the exception, Well, if you look at buffer, its actually "21 03 01 FF 07 DB" in HEX which is the previous command I had sent during a last session. It got bounced back at me by the BT adapter, or some type of caching.
Every time it does, it craps out the app with the above exception.
any ideas?