filter out comments in json files before pushing them through the JSON module
[project/uqmi.git] / commands.h
1 #ifndef __UQMI_COMMANDS_H
2 #define __UQMI_COMMANDS_H
3
4 #include <stdbool.h>
5 #include "commands-wds.h"
6 #include "commands-dms.h"
7 #include "commands-nas.h"
8
9 enum qmi_cmd_result {
10         QMI_CMD_DONE,
11         QMI_CMD_REQUEST,
12         QMI_CMD_EXIT,
13 };
14
15 enum {
16         CMD_TYPE_OPTION = -1,
17 };
18
19 struct uqmi_cmd_handler {
20         const char *name;
21         int type;
22
23         enum qmi_cmd_result (*prepare)(struct qmi_dev *qmi, struct qmi_request *req, struct qmi_msg *msg, char *arg);
24         void (*cb)(struct qmi_dev *qmi, struct qmi_request *req, struct qmi_msg *msg);
25 };
26
27 struct uqmi_cmd {
28         const struct uqmi_cmd_handler *handler;
29         char *arg;
30 };
31
32 #define __uqmi_commands \
33         __uqmi_command(version, get-versions, no, QMI_SERVICE_CTL), \
34         __uqmi_command(set_client_id, set-client-id, required, CMD_TYPE_OPTION), \
35         __uqmi_command(get_client_id, get-client-id, required, QMI_SERVICE_CTL), \
36         __uqmi_wds_commands, \
37         __uqmi_dms_commands, \
38         __uqmi_nas_commands
39
40 #define __uqmi_command(_name, _optname, _arg, _option) __UQMI_COMMAND_##_name
41 enum uqmi_command {
42         __uqmi_commands,
43         __UQMI_COMMAND_LAST
44 };
45 #undef __uqmi_command
46
47 extern const struct uqmi_cmd_handler uqmi_cmd_handler[];
48 void uqmi_add_command(char *arg, int longidx);
49 void uqmi_run_commands(struct qmi_dev *qmi);
50
51 #endif