blob: 1d0d788b0c140fa7f4dfa65997e8ddc8f617fb6b (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
|
#include <libdaemon/dlog.h>
#include "main.h"
#define CHANNELS (2)
oop_source* event_source = NULL;
int main_loop(void) {
int r = -1;
oop_source_sys *sys = NULL;
if (!(sys = oop_sys_new())) {
daemon_log(LOG_ERR, "Failed to create system source");
goto finish;
}
event_source = oop_sys_source(sys);
assert(event_source);
if (child_process_init() < 0)
goto finish;
if (modem_manager_init(CHANNELS) < 0)
goto finish;
if (oop_sys_run(sys) == OOP_ERROR) {
daemon_log(LOG_ERR, "oop_sys_new() returned OOP_ERROR");
goto finish;
}
r = 0;
finish:
modem_manager_done();
child_process_done();
if (sys) {
event_source = NULL;
oop_sys_delete(sys);
}
return r;
}
int main(int argc, char*argv[]) {
return main_loop() < 0 : 1 : 0;
}
|