add initial prototype with a few commands
[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
8 enum qmi_cmd_result {
9 QMI_CMD_DONE,
10 QMI_CMD_REQUEST,
11 QMI_CMD_EXIT,
12 };
13
14 enum {
15 CMD_TYPE_OPTION = -1,
16 };
17
18 struct uqmi_cmd_handler {
19 const char *name;
20 int type;
21
22 enum qmi_cmd_result (*prepare)(struct qmi_dev *qmi, struct qmi_request *req, struct qmi_msg *msg, char *arg);
23 void (*cb)(struct qmi_dev *qmi, struct qmi_request *req, struct qmi_msg *msg);
24 };
25
26 struct uqmi_cmd {
27 const struct uqmi_cmd_handler *handler;
28 char *arg;
29 };
30
31 #define __uqmi_commands \
32 __uqmi_command(version, get-versions, no, QMI_SERVICE_CTL), \
33 __uqmi_command(set_client_id, set-client-id, required, CMD_TYPE_OPTION), \
34 __uqmi_command(get_client_id, get-client-id, required, QMI_SERVICE_CTL), \
35 __uqmi_wds_commands, \
36 __uqmi_dms_commands
37
38 #define __uqmi_command(_name, _optname, _arg, _option) __UQMI_COMMAND_##_name
39 enum uqmi_command {
40 __uqmi_commands,
41 __UQMI_COMMAND_LAST
42 };
43 #undef __uqmi_command
44
45 extern const struct uqmi_cmd_handler uqmi_cmd_handler[];
46 void uqmi_add_command(char *arg, int longidx);
47 void uqmi_run_commands(struct qmi_dev *qmi);
48
49 #endif