aboutsummaryrefslogtreecommitdiff
path: root/src/mm-base-modem-at.c
AgeCommit message (Collapse)Author
2023-04-11base-modem-at: use better names for pairs of dependent cancellablesLubomir Rintel
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>
2023-04-11base-modem-at: make abort_task_if_port_unusable() unref the GTaskLubomir Rintel
Aleksander seems to prefer it this way. Looks better. Suggested-by: Aleksander Morgado <aleksandermj@chromium.org>
2023-04-11base-modem-at: port mm_base_modem_at_{command,sequence}_full() to GTaskLubomir Rintel
Use GTask API in place of the deprecated GSimpleAsyncResult.
2023-04-11port-serial-at: make mm_port_serial_at_command_finish() transfer ownershipLubomir Rintel
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.
2020-06-28base-modem,at: response processors return a more specific enumAleksander Morgado
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).
2020-06-28base-modem,at: improve documentation on response processor methodsAleksander Morgado
2020-01-31base-modem: define new helper MMBaseModemAtCommandAllocAleksander Morgado
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.
2019-10-11base-modem-at: avoid using MM_CORE_ERROR_CANCELLEDAleksander Morgado
2019-05-18base-modem-at: don't ignore allow_cached flag in first command in sequenceAleksander Morgado
2018-01-25*: Spelling fixesVille Skyttä
2014-02-13port-serial-at: use GIO Async API like methodsAleksander Morgado
2014-02-13ports: rename 'MMAtSerialPort' to 'MMPortSerialAt'Aleksander Morgado
2014-02-13ports: rename 'MMSerialPort' to 'MMPortSerial'Aleksander Morgado
2013-02-18base-modem: don't run port init sequence if we're just sending a commandAleksander Morgado
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.
2012-10-22base-modem-at: handle NULL responses from the serial parsing in sequencesAleksander Morgado
2012-08-24base-modem-at: new `mm_base_modem_at_command_raw()'Aleksander Morgado
Equivalent to `mm_base_modem_at_command()', but with a raw setup.
2012-08-24base-modem-at: add 'raw' handling to `mm_base_modem_at_command_full()'Aleksander Morgado
2012-08-24at-serial-port: allow sending 'raw' commandsAleksander Morgado
Commands treated as 'raw' won't get the 'AT' prefix and will also not get the trailing carriage return.
2012-08-20novatel: flip secondary ports to AT mode during port setupAleksander Morgado
2012-03-16base-modem: implement new modem-wide cancellable, and rework AT commandsAleksander Morgado
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-16base-modem-at: set error if NULL port detectedAleksander Morgado
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-16base-modem: new port getters and peekersAleksander Morgado
* 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-16at-serial-port: allow cancelling the response timeoutAleksander Morgado
2012-03-15base-modem-at: indicate sequence status to response parsersDan Williams
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-15base-modem-at: always unref the modem object in AT command/sequence contextsAleksander Morgado
2012-03-15base-modem: make public the method to get best AT portAleksander Morgado
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-15base-modem: store the AT sequence context GDestroyNotify callbackAleksander Morgado
2012-03-15base-modem-at: refactor AT sequence/command handlingAleksander Morgado
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.