Commit 0cb07be7 authored by Arnaud Blanchard's avatar Arnaud Blanchard
Browse files

Add function to display channel in terminal

parent d6e413bd
# Set the minimum version of cmake required to build this project
cmake_minimum_required(VERSION 2.6)
# Set the name of the project as the directory basename
project(o_display)
find_package(blc_channel)
find_package(blc_program)
add_definitions(${BL_DEFINITIONS} -std=c++11)
include_directories(${BL_INCLUDE_DIRS})
add_executable(o_display o_display.cpp)
target_link_libraries(o_display ${BL_LIBRARIES})
//
// Created by Arnaud Blanchard on 22/12/15.
// Copyright ETIS 2015. All rights reserved.
//
#include "blc_core.h"
#include "blc_channel.h"
#include "blc_program.h"
#include <unistd.h>
#include <math.h>
int columns_nb=64;
int rows_nb=16;
int main(int argc, char **argv){
blc_channel input;
char const *channel_name, *period_str;
int period;
blc_program_add_parameter(&channel_name, "blc_channel-in", 1, "channel name", NULL);
blc_program_add_option(&period_str, 'p', "period", "integer ", "refresh period in ms", "100"); //-2 executes one and wait for return
blc_program_init(&argc, &argv, blc_quit);
// period=strtol(period_str, NULL, 10);
SSCANF(1, period_str, "%d", &period);
period*=1000; //convert ms
input.open(channel_name, BLC_CHANNEL_READ);
blc_loop_try_add_waiting_semaphore(input.sem_new_data);
blc_loop_try_add_posting_semaphore(input.sem_ack_data);
BLC_COMMAND_LOOP(period){
if (blc_loop_iteration) blc_eprint_cursor_down(rows_nb);
input.fprint_tsv(stderr);
}
return EXIT_SUCCESS;
}
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