diff options
author | Aleksander Morgado <aleksander@aleksander.es> | 2021-04-08 00:47:28 +0200 |
---|---|---|
committer | Aleksander Morgado <aleksander@aleksander.es> | 2021-04-08 01:11:50 +0200 |
commit | 26099f19e21f278e764b875b257306d6800f0235 (patch) | |
tree | 4273d9ebfd2dfff2a11b1bca25abb53c992eb410 | |
parent | cdec8660427d2895415f1d84426e39d1ed145136 (diff) |
wds: add 'APN type' in profile create/modify operations
Just assuming the TLV id and format is the same.
E.g.:
$ sudo qmicli -p -d /dev/cdc-wdm0 \
--wds-create-profile="3gpp,apn=something2,apn-type-mask=emergency|ims"
New profile created:
Profile type: '3gpp'
Profile index: '6'
$ sudo qmicli -p -d /dev/cdc-wdm0 --wds-get-profile-list=3gpp
Profile list retrieved:
...
[6] 3gpp -
APN: 'something2'
APN type: 'ims, emergency'
PDP type: 'ipv4-or-ipv6'
PDP context number: '6'
Username: ''
Password: ''
Auth: 'none'
No roaming: 'no'
APN disabled: 'no'
-rw-r--r-- | data/qmi-service-wds.json | 8 | ||||
-rw-r--r-- | src/qmicli/qmicli-helpers.h | 3 | ||||
-rw-r--r-- | src/qmicli/qmicli-wds.c | 21 |
3 files changed, 29 insertions, 3 deletions
diff --git a/data/qmi-service-wds.json b/data/qmi-service-wds.json index 9f253b0..68042d3 100644 --- a/data/qmi-service-wds.json +++ b/data/qmi-service-wds.json @@ -1138,7 +1138,7 @@ // 0x30, PDN inactivity timeout // 0x31, APN class { "common-ref" : "WDS Roaming Disallowed Flag", - "since" : "1.22" } ], + "since" : "1.22" }, // 0x90, Negotiate DNS server preference // 0x91, PPP session close timer for DO // 0x92, PPP session close timer for 1X @@ -1167,6 +1167,8 @@ // 0xA9, APN enabled // 0xAA, PDN inactivity timeout // 0xAB, APN class + { "common-ref" : "WDS APN Type", + "since" : "1.30" } ], "output" : [ { "common-ref" : "Operation Result" }, { "common-ref" : "WDS Profile Identifier", "since" : "1.18", @@ -1245,7 +1247,7 @@ // 0x30, PDN inactivity timeout // 0x31, APN class { "common-ref" : "WDS Roaming Disallowed Flag", - "since" : "1.22" } ], + "since" : "1.22" }, // 0x90, Negotiate DNS server preference // 0x91, PPP session close timer for DO // 0x92, PPP session close timer for 1X @@ -1274,6 +1276,8 @@ // 0xA9, APN enabled // 0xAA, PDN inactivity timeout // 0xAB, APN class + { "common-ref" : "WDS APN Type", + "since" : "1.30" } ], "output" : [ { "common-ref" : "Operation Result" }, { "common-ref" : "WDS Extended Error Code", "since" : "1.18" } ] }, diff --git a/src/qmicli/qmicli-helpers.h b/src/qmicli/qmicli-helpers.h index a3a84d4..266c08c 100644 --- a/src/qmicli/qmicli-helpers.h +++ b/src/qmicli/qmicli-helpers.h @@ -72,7 +72,8 @@ QMICLI_FLAGS_LIST /* Common helpers to read 64bit flags from strings */ #define QMICLI_FLAGS64_LIST \ - QMICLI_FLAGS64_LIST_ITEM (QmiDsdApnTypePreference, dsd_apn_type_preference, "apn type preference") + QMICLI_FLAGS64_LIST_ITEM (QmiDsdApnTypePreference, dsd_apn_type_preference, "apn type preference") \ + QMICLI_FLAGS64_LIST_ITEM (QmiWdsApnTypeMask, wds_apn_type_mask, "apn type mask") #define QMICLI_FLAGS64_LIST_ITEM(TYPE,TYPE_UNDERSCORE,DESCR) \ gboolean qmicli_read_## TYPE_UNDERSCORE ##_from_string (const gchar *str, TYPE *out); diff --git a/src/qmicli/qmicli-wds.c b/src/qmicli/qmicli-wds.c index 6e8f75d..8bcf20d 100644 --- a/src/qmicli/qmicli-wds.c +++ b/src/qmicli/qmicli-wds.c @@ -1375,6 +1375,8 @@ typedef struct { gchar *name; QmiWdsPdpType pdp_type; gboolean pdp_type_set; + QmiWdsApnTypeMask apn_type; + gboolean apn_type_set; gchar *apn; gchar *username; gchar *password; @@ -1466,6 +1468,19 @@ create_modify_profile_properties_handle (const gchar *key, return TRUE; } + if (g_ascii_strcasecmp (key, "apn-type-mask") == 0 && !props->apn_type_set) { + if (!qmicli_read_wds_apn_type_mask_from_string (value, &(props->apn_type))) { + g_set_error (error, + QMI_CORE_ERROR, + QMI_CORE_ERROR_FAILED, + "unknown apn type '%s'", + value); + return FALSE; + } + props->apn_type_set = TRUE; + return TRUE; + } + if (g_ascii_strcasecmp (key, "no-roaming") == 0 && !props->no_roaming_set) { if (!qmicli_read_yes_no_from_string (value, &(props->no_roaming))) { g_set_error (error, @@ -1567,6 +1582,9 @@ create_profile_input_create (const gchar *str, if (props.pdp_type_set) qmi_message_wds_create_profile_input_set_pdp_type (*input, props.pdp_type, NULL); + if (props.apn_type_set) + qmi_message_wds_create_profile_input_set_apn_type_mask (*input, props.apn_type, NULL); + if (props.name) qmi_message_wds_create_profile_input_set_profile_name (*input, props.name, NULL); @@ -1880,6 +1898,9 @@ modify_profile_input_create (const gchar *str, if (props.pdp_type_set) qmi_message_wds_modify_profile_input_set_pdp_type (*input, props.pdp_type, NULL); + if (props.apn_type_set) + qmi_message_wds_modify_profile_input_set_apn_type_mask (*input, props.apn_type, NULL); + if (props.name) qmi_message_wds_modify_profile_input_set_profile_name (*input, props.name, NULL); |