We begin this article by asking the question: Why would you want to integrate real-time GPS data into your PowerBuilder applications anyway? After all, it's not likely you are going to connect a GPS receiver to your desktop computer and ask yourself where you are currently located. (At least I hope not!) More likely, you will be utilizing some sort of field service application where you need to know how to get from point A to point B, for example, an insurance assessor who needs to know how to get to the next accident site. For this, the user might use a tablet PC connected to a GPS receiver with some sort of integrated mapping solution.
Sep 08, 2009 How to connect to a local serial (com) port to send a string and receive the returned result? The windows stock 'Hyperterminal' communication app allows this, but need control within PB application. PB 10.5, Windows XP.-- Michael. The terminal has a serial port that I connetc to a printer. SoftwareWedge from TAL Technologies to communicate with serial devices like credit.
However, as PowerBuilder programmers, how are we to write such applications? Currently, unlike PocketBuilder, there is no built-in support for hardware devices such as GPS receivers. That being said, we will go about the task of 'rolling our own' and integrating it with Microsoft MapPoint 2004 to create an application that can plot your location on a map as a function of your current position. In order to complete this exercise you will need the following:. A GPS receiver (the Pharos Bluetooth GPS receiver is used in this example). Microsoft MapPoint 2004.
PowerBuilder 9.x. Ian Thain's NMEA parser (look on CodeExchange in the special hardware section). Some time to learn!
You can read or write to the com ports as if they were a file. Just use COM1 or whatever the port name is for the filename. If you need more control than the built-in file functions, I have examples of the API functions in this example: CreateFile is used to open files and CloseHandle closes the file. ReadFile & WriteFile are used to read or write. Look in the object nwininet in function ofreadfile or ofwritefile. The following is from the MSDN docs for CreateFile: The CreateFile function can create a handle to a communications resource, such as the serial port COM1.
For communications resources, the dwCreationDisposition parameter must be OPENEXISTING, the dwShareMode parameter must be zero (exclusive access), and the hTemplateFile parameter must be NULL. Read, write, or read/write access can be specified, and the handle can be opened for overlapped I/O. 'Michael Ray' wrote in message news:4aa6c53f$1@forums-1-dub. Michael Ray 11/9/2009, 6:04 น.
Thank you for the replies! No matter what I did with the File functions FileReadEx always returned an error. The ftpedit example declared the same or similar local external functions as Serial Comms, but it appeared to be much more than what I needed. Thanks Roland for your current and past support! The Serial Comms code specifically addressed and solved my serial connection issue!
![]()
I only had to learn how to import / recreate the objects from exported source. After that, it seemed designed just for me.
![]()
I am curious how the other (unused) structures might be used. Thank you very much Dave Hauze!! - Michael 'Dave Hauze' wrote in message news:4aa7a988$1@forums-1-dub. I've attached an NVO that has all you need (along with some structures) to communicate with a serial port.
The functions are pretty straight forwardand I've included a couple of extra helpful structures to use in your object that calls the serial comm NVO. Hope this helps.
- Dave Hauze 'Michael Ray' wrote in message news:4aa6c53f$1@forums-1-dub. How to connect to a local serial (com) port to send a string and receive the returned result? The windows stock 'Hyperterminal' communication app allows this, but need control within PB application. PB 10.5, Windows XP.
- Michael [email protected] 7/4/2014, 3:09 น.
Comments are closed.
|
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |