Initial release

This commit is contained in:
Arnaud Ferraris
2020-12-10 14:41:36 +01:00
commit 87ade8dd27
15 changed files with 1839 additions and 0 deletions

56
src/manager.h Normal file
View File

@@ -0,0 +1,56 @@
/*
* Copyright (C) 2020 Arnaud Ferraris <arnaud.ferraris@gmail.com>
*
* SPDX-License-Identifier: GPL-3.0-or-later
*/
#pragma once
#include <glib.h>
#include <gpiod.h>
#include <libmm-glib.h>
enum EG25State {
EG25_STATE_INIT = 0,
EG25_STATE_POWERED, // Power-on sequence has been executed, but the modem isn't on yet
EG25_STATE_STARTED, // Modem has been started and declared itdata ready
EG25_STATE_ACQUIRED, // Modem has been probed by ModemManager
EG25_STATE_CONFIGURED, // Modem has been configured through AT commands
EG25_STATE_SUSPENDING, // System is going into suspend
EG25_STATE_RESUMING, // System is being resumed, waiting for modem to come back
EG25_STATE_REGISTERED, // Modem is unlocked and registered to a network provider
EG25_STATE_CONNECTED, // Modem is connected (data connection active)
EG25_STATE_RESETTING, // Something went wrong, we're restarting the modem
EG25_STATE_FINISHING
};
struct EG25Manager {
GMainLoop *loop;
enum EG25State modem_state;
gchar *modem_usb_id;
gboolean braveheart;
guint mm_watch;
MMManager *mm_manager;
MMModem *mm_modem;
GDBusProxy *suspend_proxy;
int suspend_inhibit_fd;
guint suspend_source;
int at_fd;
guint at_source;
GList *at_cmds;
struct gpiod_chip *gpiochip[2];
struct gpiod_line *gpio_out[5];
};
void modem_configure(struct EG25Manager *data);
void modem_reset(struct EG25Manager *data);
void modem_suspend(struct EG25Manager *data);
void modem_resume_pre(struct EG25Manager *data);
void modem_resume_post(struct EG25Manager *data);
void modem_update_state(struct EG25Manager *data, MMModemState state);