#include <stdio.h>
#include <string.h>
#define FEED_SIZE (512)
#define MAX_PACKETS (100)
static void
{
if (status < 0) {
} else {
if (pending_blob) {
fprintf(stderr, "Could not send the pending blob!\n");
}
}
}
}
static bool
{
int err;
bool r = true;
if (err < 0) {
if (err == -ENOSPC) {
pending_blob = blob;
printf("No space left in the tx buffer - saving blob for later. Data: %.*s\n",
} else {
fprintf(stderr, "Could not not perform an UART write - Reason: %s\n",
r = false;
}
} else {
if (blob == pending_blob)
pending_blob = NULL;
}
return r;
}
static bool
{
void *v;
size_t size;
static uint16_t packets_created = 0;
bool keep_running = true;
int r;
if (pending_blob) {
printf("Waiting for blob data: %.*s to be transferred.\n",
return true;
}
packets_created++;
else {
keep_running = false;
}
if (r < 0) {
fprintf(stderr, "Could not create the UUID - Reason: %s\n",
goto err_exit;
}
v, size + 1);
if (!blob) {
fprintf(stderr, "Could not alloc memory for the blob\n");
goto err_exit;
}
goto err_exit;
if (!keep_running)
goto exit;
return true;
err_exit:
exit:
return false;
}
static ssize_t
{
char *sep;
sep = memchr(slice.
data,
'\0', slice.
len);
if (!sep)
return 0;
printf("\n\n** Consumer **: Received the close command\n\n");
} else {
printf("\n\n** Consumer ** : Received UUID %.*s\n\n",
}
}
static void
{
};
};
char **argv;
int argc;
if (argc < 3) {
fprintf(stderr, "Usage: %s <producerUART> <consumerUART>\n", argv[0]);
goto err_exit;
}
fprintf(stderr, "Could not create the producer!\n");
goto err_exit;
}
fprintf(stderr, "Could not create the consumer\n");
goto err_exit;
}
fprintf(stderr, "Could not create the producer timeout!\n");
goto err_exit;
}
return;
err_exit:
}
static void
{
if (pending_blob)
}