Commit Graph

347 Commits

Author SHA1 Message Date
Aleksander Morgado
79daa3099e api,bearer: add 'total-rx-bytes', 'total-tx-bytes' and 'total-duration' stats
Compiling the amount of bytes transferred and received during all
tracked connection attempts, as well as the total duration of all the
connections.
2020-04-10 11:45:03 +00:00
Aleksander Morgado
f325ef5902 api,bearer: add 'attempts' and 'failed-attempts' statistics
When we're reusing over and over the same bearer object, we can
provide statistical information about the number of connection
attempts that have been done and how many of them failed.
2020-04-10 11:45:03 +00:00
Aleksander Morgado
ccb45a8941 libmm-glib,helpers: ignore all leading whitespaces when parsing numbers 2020-04-09 12:38:50 +00:00
Aleksander Morgado
1c7304eb71 libmm-glib,helpers: allow reading hex strings from match info 2020-04-09 12:38:50 +00:00
Aleksander Morgado
539562af01 libmm-glib,helpers: skip quotes when reading numbers from match infos
Useful when the regex applied to the parseable strings don't have an
special ignore rule for the quotes.
2020-04-09 12:38:50 +00:00
Aleksander Morgado
7354dc928f api: new 5GNR capability 2020-04-09 12:38:50 +00:00
Aleksander Morgado
0cd76bf1c4 api: deprecate MM_MODEM_CAPABILITY_LTE_ADVANCED
It's not used anywhere.
2020-04-09 12:38:49 +00:00
Aleksander Morgado
6de1363174 api,modem: improve capabilities related documentation
And remove the unused mm_common_build_capability_combinations_any()
method in the common non-public library code.
2020-04-09 06:46:02 +02:00
Aleksander Morgado
a61caff747 iface-modem-location: plug memleaks when updating gps raw variant
The helper method returning a variant from a MMLocationGpsRaw would
return already a full variant reference instead of a floating one, so
we were really increasing the refcount when doing g_variant_ref_sink()
in the location interface.

Fix this by consolidating all helper methods in libmm-glib that return
variants from the different MMLocationXX objects, so that they all
return full variants instead of floating ones.
2020-02-07 14:42:16 +00:00
Aleksander Morgado
280363e0d6 libmm-glib,helpers: allow \r\n in string to number conversions
It's not uncommon that we may want to parse a simple AT response that
contains a single number by doing mm_strip_tag() followed by
mm_get_uint_from_str(). In order to do this, we need to have the
helper methods that convert strings to numbers support \r\n characters
at the end of the string, as we would have in AT responses.
2020-01-31 15:48:16 +01:00
Aleksander Morgado
11f04851ce libmm-glib,location-gps-nmea: avoid using deprecated build_full() method
mm-location-gps-nmea.c: In function ‘mm_location_gps_nmea_get_string_variant’:
  mm-location-gps-nmea.c:245:5: warning: ‘mm_location_gps_nmea_build_full’ is deprecated: Use 'mm_location_gps_nmea_get_traces' instead [-Wdeprecated-declarations]
    245 |     built = mm_location_gps_nmea_build_full (self);
        |     ^~~~~
2020-01-31 15:18:35 +01:00
Aleksander Morgado
02eafb5821 libmm-glib,test: avoid using deprecated mm_pco_list_free()
test-pco.c: In function ‘test_pco_list_add’:
  test-pco.c:82:5: warning: ‘mm_pco_list_free’ is deprecated [-Wdeprecated-declarations]
     82 |     mm_pco_list_free (list);
        |     ^~~~~~~~~~~~~~~~
  In file included from ../../libmm-glib/libmm-glib.h:82,
                   from test-pco.c:17:
  ../../libmm-glib/mm-pco.h:67:6: note: declared here
     67 | void mm_pco_list_free (GList *pco_list);
        |      ^~~~~~~~~~~~~~~~
2020-01-31 15:18:35 +01:00
Aleksander Morgado
1c078531a0 build: use AX_IS_RELEASE() and AX_COMPILER_FLAGS()
The autoconf macros AX_COMPILER_FLAGS_{CFLAGS|GIR|LDFLAGS} test
for compiler and linker support of various flags, and add the flags to
the generated output.

If the command-line option '--enable-compile-warnings' is specified to
'configure', a number of additional warning options is also added to the
output. This is the default.

