sportident.h File Reference

Go to the source code of this file.

Data Structures

struct  si_station
 struct for the configuration of a station to fill you need to do More...
struct  si_time
 Time record. More...
struct  si_punch
 A punching record. More...
struct  si_card
 struct representation of a control More...

Enumerations

enum  cards {
  SI_PCARD, SI_TCARD, SI_ACTIVE, SI_SIX = 0x06,
  SI_SIX_STAR, SI_EIGHT, SI_NINE
}
 

Enum to designate card type P Cards T cards and Active cards have not been given a real designation yet 6, 6*, 8, 9 cards are self explanitory.


enum  st_mode {
  SIREAD = 0x01, SISTART = 0x02, SIFINISH = 0x04, SICLEAR = 0x08,
  SICONTROL = 0x10, SIAUTO = 0x20, SIMASTER = 0x40
}
 

Enum to determine working mode of station SIREAD, SISTART, SIFINISH, SICLEAR, SICONTROL are mutally exclusive and ony one of those bytes should ever be set at once. They should be self explanitory. SIAUTO=1 the station will be in autosend mode SIAUTO=0 then station will be in handshake mode SIMASTER=1 Then anything done will be done directly with the main station. SIMASTER=0 then all communication will be done to the slave device.


Functions

int OpenStation (const char *, si_station *)
 A function to open a station connected to a tty device and initilize a si_control struct.
int CloseStation (si_station *)
 A function to close the connection to the station.
si_stationMakeStation ()
 A function to malloc and initilize a si_control struct to zero.
unsigned int SiCrc (unsigned int, const unsigned char *)
 A function to return CRC values used by SPORTident.
int WriteRaw (const si_station *, unsigned char *, int)
 This writes to the station the exact data you send it.
int ReadRaw (const si_station *, unsigned char *, int)
 This reads to the station the exact data you send it.

Detailed Description

Author:
Dylan (smellyfis) Thies <dylan.thies@lostorienteerer.net>
Version:
0.1.1

LICENSE

This Program/Library is open source software; you may redistribute and/or modify it as long as the resulting program/library is under a FOSS license or with the approval of the authors or owning group

This Program is distributed in hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE

DESCRIPTION

This is a file to include with the use of the LibSportIdent. It has all of the external functions and macros needed to it

Definition in file sportident.h.


Function Documentation

int CloseStation ( si_station station  ) 

A function to close the connection to the station.

this just resets the fd to zero and closes the connection to the station. so make sure that you free the station accordingly.

Parameters:
station the staion to close
Returns:
0 or higher on success and -1 on error
See also:
free(), OpenStation()

Definition at line 33 of file closestation.c.

si_station* MakeStation (  ) 

A function to malloc and initilize a si_control struct to zero.

Be careful you must call MakeStation() on station or you must properly free() it. This makes a control where 0 is set to the deult if all the params are null or zero. othere wise sets specific portion to the struct corialating to it's position

See also:
free()
Returns:
NULL if failure pointer to si_control struct if sucess
Todo:
add params

Definition at line 31 of file makestation.c.

int OpenStation ( const char *  fd,
si_station station 
)

A function to open a station connected to a tty device and initilize a si_control struct.

Be careful you must call MakeStation() on station or you must properly malloc() it.

See also:
malloc(), MakeStation()
Parameters:
fd a character string of the fully qualified path
station a pointer to a si_station struct to be saved to or initilized
Returns:
integer if success -1 on failure
Todo:

add more information to failure cases

implement test to check baud rate and extended mode

populate the rest of station

Definition at line 39 of file openstation.c.

int ReadRaw ( const si_station station,
unsigned char *  buffer,
int  len 
)

This reads to the station the exact data you send it.

this is a wrapper for read.

Parameters:
station the device to read from
buffer the buffer to be read from device
len length of buffer to read
Returns:
number of bytes read.
Todo:
make sure legacy mode remove delimeters

Definition at line 35 of file readraw.c.

unsigned int SiCrc ( unsigned int  len,
const unsigned char *  data 
)

A function to return CRC values used by SPORTident.

It uses ANSI CRC-16

Parameters:
len The length of the byte string data.
data The byte string of what you want to encode.
Returns:
A CRC value of data

Definition at line 37 of file crc529.c.

int WriteRaw ( const si_station station,
unsigned char *  buffer,
int  len 
)

This writes to the station the exact data you send it.

it prepends '0xff 0x02 0x02' and appends the crc and '0x03' must

Parameters:
station the device to write to
buffer the buffer to be written to device
len length of buffer to write
Returns:
number of bytes written.
Todo:
make sure legacy mode adds delimeters

Definition at line 36 of file writeraw.c.

All Data Structures Files Functions Variables Enumerations Defines
Generated on Sat May 22 20:28:32 2010 for LibSportIdent by  doxygen 1.6.3