Wiicom API Lib
|
Wiicom virtual com port library. Continua...
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <stdint.h>
#include "wiicom_libutil.h"
#include <fcntl.h>
#include <termios.h>
#include <sys/ioctl.h>
#include <unistd.h>
#include <sys/types.h>
#include <sys/stat.h>
#include <limits.h>
Vai al codice sorgente di questo file.
Definizioni | |
Virtual com port Baud rate speeds | |
#define | WIICOM_VCP_BAUDRATE_50 50 |
#define | WIICOM_VCP_BAUDRATE_75 75 |
#define | WIICOM_VCP_BAUDRATE_110 110 |
#define | WIICOM_VCP_BAUDRATE_134 134 |
#define | WIICOM_VCP_BAUDRATE_150 150 |
#define | WIICOM_VCP_BAUDRATE_200 200 |
#define | WIICOM_VCP_BAUDRATE_300 300 |
#define | WIICOM_VCP_BAUDRATE_600 600 |
#define | WIICOM_VCP_BAUDRATE_1200 1200 |
#define | WIICOM_VCP_BAUDRATE_1800 1800 |
#define | WIICOM_VCP_BAUDRATE_2400 2400 |
#define | WIICOM_VCP_BAUDRATE_4800 4800 |
#define | WIICOM_VCP_BAUDRATE_9600 9600 |
#define | WIICOM_VCP_BAUDRATE_19200 19200 |
#define | WIICOM_VCP_BAUDRATE_38400 38400 |
#define | WIICOM_VCP_BAUDRATE_57600 57600 |
#define | WIICOM_VCP_BAUDRATE_115200 115200 |
#define | WIICOM_VCP_BAUDRATE_128000 128000 |
#define | WIICOM_VCP_BAUDRATE_230400 230400 |
#define | WIICOM_VCP_BAUDRATE_256000 256000 |
Data bits size | |
#define | WIICOM_VCP_DATA_BITS_SIZE_5 5 |
#define | WIICOM_VCP_DATA_BITS_SIZE_6 6 |
#define | WIICOM_VCP_DATA_BITS_SIZE_7 7 |
#define | WIICOM_VCP_DATA_BITS_SIZE_8 8 |
Ridefinizioni di tipo (typedef) | |
typedef int | t_wiicom_libvcp_handle |
Parity type | |
#define | WIICOM_VCP_NOPARITY 0 |
#define | WIICOM_VCP_EVENPARITY 1 |
#define | WIICOM_VCP_ODDPARITY 2 |
void | wiicom_libvcp_init () |
Function that initializes the vitual com port library Warning! This function should be called before using the virtual com port. Continua... | |
uint8_t | wiicom_libvcp_open (t_wiicom_libvcp_handle *fd, char *device, uint32_t vcp_baudrate, uint8_t vcp_parity, uint8_t vcp_stop2bit, uint8_t vcp_data_bits_size) |
Function that open a VCP and returns a VCP handle. Continua... | |
void | wiicom_libvcp_close (t_wiicom_libvcp_handle fd) |
Function that close a VCP handle. Continua... | |
long | wiicom_libvcp_read (t_wiicom_libvcp_handle fd, uint8_t *buffer, uint32_t buffer_size) |
Function that read data from a VCP handle. Continua... | |
long | wiicom_libvcp_write (t_wiicom_libvcp_handle fd, uint8_t *buffer, uint32_t buffer_size) |
Function that write data to a VCP handle. Continua... | |
long | wiicom_libvcp_write_string (t_wiicom_libvcp_handle fd, char *string_to_write) |
Function that write a string to a VCP handle. Continua... | |
void | wiicom_libvcp_deinit () |
Function that de-initialize the vitual com port library Warning! This function is called when not used any more a VCP or, in general, before the close of the program. Continua... | |
int | wiicom_libvcp_getcomports (char ports[][15]) |
Function that get all system VCP Warning! This function works only on windows and linux system. Continua... | |
Wiicom virtual com port library.
Generic library for managing a virtual com port
#define WIICOM_VCP_BAUDRATE_110 110 |
#define WIICOM_VCP_BAUDRATE_115200 115200 |
#define WIICOM_VCP_BAUDRATE_1200 1200 |
#define WIICOM_VCP_BAUDRATE_128000 128000 |
Only on Windows system
#define WIICOM_VCP_BAUDRATE_134 134 |
Only on Unix like system
#define WIICOM_VCP_BAUDRATE_150 150 |
Only on Unix like system
#define WIICOM_VCP_BAUDRATE_1800 1800 |
Only on Unix like system
#define WIICOM_VCP_BAUDRATE_19200 19200 |
#define WIICOM_VCP_BAUDRATE_200 200 |
Only on Unix like system
#define WIICOM_VCP_BAUDRATE_230400 230400 |
Only on Unix like system
#define WIICOM_VCP_BAUDRATE_2400 2400 |
#define WIICOM_VCP_BAUDRATE_256000 256000 |
Only on Windows system
#define WIICOM_VCP_BAUDRATE_300 300 |
#define WIICOM_VCP_BAUDRATE_38400 38400 |
#define WIICOM_VCP_BAUDRATE_4800 4800 |
#define WIICOM_VCP_BAUDRATE_50 50 |
Only on Unix like system
#define WIICOM_VCP_BAUDRATE_57600 57600 |
#define WIICOM_VCP_BAUDRATE_600 600 |
#define WIICOM_VCP_BAUDRATE_75 75 |
Only on Unix like system
#define WIICOM_VCP_BAUDRATE_9600 9600 |
#define WIICOM_VCP_DATA_BITS_SIZE_5 5 |
#define WIICOM_VCP_DATA_BITS_SIZE_6 6 |
#define WIICOM_VCP_DATA_BITS_SIZE_7 7 |
#define WIICOM_VCP_DATA_BITS_SIZE_8 8 |
#define WIICOM_VCP_EVENPARITY 1 |
Use even parity check
#define WIICOM_VCP_NOPARITY 0 |
No parity check
#define WIICOM_VCP_ODDPARITY 2 |
Use odd parity instead of even check
typedef int t_wiicom_libvcp_handle |
void wiicom_libvcp_close | ( | t_wiicom_libvcp_handle | fd | ) |
Function that close a VCP handle.
[in] | fd | VCP handle |
void wiicom_libvcp_deinit | ( | ) |
Function that de-initialize the vitual com port library
Warning! This function is called when not used any more a VCP or, in general, before the close of the program.
int wiicom_libvcp_getcomports | ( | char | ports[][15] | ) |
Function that get all system VCP
Warning! This function works only on windows and linux system.
[out] | ports | array width discoverd ports |
void wiicom_libvcp_init | ( | ) |
Function that initializes the vitual com port library
Warning! This function should be called before using the virtual com port.
uint8_t wiicom_libvcp_open | ( | t_wiicom_libvcp_handle * | fd, |
char * | device, | ||
uint32_t | vcp_baudrate, | ||
uint8_t | vcp_parity, | ||
uint8_t | vcp_stop2bit, | ||
uint8_t | vcp_data_bits_size | ||
) |
Function that open a VCP and returns a VCP handle.
[out] | fd | VCP handle |
[in] | device | a virtual serial port device (Ex. /dev/stty0 on Unix like, \\\\.\\COM5 on Windows) |
[in] | vcp_baudrate | specifies a Baud rate speeds |
[in] | vcp_parity | specifies a parity type |
[in] | vcp_stop2bit | specifies if there is a 2 bits stop, otherwise there is 1 bit stop |
[in] | vcp_data_bits_size | it is a data bits size |
long wiicom_libvcp_read | ( | t_wiicom_libvcp_handle | fd, |
uint8_t * | buffer, | ||
uint32_t | buffer_size | ||
) |
Function that read data from a VCP handle.
[in] | fd | VCP handle |
[out] | buffer | buffer in which datas are loaded |
[in] | buffer_size | size of the buffer containing the data read |
long wiicom_libvcp_write | ( | t_wiicom_libvcp_handle | fd, |
uint8_t * | buffer, | ||
uint32_t | buffer_size | ||
) |
Function that write data to a VCP handle.
[in] | fd | VCP handle |
[in] | buffer | it contains data to send |
[in] | buffer_size | size of the buffer to send |
long wiicom_libvcp_write_string | ( | t_wiicom_libvcp_handle | fd, |
char * | string_to_write | ||
) |
Function that write a string to a VCP handle.
[in] | fd | VCP handle |
[in] | string_to_write | it contains a string to send |