• Recent
    • Tags
    • Popular
    • Register
    • Login

    Please Note This forum exists for community support for the Mango product family and the Radix IoT Platform. Although Radix IoT employees participate in this forum from time to time, there is no guarantee of a response to anything posted here, nor can Radix IoT, LLC guarantee the accuracy of any information expressed or conveyed. Specific project questions from customers with active support contracts are asked to send requests to support@radixiot.com.

    Radix IoT Website Mango 3 Documentation Website Mango 4 Documentation Website Mango 5 Documentation Website

    Mango V4.4.2 Serial Data Source Escaping CR LF Characters Wrong?

    User help
    3
    16
    2.1k
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • MattFoxM
      MattFox @Turbo
      last edited by

      @Turbo been a while!

      My advice is to export your data source config in json, amend the regexp termination and upload it.
      If that doesn't work, I might need to see if it can be altered manually in the db...
      See how you get on there!

      Fox

      Do not follow where the path may lead; go instead where there is no path.
      And leave a trail - Muriel Strode

      TurboT 1 Reply Last reply Reply Quote 0
      • TurboT
        Turbo @MattFox
        last edited by Turbo

        @MattFox Well hot dog- This seems to fix it.

        Turns out that Mango escape-escapes the ending- So if you put "\n" in, the JSON escapes that again as "\\n". This means to make this work you have to edit the JSON back to just \n, and then it doesn't display in the data source edit window.

        But, this fixed it.

        Next question on this, maybe you can help: There's a previous thread with some examples that have wiki links that don't work. I think it would help to make those examples available again for download, since they're still up in the Forum:

        https://forum.mango-os.com/topic/1448/how-to-use-the-new-serial-data-source-in-mango-automation-2-1/7?lang=en-US

        There's a thread there referring to "wiki.infiniteautomation.com":
        wiki.infiniteautomation.com/doku.php?id=serial_data_source

        http://wiki.infiniteautomation.com/doku.php?id=serial_point_properties

        http://wiki.infiniteautomation.com/doku.php?id=serial_use_case

        Looks like that wiki is no longer avilable, but I think finding those use cases and posting / sharing them somewhere would be pretty helpful for others following in the chain here. The serial data source is cool, but not exactly intuitive to interact with.

        MattFoxM 1 Reply Last reply Reply Quote 0
        • MattFoxM
          MattFox @Turbo
          last edited by

          @Turbo let's see if web.archive.org can help us here. If it can, I might be able to publish any relevant info here in the forum.

          Fox

          Do not follow where the path may lead; go instead where there is no path.
          And leave a trail - Muriel Strode

          TurboT 1 Reply Last reply Reply Quote 0
          • TurboT
            Turbo @MattFox
            last edited by

            @MattFox I appreciate your helping out here- I already tried archive.org, but it apparently the wiki wasn't up long enough to store a copy of this.

            I'm really struggling with the serial data source- I got the message terminate thing straightened out, but Mango doesn't appear to see anything coming back in from the serial port. With logging enabled, I can see the timestamp O: showing data going out, but nothing coming back int.

            I know the device is responding, since I can talk with it fine using Minicom on the same machine using the same serial port. Was hoping one of those use cases would help me figure out what I'm doing wrong here.

            Thanks for your help on this.

            MattFoxM 1 Reply Last reply Reply Quote 0
            • MattFoxM
              MattFox @Turbo
              last edited by

              @Turbo I found a bug with the serial data source combined with the virtual serial socket meant that after a reboot, you had to save the serial data source in order for it to restart and properly fire up the virtual serial socket.
              I wonder if you're encountering a similar issue here....

              Fox

              Do not follow where the path may lead; go instead where there is no path.
              And leave a trail - Muriel Strode

              TurboT 1 Reply Last reply Reply Quote 0
              • TurboT
                Turbo @MattFox
                last edited by

                @MattFox Indeed. I couldn't use the Serial Data source via Mango V4, because of this issue: I'd suggest maybe adding this to V4- A data source that can't auto-start isn't particularly reliable. I had to switch to using the TCP data source for my solution, and using an Ethernet to GPIB Adapter to parse the SCPI stuff to get the Source meter working.

                It's working now, but the fact I had to use another set of adapters due to bugs in the Mango V4 serial data source is nonideal for this.

                MattFoxM 1 Reply Last reply Reply Quote 0
                • MattFoxM
                  MattFox @Turbo
                  last edited by

                  @Turbo if you're using linux, you can use socat to do a serial to tcp connection instead.

                  Fox

                  Do not follow where the path may lead; go instead where there is no path.
                  And leave a trail - Muriel Strode

                  TurboT 1 Reply Last reply Reply Quote 0
                  • TurboT
                    Turbo @MattFox
                    last edited by

                    @MattFox For other folks who come to this thread, I was able to use the Prologix GPIB Ethernet Adapter: https://prologix.biz/product/gpib-ethernet-controller/

                    I have a working set of Mango Configs that I've got working to talk SCPI using the GPIB <-> Ethernet device servers to make this work. I originally tried to get this working with the Serial data source, but ran into a host of issues related to this.

                    Mango's quite versatile, but apparently the Serial data source chokes on SCPI-style commands- One reason was noted by @MattFox earlier in the thread, but it's also part of a problem with SCPI: Mango expects all data sources to return data, and some (many) SCPI commands don't actually generate an acknowledgement.

                    The GPIB <-> Ethernet adapter has the same problem, but the timeouts are faster, and you can use a trick in the Prologix device (++auto 1) to basically stream data into mango in Real Time.

                    The Mango config I put together for this is quite large, but if you're looking for SCPI interfacing, I'd imagine this script would work well for Native Ethernet as well as Vintage GPIB devices using an Etherent <-> GPIB device.

                    The Prologix one I linked above is the more affordable of the choices- you can just telnet into it, and issue commands, and it spits stuff back. It's actually quite cool.

                    MattFoxM 1 Reply Last reply Reply Quote 1
                    • MattFoxM
                      MattFox @Turbo
                      last edited by

                      @CraigWeb this one needs to be fixed for both 3.7 and mango4

                      Do not follow where the path may lead; go instead where there is no path.
                      And leave a trail - Muriel Strode

                      CraigWebC 1 Reply Last reply Reply Quote 0
                      • CraigWebC
                        CraigWeb @MattFox
                        last edited by

                        @MattFox
                        @Turbo
                        ill be honest im a little out of my depth when it comes to raw serial and tcp communication.

                        could we maybe summarize this thread, this is what I'm seeing:

                        • serial data sources don't restart after a reboot
                          Was this tested pre v4.35 as there were a number of serial fixes in 4.3.5

                        *When serial points are set, the string value of the terminator is used and not the escaped value?(help me here)

                        • Wiki pages are not available.
                          Unfortunately, the wiki pages were a project by previous employees who left the company and no one has any records of those pages. I don't see us recovering them.
                        MattFoxM 1 Reply Last reply Reply Quote 0
                        • MattFoxM
                          MattFox @CraigWeb
                          last edited by

                          @CraigWeb said in Mango V4.4.2 Serial Data Source Escaping CR LF Characters Wrong?:

                          Was this tested pre v4.35 as there were a number of serial fixes in 4.3.5

                          Yes it's an issue in 3.7, just start mango with a serial adaptor and nothing will read or write without restarting the datasource.

                          When serial points are set, the string value of the terminator is used and not the escaped value?(help me here)

                          The UI escapes the control characters used so a single ASCII character becomes two individual characters. This means end of line terminators cannot be used to terminate a string/serial feed ie \n for new line becomes one \ and one n

                          Do not follow where the path may lead; go instead where there is no path.
                          And leave a trail - Muriel Strode

                          TurboT 1 Reply Last reply Reply Quote 0
                          • TurboT
                            Turbo @MattFox
                            last edited by

                            @MattFox Heya: Just for clarity on this: I was able to get this to work using the suggestion you had: The UI escapes control characters, but if you export the points in JSON, and change it to \r\n (or \n\r or whatever) and re-import, the serial data source will work. You just can't see the control characters in the data source, which could cause confusion if people go back later to fix it.

                            MattFoxM 1 Reply Last reply Reply Quote 0
                            • MattFoxM
                              MattFox @Turbo
                              last edited by

                              @Turbo yeah, I want radix to have an option to set ctrl character delimeters with a symbol or something so it is effectively parsed as desired under the hood.
                              I don't want an option to set between them and custom because people may need a combination of the two.

                              Fox

                              Do not follow where the path may lead; go instead where there is no path.
                              And leave a trail - Muriel Strode

                              1 Reply Last reply Reply Quote 0
                              • CraigWebC
                                CraigWeb
                                last edited by

                                So our current policy is that we will only fix security issues on v3. @Turbo I will create an internal ticket for the UI bug. Could you help me describe it better and what the acceptance criteria for the fix woulds be ? sounds like it is just a front-end form bug if you are able to work around it via the json import

                                TurboT 1 Reply Last reply Reply Quote 0
                                • TurboT
                                  Turbo @CraigWeb
                                  last edited by

                                  @CraigWeb Sure:

                                  This is running the latest Mango V4.5. I'm using the Raw TCP data source to chat with a TCP <-> GPIB Adapter, but this bug (also) appears in the serial data source as well. It mentions it in the documentaiton somehwere, too, that you should be able to put \r\n in the "delimiter" and have it sense that as the end of message.

                                  This does not work.

                                  To make it work, you have to download the JSON file and manually put in "\r\n" and then re-import it, at which point the datasource "delimiter" blank shows up blank.

                                  Here's the screen grab of our (working) data source:
                                  a21bc8bf-3398-4d1d-8a7b-d8ee08a0edea-image.png

                                  Notice: Nothing in the "Delimiter" field.

                                  If I download the JSON for that data source, however, I see this:

                                        "updatePeriodType":"SECONDS",
                                        "delimiter":"\r\n",
                                        "hex":false,
                                  

                                  which shows the proper delimiter. This works (btw) so mango is processing the delimiter properly internally, it just doesn't display right in the UI.

                                  "acceptance criteria" would be "The actual delimiter value should be visible in the Delimiter blank, somehow, even of it consists of nonprintable characters"

                                  In the datasource help, attached below as a screen grab, with my highlighting shown, it says " Delimiters are unescaped before sending, so "\r" translates to carrriage return.":

                                  68cd3674-8d47-4f2a-9d8d-97eb66c16e19-image.png

                                  If you put "\n" in that blank, you get this in the JSON:

                                        "updatePeriodType":"MINUTES",
                                        "delimiter":"\"\\n\"",
                                        "hex":false,
                                  

                                  If you put \n (no quotes) you get this:

                                        "updatePeriodType":"MINUTES",
                                        "delimiter":"\\n",
                                        "hex":false,
                                  

                                  Which seems to mean that the parser expects \\n (not a \n)

                                  The only way I was able to get the TCP data source to store the data using \r\n was to edit the JSON file as above, which seems to work properly. But then the \r\n doesn't show up properly in the "delimiter" blank

                                  1 Reply Last reply Reply Quote 0
                                  • First post
                                    Last post