Main Page | Modules | Data Structures | Directories | File List | Data Fields | Globals | Related Pages

STX/ETX Packet Protocol Library (stxetx.c)
[General Libraries]

Detailed Description

 #include "stxetx.h" 
This library provides functions needed to transmit and receive STX/ETX packets over any interface which can send and receive bytes.  STX/ETX is a simple packet protocol for serial data streams and offers packetization, type tagging, and checksum protection for user data.  Common uses of STX/ETX might include radio communications were it can improve data reliability over lossy channels.  STX/ETX may also be used effectively anywhere multiple access to the communication medium is required.  The packets can be made to contain destination addresses or routing information as well as data.
STX/ETX Details
STX/ETX is a simple packet protocol that can be wrapped around user data for one or more of the following reasons: 1. packetization is needed
STX/ETX packets have the following structure:

[STX][status][type][length][user data...][checksum][ETX]

All fields are 1 byte except for user data which may be 0-255 bytes. Uppercase fields are constant (STX=0x02, ETX=0x03), lowercase fields vary. The length field is the number of bytes in the user data area. The checksum is the 8-bit sum of all bytes between but not including STX/ETX.


#define STX   0x02
#define ETX   0x03


void stxetxInit (void(*dataout_func)(unsigned char data))
 Initialize STX/ETX packet protocol library.
void stxetxSend (unsigned char status, unsigned char type, unsigned char datalength, unsigned char *dataptr)
 Send/Create STX/ETX packet.
unsigned char stxetxProcess (cBuffer *rxBuffer)
 Process a buffer containing STX/ETX packets.
unsigned char stxetxGetRxPacketStatus (void)
 Returns the received packet's status.
unsigned char stxetxGetRxPacketType (void)
 Returns the received packet's type.
unsigned char stxetxGetRxPacketDatalength (void)
 Returns the received packet's datalength.
unsigned char * stxetxGetRxPacketData (void)
 Returns pointer to the received packet's data.

Generated on Sun Oct 29 03:41:09 2006 for Procyon AVRlib by  doxygen 1.4.2