1 /**************************************************************************** 2 Copyright (C) 1987-2015 by Jeffery P. Hansen 3 4 This program is free software; you can redistribute it and/or modify 5 it under the terms of the GNU General Public License as published by 6 the Free Software Foundation; either version 2 of the License, or 7 (at your option) any later version. 8 9 This program is distributed in the hope that it will be useful, 10 but WITHOUT ANY WARRANTY; without even the implied warranty of 11 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 GNU General Public License for more details. 13 14 You should have received a copy of the GNU General Public License along 15 with this program; if not, write to the Free Software Foundation, Inc., 16 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. 17 ****************************************************************************/ 18 #ifndef __channel_h 19 #define __channel_h 20 /***************************************************************************** 21 * 22 * Data Channel Data Structures 23 * 24 * Data queues are used to implement communication channels. These are accessed 25 * through the system tasks $tkg$write and $tkg$read. It is also possible for 26 * the GUI write to a channel through command $write. 27 * 28 *****************************************************************************/ 29 30 struct Channel_str { 31 char *c_name; /* Name of channel */ 32 List/*Value*/ c_queue; /* Queue of channel */ 33 List/*Event*/ c_wake; /* Events to be executed on wake up */ 34 int c_isWatched; /* Flag to indicated if this is a "watched" channel */ 35 char *c_format; /* Format for watched data */ 36 }; 37 38 Channel *new_Channel(const char *name); 39 int Channel_queueLen(Channel *c); 40 void Channel_wait(Channel *c, VGThread *thread); 41 int Channel_read(Channel *c, Value *data); 42 int Channel_write(Channel *c, Value *data); 43 int Channel_setWatch(Channel *c, int doWatch, const char *format); 44 45 #endif 46