This update requires the presence of the GNU autoconf-archive in the
system.
2020-01-30 11:59:14 +01:00
Aleksander Morgado
ddb7d915a7 libmm-glib: unconditionally define autoptr support for all types
As we now depend on glib 2.48
2020-01-15 18:56:21 +01:00
Aleksander Morgado
baa68f5a4a libmm-glib,simple-connect-properties: cleaner error handling
If processing a key-value pair as a bearer property fails, we need to
know if it failed due to the key being unknown or due to some other
reason (e.g. failure parsing value of a known key).

We'll only try with the Simple.Connect properties if the key is
reported as unknown in the bearer properties.

This will help us better identify errors if e.g. an invalid value is
given to a known key. E.g. "yes" was invalid for allow-roaming here:

    daemon.notice netifd: wan (30476): simple connect=apn=internet,ip-type=ipv4,allow-roaming=yes
    daemon.notice netifd: wan (30476): Error parsing connect string: 'Invalid properties string, unexpected key 'allow-roaming''
2020-01-06 14:46:36 +01:00
Aleksander Morgado
15e8a78a15 libmm-glib,common-helpers: allow yes/no as booleans in string
E.g. so that the settings passed on Simple.Connect() or
Bearer.Connect() are parsed correctly from the user string:

  daemon.notice netifd: wan (30476): simple connect=apn=internet,ip-type=ipv4,allow-roaming=yes
  daemon.notice netifd: wan (30476): Error parsing connect string:
  'Invalid properties string, unexpected key 'allow-roaming''

This also goes inline with e.g. the --create-bearer help in the man
page that suggests using yes/no for the allow-roaming setting.
2020-01-06 14:39:45 +01:00
Aleksander Morgado
70910a6713 libmm-glib,nmea: deprecate mm_location_gps_nmea_build_full()
The new mm_location_gps_nmea_get_traces() is a much more generic way
to retrieve the full list of traces and suits the libmm-glib API much
better.
2020-01-01 09:22:41 +01:00
Aleksander Morgado
9805ffe1b0 libmm-glib,nmea: new method to get list of traces
Fixes https://gitlab.freedesktop.org/mobile-broadband/ModemManager/issues/120
2019-12-31 16:42:44 +01:00
Aleksander Morgado
fcbffbd123 libmm-glib,3gpp: make MMModem3gppNetwork a boxed type
So that bindings know how to free the list of structs.

This commit ends up triggering an API break in the bindings generated
via GObject introspection, because the methods to access the items of
a MMModem3gppNetwork are no longer treated as Modem3gpp class methods.

E.g. instead of:
  ModemManager.Modem3gpp.network_get_operator_code(network)
We should now do:
  network.get_operator_code()

There is no API break in libmm-glib.
2019-12-13 18:04:02 +01:00
Aleksander Morgado
e60132284b libmm-glib: SID value '0' is actually a good one 2019-12-03 08:43:39 +00:00
Aleksander Morgado
b076653ef0 libmm-glib,pco: deprecate mm_pco_list_free()
Use g_list_free_full() using g_object_unref() as #GDestroyNotify
function instead.
2019-10-28 10:39:22 +01:00
Aleksander Morgado
5dd829174f libmm-glib: flag as (skip) all non-API methods
So that the GI scanner ignores them.
2019-10-28 10:28:31 +01:00
Aleksander Morgado
037b774b18 simple-status: deprecate 'subscription state' property
This property was already deprecated in libmm-glib and removed from
the daemon in 1.10, so the counterpart property in MMSimpleStatus
should also be deprecated.
2019-10-28 10:28:31 +01:00
Aleksander Morgado
651028c2b7 libmm-glib: remove unused _dup() methods 2019-10-28 10:28:31 +01:00
Aleksander Morgado
856619535d api,voice: CreateCall() expects only the 'number' property
There is absolutely no reason to provide any other property when the
user creates a new call.
2019-10-28 10:28:31 +01:00
Aleksander Morgado
08d23dd64d docs,libmm-glib: provide per-version indices 2019-10-28 10:28:31 +01:00
Aleksander Morgado
b325270296 libmm-glib,pco: mm_pco_list_add() is not part of the API
This method is used by the daemon to modify the GList of MMPco
objects, the client should not need to use this method for anything.
2019-10-27 16:56:29 +01:00
Aleksander Morgado
d09aa38552 libmm-glib,location: fix 'unknown' lat/long/alt numeric values
G_MINDOUBLE is 0.0, which is a valid altitude, latitude, and
longitude. Change the 'unknown' location values to -G_MAXDOUBLE
instead, which is a completely invalid value in all cases.

