[PythonCE] serial port access

Matt S. sleepingbull at gmail.com
Fri Sep 22 04:37:02 CEST 2006


Benjamin (Gonzalo, Luke, Quentin),

Did you post the serial port code you mentioned?  I'd really appreciate it.
My goal is to work with GPS hardware attached through a serial port.  My
hope was that the pygarmin module could be "easily" adapted to work with a
Trimble GPS on the PocketPC (but it uses win32file/win32com which both
appear to be unavailable on PythonCE).  In my search, I also noticed that in
Mobile 5.0, Microsoft has released the GPS Intermediate Driver (but I don't
think this helps on the PPC 4).  PocketGPSLib also holds some promise for
use with ctypes, but it's severly un-documented.  I'm not at all versed in
building so the '.cpp' files that were offered up in this thread don't make
any sense to me.  Further complicating matters, the Trimble protocol seems
to be mostly non-existent, publicly anyway.

Up the creek without a paddle, does anyone have a paddle?

Thanks,
Matt

On 6/23/06, Benjamin McBride <benjamin.mcbride at gmail.com> wrote:
>
> Thanks all for your help!
>
> The final key was to use the wide-character variant of CreateFile.  As
> soon as I have the code cleaned up I will post the code (should be in the
> next day or so).  It will have a similar interface as pySerial.
>
> Thanks,
>
> Ben McBride
>
> On 6/21/06, Luke Dunstan <coder_infidel at hotmail.com> wrote:
> >
> > You need to use the wide-character variants of Windows APIs, i.e.
> > CreateFileW
> >
> > Luke
> >
> > ----- Original Message -----
> > From: "Benjamin McBride" <benjamin.mcbride at gmail.com>
> > To: <pythonce at python.org>
> > Sent: Wednesday, June 21, 2006 4:54 AM
> > Subject: Re: [PythonCE] serial port access
> >
> >
> > Thanks Gonzalo for your help.  I have read both the ctypes and
> > microsoft documentation.  My understanding is that I need to use the
> > CreateFile API function from the coredll to get a handle to the comm
> > port.  When I use ctypes:
> >
> > >>> windll.coredll.CreateFile
> >
> > I get an AttributeError saying the CreateFile function is not found.
> > Ironically, the ReadFile, WriteFile, and CloseHandle functions are all
> > found.
> >
> > Am I just missing something simple here?
> >
> > Ben
> >
> > On 6/20/06, Gonzalo Monzón <gmc at serveisw3.net> wrote:
> > > Have you read the ctypes docs?
> > >
> > > http://starship.python.net/crew/theller/ctypes/tutorial.html
> > >
> > > You have to read the Microsoft docs too, search what dynamic libraries
> > > to use and what functions to call. Study the example I posted, you
> have
> > > to call these functions using ctypes:
> > >
> > > (openfile, readfile, writefile...)
> > >
> > > Don't know if somebody has implemented serial access using ctypes as
> to
> > > post an example, read the docs, first you need to understand how
> ctypes
> > > work -for that you should know or learn what C variable types are and
> > > understand it almost a little bit, then the codeproject example will
> > > come in handy- otherwise could be hard to code... Though any ctypes
> > > example handling file or stream data may help you. Though pyserial
> uses
> > > ctypes too, so you could have a look to the sources. The differences
> are
> > > you have to use straight windows api calls, and pyserial calls a
> helper
> > > library wich should use windows api's for windows platform.
> > >
> > > I have to code serial access too in the next weeks, but don't have the
> > > time now to get my hands in it. If you are not in hurry I could post
> an
> > > example when done.
> > >
> > > Gonzalo.
> > >
> > >
> > > Benjamin McBride escribió:
> > >
> > > >I've got ctypes installed.  However, I have not been able to find any
> > > >examples of how I might use ctypes for serial port access.  Any
> > > >suggestions would be appreciated.
> > > >
> > > >Thanks,
> > > >
> > > >Ben
> > > >
> > > >On 6/20/06, Gonzalo Monzón <gmc at serveisw3.net> wrote:
> > > >
> > > >
> > > >>Hi Benjamin,
> > > >>
> > > >>You can use ctypes for direct access to serial ports via windows
> apis
> > > >>(openfile, readfile, writefile...)
> > > >>
> > > >>Note that manufacturers can have specific implementations, even they
> > > >>must agree to PPC implementation, but you can found small
> differences.
> > > >>
> > > >>http://www.codeproject.com/system/simpleserialcomm.asp
> > > >>
> > > >>Regards,
> > > >>Gonzalo
> > > >>
> > > >>
> > > >>Benjamin McBride escribió:
> > > >>
> > > >>
> > > >>
> > > >>>    Hi All,
> > > >>>
> > > >>>    I need to access the serial port for my PPC application.  I
> have
> > > >>> been
> > > >>>    unable to locate information on this.  I'm using Python 2.4.3and
> > > >>> PPC
> > > >>>    2003.  Previously I've used pyserial, but it appears that
> pyserial
> > > >>> does
> > > >>>    not work on Windows CE.
> > > >>>
> > > >>>    Thanks for any suggestions,
> > > >>>
> > > >>>    Ben McBride
> > > >>>    bdm7935 at ksu.edu
> > > >>>_______________________________________________
> > > >>>PythonCE mailing list
> > > >>>PythonCE at python.org
> > > >>>http://mail.python.org/mailman/listinfo/pythonce
> > > >>>
> > > >>>
> > > >>>
> > > >>>
> > > >>>
> > > >>
> > > >>
> > > >_______________________________________________
> > > >PythonCE mailing list
> > > >PythonCE at python.org
> > > >http://mail.python.org/mailman/listinfo/pythonce
> > > >
> > > >
> > > >
> > >
> > >
> > _______________________________________________
> > PythonCE mailing list
> > PythonCE at python.org
> > http://mail.python.org/mailman/listinfo/pythonce
> > _______________________________________________
> > PythonCE mailing list
> > PythonCE at python.org
> > http://mail.python.org/mailman/listinfo/pythonce
> >
> _______________________________________________
> PythonCE mailing list
> PythonCE at python.org
> http://mail.python.org/mailman/listinfo/pythonce
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mail.python.org/pipermail/pythonce/attachments/20060921/915f2b8b/attachment.html 


More information about the PythonCE mailing list