PortableSerialLib  v0.4
a portable serial port lib
Functions
Serial Port Utility Functions

This functions are not related to a specific port object but provide some useful functionality.

Functions

PSL_ErrorCodes_e PSerLib_getAvailablePorts (char *o_names, int i_maxlen, int *o_numPortsFound)
 returns a list with device names of available serial ports
const char * PSerLib_getErrorMessage (PSL_ErrorCodes_e i_errorCode)
 translates an error code in something printable

Function Documentation

PSL_ErrorCodes_e PSerLib_getAvailablePorts ( char *  o_names,
int  i_maxlen,
int *  o_numPortsFound 
)

returns a list with device names of available serial ports

Parameters:
o_namesbuffer for output
Each device name is quit a \0 character. An empty name indicates the end of the list.
Look at details - section for an example how to use the output.
i_maxlenlength of buffer
o_numPortsFoundpointer to variable that receives the number of ports found
Returns:
PSL_ERROR_none if successful else another error code

Fiddeling out devices may be done in following fashion:

 {.c}
  char buff[1000];
  char* iterator = buff;
  int n;
  PSerLib_getAvailablePorts(buff, sizeof(buff), &n);
  printf("found %i devices:\n", n);
  for( ;*iterator; iterator+=strlen(iterator)+1 )
  {
    printf("%s\n",iterator);
  }
const char* PSerLib_getErrorMessage ( PSL_ErrorCodes_e  i_errorCode)

translates an error code in something printable

Parameters:
i_errorCodethe error code to translate
Returns:
pointer to a null-terminated string that gives a short description of the error