This is strictly an ABI break, but it's also true that until now the
methods returning these 'unknown' values could also return valid 0.0
values that would have been detected as 'unknown' by the caller.
So, just stop this madness and don't consider this any ABI break.

This is the same thing we had to do with MM_SIGNAL_UNKNOWN in
fe66bdf65e.
2019-10-27 16:30:37 +01:00
Aleksander Morgado
1f6c006976 api,sim: new 'Emergency Numbers' property 2019-10-17 08:31:46 +00:00
Aleksander Morgado
657833a400 voice,api: new 'EmergencyOnly' boolean flag
This new flag allows users of the API to know whether general purpose
voice calls are allowed or otherwise only voice calls to the
registered emergency numbers should be performed.

ModemManager won't really do any distinction between emergency and
non-emergency calls at this point, this flag is just an early
indication for the user of the API that no normal voice call should be
attempted.
2019-10-17 08:31:46 +00:00
Aleksander Morgado
3a9c553184 libmm-glib,oma: avoid plural in type 2019-10-02 10:00:23 +02:00
Aleksander Morgado
19652e101c libmm-glib,call: fix typo in documentation 2019-10-02 09:58:07 +02:00
Aleksander Morgado
be4fa661c1 plugins,telit: refactor #BND command support
And added support for several new things, including:
 * Setting "any" band now attempts to set all supported bands.
 * Added new 2G band value '5' (egsm+dcs+pcs+g850).
 * Setup support for two different 3G band combinations, a default one
   plus an alternate one applicable to the LM940/960 models only. The
   alternate combination is selected via udev tags.

During the refactor, the following Telit-specific helpers were also
removed and exchanged with more generic counterparts.
 * mm_telit_bands_contains() -> mm_common_bands_garray_lookup()
 * mm_telit_get_band_flags_from_string() -> mm_parse_uint_list()
2019-09-17 10:52:42 +02:00
Ben Chan
c6cf7cf094 libmm-glib,firmware-update-settings: handle null self pointer
mm_firmware_update_settings_get_variant() checks for a null `self'
pointer when accessing `self->priv->method', but doesn't perform the
null check when accessing other members of
MMFirmwareUpdateSettingsPrivate.

