Implementation of Palm Serial Communication GPS Data Reading

xiaoxiao2021-03-06  39

Author: taling Source: cnemb Li Lu group (liluqun@263.net) Shandong University of Science Computing Center in November 2001 on J2ME programming tutorial, the major sites are introduced. However, the learning and practical application of the J2ME tutorial is still a distance. The author has been engaged in J2ME for more than a year, and has successfully developed wireless Internet Palm and GPS, electronic map combined with personal navigation systems. The system uses PALM to collect GPS data via serial port, position GPS data on electronic map, update or spatial attribute analysis of map data is connected to the mobile phone with mobile phone via the Palm Palm, and send data requests to the server, the server receives the request, after receiving the request, Return the processing result to the PALM user. The following introduction is important in the system -

1 Introduction At present, no matter the self-positioned navigation system embodied as a GIS application, most of them use laptops or special custom hardware, and the cost of displaying equipment has accounted for the vast majority of the entire system cost, and the performance and cost of hardware platform constrain these high-tech. Technology promotion and application, personal consumption This huge market is still difficult to start, unable to adapt to certain special industries (such as public security, fire, place name data collection, field exploration navigation, etc.). With the development of computer software hardware technology, WAP wireless Internet technology has been successfully applied, and various mobile intelligent terminals with wireless Internet functions (such as handheld computers, WAP mobile phones, Pager, etc.) have enabled people with these intelligent terminals. Opening only the work in the office or home in the past, people can "office in mobile", intelligent terminal wireless Internet has been successfully applied to all aspects of people's lives. At the same time, the emergence of these intelligent terminals is further expanded with the appearance of peripheral hardware (eg, GPS, GSM module, etc.) that is supported by these intelligent terminals. It is self-evident, intelligent terminal, GPS, wireless Internet and other new technologies applied in the GIS field, it is bound to enrich GIS theory and expand the GIS application area. Based on these mobile intelligent terminal platform research, the research of GIS GPS wireless Internet integration is inevitably become an emerging important research field in the field of GIS. The research of GIS borders will be called "Mobile GIS". The author is engaged in this area for more than 1 year, and has successfully developed wireless Internet Palm and GPS, electronic map combined with personal navigation systems. The system uses PALM to collect GPS data via serial port, position GPS data on electronic map, update or spatial attribute analysis of map data is connected to the mobile phone with mobile phone via the Palm Palm, and send data requests to the server, the server receives the request, after receiving the request, Return the processing result to the PALM user. The following is described below to read the readings of important technologies - PDA (PALM) GPS data. 2 Palm Handheld Introduction 2.1 Hardware Introduction Palm is a 3COM product, its operating system is Palmos. Palm OS is a 32-bit embedded operating system. Palm provides a serial communication interface and an infrared transmission interface. Using it can easily communicate with other external devices, transfer data. Palm OS and Synchronous Software (HotSync) combines the handheld computer with the information on the PC, and extends the desktop's function to the palm. Palm application is quite wide, such as contact and worksheet management, email and Internet communication, sales staff and group automation, and so on. Palm peripheral hardware is also very rich, there are digital cameras, GPS receivers, modems, GSM wireless phones, digital audio playback devices, portable keyboards, voice recorders, barcode scans, wireless paging receivers, and probe. Where Palm and GPS are combined, it can not only make navigation positioning, but also combined with GPS monitoring, place name surveys, etc. 2.2 Development Tools Selecting the current development tools for the PALM environment mainly include CodeWarror C, Java, AppForGeSonal (Basic), and more. Due to the Palm platform and the microcomputer hardware, the software platform has the essence difference, in order to reduce the training costs of developers, improve the development speed, we use Java language as system development tools. Java technology consists of three versions: .micro Microcate (J2ME), Standard Standard Edition (J2SE), Enterprise Enterprise (J2EE).

Among them, J2ME mainly targets consumer electronic products (such as daily necessities, such as small smart cards, set-top boxes, various handheld equipment, etc.) and embedded equipment development tools and operating environments. J2ME has many Java technical features that can be run on various devices that support Java, the code is short, safe, and the application implemented with J2ME can be easily upgraded to J2SE, J2EE. Figure 1 Java technology structure diagram

