#include "qmi-message.h"
+static struct {
+ QmiDmsUimPinId pin_id;
+ char* pin;
+ char* new_pin;
+ char* puk;
+} dms_req_data;
+
static const char *get_pin_status(int status)
{
static const char *pin_status[] = {
return QMI_CMD_REQUEST;
}
-static struct qmi_dms_uim_set_pin_protection_request dms_pin_protection_req = {
- QMI_INIT_SEQUENCE(info,
- .pin_id = QMI_DMS_UIM_PIN_ID_PIN
- )
-};
-
#define cmd_dms_set_pin_cb no_cb
static enum qmi_cmd_result
cmd_dms_set_pin_prepare(struct qmi_dev *qmi, struct qmi_request *req, struct qmi_msg *msg, char *arg)
{
- qmi_set_ptr(&dms_pin_protection_req, info.pin, arg);
+ dms_req_data.pin = arg;
return QMI_CMD_DONE;
}
static enum qmi_cmd_result
cmd_dms_set_pin_protection_prepare(struct qmi_msg *msg, char *arg)
{
- if (!dms_pin_protection_req.data.info.pin) {
+ if (!dms_req_data.pin) {
uqmi_add_error("Missing argument");
return QMI_CMD_EXIT;
}
return QMI_CMD_EXIT;
}
- qmi_set_ptr(&dms_pin_protection_req, info.protection_enabled, is_enabled);
+ struct qmi_dms_uim_set_pin_protection_request dms_pin_protection_req = {
+ QMI_INIT_SEQUENCE(info,
+ .pin_id = dms_req_data.pin_id
+ ),
+ QMI_INIT_PTR(info.pin, dms_req_data.pin),
+ QMI_INIT_PTR(info.protection_enabled, is_enabled)
+ };
+
qmi_set_dms_uim_set_pin_protection_request(msg, &dms_pin_protection_req);
return QMI_CMD_REQUEST;
}
static enum qmi_cmd_result
cmd_dms_set_pin1_protection_prepare(struct qmi_dev *qmi, struct qmi_request *req, struct qmi_msg *msg, char *arg)
{
- qmi_set_ptr(&dms_pin_protection_req, info.pin_id, QMI_DMS_UIM_PIN_ID_PIN);
+ dms_req_data.pin_id = QMI_DMS_UIM_PIN_ID_PIN;
return cmd_dms_set_pin_protection_prepare(msg, arg);
}
static enum qmi_cmd_result
cmd_dms_set_pin2_protection_prepare(struct qmi_dev *qmi, struct qmi_request *req, struct qmi_msg *msg, char *arg)
{
- qmi_set_ptr(&dms_pin_protection_req, info.pin_id, QMI_DMS_UIM_PIN_ID_PIN2);
+ dms_req_data.pin_id = QMI_DMS_UIM_PIN_ID_PIN2;
return cmd_dms_set_pin_protection_prepare(msg, arg);
}
-static struct qmi_dms_uim_unblock_pin_request dms_unlock_pin_req = {
- QMI_INIT_SEQUENCE(info,
- .pin_id = QMI_DMS_UIM_PIN_ID_PIN
- )
- };
-
#define cmd_dms_set_new_pin_cb no_cb
static enum qmi_cmd_result
cmd_dms_set_new_pin_prepare(struct qmi_dev *qmi, struct qmi_request *req, struct qmi_msg *msg, char *arg)
{
- qmi_set_ptr(&dms_unlock_pin_req, info.new_pin, arg);
+ dms_req_data.new_pin = arg;
return QMI_CMD_DONE;
}
static enum qmi_cmd_result
cmd_dms_set_puk_prepare(struct qmi_dev *qmi, struct qmi_request *req, struct qmi_msg *msg, char *arg)
{
- qmi_set_ptr(&dms_unlock_pin_req, info.puk, arg);
+ dms_req_data.puk = arg;
return QMI_CMD_DONE;
}
static enum qmi_cmd_result
cmd_dms_unblock_pin1_prepare(struct qmi_dev *qmi, struct qmi_request *req, struct qmi_msg *msg, char *arg)
{
- qmi_set_ptr(&dms_unlock_pin_req, info.pin_id, QMI_DMS_UIM_PIN_ID_PIN);
-
- if (!dms_unlock_pin_req.data.info.puk || !dms_unlock_pin_req.data.info.new_pin) {
+ if (!dms_req_data.puk || !dms_req_data.new_pin) {
uqmi_add_error("Missing argument");
return QMI_CMD_EXIT;
}
+ struct qmi_dms_uim_unblock_pin_request dms_unlock_pin_req = {
+ QMI_INIT_SEQUENCE(info,
+ .pin_id = QMI_DMS_UIM_PIN_ID_PIN
+ ),
+ QMI_INIT_PTR(info.puk, dms_req_data.puk),
+ QMI_INIT_PTR(info.new_pin, dms_req_data.new_pin)
+ };
+
qmi_set_dms_uim_unblock_pin_request(msg, &dms_unlock_pin_req);
return QMI_CMD_REQUEST;
}
static enum qmi_cmd_result
cmd_dms_unblock_pin2_prepare(struct qmi_dev *qmi, struct qmi_request *req, struct qmi_msg *msg, char *arg)
{
- qmi_set_ptr(&dms_unlock_pin_req, info.pin_id, QMI_DMS_UIM_PIN_ID_PIN2);
-
- if (!dms_unlock_pin_req.data.info.puk || !dms_unlock_pin_req.data.info.new_pin) {
+ if (!dms_req_data.puk || !dms_req_data.new_pin) {
uqmi_add_error("Missing argument");
return QMI_CMD_EXIT;
}
+ struct qmi_dms_uim_unblock_pin_request dms_unlock_pin_req = {
+ QMI_INIT_SEQUENCE(info,
+ .pin_id = QMI_DMS_UIM_PIN_ID_PIN2
+ ),
+ QMI_INIT_PTR(info.puk, dms_req_data.puk),
+ QMI_INIT_PTR(info.new_pin, dms_req_data.new_pin)
+ };
+
qmi_set_dms_uim_unblock_pin_request(msg, &dms_unlock_pin_req);
return QMI_CMD_REQUEST;
}