| By Deanne M. Chance | Article Rating: |
|
| February 19, 2006 12:30 PM EST | Reads: |
20,427 |
What we need now is a way to extract each individual sentence out of the stream to be passed for parsing to the NMEA object. For that I wrote the wf_get_token function. This will extract a string based upon a delimiter. For the NMEA stream, that is the newline character.
Finally, we will need a way to convert the latitude and longitude returned by the receiver to decimal degrees. This is necessary for the MapPoint method GetLocation. The formula for doing so is:

There are some other conversions necessary for GetLocation as well. They are as follows:

We can determine the sign based upon the direction returned by the NMEA sentence. Finally, we can map our current position by using the following MapPoint code.
loo_Location = ioo_Map.GetLocation(ldb_Lat, ldb_Long, ldb_Alt)
loo_PinCurrentFix=ioo_Map.AddPushpin(loo_Location,"You are here!")
loo_Location.GoTo()
loo_PinCurrentFix.Select()
There are many other operations you can perform in MapPoint, for example, directions from point A to point B. A good resource is an article written in PBDJ (Vol. 11, issue 10) entitled "Using MS MapPoint in PowerBuilder" by Arthur Hefti. The source for that article can be found here: http://gemsres.com/story/jul05/107019/source.html.
Step 5: Put it all together. Add the following code to the clicked button of your "Get GPS Data" button.
ib_Connected = wf_detect_bt()
If ib_Connected Then
wf_write_gps()
sleep(3)
wf_read_gps()
End If
Step 6: Cleanup
ole_MapControl.Object.CloseMap()
wf_close_bt()
That's it.
One final note, if you plan on connecting to a Bluetooth serial port greater than COM9, you will need to use this syntax "\\.\COMxx" as the port name. Just substitute the port number you wish to use for xx. The cause of the problem is that CreateFile accepts strings "COM1" - "COM9" as names of devices but rejects doing so for two or more digit numbers.
If you are interested in learning more, check out the following references. In addition, you can find the complete source code for this project on CodeExchange in the PowerBuilder special hardware section.
Resources
- How GPS Receivers Work: http://electronics.howstuffworks.com/gps.htm
- A General Overview of the NMEA Protocol: www.gpsinformation.org/dale/nmea.htm
- Powerbuilder MapPoint Code Examples: http://gemsres.com/story/jul05/107019/source.html
Published February 19, 2006 Reads 20,427
Copyright © 2006 SYS-CON Media, Inc. — All Rights Reserved.
Syndicated stories and blog feeds, all rights reserved by the author.
More Stories By Deanne M. Chance
Ms. Chance graduated in 1996 with a degree in computer science from the University of Illinois. She has been a frequent contributor to the PowerBuilder Developer's Journal and gave a key presentation at Sybase TechWave 2005 entitled "A Real-Time Physical Inventory Solution Using PocketBuilder ASA and a WiFi Connection." She has held several engineering positions, starting a career at Motorola where she focused on mobile I.P. by doing real-time embedded programming for the base radio controller group as part of the iDEN/Nextel project.
![]() |
josen30308 05/06/09 07:38:00 PM EDT | |||
I just got a simple question. wich is the code NMEA and where am I supposed to put this code? sincerely Jose |
||||
![]() |
SYS-CON Belgium News Desk 02/19/06 01:43:54 PM EST | |||
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!) |
||||
![]() |
news desk 02/18/06 02:49:34 PM EST | |||
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!) |
||||
![]() |
SYS-CON Belgium News Desk 02/18/06 01:20:55 PM EST | |||
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!) |
||||
- Why SOA Needs Cloud Computing - Part 1
- Cloud Expo and The End of Tech Recession
- The Transition to Cloud Computing: What Does It Mean For You?
- A Rules Engine Built in PowerBuilder
- Sybase Named “Silver Sponsor” of iPhone Developer Summit
- How PowerBuilder Got Its Groove Back
- The Cloud Has Cross-Border Ambitions
- Ulitzer Names The World's 30 Most Influential Virtualization Bloggers
- Ulitzer Named "New Media" Partner of Greatly Anticipated iStrategy Event in Berlin
- Risks and Enterprise Mobility?
- Steps for Success in Enterprise Mobility?
- Are Mobile Luddites Resisting Mobility?
- The Difference Between Web Hosting and Cloud Computing
- Sybase CTO to Speak at 4th International Cloud Computing Expo
- Why SOA Needs Cloud Computing - Part 1
- Cloud Expo and The End of Tech Recession
- The Transition to Cloud Computing: What Does It Mean For You?
- Five Reasons to Choose a Private Cloud
- Seeding The Cloud: The Future of Data Management
- The Threat Behind the Firewall
- Economy Drives Adoption of Virtual Lab Technology
- Tips for Efficient PaaS Application Design
- A Rules Engine Built in PowerBuilder
- Sybase Named “Silver Sponsor” of iPhone Developer Summit
- Where Are RIA Technologies Headed in 2008?
- PowerBuilder History - How Did It Evolve?
- The Top 250 Players in the Cloud Computing Ecosystem
- Custom Common Dialogs Using SetWindowsHookEx
- DDDW Tips and Tricks
- OLE - Extending the Capabilities of PowerBuilder
- DataWindow.NET How To: Data Entry Form
- Book Excerpt: Sybase Adaptive Server Anywhere
- Sybase ASE 12.5 Performance and Tuning
- Working with SOA & Web Services in PowerBuilder
- Office 2003 Toolbar: A New Look For Your Old PowerBuilder App
- Dynamically Creating DataWindow Objects



































