Libsmr: Difference between revisions

From Rsewiki
(New page: LibSmr is the C programming library that enables C programs to communicate with the SMR sensor daemon, [smrd]. The library provides two types of functions: smr specific and low level. ''...)
 
No edit summary
Line 15: Line 15:
The following summary shows the function type declarations:
The following summary shows the function type declarations:


<pre>
#include <smr.h>
#include <smr.h>
</pre>


[struct smr] *[smr_connect](char *hostname, int port);
[[struct smr]] *[smr_connect](char *hostname, int port);


void [smr_disconnect]([struct smr] *robot);
void [smr_disconnect]([struct smr] *robot);

Revision as of 13:19, 29 September 2008

LibSmr is the C programming library that enables C programs to communicate with the SMR sensor daemon, [smrd].

The library provides two types of functions: smr specific and low level.

Smr specific functions

The library provides four C functions: smr_connect(), smr_disconnect(), smr_read() and smr_write(). These are modelled after similarly named functions familiar to C programmers, used for other kinds of input/output.

Central to all use of the smr specific functions if a struct smr datatype. A pointer to such a struct is returned by smr_connect(), and this pointer is used in all subsequent calls to smr_read() and smr_write(), and must finally be provided to smr_close().

To use the library, a header file must be included. The following summary shows the function type declarations:

#include <smr.h>

struct smr *[smr_connect](char *hostname, int port);

void [smr_disconnect]([struct smr] *robot);

int [smr_read]([struct smr] *robot);

int [smr_write]([struct smr] *robot);

Each function, and the smr struct datatype, is described on its own page.


Low level functions

The low level functions are not currently documented.