Commit c478e9a9 authored by Arnaud Blanchard's avatar Arnaud Blanchard

Simplify demo

parent c46f006c
#We go in blaar directory
cd `dirname $0`/..
cd `dirname $0`/../..
echo "Demo to send data from t_channel_writer to t_channel_reader through blc_channel (shared memory) called /channel_example"
./ blc_channel/t_channel_reader &
./ blc_channel/t_channel_writer
pkill -TERM -P $reader_pid #To simplify, this kill the reader and all its children when the writer stop
./ blibs/blc_channel/t_channel_reader &
./ blibs/blc_channel/t_channel_writer
......@@ -7,18 +7,21 @@
#define SIZE 1000000
int main(int, char **){
blc_channel channel;
fprintf(stderr, "CHANNEL_READER: Example of a program reading a channel.\n");
//Create or open an async channel "/channel_example" receiving data (uint8/uchar) in undefined format in one dimension (vector) of SIZE.
channel.create_or_open("/channel_example", BLC_CHANNEL_READ, 'INT8', 'NDEF', 1, SIZE);
channel.create_or_open("/channel_example", BLC_CHANNEL_READ, 'UIN8', 'TEXT', 1, SIZE);
while(1){ //Quit if content is 'q' return
{ //Quit if content is 'q' return
fprintf(stderr, "CHANNEL_READER: Received text '%s'\n", channel.chars);
fprintf(stderr, "CHANNEL_READER: Received text '%s'\n",channel.chars);
}while(strcmp("q\n", channel.chars)!=0);
......@@ -8,7 +8,9 @@ int main(int, char **){
fprintf(stderr, "CHANNEL_WRITTER: Example of a program sending any data on a channel. Press 'q' return to quit.\n");
//Create or reopen an asynchrone channel "/channel_example" sending data of type int8/char in format undefined format of one dimension (vector) of SIZE.
channel.create_or_open("/channel_example", BLC_CHANNEL_WRITE, 'INT8', 'NDEF', 1, SIZE);
channel.create_or_open("/channel_example", BLC_CHANNEL_WRITE, 'UIN8', 'TEXT', 1, SIZE);
channel.reset(); //Clear the memory to remove the eventual q\n
fprintf(stderr, "CHANNEL_WRITTER: Text to send ?...\n");
fgets(channel.chars, SIZE, stdin);
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment