From 030472e7d9d57eaf898a918b97b1167a0bfab0fa Mon Sep 17 00:00:00 2001 From: tth Date: Tue, 20 Jul 2021 11:24:27 +0200 Subject: [PATCH] + send_button --- Gaby/gabylaser.c | 3 +-- Gaby/receive-osc.c | 4 ++++ Gaby/transmit.c | 25 +++++++++++++++++++++++++ Gaby/transmit.h | 2 ++ 4 files changed, 32 insertions(+), 2 deletions(-) diff --git a/Gaby/gabylaser.c b/Gaby/gabylaser.c index fa6b703..88da43e 100644 --- a/Gaby/gabylaser.c +++ b/Gaby/gabylaser.c @@ -65,7 +65,7 @@ int foo, opt; fprintf(stderr, "GabyLaser - compiled %s %s\n", __DATE__, __TIME__); -while ((opt = getopt(argc, argv, "hp:vE:C:")) != -1) { +while ((opt = getopt(argc, argv, "hp:v")) != -1) { switch (opt) { case 'h': if (help(0)) exit(1); break; case 'p': local_port = optarg; break; @@ -90,7 +90,6 @@ if (foo < 0) { /* * infinite loop is infinite */ - for (;;) { if (verbosity) fprintf(stderr, "t = %ld\n", time(NULL)); diff --git a/Gaby/receive-osc.c b/Gaby/receive-osc.c index 20f5c7a..aa5d608 100644 --- a/Gaby/receive-osc.c +++ b/Gaby/receive-osc.c @@ -44,9 +44,13 @@ return -1; int button_handler(const char *path, const char *types, lo_arg ** argv, int argc, void *data, void *user_data) { +int foo; fprintf(stderr, ">>> %s ( '%s' '%s' )\n", __func__, path, types); +foo = send_button(argv[0]->i, argv[1]->i); + + return -1; } /* ---------------------------------------------------------------- */ diff --git a/Gaby/transmit.c b/Gaby/transmit.c index 3694de4..18154cd 100644 --- a/Gaby/transmit.c +++ b/Gaby/transmit.c @@ -97,3 +97,28 @@ return 0; } /* ---------------------------------------------------------------- */ +/* + * comment gerer le up/down des boutons ? + */ + +int send_button(int number, int state) +{ +char message[100]; + +if (fdtx < 0) { + fprintf(stderr, "%s: fdtx not initialized !\n", __func__); + exit(1); + } + +if (number<0 || number>16) { + return -1; + } + +sprintf(message, "T%01x%1x", number, state); +fprintf(stderr, "%s ----> '%s'\n", __func__, message); + + + +return -1; +} +/* ---------------------------------------------------------------- */ diff --git a/Gaby/transmit.h b/Gaby/transmit.h index 39e70cb..b0c8923 100644 --- a/Gaby/transmit.h +++ b/Gaby/transmit.h @@ -9,3 +9,5 @@ int init_transmit(char *fname, int k); int send_position(char xy, int value); +int send_button(int number, int state); +