Where communities thrive


  • Join over 1.5M+ people
  • Join over 100K+ communities
  • Free without limits
  • Create your own community
People
Repo info
Activity
    Carolina Sarnevesht
    @csarnevesht
    wow! i can't believe it's running!
    thanks again SO much!
    Jakob Odersky
    @jodersky
    Glad I could help!
    Regarding the dependencies, scala has adopted the convention to append a "_x" to the jar name to differentiate between binary scala versions
    binary scala versions are the first two decimals: 2.11.5, 2.11.6, 2.11.7 etc all have scala binary version 2.11 and 2.10.1, 2.10.2 etc are all 2.10
    When specifying a dependency in sbt, you can either use the single percent notation (%) which divides maven coordiantes into groupId, artifactId and versionId. Or, in case you're specifying a scala library, sbt provides the convenience double-percent notation (%%) that inserts the scala binary version for you, corresponding to the version your project uses
    Jakob Odersky
    @jodersky
    It just makes things easier, e.g. if you change the scala version of your project to 2.12.0 in the future, sbt will automatically depend on the package compiled for scala 2.12 as well
    Carolina Sarnevesht
    @csarnevesht
    you have been tremendous help, and so quick to respond. I am so appreciative of that! I have gotten something that works and I've been able to continue with my work!
    Have a wonderful day!
    Carolina Sarnevesht
    @csarnevesht
    Hi again! I have been experiencing issues with the serial port on a mac, and the developer of our device claims that this is an issue with the mac os serial driver.
    i'm not convinced but i have a windows laptop where i can run the same code.
    i've set it up with intellij and the project which has your SerialConnection code.
    however, i'm having issues with the NativeLoader code not finding the library for flow-native for Windows...
    is there one?
    or do I need to build it?
    would you kindly point me to instructions?
    i'm waiting for a Linux machine so soon I may just move to that... if there is no Windows support for flow-native.
    your help again would be so greatly appreciated!
    Jakob Odersky
    @jodersky
    HI
    flow's native library is written in C and uses only standard (POSIX) APIs. It can therefore be compiled for OSX, Linux and probably othe unices. Windows is not supported currently, however there was an attempt to get it working with Cygwin, yet that was not completed due to slight differences in the way libraries are loaded
    Jakob Odersky
    @jodersky
    The platforms that are supported out-of-the-box (i.e., that have libraries included in the flow-native jar from bintray) are listed on the download page http://www.jodersky.ch/flow/downloads/
    Jakob Odersky
    @jodersky
    There is an open issue (with tips on how to get started) to add windows support. Although I will not personally take up the issue (since I don't know much about the windows api), I would greatly appreciate contributions on the matter.
    Guillermo Lammers Corral
    @glammers1

    Hi,

    If somebody could give me a clue on this problem I'm facing, I will be very grateful.

    I am facing unexpected problems due to an exception while hanging-up the connection with a GSM modem.

    • The remote modem answer the call and establish the connection:

    -> ATD[number]
    <- CONNECT 9600/RLP

    • The calling modem doesn't hang with the message:

    -> +++
    <- OK

    -> ATH0

    java.io.IOException: 
        at com.github.jodersky.flow.internal.NativeSerial.readDirect(Native Method)
        at com.github.jodersky.flow.internal.SerialConnection$$anonfun$read$1.apply(SerialConnection.scala:75)
        at com.github.jodersky.flow.internal.SerialConnection$$anonfun$read$1.apply(SerialConnection.scala:75)
        at com.github.jodersky.flow.internal.SerialConnection.transfer(SerialConnection.scala:120)
        at com.github.jodersky.flow.internal.SerialConnection.read(SerialConnection.scala:77)
        at com.github.jodersky.flow.internal.Reader.readLoop(Reader.scala:14)
        at com.github.jodersky.flow.internal.Reader.run(Reader.scala:34)

    Thanks in advance.

    flow version 2.6.0

    btw:
    -> sent message
    <- received message
    Jakob Odersky
    @jodersky
    That's a peculiar error you're seeing. What message do you get when setting com.github.jodersky.flow.internal.SerialConnection.debug(true) beforehand?
    Does your modem change baud rate during a connection?
    Guillermo Lammers Corral
    @glammers1

    Thanks, Jacob. I did it, it shows the following message:

    error data not available after select: No such file or directory

    I think that I've found something similar in the flow.c file at line 232 https://github.com/jodersky/flow/blob/f791debe0c44f7bf420df37725e52b724c19660d/flow-native/src/platform/posix/flow.c#L232. For version 2.6.0 I've found here https://github.com/jodersky/flow/blob/v2.6.0/flow-native/src/platform/posix/flow.c#L218

    Any ideas? Thanks!

    Guillermo Lammers Corral
    @glammers1

    I don't change the baud rate during a connection. I'm using the following values but never change:

    val settings = SerialSettings(
            baud = 9600,
            characterSize = 8,
            twoStopBits = false,
            parity = Parity.None
        )

    I'm sending AT commands like ATE0, ATV1 and ATQ0 before the ATD command. That's all.

    Guillermo Lammers Corral
    @glammers1
    Ops, sorry for my mistake. I changed your name to Jacob and I couldn't edit :smile:
    Jakob Odersky
    @jodersky
    The error you're getting looks like a bug from flow. Does your modem close the connection (or reset itself) after you issue the command before the error?
    Jakob Odersky
    @jodersky
    My assumption is that somehow the connection is reset while the reader thread is waiting on a select. Instead of returning an error, the call to read returns 0 bytes corresponding to an end-of-file. Flow, incorrectly, assumes that data will always be available after a select:
            int r = read(port, buffer, size);
    
            //treat 0 bytes read as an error to avoid problems on disconnect
            //anyway, after a poll there should be more than 0 bytes available to read
            if (r <= 0) {
                DEBUG(perror("error data not available after select"););
                return E_IO;
            }
            return r;
    I can't remember the reasoning behind my comment, on why there would be issues on a disconnect, but it seems flawed anyway. The code should treat r < 0 and r == 0 differently
    Jakob Odersky
    @jodersky
    I think I recall the reasoning now. When a serial connection is unexpectedly closed, usually read returns -1 and sets errno to a specific error code. serial_read should never return and empty message, since this has no meaning in combination with a select (the whole point of select is to ensure that data is available before returning)
    What I did not consider is that read can actually return 0, even after a select. I would argue however that a read of zero bytes, equivalent to an end-of-file, is also a kind of error message: the remote end closed the connection while you were trying to read => you did not respect the protocol.
    It is a less sever error however, more like an unexpected close from the remote in a TCP connection
    The error message is very bad however, and should distinguish cases of r == 0 and an actual error
    Jakob Odersky
    @jodersky
    and also it should not return an E_IO in case of eof
    Jakob Odersky
    @jodersky
    Can you just reconnecting after sending the OK?
    Guillermo Lammers Corral
    @glammers1

    Hi Jakob,

    Sorry, but I don't understand you, what do you mean with "after sending the OK"?. If I try to reconnect after the reception of the OK corresponding to +++ then I receive ERROR from the remote modem.

    Btw, I've changed version to 3.0.1
    Leonardo Sa
    @leolimasa
    Hi all, does anyone know why the snippet below doesn't typecheck?
    type LiteralA = "LiteralTypeA";
    type LiteralB = "LiteralTypeB";
    type UnionAB = LiteralA | LiteralB;
    
    const isLiteralA = (u : LiteralA) =>
        u == "LiteralTypeA";
    
    const unionIsLiteralA = (u : UnionAB) =>
        isLiteralA(u);
     12:     isLiteralA(u);
             ^^^^^^^^^^^^^ function call
     12:     isLiteralA(u);
                        ^ string literal `LiteralTypeB`. Expected string literal `LiteralTypeA`, got `LiteralTypeB` instead
      8: const isLiteralA = (u : LiteralA) =>
                                 ^^^^^^^^ string literal `LiteralTypeA`y
    Jakob Odersky
    @jodersky
    @leolimasa I think you got the wrong channel
    Leonardo Sa
    @leolimasa
    I did indeed, thought this was facebook flow... sorry!
    Joesan
    @joesan
    What does this line in the preStart method of the Actor do?
    IO(Serial) ! Serial.Open(port, settings)
    Maarten Mulders
    @mthmulders
    It attempts to open a serial port using the specified settings, I'd say.
    Jakob Odersky
    @jodersky
    that's correct
    Jakob Odersky
    @jodersky
    also, for more details about the protocol messages refer to the API docs http://www.jodersky.ch/flow/documentation/3.0/api/ch/jodersky/flow/Serial$.html
    Jakob Odersky
    @jodersky
    @/all The project has been renamed to "akka-serial". The new chat room is https://gitter.im/jodersky/akka-serial.