Commit Graph

80 Commits

Author SHA1 Message Date
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
4bdfd25de1 base-modem: when getting best AT port, assume we may have lost specific ports
Don't assume that primary port is always set.
2012-03-16 14:53:23 +01:00
Aleksander Morgado
3e5b42569b base-modem: use new simplified authentication setup 2012-03-16 14:53:15 +01:00
Aleksander Morgado
21a722b616 core: don't pass primary port to interface initializations
They will all get it themselves.
2012-03-15 14:15:05 +01:00
Aleksander Morgado
8b7b614105 core: rework port grabbing and organization
Make port roles more flexible.  We have modems that do PPP
on interfaces other than the primary interface, and that
wasn't possible with the old code.  So clean up all that
logic and move the port organization code into the core
so we can reduce code in the plugins.

In the new world order, the plugins say whether the port
is a QCDM port, an AT port, or ignored.  If it's an AT
port the plugins get to tag it as primary, secondary, or
PPP, or any combination of the 3.  This allows for modems
where PPP should really be done on the secondary port
(Huawei E220, Sierra devices) so that the primary port
stays open for command and status.

After all ports are grabbed by the generic classes, they get
"organized", which assigns various ports to the roles of
PRIMARY, SECONDARY, DATA, and QCDM based on specific rules
and hints that the plugin provided (which are expressed as
MMAtPortFlags).

The plugin code is responsible for determining the port
hints (ie MMAtPortFlags) at probe time, instead of having
a combination of the plugin and the modem class do the
job.  This simplifies things greatly for the plugins at
the expense of more complicated logic in the core.

This is the port of commit 96505d42ed62327101dcee7c2bf31177b0bb1c9f
to the 06-api branch.
2012-03-15 14:15:05 +01:00
Aleksander Morgado
11962711e4 at-serial-port: no need to pass port type when creating the object
We'll just specify the port is AT, not primary or secondary
2012-03-15 14:15:05 +01:00
Aleksander Morgado
f8cc4114ad qcdm-serial-port: no need to pass port type when creating the object 2012-03-15 14:15:05 +01:00
Aleksander Morgado
66b2b7fb23 base-modem: also signal validity when reporting invalid
Otherwise the manager won't catch invalid modems failing at initialization.
2012-03-15 14:15:05 +01:00
Aleksander Morgado
46a665630d base-modem: use new autogenerated port-enum-string getters 2012-03-15 14:15:04 +01:00
Aleksander Morgado
ee13bbe4a3 base-modem: ignore every unsolicited CMTI until we set up messaging 2012-03-15 14:15:00 +01:00
Aleksander Morgado
cd5e9c27a3 broadband-modem: if locked, don't try to initialize remaining interfaces
Whenever we get unlocked, the modem initialization sequence will be run again.
2012-03-15 14:14:59 +01:00
Aleksander Morgado
81d130b2bb base-modem: initially set the unsolicited CUSD handler with NULL callback 2012-03-15 14:14:57 +01:00
Aleksander Morgado
1304b65956 base-modem: log when fully disposing the object 2012-03-15 14:14:44 +01:00
Aleksander Morgado
8af488b452 base-modem: use g_clear_object() before setting new objects 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
b0d3f59397 base-modem: fully ignore CIEV messages on startup 2012-03-15 14:14:40 +01:00
Aleksander Morgado
b6a3ccd578 modem-helpers: renamed 3GPP registration related helpers with `mm_3gpp' prefix 2012-03-15 14:14:35 +01:00
Aleksander Morgado
c133c3284d base-modem: allow retrieving non-connected data ports
Bearers will ask for data ports that can be used for connections. Right now,
only one data port is expected to be handled, but we don't impose any
restriction in the API.
2012-03-15 14:14:34 +01:00
Aleksander Morgado
c636cdb27f base-modem: setup NULL callbacks in unsolicited CREG message handlers
When the port is grabbed, we setup NULL callbacks for all unsolicited
registration message handlers. If we do enable 3GPP registrations
afterwards, we'll set proper callbacks.
2012-03-15 14:14:29 +01:00
Aleksander Morgado
acc3e3f6da core: always pass open port to interface initializations
When the first AT port is grabbed, modem initialization is launched, using that
specific port. This port is also passed to all interface initialization methods.
2012-03-15 14:14:28 +01:00
Aleksander Morgado
c58db4e015 core: start using our newly defined errors 2012-03-15 14:14:25 +01:00
Aleksander Morgado
b00c409978 base-modem: new virtual initialize() method
Whenever the first AT port is grabbed, we launch the initialize() method, which
must have been implemented by the corresponding modem subclass.
2012-03-15 14:14:22 +01:00
Aleksander Morgado
677e04be95 base-modem: new property to keep the Connection object 2012-03-15 14:14:22 +01:00
Aleksander Morgado
d32b006cce base-modem: new properties for vendor and product IDs
These will be set during modem object creation.
2012-03-15 14:14:22 +01:00
Aleksander Morgado
d5a0efc659 base-modem: getters for primary/secondary/qcdm ports 2012-03-15 14:14:22 +01:00
Aleksander Morgado
4a096c8c56 base-modem: set v1 serial parser always
CDMA modems used to use the v1_e1 serial parser; but we'll try to setup a common
one in all modems.
2012-03-15 14:14:22 +01:00
Aleksander Morgado
0d53a72d41 base-modem: new properties to handle Device, Driver and Plugin
They will be set when constructing the object.
2012-03-15 14:14:22 +01:00
Aleksander Morgado
b6cb5bd6da base-modem: ported all port grabbing/releasing logic to the base object 2012-03-15 14:14:22 +01:00
Aleksander Morgado
f39923c97d base-modem: expect a GDBusMethodInvocation as context of the auth request 2012-03-15 14:14:22 +01:00
Aleksander Morgado
9a72ac80d0 core: new MMBaseModem abstract type
Basically, a replacement of the MMModemBase type, being prepared to handle
multimode devices.

This object derives from a MmGdbusObjectSkeleton, which makes it suitable to be
controlled within the GDBusObjectManagerServer.
2012-03-15 14:14:21 +01:00