PortableSerialLib  v0.2
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

int PSerLib_getAvailablePorts (char *o_names, int i_maxlen)
 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

int PSerLib_getAvailablePorts ( char *  o_names,
int  i_maxlen 
)

returns a list with device names of available serial ports

Parameters:
o_namesbuffer for output
Device names are each separated by a \0 character The last name is terminated by \0\0.
Look at details - section for an example how to use the output.
i_maxlenlength of buffer
Returns:
number of ports found if an error occurred then the negated PSL_ErrorCodes_e is returned.

Fiddeling out devices may be done in following fashion:

 {.c}
  char buff[1000];
  char* iterator = buff;
  int n = PSerLib_getAvailablePorts(buff, sizeof(buff));
  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