diff options
author | Jean-Baptiste Maillet <jean-baptiste.maillet@parrot.com> | 2014-12-08 13:20:02 +0100 |
---|---|---|
committer | Jean-Baptiste Maillet <jean-baptiste.maillet@parrot.com> | 2014-12-08 13:20:02 +0100 |
commit | 1442d9715e59aa641656922a03f0c19fc2e2e04d (patch) | |
tree | 8145d749edc5cbc1a3056c5ac5faf678797e8a56 /examples/simple_talker | |
parent | 4e20fe6ad03ff3ba1695a29243c2998d83db73a6 (diff) | |
download | Open-AVB-1442d9715e59aa641656922a03f0c19fc2e2e04d.tar.gz |
MRP client code talker side: except for send_mrp_msg(), fincs return 0 or -1
Callers of send_mrp_msg() are able to ckeck the message length returned.
Callers of higher level functions get 0 for sucess, -1 for failure.
Diffstat (limited to 'examples/simple_talker')
-rwxr-xr-x | examples/simple_talker/simple_talker.c | 43 |
1 files changed, 35 insertions, 8 deletions
diff --git a/examples/simple_talker/simple_talker.c b/examples/simple_talker/simple_talker.c index d465b5a6..736480d0 100755 --- a/examples/simple_talker/simple_talker.c +++ b/examples/simple_talker/simple_talker.c @@ -566,7 +566,12 @@ int main(int argc, char *argv[]) } - mrp_monitor(); + rc = mrp_monitor(); + if (rc) { + printf("failed creating MRP monitor thread\n"); + return EXIT_FAILURE; + } + /* * should use mrp_get_domain() but this is a simplification */ @@ -577,9 +582,17 @@ int main(int argc, char *argv[]) printf("detected domain Class A PRIO=%d VID=%04x...\n", domain_class_a_priority, domain_class_a_vid); - mrp_register_domain(&domain_class_a_id, &domain_class_a_priority, &domain_class_a_vid); + rc = mrp_register_domain(&domain_class_a_id, &domain_class_a_priority, &domain_class_a_vid); + if (rc) { + printf("mrp_register_domain failed\n"); + return EXIT_FAILURE; + } - mrp_join_vlan(); + rc = mrp_join_vlan(); + if (rc) { + printf("mrp_join_vlan failed\n"); + return EXIT_FAILURE; + } if( transport == 2 ) { igb_set_class_bandwidth @@ -738,7 +751,7 @@ int main(int argc, char *argv[]) */ fprintf(stderr, "advertising stream ...\n"); if( transport == 2 ) { - mrp_advertise_stream(glob_stream_id, dest_addr, + rc = mrp_advertise_stream(glob_stream_id, dest_addr, domain_class_a_vid, PKT_SZ - 16, L2_PACKET_IPG / 125000, domain_class_a_priority, 3900); @@ -748,15 +761,23 @@ int main(int argc, char *argv[]) * not allowed, not sure the significance of the value 6, but * using it consistently */ - mrp_advertise_stream(glob_stream_id, dest_addr, + rc = mrp_advertise_stream(glob_stream_id, dest_addr, domain_class_a_vid, sizeof(*l4_headers) + L4_SAMPLES_PER_FRAME * CHANNELS * 2 + 6, 1, domain_class_a_priority, 3900); } + if (rc) { + printf("mrp_advertise_stream failed\n"); + return EXIT_FAILURE; + } fprintf(stderr, "awaiting a listener ...\n"); - mrp_await_listener(glob_stream_id); + rc = mrp_await_listener(glob_stream_id); + if (rc) { + printf("mrp_await_listener failed\n"); + return EXIT_FAILURE; + } listeners = 1; printf("got a listener ...\n"); halt_tx = 0; @@ -907,19 +928,25 @@ int main(int argc, char *argv[]) halt_tx = 1; if( transport == 2 ) { - mrp_unadvertise_stream + rc = mrp_unadvertise_stream (glob_stream_id, dest_addr, domain_class_a_vid, PKT_SZ - 16, L2_PACKET_IPG / 125000, domain_class_a_priority, 3900); } else { - mrp_unadvertise_stream + rc = mrp_unadvertise_stream (glob_stream_id, dest_addr, domain_class_a_vid, sizeof(*l4_headers)+L4_SAMPLES_PER_FRAME*CHANNELS*2 + 6, 1, domain_class_a_priority, 3900); } + if (rc) { + printf("mrp_unadvertise_stream failed\n"); + return EXIT_FAILURE; + } igb_set_class_bandwidth(&igb_dev, 0, 0, 0, 0); /* disable Qav */ rc = mrp_disconnect(); + if (rc) + printf("mrp_disconnect failed\n"); igb_dma_free_page(&igb_dev, &a_page); rc = gptpdeinit(&igb_shm_fd, igb_mmap); |