Commit Graph

103 Commits

Author SHA1 Message Date
Aleksander Morgado cf62f84382 qmi-codegen: allow handling built-in sequence numbers in arrays
TLVs are really limited in size, so if you want to have truly long data passed
between host and modem, you may end up needing multiple QMI messages where the
long TLV is split in segments. Currently support this by handling a built-in
sequence number expected to be found between the array size prefix and the array
itself (see e.g. TLV 0x13 (PRL) in 'DMS Activate Manual'). This sequence number
can be enabled with the new 'sequence-prefix-format' keyword in the array
definition.
2013-07-15 10:24:31 +02:00
Aleksander Morgado a212dfe758 pbm: setup generation of the PBM service support
Only 'Indication Register' message for now.
2013-07-04 13:25:03 +02:00
Aleksander Morgado 8045711f3c dms: activation code string needs explicit 1-byte length prefix
Reported by Arman Uguray <armansito@google.com>
2013-03-07 09:09:54 +01:00
Marius Kotsbak 1822155d25 qmi-codegen: clean up compiled python files
These caused problems for deb packaging, as their content depends on the Python
version used.
2012-12-24 15:20:06 +01:00
Shawn J. Goff 725ef97dfd qmi-codegen python3: change string.lower(str) to str.lower()
The string.lower(str) class method is no longer available.

sed regex:
s/string\.lower(\(.*\))/\1.lower()/
2012-12-17 17:00:20 -06:00
Shawn J. Goff 2a9bb58bd2 qmi-codegen python3: fix dict.has_key('key') to 'key' in dict
Python 3 no longer supports the has_key() method.

sed regex:
s/\([^ ]\+\)\.has_key(\([^)]*\))/\2 in \1/g
2012-12-17 16:59:48 -06:00
Shawn J. Goff 31e3155c41 qmi-codegen python3: change string.replace() class method use to str.replace() instance method
Python 3 doesn't support the replace class method; it's now an instance method only.
string.replace(object, old, new) changes to object.replace(old, new)

