Android Question USING EMBEDDED RS232 SERIAL PORT

Discussion in 'Android Questions' started by Sganga61, Jul 17, 2017.

  1. Sganga61

    Sganga61 Member Licensed User

    Hi
    I need to add code to my application to use the embedded serial port (RS232) of my industrial tablet using B4A.
    Following some examples found on the forum I add this simple code:

    (in the global)
    Dim SerialPort As AsyncStreams

    (in start activity)
    fo = File.OpenOutput("","/dev/ttyS0", False) '********
    fi = File.OpenInput("","/dev/ttyS0")
    SerialPort.Initialize(fi,fo,"astreams")

    (then in the code)
    Sub astreams_NewData (Buffer() As Byte)
    Log(BytesToString(Buffer, 0, Buffer.Length, "UTF8"))
    End Sub

    Sub STESTn_Click
    File.WriteString("/dev/ttyS0", "","serial comm test" & CRLF)
    End Sub

    -------------------

    In debug mode reaching the line with '****** I get the following error and program closed:

    error occured on line ......
    java.io.filenotfoundexception: (dev/ttyso: open failed: EACCES (permission denied)

    PS: the file ttyso already exist in the system dev/ folder


    Who can help me?
     
  2. Erel

    Erel Administrator Staff Member Licensed User

    Please use [code]code here...[/code] tags when posting code.

    Did you receive any documentation about this feature from the device manufacturer?
     
  3. Peter Simpson

    Peter Simpson Expert Licensed User

    What's the make and model of your industrial tablet...
     
Loading...
  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