GPS4Palm

Source Code Documentation


Serial.c File Reference

#include <PalmOS.h>
#include <SerialMgrOld.h>
#include <BtCommVdrv.h>
#include "Serial.h"

Include dependency graph for Serial.c:

Go to the source code of this file.

Functions

UInt32 DoReceive (UInt16 portId, void *rcvBufP, UInt32 count, Int32 timeout, Err *errP)
 Serial Manager/New Serial Manager wrapper function for data reception.
Err DoSetReceiveBuffer (UInt16 portId, void *bufP, UInt16 bufSize)
 Serial Manager/New Serial Manager wrapper function to set receive buffer.
Err DoReceiveWait (UInt16 portId, UInt32 bytes, Int32 timeout)
 Serial Manager/New Serial Manager wrapper function to wait for at least specified number of bytes in receive buffer.
Err DoReceiveFlush (UInt16 portId, Int32 timeout)
Err DoReceiveCheck (UInt16 portId, UInt32 *numBytesP)
 Serial Manager/New Serial Manager wrapper function to return the count of bytes presently in the receive queue.
Err DoClose (UInt16 portId)
 Serial Manager/New Serial Manager wrapper function to close port.
void FreeCncProfileList (void)
 Deallocation of memory allocated by CncGetProfileList().
Err BluetoothOpen (UInt32 port, UInt32 baud, UInt8 *bt_addr, UInt16 *PortID)
 Open Bluetooth Virtual Serial Port and connect to known device (address).

Variables

Boolean gNewSerialManager
 New Serial Manager available.
Boolean gCncManagerFtr
 Connection Manager feature set available.
UInt16 gPortID
 Serial port ID.
UInt32 gSerialPort
 four-character port name or logical port number (New Serial Manager)
Char ** gProfiles
 List of Connection Manager Profiles.
UInt16 gNumProfiles
 Number of Connection Manager Profiles.
char gSerialBuffer [900]
 Serial port receive buffer.


Function Documentation

Err BluetoothOpen UInt32  port,
UInt32  baud,
UInt8 *  bt_addr,
UInt16 *  PortID
 

Open Bluetooth Virtual Serial Port and connect to known device (address).

Parameters:
port port name or logical port number
baud baud rate
bt_addr Bluetooth Device Address
PortID port ID returned by reference
Returns:
see SrmExtOpen()

Definition at line 220 of file Serial.c.

Err DoClose UInt16  portId  ) 
 

Serial Manager/New Serial Manager wrapper function to close port.

Parameters:
portId port ID
Returns:
  • 0 if no error
  • serErrNotOpen if port wasn't open
  • serErrStillOpen if port still held open by another process.

Definition at line 180 of file Serial.c.

References gNewSerialManager.

Referenced by PortFormHandleEvent(), RouteFormHandleEvent(), TrackFormHandleEvent(), and WaypointFormHandleEvent().

UInt32 DoReceive UInt16  portId,
void *  rcvBufP,
UInt32  count,
Int32  timeout,
Err *  errP
 

Serial Manager/New Serial Manager wrapper function for data reception.

Parameters:
portId port ID
rcvBufP ptr to receive buffer
count number of bytes to receive
timeout timeout in ticks
errP error code
Returns:
Number of bytes received.

Definition at line 85 of file Serial.c.

References gNewSerialManager.

Err DoReceiveCheck UInt16  portId,
UInt32 *  numBytesP
 

Serial Manager/New Serial Manager wrapper function to return the count of bytes presently in the receive queue.

Parameters:
portId port ID
numBytesP number of bytes in receive queue
Returns:
  • 0 if no error
  • serErrLineErr if line error pending

Definition at line 159 of file Serial.c.

References gNewSerialManager.

Err DoReceiveFlush UInt16  portId,
Int32  timeout
 

Definition at line 136 of file Serial.c.

References gNewSerialManager.

Referenced by ApproachFormHandleEvent(), DebugFormHandleEvent(), MainFormHandleEvent(), MapFormHandleEvent(), NavigationFormHandleEvent(), SkyviewFormHandleEvent(), and WayptEditFormHandleEvent().

Err DoReceiveWait UInt16  portId,
UInt32  bytes,
Int32  timeout
 

Serial Manager/New Serial Manager wrapper function to wait for at least specified number of bytes in receive buffer.

Parameters:
portId port ID
bytes number of bytes desired
timeout timeout in ticks
Returns:
Returns
  • 0 if successful
  • serErrTimeOut if timeout occurred
  • serErrLineErr if line error ocurred

Definition at line 128 of file Serial.c.

References gNewSerialManager.

Err DoSetReceiveBuffer UInt16  portId,
void *  bufP,
UInt16  bufSize
 

Serial Manager/New Serial Manager wrapper function to set receive buffer.

Parameters:
portId port ID
bufP ptr to receive buffer
bufSize size of buffer in bytes
Returns:
Returns 0 if successful.

Definition at line 105 of file Serial.c.

References gNewSerialManager.

Referenced by PortFormHandleEvent().

void FreeCncProfileList void   ) 
 

Deallocation of memory allocated by CncGetProfileList().

Definition at line 193 of file Serial.c.

References gNumProfiles, and gProfiles.


Variable Documentation

Boolean gCncManagerFtr
 

Connection Manager feature set available.

Definition at line 51 of file Serial.c.

Referenced by PortFormHandleEvent().

Boolean gNewSerialManager
 

New Serial Manager available.

Definition at line 48 of file Serial.c.

Referenced by DoClose(), DoReceive(), DoReceiveCheck(), DoReceiveFlush(), DoReceiveWait(), DoSetReceiveBuffer(), MainFormHandleEvent(), MapFormHandleEvent(), MapOptsFormHandleEvent(), MiscOptsFormHandleEvent(), NavigationFormHandleEvent(), RouteFormHandleEvent(), sermux_enable(), sermux_select(), SkyviewFormHandleEvent(), TrackFormHandleEvent(), and WaypointFormHandleEvent().

UInt16 gNumProfiles
 

Number of Connection Manager Profiles.

Definition at line 63 of file Serial.c.

UInt16 gPortID
 

Serial port ID.

Definition at line 54 of file Serial.c.

Char** gProfiles
 

List of Connection Manager Profiles.

Definition at line 60 of file Serial.c.

char gSerialBuffer[900]
 

Serial port receive buffer.

900 bytes should be more than enough for one second of data: 10 lines @ 80 chars per line.

Definition at line 70 of file Serial.c.

Referenced by PortFormHandleEvent().

UInt32 gSerialPort
 

four-character port name or logical port number (New Serial Manager)

Definition at line 57 of file Serial.c.


Created: Mon, 08 Oct 2007 22:33:16 +0200
Copyright ©2004 M. Prinke