Android Question Bluetooth

Discussion in 'Android Questions' started by Cenny, Jun 10, 2015.

  1. Cenny

    Cenny Member Licensed User


    Can somebody help me solving my next problem:
    I want to receive a stream of 260 8 bits values in the range from 0-255 from some device via bluetooth.
    Bluetooth is expecting the incoming stream to be of type byte (-128 to 127)
    I was told to use the Byteconverter library, but I have no idea how.

  2. derez

    derez Expert Licensed User

    Dim bc As ByteConverter
    Sbuffer = bc.StringToBytes( data_string ,
    and back:
    Dim st As String
    st = 
    BytesToString(buffer, 0, buffer.Length, "UTF8")
    Erel likes this.
  3. Erel

    Erel Administrator Staff Member Licensed User

    Note that you can also convert a string to bytes with:
    buffer = data_string.GetBytes("UTF8"'this is also possible: "some text".GetBytes("UTF8")
  4. Cenny

    Cenny Member Licensed User

    Thanks for your reaction, but this is all about strings.
    Is there something for numbers as wel?
  5. Erel

    Erel Administrator Staff Member Licensed User

    AStream.Write(Array As Byte(1,22502000xEA)) 'it will work correctly
  6. Cenny

    Cenny Member Licensed User

    Thank you Erel.
  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