Commit Graph

18 Commits

Author SHA1 Message Date
Aleksander Morgado
d4dfd661b9 port-serial-at: use GIO Async API like methods 2014-02-13 13:40:21 +01:00
Aleksander Morgado
6f235b9948 ports: rename 'MMAtSerialPort' to 'MMPortSerialAt' 2014-02-13 13:40:01 +01:00
Aleksander Morgado
9cde02111b ports: rename 'MMSerialPort' to 'MMPortSerial' 2014-02-13 13:39:51 +01:00
Aleksander Morgado
d593116d68 base-modem: don't run port init sequence if we're just sending a command
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.
2013-02-18 16:06:18 +01:00
Aleksander Morgado
5978258d85 base-modem-at: handle NULL responses from the serial parsing in sequences 2012-10-22 12:33:19 +02:00
Aleksander Morgado
4fe7c7d637 base-modem-at: new `mm_base_modem_at_command_raw()'
Equivalent to `mm_base_modem_at_command()', but with a raw setup.
2012-08-24 12:32:29 +02:00
Aleksander Morgado
d18dbb869a base-modem-at: add 'raw' handling to `mm_base_modem_at_command_full()' 2012-08-24 12:32:29 +02:00
Aleksander Morgado
d9ea4a304c at-serial-port: allow sending 'raw' commands
Commands treated as 'raw' won't get the 'AT' prefix and will also not get the
trailing carriage return.
2012-08-24 12:32:28 +02:00
Aleksander Morgado
b8e5dbcaf4 novatel: flip secondary ports to AT mode during port setup 2012-08-20 16:26:55 +02:00
Aleksander Morgado
cdd339f802 base-modem: implement new modem-wide cancellable, and rework AT commands
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.
2012-03-16 14:53:23 +01:00
Aleksander Morgado
7bfc56c2a8 base-modem-at: set error if NULL port detected
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.
2012-03-16 14:53:23 +01:00
Aleksander Morgado
cc6d4a97fb base-modem: new port getters and peekers
* 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.
2012-03-16 14:53:23 +01:00
Aleksander Morgado
ef2b1cf030 at-serial-port: allow cancelling the response timeout 2012-03-16 14:53:22 +01:00
Dan Williams
cb2d6d6105 base-modem-at: indicate sequence status to response parsers
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.
2012-03-15 14:14:48 +01:00
Aleksander Morgado
7b884c4635 base-modem-at: always unref the modem object in AT command/sequence contexts 2012-03-15 14:14:44 +01:00
Aleksander Morgado
94846a2f51 base-modem: make public the method to get best AT port
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).
2012-03-15 14:14:43 +01:00
Aleksander Morgado
e4486fd5f0 base-modem: store the AT sequence context GDestroyNotify callback 2012-03-15 14:14:41 +01:00
Aleksander Morgado
52db9b9035 base-modem-at: refactor AT sequence/command handling
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.
2012-03-15 14:14:31 +01:00