GithubHelp home page GithubHelp logo

Comments (11)

semuadmin avatar semuadmin commented on July 26, 2024 1

from pygpsclient.

semuadmin avatar semuadmin commented on July 26, 2024 1

Hi @hpsaturn

FYI I've added a PR containing the following enhancement:

Add provision to pass user-defined serial port designator via command line keyword argument port or environment variable PYGPSCLIENT_USERPORT.

e.g.

pygpsclient port=/dev/tty12345

or

export PYGPSCLIENT_USERPORT = "/dev/tty12345"
pygpsclient

Any user-defined port will appear in the serial port listbox as the first preselected item.

from pygpsclient.

hpsaturn avatar hpsaturn commented on July 26, 2024

I wrote a small guide to have virtual serial ports. This guide uses your script socker server implementation and one virtual serial port. With this possible new feature, we could put direct the virtual serial port instead the socket server. It's only an idea.

from pygpsclient.

semuadmin avatar semuadmin commented on July 26, 2024

Hi @hpsaturn. Thanks for this, and sorry it's taken a while to get back to you.

Given the additional information you've provided on virtual ports, I'm not entirely clear what the outstanding issue is or what additional functionality you're after.

As you've presumably seen, the serial port listbox in PyGPSClient uses the standard Python serial.tools.list_ports.comports function to list the available serial ports. This is primarily intended for physical serial connections (i.e. USB or UART), and as a standard library function I have no direct control over its functionality.

I could, as you suggest, add a manual serial port entry facility, but since the listbox works for 99% of standard use cases I'm somewhat loath to complicate the UI for what would be a niche case. I could, as an alternative, provide an optional command line facility for manual port override e.g. pygpsclient port=/dev/pts/14.

As you've seen, PyGPSClient can also read directly from a TCP or UDP socket stream - have you actually tried reading your device's UDP stream directly using this facility, rather than coverting it to a virtual serial port using socat?

If you can clarify exactly what missing functionality you're after, I'm happy to investigate further.

from pygpsclient.

hpsaturn avatar hpsaturn commented on July 26, 2024

Hi @semuadmin

Thanks for your detailed explanation. I think that option on the command line or via an environment variable could works. Also I understand that this feature maybe nobody needs it, is a minor feature. With the command line option I wouldn't have to start the UDP server.

Regarding to try to read direct the UDP device stream, I need test again because didn't works. I tried many times on many ways. But let me test again, maybe I had some protocol mistakes..

from pygpsclient.

semuadmin avatar semuadmin commented on July 26, 2024

Hi @hpsaturn Yes, suggest try the direct UDP/TCP socket and let me know how you get on. Purely out of interest, any particular reason why you favour UDP over TCP?

I take it you're working with IOT devices like the ESP32? I have in the past tested using a WROOM ESP32 with an old NEO-M6 GPS module connected via UART, transmitting a raw NMEA data stream via a TCP socket using the wifiserver.h Arduino library, and it did work fine with PyGPSClient's socket stream facility.

from pygpsclient.

hpsaturn avatar hpsaturn commented on July 26, 2024

Yes I will try again it. Regarding TCP/UDP, don't matter. I want map the UART output via TCP/UDP for other features. For example I have a CLI, and sometimes for debugging via UDP could be more fast without no matter lost some packets.. But again, let me try again to test the direct UDP/TCP socket again, for close this issue.

from pygpsclient.

hpsaturn avatar hpsaturn commented on July 26, 2024

Works like a charm!

(pvenv) (add-app-entry-kwargs) avp:PyGPSClientȹ export PYGPSCLIENT_USERPORT="/dev/pts/10" 
(pvenv) (add-app-entry-kwargs) avp:PyGPSClientȹ python3 -m pygpsclient

screenshot20221104_120455

screenshot20221102_231819

I will change my guide because with this improvement I don't need starting the socket server, I don't need the last part on the guide.

Thanks!

from pygpsclient.

Ve2mrx avatar Ve2mrx commented on July 26, 2024

I'm in need of this workaround due to pyserial/pyserial#489, it blocks /dev/ttyS0 on which the GPS is present.
Unfortunately, I can't seem to get the tweak to work

Hi @hpsaturn

FYI I've added a PR containing the following enhancement:

Add provision to pass user-defined serial port designator via command line keyword argument port or environment variable PYGPSCLIENT_USERPORT.

e.g.

pygpsclient port=/dev/tty12345

or

export PYGPSCLIENT_USERPORT = "/dev/tty12345"
pygpsclient

Any user-defined port will appear in the serial port listbox as the first preselected item.

pygpsclient: error: unrecognized arguments: port=/dev/ttyS0

PyGPSClient 1.4.7
Python 3.9.2
Raspberry Pi OS 64-bit "Bullseye"

Thanks for your time,
Martin

from pygpsclient.

semuadmin avatar semuadmin commented on July 26, 2024

Hi @Ve2mrx

Things have moved on a bit since this change was originally made. The easiest way to do this now is via a *.json configuration file e.g. pygpsclient.json. The following configuration setting in the file will take precedence over any command line arguments:

"userport_s": "/dev/ttyS0",

To create an initial default configuration file, simply use the 'File...Save Configuration` menu option.

Unfortunately it appears I've broken the command line parsing so the alternative pygpsclient --userport /dev/ttyS0 or pygpsclient -U /dev/ttyS0 command line argument (note updated syntax) doesn't currently work - a fix will go into v1.4.8: 13ec43b.

Hope this helps

from pygpsclient.

Ve2mrx avatar Ve2mrx commented on July 26, 2024

@semuadmin Thanks, this fixed my problem!

Martin

from pygpsclient.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.