sed:
s/string\.replace(\([^,]*\), /\1.replace(/
2012-12-17 16:59:35 -06:00
Dan Williams 01becf82d5 qmi-codegen: fix some python3 compatibility issues
Simple methods are no longer in the string module.
2012-12-17 11:37:31 -06:00
Aleksander Morgado d07c5e14b9 qmi-codegen: translate the values of enums/flags in traces 2012-11-02 13:13:47 +01:00
Aleksander Morgado 5cbc7a5ca5 qmi-codegen: fix computation of expected TLV length when using strings 2012-11-02 09:02:41 +01:00
Aleksander Morgado 4c98ff41cc qmi-codegen: validate TLV before really reading it
Try to handle buggy firmware, or just make the library more robust, by
validating the read TLV before really reading it. If a TLV is not considered
valid, we just skip it for now.

E.g.: the "Detailed Service Status" TLV (0x21) in the "NAS Get Serving System"
message is supposed to be a sequence of 5 bytes, but some models (e.g. ZTE MF683)
end up sending only the first 4 bytes.
2012-10-30 20:42:59 +01:00
Aleksander Morgado fe7d46d49a libqmi-glib,utils: no need to pass endianness when reading/writing single bytes 2012-10-29 11:57:20 +01:00
Dan Williams cb5851e700 libqmi-glib,qmi-codegen: add endian-ness annotation capability
Some values are sent by the firmware in big endian byte order,
specifically IP addresses, which are sent in network byte order
(ie, big endian).  Add the ability to specify the byte order
the firmware handles the value as, and convert that to host
byte order when reading/writing QMI buffers.
2012-10-23 17:25:05 +02:00
Aleksander Morgado 51eff87f79 libqmi-glib,qmi-codegen: cancelled operations will issue an ABORT message
We allow passing a GCancellable to every async operation with the clients. Now,
if the cancellable gets cancelled and the operation can be ABORT-ed, then we
do it.
2012-10-10 21:14:48 +02:00
Aleksander Morgado 13b53c6a1d libqmi-glib,qmi-codegen: timed out operations will issue an ABORT message
Messages can now be tagged with a special 'abort' keyword, so that whenever the
message times out we issue a new ABORT command to cancel the specific timed out
request.

This support is currently only available for the NAS and WDS services, which are
the ones supporting ABORT for their long-running operations.
2012-10-10 21:14:48 +02:00
Aleksander Morgado 386fdf3f80 libqmi-glib,utils: make qmi_utils_str_hex() private to the library 2012-10-09 15:23:48 +02:00
Aleksander Morgado 586aba166a qmi-codegen: make internal get_printable() and get_version_introduced()
These methods are (should only be) used only by the library.
2012-10-09 15:23:48 +02:00
Aleksander Morgado 3bbdc47947 docs: improve documentation of enums, flags and errors 2012-10-09 15:23:48 +02:00
Aleksander Morgado a873852f8e qmi-codegen: request creator and response/indication parsers are private 2012-10-09 15:23:47 +02:00
Aleksander Morgado d2e47956d2 libqmi-glib: completely hide the implicit CTL Client in the API 2012-10-09 15:23:47 +02:00
Aleksander Morgado 71e2858271 libqmi-glib: new header file for private enum/flag types 2012-10-09 15:23:47 +02:00
Aleksander Morgado bb1807c4ba build: include missing files in dist 2012-10-09 15:23:47 +02:00
Aleksander Morgado 148791b4ca docs: improve generated `libqmi-glib' documentation
Among the tons of fixes done here, we now generate some per-service .sections
file which we then concatenate to build the final libqmi-glib-sections.txt file.
2012-10-09 15:23:47 +02:00
Aleksander Morgado 75ccb48f4d libmm-glib: fix multiple documentation issues 2012-10-09 12:20:55 +02:00
Aleksander Morgado c4a85b1f96 qmi-codegen: don't issue the array element clear function on 'Input' arrays
When an array is required to be passed in an input TLV, the user who created it
is responsible for freeing it. Therefore, we should not dump the static array
element clear function in these cases, or these unused methods will end up
breaking the compilation.
2012-09-26 09:45:42 +02:00
Aleksander Morgado 27ce79a38b message: swapped buffer/length variables in `qmi_message_get_tlv_printable()' 2012-09-26 09:25:05 +02:00
Aleksander Morgado f88c6029d0 message: renamed `qmi_message_tlv_foreach()' to `qmi_message_foreach_raw_tlv()' 2012-09-26 09:25:05 +02:00
Aleksander Morgado d6613195a9 message: renamed `qmi_message_tlv_add()' to `qmi_message_add_raw_tlv()'
Also swapped length and buffer variables; it no longer follows the 'TLV' name
(type,length,value), but it's more consistent with other interfaces where
buffer is given first and then the length.
2012-09-26 09:25:05 +02:00
Aleksander Morgado 3347c00dab message: renamed `qmi_message_tlv_get()' to `qmi_message_get_raw_tlv()'
Also made it return directly a pointer to the raw data buffer.
2012-09-26 09:25:05 +02:00
Aleksander Morgado d7b05576a9 libqmi-glib,utils: use constant buffer pointer when reading variables
The contents of the input buffer are never modified when reading variables from
it, so better use a constant pointer in the methods doing it.

What it does change is the pointer to the current position in the constant
buffer.
2012-09-26 09:25:05 +02:00
Aleksander Morgado 8cdc317238 qmi-codegen: fix error reporting when failed parsing JSON
If we get an error parsing a JSON file we really want to have the exact line
number where the error happened, so don't just skip the comment lines and
substitute them with an empty line instead so that the line numbers don't
change.
2012-09-24 07:46:01 +02:00
Aleksander Morgado 0331ddf28f qmi-codegen: ensure helper methods get always generated
For those variables which are containers of other variables (struct, sequence
and array), ensure we call `emit_helper_methods()' in order to generate variable
specific dispose() helpers and such.

This fixes the case of nested arrays of structs (arrays of structs with arrays of
structs whithin).
2012-09-24 07:45:57 +02:00
Aleksander Morgado 201e0cea5f qmi-codegen: for strings, use 'size-prefix-format' instead of 'length-prefix-size'
Use the new 'size-prefix-format' property to specify whether the length prefix
variable is a 'guint8' or a 'guint16'.

We therefore consolidate the way how this length prefix variable is specified in
both arrays and strings.

So, instead of:
    "length-prefix-size" : "16"

We now just do:
    "size-prefix-format" : "guint16"
2012-09-19 12:06:28 +02:00
Aleksander Morgado 7345ca6aaf qmi-codegen: for arrays, use a new 'size-prefix-format' instead of 'array-size'
The 'array-size' property was used to define an implicit variable to be found at
the beginning of every array. This property expected a dictionary with one
single 'format' key.

Instead of this setup, create a new 'size-prefix-format' property which directly
expects the format string of the variable to be used as array-length indicator.

So, instead of:
    "array-size" : { "format" : "guint16" }

We can now just use:
    "size-prefix-format" : "guint16"

Also, remove the explicit size definitions when the format is "guint8", as that
is the default already when none specified and the array is not of fixed size.
2012-09-19 12:06:28 +02:00
Aleksander Morgado dd82d6c92d qmi-codegen: fix invalid `g_array_unref()' calls in generated code 2012-09-19 08:52:02 +02:00
Aleksander Morgado 8a90c928a7 qmi-codegen: fix printable indications 2012-09-18 18:51:53 +02:00
Aleksander Morgado a2844ab041 qmi-codegen: fix memleak in generated code
The contents of the containers were not being freed properly.
2012-09-18 18:51:34 +02:00
Aleksander Morgado 3d26f41300 pds: setup generation of the PDS service support
Including "PDS Reset".
2012-09-18 13:14:38 +02:00
Aleksander Morgado d70bb0f720 qmi-codegen: allow nesting arrays 2012-09-18 10:02:14 +02:00
Dan Williams ba4e131c89 qmi-codegen: handle string arrays
Like these:

struct {
	uint8 num_instances;
	struct {
		uint8 length;
		char data[];
	};
};
2012-09-08 10:34:13 +02:00
Dan Williams e6f08631b7 qmi-codegen: handle fixed-size arrays
Like IPv6 addresses.
2012-09-08 10:34:13 +02:00
Dan Williams e7a72f26b6 qmi-codegen: handle variable-sized string length prefix fields
Most string lengths are UINT8, but some (WDS Get Current Settings
PCSCF Domain Name List, for example) are UINT16.
2012-09-08 10:34:13 +02:00
Aleksander Morgado 787b02287f wms: setup generation of the WMS service support
Including "WMS Reset".
2012-09-06 10:28:54 +02:00
Aleksander Morgado 334177e678 qmi-codegen: allow 'max-size' in output string variables
If 'max-size' is given for an output string variable, we will read up to the
specified number of bytes from the buffer. This will help us handle cases where
the firmware of the device doesn't match what it sends with what it wanted to
send (e.g. IMEI longer than 15 characters).
2012-09-04 14:28:00 +02:00
Aleksander Morgado c18cd871b6 libqmi-glib: register errors in DBus 2012-08-27 16:46:13 +02:00
Aleksander Morgado 94aa985761 build: cleanup dependencies
The service-specific implementation header needs to include only the raw
enums/flags headers; while the source needs to include the enum/flags types
headers.
2012-08-02 10:33:51 +02:00
Aleksander Morgado b043619eb0 build: autogenerate 64bit flags helpers 2012-07-26 14:24:00 +02:00
Aleksander Morgado 2dff82edbd qmi-codegen: allow indications without output TLVs 2012-07-23 13:30:28 +02:00
Aleksander Morgado af6d4526b1 qmi-codegen: convert indication messages received into `QmiClient' signals 2012-07-23 12:51:47 +02:00
Aleksander Morgado 5ad07e7bc7 qmi-codegen: create new boxed types for the input/output bundles 2012-07-23 12:51:47 +02:00