#include <stdio.h>
#include <stdlib.h>
#include <string.h>
Go to the source code of this file.
Classes | |
struct | serial_port_t |
Macros | |
#define | BAUDRATE_1000000 1000000 |
#define | BAUDRATE_115200 115200 |
#define | BAUDRATE_1200 1200 |
#define | BAUDRATE_1220000 1220000 |
#define | BAUDRATE_1440000 1440000 |
#define | BAUDRATE_1500000 1500000 |
#define | BAUDRATE_19200 19200 |
#define | BAUDRATE_2000000 2000000 |
#define | BAUDRATE_230400 230400 |
#define | BAUDRATE_2400 2400 |
#define | BAUDRATE_300 300 |
#define | BAUDRATE_3000000 3000000 |
#define | BAUDRATE_38400 38400 |
#define | BAUDRATE_460800 460800 |
#define | BAUDRATE_4800 4800 |
#define | BAUDRATE_57600 57600 |
#define | BAUDRATE_600 600 |
#define | BAUDRATE_921600 921600 |
#define | BAUDRATE_9600 9600 |
#define | MAX_SERIAL_PORT_NAME_LENGTH 63 |
Typedefs | |
typedef int(* | pfnSerialPortAsyncRead) (serial_port_t *serialPort, unsigned char *buf, int len, pfnSerialPortAsyncReadCompletion completion) |
typedef void(* | pfnSerialPortAsyncReadCompletion) (serial_port_t *serialPort, unsigned char *buf, int len, int errorCode) |
typedef int(* | pfnSerialPortClose) (serial_port_t *serialPort) |
typedef int(* | pfnSerialPortFlush) (serial_port_t *serialPort) |
typedef int(* | pfnSerialPortGetByteCountAvailableToRead) (serial_port_t *serialPort) |
typedef int(* | pfnSerialPortGetByteCountAvailableToWrite) (serial_port_t *serialPort) |
typedef int(* | pfnSerialPortIsOpen) (serial_port_t *serialPort) |
typedef int(* | pfnSerialPortOpen) (serial_port_t *serialPort, const char *port, int baudRate, int blocking) |
typedef int(* | pfnSerialPortRead) (serial_port_t *serialPort, unsigned char *buf, int len, int timeoutMilliseconds) |
typedef int(* | pfnSerialPortSleep) (int sleepMilliseconds) |
typedef int(* | pfnSerialPortWrite) (serial_port_t *serialPort, const unsigned char *buf, int len) |
typedef struct serial_port_t | serial_port_t |
Functions | |
int | serialPortClose (serial_port_t *serialPort) |
int | serialPortFlush (serial_port_t *serialPort) |
int | serialPortGetByteCountAvailableToRead (serial_port_t *serialPort) |
int | serialPortGetByteCountAvailableToWrite (serial_port_t *serialPort) |
int | serialPortIsOpen (serial_port_t *serialPort) |
int | serialPortOpen (serial_port_t *serialPort, const char *port, int baudRate, int blocking) |
int | serialPortOpenRetry (serial_port_t *serialPort, const char *port, int baudRate, int blocking) |
int | serialPortRead (serial_port_t *serialPort, unsigned char *buffer, int readCount) |
int | serialPortReadAscii (serial_port_t *serialPort, unsigned char *buffer, int bufferLength, unsigned char **asciiData) |
int | serialPortReadAsciiTimeout (serial_port_t *serialPort, unsigned char *buffer, int bufferLength, int timeoutMilliseconds, unsigned char **asciiData) |
int | serialPortReadChar (serial_port_t *serialPort, unsigned char *c) |
int | serialPortReadCharTimeout (serial_port_t *serialPort, unsigned char *c, int timeoutMilliseconds) |
int | serialPortReadLine (serial_port_t *serialPort, unsigned char *buffer, int bufferLength) |
int | serialPortReadLineTimeout (serial_port_t *serialPort, unsigned char *buffer, int bufferLength, int timeoutMilliseconds) |
int | serialPortReadTimeout (serial_port_t *serialPort, unsigned char *buffer, int readCount, int timeoutMilliseconds) |
int | serialPortReadTimeoutAsync (serial_port_t *serialPort, unsigned char *buffer, int readCount, pfnSerialPortAsyncReadCompletion callback) |
void | serialPortSetPort (serial_port_t *serialPort, const char *port) |
int | serialPortSleep (serial_port_t *serialPort, int sleepMilliseconds) |
int | serialPortWaitFor (serial_port_t *serialPort, const unsigned char *waitFor, int waitForLength) |
int | serialPortWaitForTimeout (serial_port_t *serialPort, const unsigned char *waitFor, int waitForLength, int timeoutMilliseconds) |
int | serialPortWrite (serial_port_t *serialPort, const unsigned char *buffer, int writeCount) |
int | serialPortWriteAndWaitFor (serial_port_t *serialPort, const unsigned char *buffer, int writeCount, const unsigned char *waitFor, int waitForLength) |
int | serialPortWriteAndWaitForTimeout (serial_port_t *serialPort, const unsigned char *buffer, int writeCount, const unsigned char *waitFor, int waitForLength, const int timeoutMilliseconds) |
int | serialPortWriteAscii (serial_port_t *serialPort, const char *buffer, int bufferLength) |
int | serialPortWriteLine (serial_port_t *serialPort, const unsigned char *buffer, int writeCount) |
Variables | |
int | SERIAL_PORT_DEFAULT_TIMEOUT |
#define BAUDRATE_1000000 1000000 |
Definition at line 42 of file serialPort.h.
#define BAUDRATE_115200 115200 |
Definition at line 38 of file serialPort.h.
#define BAUDRATE_1200 1200 |
Definition at line 31 of file serialPort.h.
#define BAUDRATE_1220000 1220000 |
Definition at line 43 of file serialPort.h.
#define BAUDRATE_1440000 1440000 |
Definition at line 44 of file serialPort.h.
#define BAUDRATE_1500000 1500000 |
Definition at line 45 of file serialPort.h.
#define BAUDRATE_19200 19200 |
Definition at line 35 of file serialPort.h.
#define BAUDRATE_2000000 2000000 |
Definition at line 46 of file serialPort.h.
#define BAUDRATE_230400 230400 |
Definition at line 39 of file serialPort.h.
#define BAUDRATE_2400 2400 |
Definition at line 32 of file serialPort.h.
#define BAUDRATE_300 300 |
Definition at line 29 of file serialPort.h.
#define BAUDRATE_3000000 3000000 |
Definition at line 47 of file serialPort.h.
#define BAUDRATE_38400 38400 |
Definition at line 36 of file serialPort.h.
#define BAUDRATE_460800 460800 |
Definition at line 40 of file serialPort.h.
#define BAUDRATE_4800 4800 |
Definition at line 33 of file serialPort.h.
#define BAUDRATE_57600 57600 |
Definition at line 37 of file serialPort.h.
#define BAUDRATE_600 600 |
Definition at line 30 of file serialPort.h.
#define BAUDRATE_921600 921600 |
Definition at line 41 of file serialPort.h.
#define BAUDRATE_9600 9600 |
Definition at line 34 of file serialPort.h.
#define MAX_SERIAL_PORT_NAME_LENGTH 63 |
Definition at line 26 of file serialPort.h.
typedef int(* pfnSerialPortAsyncRead) (serial_port_t *serialPort, unsigned char *buf, int len, pfnSerialPortAsyncReadCompletion completion) |
Definition at line 55 of file serialPort.h.
typedef void(* pfnSerialPortAsyncReadCompletion) (serial_port_t *serialPort, unsigned char *buf, int len, int errorCode) |
Definition at line 54 of file serialPort.h.
typedef int(* pfnSerialPortClose) (serial_port_t *serialPort) |
Definition at line 57 of file serialPort.h.
typedef int(* pfnSerialPortFlush) (serial_port_t *serialPort) |
Definition at line 58 of file serialPort.h.
typedef int(* pfnSerialPortGetByteCountAvailableToRead) (serial_port_t *serialPort) |
Definition at line 59 of file serialPort.h.
typedef int(* pfnSerialPortGetByteCountAvailableToWrite) (serial_port_t *serialPort) |
Definition at line 60 of file serialPort.h.
typedef int(* pfnSerialPortIsOpen) (serial_port_t *serialPort) |
Definition at line 52 of file serialPort.h.
typedef int(* pfnSerialPortOpen) (serial_port_t *serialPort, const char *port, int baudRate, int blocking) |
Definition at line 51 of file serialPort.h.
typedef int(* pfnSerialPortRead) (serial_port_t *serialPort, unsigned char *buf, int len, int timeoutMilliseconds) |
Definition at line 53 of file serialPort.h.
typedef int(* pfnSerialPortSleep) (int sleepMilliseconds) |
Definition at line 61 of file serialPort.h.
typedef int(* pfnSerialPortWrite) (serial_port_t *serialPort, const unsigned char *buf, int len) |
Definition at line 56 of file serialPort.h.
typedef struct serial_port_t serial_port_t |
Definition at line 49 of file serialPort.h.
int serialPortClose | ( | serial_port_t * | serialPort | ) |
Definition at line 66 of file serialPort.c.
int serialPortFlush | ( | serial_port_t * | serialPort | ) |
Definition at line 75 of file serialPort.c.
int serialPortGetByteCountAvailableToRead | ( | serial_port_t * | serialPort | ) |
Definition at line 329 of file serialPort.c.
int serialPortGetByteCountAvailableToWrite | ( | serial_port_t * | serialPort | ) |
Definition at line 339 of file serialPort.c.
int serialPortIsOpen | ( | serial_port_t * | serialPort | ) |
Definition at line 57 of file serialPort.c.
int serialPortOpen | ( | serial_port_t * | serialPort, |
const char * | port, | ||
int | baudRate, | ||
int | blocking | ||
) |
Definition at line 28 of file serialPort.c.
int serialPortOpenRetry | ( | serial_port_t * | serialPort, |
const char * | port, | ||
int | baudRate, | ||
int | blocking | ||
) |
Definition at line 37 of file serialPort.c.
int serialPortRead | ( | serial_port_t * | serialPort, |
unsigned char * | buffer, | ||
int | readCount | ||
) |
Definition at line 84 of file serialPort.c.
int serialPortReadAscii | ( | serial_port_t * | serialPort, |
unsigned char * | buffer, | ||
int | bufferLength, | ||
unsigned char ** | asciiData | ||
) |
Definition at line 145 of file serialPort.c.
int serialPortReadAsciiTimeout | ( | serial_port_t * | serialPort, |
unsigned char * | buffer, | ||
int | bufferLength, | ||
int | timeoutMilliseconds, | ||
unsigned char ** | asciiData | ||
) |
Definition at line 150 of file serialPort.c.
int serialPortReadChar | ( | serial_port_t * | serialPort, |
unsigned char * | c | ||
) |
Definition at line 191 of file serialPort.c.
int serialPortReadCharTimeout | ( | serial_port_t * | serialPort, |
unsigned char * | c, | ||
int | timeoutMilliseconds | ||
) |
Definition at line 196 of file serialPort.c.
int serialPortReadLine | ( | serial_port_t * | serialPort, |
unsigned char * | buffer, | ||
int | bufferLength | ||
) |
Definition at line 116 of file serialPort.c.
int serialPortReadLineTimeout | ( | serial_port_t * | serialPort, |
unsigned char * | buffer, | ||
int | bufferLength, | ||
int | timeoutMilliseconds | ||
) |
Definition at line 121 of file serialPort.c.
int serialPortReadTimeout | ( | serial_port_t * | serialPort, |
unsigned char * | buffer, | ||
int | readCount, | ||
int | timeoutMilliseconds | ||
) |
Definition at line 89 of file serialPort.c.
int serialPortReadTimeoutAsync | ( | serial_port_t * | serialPort, |
unsigned char * | buffer, | ||
int | readCount, | ||
pfnSerialPortAsyncReadCompletion | callback | ||
) |
Definition at line 106 of file serialPort.c.
void serialPortSetPort | ( | serial_port_t * | serialPort, |
const char * | port | ||
) |
Definition at line 18 of file serialPort.c.
int serialPortSleep | ( | serial_port_t * | serialPort, |
int | sleepMilliseconds | ||
) |
Definition at line 349 of file serialPort.c.
int serialPortWaitFor | ( | serial_port_t * | serialPort, |
const unsigned char * | waitFor, | ||
int | waitForLength | ||
) |
Definition at line 303 of file serialPort.c.
int serialPortWaitForTimeout | ( | serial_port_t * | serialPort, |
const unsigned char * | waitFor, | ||
int | waitForLength, | ||
int | timeoutMilliseconds | ||
) |
Definition at line 308 of file serialPort.c.
int serialPortWrite | ( | serial_port_t * | serialPort, |
const unsigned char * | buffer, | ||
int | writeCount | ||
) |
Definition at line 201 of file serialPort.c.
int serialPortWriteAndWaitFor | ( | serial_port_t * | serialPort, |
const unsigned char * | buffer, | ||
int | writeCount, | ||
const unsigned char * | waitFor, | ||
int | waitForLength | ||
) |
Definition at line 281 of file serialPort.c.
int serialPortWriteAndWaitForTimeout | ( | serial_port_t * | serialPort, |
const unsigned char * | buffer, | ||
int | writeCount, | ||
const unsigned char * | waitFor, | ||
int | waitForLength, | ||
const int | timeoutMilliseconds | ||
) |
Definition at line 286 of file serialPort.c.
int serialPortWriteAscii | ( | serial_port_t * | serialPort, |
const char * | buffer, | ||
int | bufferLength | ||
) |
Definition at line 230 of file serialPort.c.
int serialPortWriteLine | ( | serial_port_t * | serialPort, |
const unsigned char * | buffer, | ||
int | writeCount | ||
) |
Definition at line 218 of file serialPort.c.
int SERIAL_PORT_DEFAULT_TIMEOUT |
Definition at line 16 of file serialPort.c.