Main Page | Modules | Namespace List | Class Hierarchy | Alphabetical List | Class List | Directories | File List | Namespace Members | Class Members | File Members | Related Pages | Examples

AshtechG12_GPS_PhysicalDevice Class Reference

#include <AshtechG12_GPS_PhysicalDevice.h>

Collaboration diagram for AshtechG12_GPS_PhysicalDevice:

Collaboration graph
[legend]
List of all members.

Detailed Description

This class encapsulates the serial interface to Ashtech's G12 series of GPS receivers.

The intention is to send all commands synchronously over PortA. Asynchonous (periodic) messages are intended to be received from Port B. If no asynchonous operation is desired, Port B may be omitted at initialization. TODO: 1) If we need to use port B for control instead of A for some reason, supply interface to specify which port is for control and which (if any) is for asynch. 2) If necessary, make RecvAckNak() search for leading $PASH instead of just leading '$'. This would only be needed if there is "garbage" on the line that includes '$' characters. 3) As time permits and need dictates, find some way to handle synchronous and asynchronous messaging on the same port. Likely with a reader thread and ACE_Conditional or counting semaphore arrangement. The G12 signifigantly complicates this because messages are not always a single line with a $PASH header.

Definition at line 53 of file AshtechG12_GPS_PhysicalDevice.h.

Public Types

enum  { DEFAULT_PORT = 5002 }

Public Member Functions

 AshtechG12_GPS_PhysicalDevice ()
 Commands for G12 GPS Receiver Default constructor. Object will be useless until Connect() is called. Default constructor. Object will be useless until Connect() is called.
 AshtechG12_GPS_PhysicalDevice (const char *serverName)
 Constructs the device and calls Connect(). This method has no return value so failures in the Connect() method may not be reported. If failures must be handled, you should use the default constructor and call Connect() explicitly.
 AshtechG12_GPS_PhysicalDevice (const char *serverName, int port)
 Constructs the device and calls Connect(). This method has no return value so failures in the Connect() method may not be reported. If failures must be handled, you should use the default constructor and call Connect() explicitly.
 ~AshtechG12_GPS_PhysicalDevice ()
 Destroys the AshtechG12_GPS_PhysicalDevice.
int Connect (const char *serverName)
 Attempts to connect the physical device to GPS Receiver.
int Connect (const char *serverName, int portNumber)
 Attempts to connect the physical device to GPS Receiver.
int Send_i (const char *buf)
int Send_i (const char *buf, unsigned int len)
int Recv_i (char *buf, unsigned int bufsize)
int GetCurrentPosition (Position &pos)
 Receive Data from Server Sends the $PASHQ,POS command to the G12. Queries the G12 for its present position.

Static Public Member Functions

int ValidateChecksum (const char *message)
 Verifies that a message string matches its embedded checksum. The complete, including header and terminating linefeed, should be passed.

Private Attributes

ClientSocketm_clientSocket


Member Enumeration Documentation

anonymous enum
 

Enumeration values:
DEFAULT_PORT 

Definition at line 208 of file AshtechG12_GPS_PhysicalDevice.h.


Constructor & Destructor Documentation

AshtechG12_GPS_PhysicalDevice::AshtechG12_GPS_PhysicalDevice  ) 
 

Commands for G12 GPS Receiver Default constructor. Object will be useless until Connect() is called. Default constructor. Object will be useless until Connect() is called.

Definition at line 27 of file AshtechG12_GPS_PhysicalDevice.cpp.

AshtechG12_GPS_PhysicalDevice::AshtechG12_GPS_PhysicalDevice const char *  serverName  ) 
 

Constructs the device and calls Connect(). This method has no return value so failures in the Connect() method may not be reported. If failures must be handled, you should use the default constructor and call Connect() explicitly.

Parameters:
serverName argument is the hostname or dotted decimal IP address at which GPS Receiver is to be found. The port number is presumed to be the default port.

Definition at line 41 of file AshtechG12_GPS_PhysicalDevice.cpp.

References Connect().

AshtechG12_GPS_PhysicalDevice::AshtechG12_GPS_PhysicalDevice const char *  serverName,
int  port
 

