supla-device
Loading...
Searching...
No Matches
eh.h
1/*
2 Copyright (C) AC SOFTWARE SP. Z O.O.
3
4 This program is free software; you can redistribute it and/or
5 modify it under the terms of the GNU General Public License
6 as published by the Free Software Foundation; either version 2
7 of the License, or (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
15 along with this program; if not, write to the Free Software
16 Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
17 */
18#ifndef EH_H_
19#define EH_H_
20
21#if !defined(ESP8266) && !defined(__AVR__) && !defined(_WIN32) && \
22 !defined(ESP32) && !defined(ARDUINO) && !defined(SUPLA_DEVICE)
23#include <sys/select.h>
24#endif
25
26#if !defined(__AVR__) && !defined(_WIN32)
27#include <sys/time.h>
28#endif
29
30#ifdef __AVR__
31#include "proto.h"
32#endif
33
34#ifdef __cplusplus
35extern "C" {
36#endif
37
38typedef struct {
39 int nfds;
40
41#ifndef _WIN32
42
43#ifdef __linux__
44 int epoll_fd;
45 int fd1;
46#else
47 int fd1[2];
48#endif
49
50 int fd2;
51 int fd3;
52
53 struct timeval tv;
54
55#endif
57
58TEventHandler *eh_init(void);
59void eh_add_fd(TEventHandler *eh, int fd);
60void eh_raise_event(TEventHandler *eh);
61int eh_wait(TEventHandler *eh, int usec);
62void eh_free(TEventHandler *eh);
63
64#ifdef __cplusplus
65}
66#endif
67
68#endif /* EH_H_ */
Definition eh.h:38