Examples from bin directory updated. API usage updated in mbus-protocol-aux.h.

This commit is contained in:
jakubovsky
2012-07-04 19:49:54 +02:00
parent 34255c7237
commit ec50ab9286
14 changed files with 111 additions and 32 deletions

View File

@ -1336,7 +1336,7 @@ mbus_context_serial(const char *device)
handle->close = mbus_serial_disconnect;
handle->recv = mbus_serial_recv_frame;
handle->send = mbus_serial_send_frame;
handle->free_auxdata = mbus_tcp_data_free;
handle->free_auxdata = mbus_serial_data_free;
if ((serial_data->device = strdup(device)) == NULL)
{
@ -1403,7 +1403,7 @@ mbus_context_free(mbus_handle * handle)
}
int
modbus_connect(mbus_handle * handle)
mbus_connect(mbus_handle * handle)
{
if (handle == NULL)
{

View File

@ -20,9 +20,11 @@
* the data processing.
* Typical use might be (in oversimplified "pseudocode"):
* \verbatim
* mbus_handle = mbus_connect_serial(device);
* mbus_handle = mbus_context_serial(device);
* or
* mbus_handle = mbus_connect_tcp(host, port);
* mbus_handle = mbus_context_tcp(host, port);
*
* mbus_connect(mbus_handle);
*
* ...
*
@ -45,6 +47,7 @@
* ...
*
* mbus_disconnect(mbus_handle);
* mbus_context_free(mbus_handle);
* \endverbatim
*
* Note that the quantity values are partially "normalized". For example energy

View File

@ -81,8 +81,8 @@ mbus_tcp_connect(mbus_handle *handle)
}
// Set a timeout
time_out.tv_sec = 0; //seconds
time_out.tv_usec = 100000;
time_out.tv_sec = 4; //seconds
time_out.tv_usec = 0;
setsockopt(handle->fd, SOL_SOCKET, SO_SNDTIMEO, &time_out, sizeof(time_out));
setsockopt(handle->fd, SOL_SOCKET, SO_RCVTIMEO, &time_out, sizeof(time_out));
@ -189,7 +189,7 @@ retry:
goto retry;
if (errno == EAGAIN || errno == EWOULDBLOCK) {
mbus_error_str_set("M-Bus tcp transport layer timeout has been reached.");
mbus_error_str_set("M-Bus tcp transport layer response timeout has been reached.");
return -3;
}