Android Question OBDII CONNECTION QUESTION

Anastasios Michaelides

Member
Licensed User
Hello to all, I am new to B4A and i want to make a question.
I am trying to make an application to connect with obdii, so far i managed to communicate with cars
ecu to send commands and get response's. My issue is that the response's are in Hex and are containing
for example 6 bytes(41 05 5A), from that bytes the first 4 (41 05) are not usable. The bytes after first 4 are containing the answer information(5A).
Is there a way to get from every response the bytes after the first 4 and convert them to decimal ?
Thank you in advance.
 

raphaelcno

Active Member
Licensed User
I understand that you have converted "41055A" to a string since you talk about 6 bytes and not 3.
Then you can use this kind of code:
B4X:
Dim S As String = "41055A"
If S.Length >= 6 Then  ' Condition to avoid error when using SubString2(4, 6)
    Dim S2 As String = S.SubString2(4, 6)  ' => S2 = "5A".
    Dim I As Int = Bit.ParseInt(S2, 16)  ' => I = 90 (= 0x5A)
End If
Help > Bit > ParseInt:
http://www.b4x.com/android/help/core.html#bit_parseint
 
Top