Constructs the device and calls Connect(). This method has no return value so failures in the Connect() method may not be reported. If failures must be handled, you should use the default constructor and call Connect() explicitly.

Parameters:
serverName argument is the hostname or dotted decimal IP address at which GPS Receiver is to be found. The port number is presumed to be the default port.
port 

Definition at line 58 of file AshtechG12_GPS_PhysicalDevice.cpp.

References Connect().

AshtechG12_GPS_PhysicalDevice::~AshtechG12_GPS_PhysicalDevice  ) 
 

Destroys the AshtechG12_GPS_PhysicalDevice.

Definition at line 66 of file AshtechG12_GPS_PhysicalDevice.cpp.


Member Function Documentation

int AshtechG12_GPS_PhysicalDevice::Connect const char *  serverName,
int  portNumber
 

Attempts to connect the physical device to GPS Receiver.

Parameters:
serverName argument is the hostname or dotted decimal IP address at which GPS Receiver is to be found.
portNumber argument is the port to access on the server.
Returns:
0 on success or -1 on failure.

Definition at line 92 of file AshtechG12_GPS_PhysicalDevice.cpp.

References Connect(), and m_clientSocket.

int AshtechG12_GPS_PhysicalDevice::Connect const char *  serverName  ) 
 

Attempts to connect the physical device to GPS Receiver.

Parameters:
serverName argument is the hostname or dotted decimal IP address at which SimGEN is to be found. The port number is presumed to be the default port.
Returns:
0 on success or -1 on failure.

Definition at line 79 of file AshtechG12_GPS_PhysicalDevice.cpp.

References DEFAULT_PORT.

Referenced by AshtechG12_GPS_PhysicalDevice(), Connect(), and GPSObserver::Initialize().

int AshtechG12_GPS_PhysicalDevice::GetCurrentPosition Position pos  ) 
 

Receive Data from Server Sends the $PASHQ,POS command to the G12. Queries the G12 for its present position.

Parameters:
pos The position object to be populated from the G12's state
sock 
Returns:
0=success, -1=command failure, -2=ambiguous response, -3=serial read error

Command to be sent to GPS Receiver

Send Command to GPS Receiver Server

Retrieve Command from GPS Receiver Server

Parse RESPONSE Character Array

Definition at line 226 of file AshtechG12_GPS_PhysicalDevice.cpp.

References Recv_i(), Send_i(), and AshtechG12_GPS_PhysicalDevice::Position::SetFromPOS_Message().

Referenced by GPSObserver::Run().

int AshtechG12_GPS_PhysicalDevice::Recv_i char *  buf,
unsigned int  bufsize
 

Referenced by GetCurrentPosition().

int AshtechG12_GPS_PhysicalDevice::Send_i const char *  buf,
unsigned int  len
 

Definition at line 124 of file AshtechG12_GPS_PhysicalDevice.cpp.

References m_clientSocket.

int AshtechG12_GPS_PhysicalDevice::Send_i const char *  buf  ) 
 

Definition at line 118 of file AshtechG12_GPS_PhysicalDevice.cpp.

Referenced by GetCurrentPosition().

int AshtechG12_GPS_PhysicalDevice::ValidateChecksum const char *  message  )  [static]
 

Verifies that a message string matches its embedded checksum. The complete, including header and terminating linefeed, should be passed.

Parameters:
message The complete message for which checksum is computed
Returns:
0=success,-1=bad checksum,-2=unable to extract checksum

Definition at line 273 of file AshtechG12_GPS_PhysicalDevice.cpp.

Referenced by AshtechG12_GPS_PhysicalDevice::Position::SetFromPOS_Message().


Member Data Documentation

ClientSocket* AshtechG12_GPS_PhysicalDevice::m_clientSocket [private]
 

Definition at line 247 of file AshtechG12_GPS_PhysicalDevice.h.

Referenced by Connect(), and Send_i().


The documentation for this class was generated from the following files:
Generated on Wed Sep 5 12:54:37 2007 for DSACSS Operational Code by  doxygen 1.3.9.1