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

@ -53,13 +53,19 @@ main(int argc, char **argv)
return 1;
}
if ((handle = mbus_connect_serial(device)) == NULL)
if ((handle = mbus_context_serial(device)) == NULL)
{
printf("Failed to setup connection to M-bus device: %s\n", mbus_error_str());
fprintf(stderr, "Could not initialize M-Bus context: %s\n", mbus_error_str());
return 1;
}
if (mbus_serial_set_baudrate(handle->m_serial_handle, baudrate) == -1)
if (!mbus_connect(handle))
{
printf("Failed to setup connection to M-bus gateway\n");
return 1;
}
if (mbus_serial_set_baudrate(handle, baudrate) == -1)
{
printf("Failed to set baud rate.\n");
return 1;
@ -113,6 +119,7 @@ main(int argc, char **argv)
free(addr);
mbus_disconnect(handle);
mbus_context_free(handle);
return 0;
}