summaryrefslogtreecommitdiffstats
path: root/src/main.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/main.c')
-rw-r--r--src/main.c43
1 files changed, 27 insertions, 16 deletions
diff --git a/src/main.c b/src/main.c
index db4c438..9fac796 100644
--- a/src/main.c
+++ b/src/main.c
@@ -2,30 +2,41 @@
#include "main.h"
-int init(void) {
- if (modem_manager_init(CHANNELS) < 0)
- return -1;
-
-}
+#define CHANNELS (2)
-void done(void) {
-
- modem_manager_done(CHANNELS);
-
-}
+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 (init() < 0)
- return -1;
+ if (modem_manager_init(CHANNELS) < 0)
+ goto finish;
- for (;;) {
- /* ... */
+ if (oop_sys_run(sys) == OOP_ERROR) {
+ daemon_log(LOG_ERR, "oop_sys_new() returned OOP_ERROR");
+ goto finish;
}
-
- done();
+ r = 0;
+
+finish:
+ modem_manager_done();
+
+ if (sys) {
+ event_source = NULL;
+ oop_sys_delete(sys);
+ }
+
+ return r;
}
int main(int argc, char*argv[]) {