3 PDA and GPS communication NMEA protocol GPS, GPS, GPS, which mainly has three major components, namely space constellation parts, ground monitoring parts, and user equipment parts. Where the GPS space constellation part is controlled by the United States; the user equipment of GPS is mainly composed of receiver hardware and processing software. The user receives the GPS satellite signal by the user equipment, obtains information, speed and other information, and finally realizes the purpose of navigation and positioning using GPS. Many GPS manufacturers have developed many navigation GPSs for the PDA handheld computer in accordance with NMEA0183 protocol. These GPS provide serial communication interface, serial communication parameters are: Porter = 4800 data bit = 8-bit stop bit = 1-bit no parity GPS and handheld communication, through the serial port 10 data from the second. When the actual navigation app reads the GPS space positioning data, we can update latitude and time data every second. The more frequent data updates are not necessary, and the Palm's finished battery will be quite wetted. We don't need to understand all information about the NMEA 0183 communication protocol, only you need to pick the part of the partial data we need. We ignore the rest of the information. If the communication between the satellite is normal at this time, the data format that can be received is as follows: $ GPRMC, 204700, A, 3403.868, N, 11709.9, 170698, 013.6, E * 6E data descriptions are as follows: $ GPRMC represents the shortest data of the GPS recommended to the shortest data of the UTC_TIME 24 hours, according to the time / minute / sec format AA or VA indicates that the data "OK", V represents a warning 3403.868 LAT latitude, precise To the first 4 digits of the decimal point, the latter N lat_dir N indicates north latitude, s indicates the south latitude 11709.432 LON longitude value, accurate to the top 5 digits of the decimal point, the latter 3-bit W LON_DIR W indicates the West, E indicates that the east is not currently available. Contact, the format of the string is: $ GPRMC, UTC_TIME, V, ... below is: $ GPRMC, 204149, V, ,,,,,, 170698 ,, * 3A 4 J2ME Serial read and write GPS data The implementation of Palm J2ME can use two ways to read and write GPS serial port data, one is to use the original single byte data read and write in the serial port, and another buffer byte array read and write. (Note: J2ME The 1.0 version of the KVM provided by Palm does not support serial communication rate 4800 baud, GPS serial communication rate is 4800 baud, must adopt CLDC 1.02 or higher version or Kawt, Color KVM) in actual PALM pair In the serial port GPS data read-write implementation, we found that the former is low, the read / write speed is slow, and the average can read the required GPS positioning data, and the latter reads and writes fast, you can read the required every second GPS data, no GPS data loss. Therefore, only the method of reading the latter GPS is described here. J2ME and PALM profile have been provided with a class Protocol read and written by constructing the Protocol instance SerialPort, obtaining input stream inputStream () by constructing the input stream inputStream (), using the input stream data to read the GPS serial data into a buffer byte array, will The byte array is transformed into a string, and it is determined that the GPS coordinate flag "$ GPRMC" is intercepting the coordinate data. Figure 2 Palm Read UML Collaboration Map for GPS

See the source program PrintMe.java

Package Earth_survy;

Import java.util. *; import javax.microedition.io. *;

Import java.io. *;

Import com.sun.kjava. *;

Import com.sun.cldc.io.palm.comm. *;

Public class getgpsdata extends spotlet {

Static graphics g = graphics.getgraphics ();

Static Protocol SerialPort = new protocol ();

STATIC STRING URL = "0; baudrate = 4800; bitsperchar = 8; stopbits = 1; Parity = None";

Static InputStream IS;

// Open the Serial Port for GPS Data Input

Public Boolean OpenPort () {

Try {

SerialPort.Open (URL, 1, TRUE);

IS = serialport.openputstream ();

Return True;

}

Catch (Exception EX) {

Return False;

}

}

File: // Close The Serial Port

Public Boolean Closeport () {

Try {

Is.close ();

SerialPort.Close ();

Return True;

}

Catch (Exception EX) {

Return False;

}

}

File: // ion the GPS Data

File: // mark is "$ GPRMC

File: // rdlen is the buffer length

File: // Getlen is The Return LENTH;

Public String Readgpsdata (String Mark, Int Rdlen, Int getlen) {

Byte [] readbuffer = new byte [rdlen];

String Rawgpsdata;

String gprmc;

While (true) {

Try {

File: // read raw GPS Data Into a buffer;

Is.read (readbuffer);

Rawgpsdata = new string (readbuffer);

File: // determin the Positon of the mark ==> $ GPRMC;

INT POS = RawgpsData.indexof (Mark);

IF (POS> -1)

{

Gprmc = rawgpsdata.substring (POS);

IF (gprmc.length ()> getlen)

{

Gprmc = gprmc.substring (0, getlen);

Break;

}

}

}

Catch (Exception E) {

}

}

Return Gprmc;

// end loop

} // End Method

}

references

Gong Jianya. Data Organization and Treatment Method of Overall SIS. Wuhan: Wuhan Surveying and Mapping University Press, 1993 http://www.palmheart.net/document/ c.thomas wu.an Introduction to Object-Oriented Programming with java.2001 Jiang Hui et al .UML design core technology. Beijing: Hope Electronics Press. 2001

转载请注明原文地址:https://www.9cbs.com/read-62163.html

New Post(0)