aqhome: started rewriting message code, start using new event2 lib.
This commit is contained in:
38
aqhome/ipc2/ttyobject.h
Normal file
38
aqhome/ipc2/ttyobject.h
Normal file
@@ -0,0 +1,38 @@
|
||||
/****************************************************************************
|
||||
* 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 <aqhome/events2/object.h>
|
||||
|
||||
#include <termios.h>
|
||||
|
||||
|
||||
/**
|
||||
* 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
|
||||
Reference in New Issue
Block a user