Replaced magic resultcodes from mbus_recv_frame with defines
This commit is contained in:
@ -132,7 +132,7 @@ main(int argc, char **argv)
|
||||
}
|
||||
}
|
||||
|
||||
if (mbus_recv_frame(handle, &reply) != 0)
|
||||
if (mbus_recv_frame(handle, &reply) != MBUS_RECV_RESULT_OK)
|
||||
{
|
||||
fprintf(stderr, "Failed to receive M-Bus response frame.\n");
|
||||
return 1;
|
||||
|
@ -103,7 +103,7 @@ main(int argc, char **argv)
|
||||
|
||||
ret = mbus_recv_frame(handle, &reply);
|
||||
|
||||
if (ret == -3)
|
||||
if (ret == MBUS_RECV_RESULT_TIMEOUT)
|
||||
{
|
||||
continue;
|
||||
}
|
||||
@ -111,7 +111,7 @@ main(int argc, char **argv)
|
||||
if (debug)
|
||||
printf("\n");
|
||||
|
||||
if (ret == -2)
|
||||
if (ret == MBUS_RECV_RESULT_INVALID)
|
||||
{
|
||||
/* check for more data (collision) */
|
||||
mbus_purge_frames(handle);
|
||||
|
@ -79,13 +79,13 @@ main(int argc, char **argv)
|
||||
|
||||
ret = mbus_recv_frame(handle, &reply);
|
||||
|
||||
if (ret == -3)
|
||||
if (ret == MBUS_RECV_RESULT_TIMEOUT)
|
||||
{
|
||||
printf("No reply from device with secondary address %s: %s\n", argv[2], mbus_error_str());
|
||||
return 1;
|
||||
}
|
||||
|
||||
if (ret == -2)
|
||||
if (ret == MBUS_RECV_RESULT_INVALID)
|
||||
{
|
||||
printf("Invalid reply from %s: The address address probably match more than one device: %s\n", argv[2], mbus_error_str());
|
||||
return 1;
|
||||
@ -99,7 +99,7 @@ main(int argc, char **argv)
|
||||
return 1;
|
||||
}
|
||||
|
||||
if (mbus_recv_frame(handle, &reply) != 0)
|
||||
if (mbus_recv_frame(handle, &reply) != MBUS_RECV_RESULT_OK)
|
||||
{
|
||||
printf("Failed to recieve reply from selected secondary device: %s\n", mbus_error_str());
|
||||
return 1;
|
||||
|
@ -78,7 +78,7 @@ main(int argc, char **argv)
|
||||
|
||||
ret = mbus_recv_frame(handle, &reply);
|
||||
|
||||
if (ret == -3)
|
||||
if (ret == MBUS_RECV_RESULT_TIMEOUT)
|
||||
{
|
||||
printf("No reply from device\n");
|
||||
return 1;
|
||||
|
@ -117,7 +117,7 @@ main(int argc, char **argv)
|
||||
}
|
||||
}
|
||||
|
||||
if (mbus_recv_frame(handle, &reply) != 0)
|
||||
if (mbus_recv_frame(handle, &reply) != MBUS_RECV_RESULT_OK)
|
||||
{
|
||||
fprintf(stderr, "Failed to receive M-Bus response frame: %s\n", mbus_error_str());
|
||||
return 1;
|
||||
|
@ -86,7 +86,7 @@ main(int argc, char **argv)
|
||||
|
||||
ret = mbus_recv_frame(handle, &reply);
|
||||
|
||||
if (ret == -3)
|
||||
if (ret == MBUS_RECV_RESULT_TIMEOUT)
|
||||
{
|
||||
continue;
|
||||
}
|
||||
@ -94,7 +94,7 @@ main(int argc, char **argv)
|
||||
if (debug)
|
||||
printf("\n");
|
||||
|
||||
if (ret == -2)
|
||||
if (ret == MBUS_RECV_RESULT_INVALID)
|
||||
{
|
||||
/* check for more data (collision) */
|
||||
mbus_purge_frames(handle);
|
||||
|
@ -65,13 +65,13 @@ main(int argc, char **argv)
|
||||
|
||||
ret = mbus_recv_frame(handle, &reply);
|
||||
|
||||
if (ret == -3)
|
||||
if (ret == MBUS_RECV_RESULT_TIMEOUT)
|
||||
{
|
||||
printf("No reply from device with secondary address %s: %s\n", argv[3], mbus_error_str());
|
||||
return 1;
|
||||
}
|
||||
|
||||
if (ret == -2)
|
||||
if (ret == MBUS_RECV_RESULT_INVALID)
|
||||
{
|
||||
printf("Invalid reply from %s: The address address probably match more than one device: %s\n", argv[3], mbus_error_str());
|
||||
return 1;
|
||||
@ -85,7 +85,7 @@ main(int argc, char **argv)
|
||||
return 1;
|
||||
}
|
||||
|
||||
if (mbus_recv_frame(handle, &reply) != 0)
|
||||
if (mbus_recv_frame(handle, &reply) != MBUS_RECV_RESULT_OK)
|
||||
{
|
||||
printf("Failed to recieve reply from selected secondary device: %s\n", mbus_error_str());
|
||||
return 1;
|
||||
|
Reference in New Issue
Block a user