Wiicom API Lib
|
Wiicom Virtucal com port library. Continua...
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <stdint.h>
#include <errno.h>
#include <unistd.h>
Vai al codice sorgente di questo file.
Definizioni | |
#define | FALSE 0 |
#define | TRUE 1 |
#define | WIICOM_EWINSOCKETFAILURE -1 |
#define | WIICOM_ESOCKETCONNTIMEOUT -2 |
#define | WIICOM_ESOCKETRECVTIMEOUT -3 |
#define | WIICOM_EADDDATABLOCK -4 |
#define | WIICOM_EGETDATABLOCK -5 |
#define | WIICOM_EELABCOMM_MSG -6 |
#define | WIICOM_EVCPBAUD -7 |
#define | WIICOM_EVCPDATASIZE -8 |
#define | WIICOM_EVCPATTR -9 |
#define | WIICOM_EVCPPARITY -10 |
#define | WIICOM_ESETCMP_ALIAS -11 |
#define | WIICOM_ESETCMP_NET -12 |
#define | WIICOM_ESETCMP_UART -13 |
#define | WIICOM_ENOTSUPPORTED -14 |
#define | WIICOM_N_ERRNO -15 |
Funzioni | |
void | wiicom_util_perror (const char *string) |
Function that prints to stderr the description of the last error found. Continua... | |
const char * | wiicom_util_strerror (int16_t par_errnum) |
Function that returns the description for the error number passed as a parameter. Continua... | |
void | wiicom_util_set_errno (int32_t par_errnum) |
Function that sets the errno in the system error handling. Continua... | |
int32_t | wiicom_util_get_errno () |
Function that returns the last errno reported. Continua... | |
void | wiicom_util_set_err_msg (const char *string) |
Function that override the error description returned by wiicom_util_perror. Continua... | |
uint8_t | wiicom_util_isBigEndianSystem () |
Function that checks if the system is Big Endian. Continua... | |
uint16_t | wiicom_util_endianU16Conversion (uint16_t word) |
Function that reverses the order of the bytes of a uint16_t. Continua... | |
uint32_t | wiicom_util_endianU32Conversion (uint32_t dword) |
Function that reverses the order of the bytes of a uint32_t. Continua... | |
uint16_t | wiicom_util_CRC16 (uint8_t *msgByte, uint16_t msgByteLength) |
Function that computes CRC16 (standard Modbus CRC) of a sequence of bytes. Continua... | |
uint16_t | wiicom_util_walkingCRC16 (uint8_t msgByte, uint8_t msgStart) |
Function that calculates the CRC16 (standard Modbus CRC) of a sequence of bytes using only one byte of that sequence and its position. Continua... | |
void | wiicom_util_sleep (uint32_t millisec) |
Function that stop program execution for a number of milliseconds. Continua... | |
Wiicom Virtucal com port library.
Generic library for error handling, data conversion and calculation of CRC16 (Modbus standard CRC)
uint16_t wiicom_util_CRC16 | ( | uint8_t * | msgByte, |
uint16_t | msgByteLength | ||
) |
Function that computes CRC16 (standard Modbus CRC) of a sequence of bytes.
[in] | msgByte | Sequence of bytes on which you want to calculate the CRC16 |
[in] | msgByteLength | Number of bytes on which you want to calculate the CRC16 |
uint16_t wiicom_util_endianU16Conversion | ( | uint16_t | word | ) |
Function that reverses the order of the bytes of a uint16_t.
[in] | word | The number to convert |
uint32_t wiicom_util_endianU32Conversion | ( | uint32_t | dword | ) |
Function that reverses the order of the bytes of a uint32_t.
[in] | dword | The number to convert |
int32_t wiicom_util_get_errno | ( | ) |
Function that returns the last errno reported.
uint8_t wiicom_util_isBigEndianSystem | ( | ) |
Function that checks if the system is Big Endian.
void wiicom_util_perror | ( | const char * | string | ) |
Function that prints to stderr the description of the last error found.
[in] | string | Text to prepend to the error description |
void wiicom_util_set_err_msg | ( | const char * | string | ) |
Function that override the error description returned by wiicom_util_perror.
[in] | string | string to be used for overwriting |
void wiicom_util_set_errno | ( | int32_t | par_errnum | ) |
Function that sets the errno in the system error handling.
[in] | par_errnum | Error number to set |
void wiicom_util_sleep | ( | uint32_t | millisec | ) |
Function that stop program execution for a number of milliseconds.
[in] | number | of milliseconds |
const char* wiicom_util_strerror | ( | int16_t | par_errnum | ) |
Function that returns the description for the error number passed as a parameter.
[in] | par_errnum | Error number you want to have the description |
uint16_t wiicom_util_walkingCRC16 | ( | uint8_t | msgByte, |
uint8_t | msgStart | ||
) |
Function that calculates the CRC16 (standard Modbus CRC) of a sequence of bytes using only one byte of that sequence and its position.
[in] | msgByte | Byte on which you want to calculate the CRC16 |
[in] | msgStart | Byte position within the sequence of bytes |