diff options
author | Aleksander Morgado <aleksander@aleksander.es> | 2022-02-24 11:03:07 +0100 |
---|---|---|
committer | Aleksander Morgado <aleksander@aleksander.es> | 2022-02-26 23:10:21 +0100 |
commit | 2605831abfc6cd4c4ac64b6648c330efbbeab1a8 (patch) | |
tree | 8d42f649fde28af0fb6bf42499c87c826283d45f | |
parent | f2d8047fa8e185033e9fa30e1d3aada7de60687a (diff) | |
download | libqmi-2605831abfc6cd4c4ac64b6648c330efbbeab1a8.tar.gz |
uim: avoid array of arrays in Personalization Status Other
-rw-r--r-- | data/qmi-service-uim.json | 39 | ||||
-rw-r--r-- | docs/reference/libqmi-glib/libqmi-glib-common.sections | 3 | ||||
-rw-r--r-- | src/libqmi-glib/qmi-compat.c | 80 | ||||
-rw-r--r-- | src/libqmi-glib/qmi-compat.h | 41 |
4 files changed, 145 insertions, 18 deletions
diff --git a/data/qmi-service-uim.json b/data/qmi-service-uim.json index 1f8f27ce..df41502d 100644 --- a/data/qmi-service-uim.json +++ b/data/qmi-service-uim.json @@ -850,6 +850,7 @@ "since" : "1.30", "format" : "guint32", "public-format" : "QmiUimConfiguration" } ], + "output-compat" : "yes", "output" : [ { "common-ref" : "Operation Result" }, { "name" : "Automatic Selection", "id" : "0x10", @@ -881,25 +882,27 @@ "format" : "guint8", "public-format" : "gboolean", "prerequisites" : [ { "common-ref" : "Success" } ] }, - { "name" : "Personalization Status Other Slots", - "id" : "0x13", - "type" : "TLV", - "since" : "1.30", - "format" : "array", + { "name" : "Personalization Status Other", + "id" : "0x13", + "type" : "TLV", + "since" : "1.32", + "format" : "array", "size-prefix-format" : "guint8", - "array-element" : { "name" : "Slots", - "format" : "array", - "size-prefix-format" : "guint8", - "array-element" : { "name" : "Element", - "format" : "struct", - "contents" : [ { "name" : "Feature", - "format" : "guint8", - "public-format" : "QmiUimCardApplicationPersonalizationFeature" }, - { "name" : "Verify Left", - "format" : "guint8" }, - { "name" : "Unblock Left", - "format" : "guint8" } ] } }, - "prerequisites" : [ { "common-ref" : "Success" } ] } ] }, + "array-element" : { "name" : "Element", + "format" : "struct", + "contents" : [ { "name" : "Slot", + "format" : "array", + "size-prefix-format" : "guint8", + "array-element" : { "name" : "Element", + "format" : "struct", + "contents" : [ { "name" : "Feature", + "format" : "guint8", + "public-format" : "QmiUimCardApplicationPersonalizationFeature" }, + { "name" : "Verify Left", + "format" : "guint8" }, + { "name" : "Unblock Left", + "format" : "guint8" } ] } } ] }, + "prerequisites" : [ { "common-ref" : "Success" } ] } ] }, // ********************************************************************************* { "name" : "Refresh Register All", diff --git a/docs/reference/libqmi-glib/libqmi-glib-common.sections b/docs/reference/libqmi-glib/libqmi-glib-common.sections index 21996b2d..c2f7f19f 100644 --- a/docs/reference/libqmi-glib/libqmi-glib-common.sections +++ b/docs/reference/libqmi-glib/libqmi-glib-common.sections @@ -1866,6 +1866,9 @@ QmiIndicationLocPositionReportOutputDilutionOfPrecision qmi_indication_loc_position_report_output_get_dilution_of_precision QmiIndicationLocPositionReportOutputGpsTime qmi_indication_loc_position_report_output_get_gps_time +<SUBSECTION PersonalizationStatusOtherSlots> +QmiMessageUimGetConfigurationOutputPersonalizationStatusOtherSlotsSlotsElement +qmi_message_uim_get_configuration_output_get_personalization_status_other_slots <SUBSECTION Private> QmiDeprecatedNasSimRejectState QmiDeprecatedWdsCdmaCauseCode diff --git a/src/libqmi-glib/qmi-compat.c b/src/libqmi-glib/qmi-compat.c index 0a03e9c8..c6c25d76 100644 --- a/src/libqmi-glib/qmi-compat.c +++ b/src/libqmi-glib/qmi-compat.c @@ -2492,4 +2492,84 @@ qmi_indication_uim_slot_status_output_get_slot_eid_information ( #endif /* HAVE_QMI_INDICATION_UIM_SLOT_STATUS */ +#if defined HAVE_QMI_MESSAGE_UIM_GET_CONFIGURATION + +typedef struct { + GArray *personalization_status_other_slots; +} MessageUimGetConfigurationOutputCompatContext; + +static void +message_uim_get_configuration_output_clear_personalization_status_other_slots (GArray *array) +{ + guint i; + + for (i = 0; i < array->len; i++) + g_array_unref (g_array_index (array, GArray *, i)); + g_array_unref (array); +} + +static void +message_uim_get_configuration_output_compat_context_free (MessageUimGetConfigurationOutputCompatContext *ctx) +{ + if (ctx->personalization_status_other_slots) + message_uim_get_configuration_output_clear_personalization_status_other_slots (ctx->personalization_status_other_slots); + g_slice_free (MessageUimGetConfigurationOutputCompatContext, ctx); +} + +static MessageUimGetConfigurationOutputCompatContext * +message_uim_get_configuration_output_get_compat_context (QmiMessageUimGetConfigurationOutput *self) +{ + MessageUimGetConfigurationOutputCompatContext *ctx; + + ctx = qmi_message_uim_get_configuration_output_get_compat_context (self); + if (!ctx) { + ctx = g_slice_new0 (MessageUimGetConfigurationOutputCompatContext); + qmi_message_uim_get_configuration_output_set_compat_context (self, ctx, (GDestroyNotify)message_uim_get_configuration_output_compat_context_free); + } + + return ctx; +} + +gboolean +qmi_message_uim_get_configuration_output_get_personalization_status_other_slots ( + QmiMessageUimGetConfigurationOutput *self, + GArray **value_personalization_status_other_slots, + GError **error) +{ + GArray *array = NULL; + + if (!qmi_message_uim_get_configuration_output_get_personalization_status_other (self, &array, error)) + return FALSE; + + if (value_personalization_status_other_slots) { + MessageUimGetConfigurationOutputCompatContext *ctx; + guint i; + + ctx = message_uim_get_configuration_output_get_compat_context (self); + + if (ctx->personalization_status_other_slots) + message_uim_get_configuration_output_clear_personalization_status_other_slots (ctx->personalization_status_other_slots); + + ctx->personalization_status_other_slots = g_array_sized_new (FALSE, FALSE, sizeof (GArray *), array->len); + + + for (i = 0; i < array->len; i++) { + QmiMessageUimGetConfigurationOutputPersonalizationStatusOtherElement *element; + GArray *aux; + + element = &g_array_index (array, QmiMessageUimGetConfigurationOutputPersonalizationStatusOtherElement, i); + + /* We can do this because QmiMessageUimGetConfigurationOutputPersonalizationStatusOtherElementSlotElement (the new type) + * and QmiMessageUimGetConfigurationOutputPersonalizationStatusOtherSlotsSlotsElement (the old type) are equivalent */ + aux = g_array_ref (element->slot); + g_array_append_val (ctx->personalization_status_other_slots, aux); + } + + *value_personalization_status_other_slots = ctx->personalization_status_other_slots; + } + return TRUE; +} + +#endif /* HAVE_QMI_MESSAGE_UIM_GET_CONFIGURATION */ + #endif /* QMI_DISABLE_DEPRECATED */ diff --git a/src/libqmi-glib/qmi-compat.h b/src/libqmi-glib/qmi-compat.h index 9904ecb2..49d9a055 100644 --- a/src/libqmi-glib/qmi-compat.h +++ b/src/libqmi-glib/qmi-compat.h @@ -3845,6 +3845,47 @@ gboolean qmi_indication_uim_slot_status_output_get_slot_eid_information ( #endif /* HAVE_QMI_INDICATION_UIM_SLOT_STATUS */ +#if defined HAVE_QMI_MESSAGE_UIM_GET_CONFIGURATION + +/** + * QmiMessageUimGetConfigurationOutputPersonalizationStatusOtherSlotsSlotsElement: + * @feature: a #QmiUimCardApplicationPersonalizationFeature. + * @verify_left: a #guint8. + * @unblock_left: a #guint8. + * + * A QmiMessageUimGetConfigurationOutputPersonalizationStatusOtherSlotsSlotsElement struct. + * + * Since: 1.30 + * Deprecated: 1.32: Use #QmiMessageUimGetConfigurationOutputPersonalizationStatusOtherElementSlotsElement instead. + */ +G_DEPRECATED_FOR (QmiMessageUimGetConfigurationOutputPersonalizationStatusOtherElementSlotsElement) +typedef struct _QmiMessageUimGetConfigurationOutputPersonalizationStatusOtherSlotsSlotsElement { + QmiUimCardApplicationPersonalizationFeature feature; + guint8 verify_left; + guint8 unblock_left; +} QmiMessageUimGetConfigurationOutputPersonalizationStatusOtherSlotsSlotsElement; + +/** + * qmi_message_uim_get_configuration_output_get_personalization_status_other_slots: + * @self: a #QmiMessageUimGetConfigurationOutput. + * @value_personalization_status_other_slots: (out)(optional)(element-type GArray)(transfer none): a placeholder for the output #GArray of #GArray * elements, or %NULL if not required. Do not free it, it is owned by @self. + * @error: Return location for error or %NULL. + * + * Get the 'Personalization Status Other Slots' field from @self. + * + * Returns: (skip): %TRUE if the field is found, %FALSE otherwise. + * + * Since: 1.30 + * Deprecated: 1.32: Use qmi_message_uim_get_configuration_output_get_personalization_status_other() instead. + */ +G_DEPRECATED_FOR (qmi_message_uim_get_configuration_output_get_personalization_status_other) +gboolean qmi_message_uim_get_configuration_output_get_personalization_status_other_slots ( + QmiMessageUimGetConfigurationOutput *self, + GArray **value_personalization_status_other_slots, + GError **error); + +#endif /* HAVE_QMI_MESSAGE_UIM_GET_CONFIGURATION */ + #endif /* QMI_DISABLE_DEPRECATED */ #endif /* _LIBQMI_GLIB_QMI_COMPAT_H_ */ |