Studer Innotec Xtender Serial Communication C Library  1.5.0
 All Data Structures Files Functions Variables Enumerations Enumerator Macros Pages
usage_examples.c File Reference
#include <stdio.h>
#include <string.h>
#include <scom_property.h>

Functions

int initialize_serial_port ()
 configure the serial port More...
 
void clear_serial_port ()
 empty the rx and tx buffer before a new exchange
 
size_t read_serial_port (char *buffer, size_t byte_count)
 read in a blocking way on the serial port More...
 
size_t write_serial_port (const char *buffer, size_t byte_count)
 write in a blocking way on the serial port More...
 
void close_serial_port ()
 close the serial port even if initialize_serial_port() failed
 
scom_error_t exchange_frame (scom_frame_t *frame)
 example code to exchange a frame and print possible error on standard output More...
 
void read_xt1_uBat ()
 example code to read the battery voltage on Xtender 1 and print it to the standard output
 
int main ()
 

Detailed Description

examples of usage of the scom library

Function Documentation

scom_error_t exchange_frame ( scom_frame_t frame)

example code to exchange a frame and print possible error on standard output

Parameters
framean initialized frame configured for a service
Returns
a possible error that occurred or SCOM_NO_ERROR
int initialize_serial_port ( )

configure the serial port

Returns
zero in case of an error
size_t read_serial_port ( char *  buffer,
size_t  byte_count 
)

read in a blocking way on the serial port

This function must implement the proper timeout mechanism.

  • Returns
    number of byte read
size_t write_serial_port ( const char *  buffer,
size_t  byte_count 
)

write in a blocking way on the serial port

This function must implement the proper timeout mechanism.

Returns
number of byte written