Examples from bin directory updated. API usage updated in mbus-protocol-aux.h.
This commit is contained in:
14
bin/mbus-serial-scan-secondary.c
Normal file → Executable file
14
bin/mbus-serial-scan-secondary.c
Normal file → Executable file
@ -102,13 +102,19 @@ main(int argc, char **argv)
|
||||
return 1;
|
||||
}
|
||||
|
||||
if ((handle = mbus_connect_serial(device)) == NULL)
|
||||
if ((handle = mbus_context_serial(device)) == NULL)
|
||||
{
|
||||
fprintf(stderr, "Failed to setup connection to M-bus gateway: %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)
|
||||
{
|
||||
fprintf(stderr, "Failed to set baud rate.\n");
|
||||
return 1;
|
||||
@ -153,7 +159,7 @@ main(int argc, char **argv)
|
||||
mbus_scan_2nd_address_range(handle, 0, addr_mask);
|
||||
|
||||
mbus_disconnect(handle);
|
||||
|
||||
mbus_context_free(handle);
|
||||
//printf("Summary: Tried %ld address masks and found %d devices.\n", probe_count, match_count);
|
||||
|
||||
free(addr_mask);
|
||||
|
Reference in New Issue
Block a user