This patch fixes mm_firmware_update_settings_get_variant() to fully
handle a null `self' pointer.
2019-08-03 09:16:39 -07:00
Aleksander Morgado
9263e79dc3 api,voice: new CallWaitingSetup() and CallWaitingQuery() methods
These new methods allow querying and updating the status of the call
waiting network service, as per 3GPP TS 22.083.

The status of the service is not a property because we don't want to
unconditionally load it on every boot, given that the process involves
talking to the network (i.e. it is not a device setting).
2019-07-19 17:47:51 +02:00
Aleksander Morgado
511b0ff244 api,call: new JoinMultiparty() and LeaveMultiparty() methods 2019-07-11 23:21:00 +02:00
Aleksander Morgado
213c60b76d api,call: new Multiparty boolean property
It will be set to TRUE if this call is part of a multiparty call.
2019-07-11 23:21:00 +02:00
Aleksander Morgado
222874299e api,call: new Deflect() method
This method allows deflecting an incoming or waiting call to a
different number.
2019-07-11 23:20:59 +02:00
Aleksander Morgado
8b01958cb4 api,voice: new Transfer() method
This method will join all active and held calls into a single
multiparty call, and then request the network to terminate the call on
the subscriber's end and transfer the control of the call to the
parties that are still in the call.
2019-07-11 23:20:59 +02:00
Aleksander Morgado
efcc4c60fe api,voice: new HangupAll() method
This method will terminate all ongoing calls.
2019-07-11 23:20:59 +02:00
Aleksander Morgado
c713c2c5f9 api,voice: new HoldAndAccept() method
This method will put the currently active call on hold, and right away
accept the next available call.

The user of the API does not need to specify explicitly which is the
next call to accept, because that is decided automatically:
  * If there is any waiting call, it will accept it right away.
  * If there is no waiting call but there is a held call, it will make
  the held call active again.
2019-07-11 23:20:59 +02:00
Aleksander Morgado
d56d1b2656 api,voice: new HangupAndAccept() method
This method will hangup the currently active call and right away
accept the next available call.

The user of the API does not need to specify explicitly which is the
next call to accept, because that is decided automatically:
  * If there is any waiting call, it will accept it right away.
  * If there is no waiting call but there is a held call, it will make
    the held call active again.
2019-07-11 23:20:59 +02:00
Aleksander Morgado
52b67dc7c3 api,modem: new 'CarrierConfigurationRevision' property
Which reports the version of the currently active carrier
configuration.

We also update the firmware 'version' reported in the firmware
settings so that carrier-specific upgrades can be performed (e.g. when
the firmware stays the same but the MCFG is updated).
2019-04-02 12:14:03 +02:00
Aleksander Morgado
94cf7f0ceb iface-modem: new carrier config support
During initialization phase we will allow querying the modem for the
details of which carrier-specific configuration is being used, and
will expose a description string in the API.

In addition to showing the current configuration, we will also allow
automatically switching the configuration based on the SIM card
detected in the device. In order to allow this, plugins/modems will
need to provide the expected mapping between carrier config
description and MCCMNC. This mapping cannot be generic, because
different manufacturers may use different description strings.
2019-04-02 12:11:25 +02:00
Aleksander Morgado
7330f6d581 libmm-glib,common: new helper methods to read guint64 values
We use strtoull() to read a "unsigned long long" that is always at
least 64bits, even in 32bit systems.
2019-03-29 10:07:29 +00:00
Aleksander Morgado
f49f325715 libmm-glib,firmware-update-settings: skip dictionary if method is NONE
No need to process the detailed dictionary if no explicit method is
reported as supported. Avoids unnecessary warnings:

  $ mmcli -m 1 --firmware-status
  ** (mmcli:6887): WARNING **: 15:52:54.664: Invalid initial update settings: Missing required 'device-ids' setting
  error: firmware status unsupported
2019-01-16 15:56:59 +01:00
Aleksander Morgado
478a076d30 libmm-glib,manager: use g_async_initable_new_finish() explicitly
We're running g_async_initable_new_async() ourselves in
mm_manager_new(), so our finish() method should call
g_async_initable_new_finish() explicitly.

There's no change in the logic here, as the generated
mm_gdbus_object_manager_client_new_finish() was already doing this
implicitly.
2019-01-13 18:11:41 +01:00
Aleksander Morgado
495a466aaa libmm-glib,manager: simplify object creation
The G_OBJECT() casts accept NULL safely.
2019-01-13 18:02:22 +01:00
Aleksander Morgado
3eb3854fcb libmm-glib,manager: cleanup internal proxy on name owner updates
The MMManager object keeps an internal proxy object for the Manager
interface, and we must make sure we cleanup this object any time the MM
daemon is restarted. Otherwise, the MMManager may end up trying to use
a stale proxy associated to a previous run of the daemon, and e.g. not
showing properly the runtime version info.

E.g., in this sequence with the example python tester, the runtime
version of the daemon was valid only for the first time the daemon
runs, and if the daemon is restarted, mm_manager_get_version()
would keep returning NULL.

    $ ./modem-watcher-python
    [ModemWatcher] ModemManager service not available in bus
    [ModemWatcher] ModemManager 1.9.990 service is available in bus
    [ModemWatcher] Dell Inc. (DW5821e Snapdragon X20 LTE) modem managed by ModemManager [None]: /org/freedesktop/ModemManager1/Modem/0
    [ModemWatcher] ModemManager service not available in bus
    [ModemWatcher] ModemManager None service is available in bus
    [ModemWatcher] Dell Inc. (DW5821e Snapdragon X20 LTE) modem managed by ModemManager [None]: /org/freedesktop/ModemManager1/Modem/0
    [ModemWatcher] ModemManager service not available in bus
    [ModemWatcher] ModemManager None service is available in bus
    [ModemWatcher] Dell Inc. (DW5821e Snapdragon X20 LTE) modem managed by ModemManager [None]: /org/freedesktop/ModemManager1/Modem/0
2019-01-13 18:01:54 +01:00
Aleksander Morgado
2212d3e054 api,manager: new InhibitDevice() method
This new method allows users of the ModemManager API to take full
control of a given device.

Unlike other operations in the API, the inhibition is maintained as
long as the caller exists in the bus, or until the same caller
uninhibits the device.

https://gitlab.freedesktop.org/mobile-broadband/ModemManager/issues/98
2019-01-03 21:05:58 +01:00