/**************************************************************************** * This file is part of the project Gwenhywfar. * Gwenhywfar (c) by 2023 Martin Preuss, all rights reserved. * * The license for this file can be found in the file COPYING which you * should have received along with this file. ****************************************************************************/ #ifndef AQH_TTYOBJECT_H #define AQH_TTYOBJECT_H #include #include #define AQH_TTYOBJECT_FLAGS_NOATTN 0x0001 /** * Create Tty object for given filedescriptor and in given mode (read or write) * * @return object created * @param eventLoop event loop to assign the new object to * @param fd filedescriptor (e.g. created by calls to open or socket) * @param fdMode AQH_FDOBJECT_FDMODE_READ or AQH_FDOBJECT_FDMODE_WRITE */ AQHOME_API AQH_OBJECT *AQH_TtyObject_new(AQH_EVENT_LOOP *eventLoop, int fd, int fdMode); /** * Open given device and setup TTY parameters for it. * * @return filedescriptor for the openened and initialized device * @param device path to device to open (e.g. "/dev/ttyUSB0") * @param initialTermiosState var to store initial state of the device (if given) */ AQHOME_API int AQH_TtyObject_OpenAndInitDevice(const char *device, struct termios *initialTermiosState); #endif