Discussion in 'Android Questions' started by Anastasios Michaelides, Apr 19, 2015.

  1. Anastasios Michaelides

    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.
  2. raphaelcno

    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:
    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(46)  ' => S2 = "5A".
        Dim I As Int = Bit.ParseInt(S2, 16)  ' => I = 90 (= 0x5A)
    End If
    Help > Bit > ParseInt:
  3. Anastasios Michaelides

    Anastasios Michaelides Member Licensed User

    Thank you for your time I will try your code and I will inform you.
  1. This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
    By continuing to use this site, you are consenting to our use of cookies.
    Dismiss Notice