mirror of
https://gitlab.com/mobian1/eg25-manager.git
synced 2025-08-29 23:32:14 +02:00
If a user created a custom config file and we added new fields in a newer version, `eg25-manager` will crash by assuming all config files are complete and up-to-date. Moreover, creating a custom config, even to change only one option, required copying a complete default config file and then editing the relevant field(s). This could lead to issues when upgrading, as default values of fields unrelated to the user change could be modified and not applied to the user config. This patch addresses both these issues by: * making sure at least one config file exists * requiring only the "default" config file (the one under `/usr/share`) to include all the required fields * trying to use user config for each field, falling back to the default config file if the field isn't present in the user config * exiting with a meaningful error message in case the default config file is missing a required field or section That way, it will be possible to have a minimal user config file containing only the field(s) needing a different value than the default one, falling back to the values in the default config file. Fixes #23
40 lines
1.3 KiB
C
40 lines
1.3 KiB
C
/*
|
|
* Copyright (C) 2020 Arnaud Ferraris <arnaud.ferraris@gmail.com>
|
|
*
|
|
* SPDX-License-Identifier: GPL-3.0-or-later
|
|
*/
|
|
|
|
#pragma once
|
|
|
|
#include "manager.h"
|
|
|
|
typedef struct AtCommand {
|
|
char *cmd;
|
|
char *subcmd;
|
|
char *value;
|
|
char *expected;
|
|
void (*callback)(struct EG25Manager *manager, const char *response);
|
|
int retries;
|
|
} AtCommand;
|
|
|
|
int at_init(struct EG25Manager *manager, toml_table_t *config[]);
|
|
void at_destroy(struct EG25Manager *manager);
|
|
|
|
void at_process_result(struct EG25Manager *manager,
|
|
const char *response);
|
|
void at_next_command(struct EG25Manager *manager);
|
|
gboolean at_send_command(struct EG25Manager *manager);
|
|
int at_append_command(struct EG25Manager *manager,
|
|
const char *cmd,
|
|
const char *subcmd,
|
|
const char *value,
|
|
const char *expected,
|
|
void (*callback)
|
|
(struct EG25Manager *manager,
|
|
const char *response));
|
|
|
|
void at_sequence_configure(struct EG25Manager *manager);
|
|
void at_sequence_suspend(struct EG25Manager *manager);
|
|
void at_sequence_resume(struct EG25Manager *manager);
|
|
void at_sequence_reset(struct EG25Manager *manager);
|