Age | Commit message (Collapse) | Author |
|
When we don't care about the type of AT port to use, prefer the QMI or
MBIM based ones if any available.
|
|
The whole codebase is updated to assume the MMBaseModem AT operations
require an object implementing the MMIfacePortAt interface, instead of
a MMPortSerialAt object.
In the places where we know the port is a MMPortSerialAt, e.g. when we
query explicitly for the primary or secondary serial AT port, we will
use an explicit MM_IFACE_PORT_AT() cast when calling the AT command
method.
In the places where we get_best_at_port() we're going to assume that
we don't know the port type. This method will be updated in a follow
up commit to support the MMIfacePortAt interface as well.
|
|
|
|
No functional changes should happen.
The purpose of this change is to align coding style with the rest of
the project and also simplify the implementation of the different AT
command handling methods, e.g. to avoid needing so many internal
helper methods.
|
|
|
|
|
|
Can be used for easier command retries where the generic sequence code
handles the GTimeout source.
Signed-off-by: Dan Williams <dcbw@redhat.com>
|
|
We cancel AT commands (or sequences) on cancellation of the modem's
cancellable as well as of the optional user-provided one.
However, the GTask can be associated with only one. That's okay if the
user didn't supply one -- we just use the modem's cancellable only.
Otherwise we chain the cancellables together (also cancel the user one
with the modem one) at cost of some extra complexity.
This aims to make the above a little clearer by using hopefully
better names.
Suggested-by: Aleksander Morgado <aleksandermj@chromium.org>
|
|
Aleksander seems to prefer it this way. Looks better.
Suggested-by: Aleksander Morgado <aleksandermj@chromium.org>
|
|
Use GTask API in place of the deprecated GSimpleAsyncResult.
|
|
This will make it slightly easier to port mm_port_serial_at_command() to
use GTask, since we won't have to keep a pointer to the result in GTask
after _finish() has been called.
In most cases the caller needs the value anyway, so this doesn't add too
much hasle.
|
|
Instead of using the FALSE return of the method to indicate either a
fatal error (if result_error was set) or the continuation request (if
result_error wasn't set), provide a enum that has explicit states for
all three possible values (failure, success or continue).
|
|
|
|
It has the same exact format as MMBaseModemAtCommand, but its contents
are assumed heap allocated.
The only real purpose of this type is to allow defining static
constant MMBaseModemAtCommand variables without warnings when using
-Wdiscarded-qualifiers.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
This may happen when sending commands to the modem while in non-enabled state,
like when sending the PIN. In this case, just send the command, don't fully
initialize the port with the initialization sequence.
|
|
|
|
Equivalent to `mm_base_modem_at_command()', but with a raw setup.
|
|
|
|
Commands treated as 'raw' won't get the 'AT' prefix and will also not get the
trailing carriage return.
|
|
|
|
Instead of the `_in_port()' variants, we'll provide more generic
`_full()' methods. These should be used either if we want to send commands
to a specific port, or if we want to use a specific user-provided GCancellable.
In addition to this user-provided GCancellable, we keep the internal modem-wide
one.
|
|
Users of mm_base_modem_at_command_in_port() can now directly pass the result
of mm_base_modem_peek_port_primary() or mm_base_modem_peek_port_secondary(),
which may be NULL if no such port exists in the modem. So we'll gracefully
detect the NULL port and complete the async operation with an error.
|
|
* mm_base_modem_peek_port_* () will return either a port object (no new
reference), or NULL if none available.
You would usually peek() a port if you're going to use it just in the current
method, as there is no way to that reference to get invalid (we're single
threaded).
* mm_base_modem_get_port_* () will return either NEW references to valid
port objects, or NULL if none available.
And, you would usually get() a port, whenever you want the port object to be
valid even out of the current method, for example when keeping it in the
context of an async operation.
Also, we need to consider that the primary AT port MAY BE NULL when you
peek() or get() it. This is due to the fact that we may be releasing ports
(due to device disconnection) in the middle of async operations.
|
|
|
|
Let parsers know if this command is the last in a sequence since
they may want to handle errors differently if that's the case.
|
|
|
|
Sometimes, we want to check whether a given port is available to send commands,
and fallback to some other method if so (e.g. using a QCDM port).
|
|
|
|
Make a tight connection between the action of sending AT commands, either single
or in a sequence, with the MMBaseModem object owning the port. This direct
relation allows sending commands without specifying which port to use, so that
the modem object can get the best port at each time, and handling all that in a
single common place.
The original mm-at API has also been modified so that when a single command is
sent, a constant string is returned. We are allowed to return constant strings
in mm_base_modem_at_command_finish() because the string itself is owned by the
GSimpleAsyncResult, and hence, alive enough time. The GSimpleAsyncResult is
completely disposed only after the async call is fully completed.
Same reasoning behind the GVariant returned in the AT sequences; it should not
be owned by the caller, it's a transfer-none in introspection terms.
|