Commit graph

26 commits

Author SHA1 Message Date
Barnabás Pőcze
4aa2e44796 spa: move dbus helpers out of bluez plugin
The file is moved into a new "include-private" directory. This is done
because otherwise adjustments would have to be made to the list of installed
headers, the way include tests currently work and which files are
used for generating documentation.
2024-02-05 13:03:20 +00:00
Barnabás Pőcze
4083502e03 spa: bluez: use some more spa_auto* 2023-07-30 13:45:49 +02:00
Barnabás Pőcze
ca85872e83 spa: bluez: use spa_auto for DBusError 2023-07-30 13:45:49 +02:00
Barnabás Pőcze
b52d590936 spa: bluez: add send_with_reply() dbus helper
This function sends a DBusMessage on a DBusConnection
and sets the reply callback of the resulting DBusPendingCall,
as well as properly cancelling the pending call if anything fails.
2023-07-30 13:45:49 +02:00
Barnabás Pőcze
6e581deb91 spa: bluez: use spa_autoptr for DBusMessage 2023-07-30 13:45:49 +02:00
Barnabás Pőcze
708e5443ae spa: bluez: add steal_reply_and_unref() helper
This function retrieves the reply from a DBusPendingCall and unrefs the call.
2023-07-15 01:04:23 +02:00
Barnabás Pőcze
183270f53c spa: bluez: add cancel_and_unref() dbus helper
This function cancels and unrefs a DBusPendingCall and
resets the pointer to NULL.
2023-07-15 01:04:22 +02:00
Barnabás Pőcze
0ed8880489 spa: bluez: modemmanager: do not use old style declaration 2023-07-03 19:40:31 +02:00
Barnabás Pőcze
2dd3a00bb5 spa: bluez: modemmanager: fix DBusMessage leaks
A DBusMessage needs to be unref-ed after sending it regardless
whether or not it was successfully sent. So do that in
`mm_dbus_connection_send_with_reply()` so that the callers
do not need to deal with that.
2023-05-03 11:27:25 +00:00
Barnabás Pőcze
4591cfcd37 spa: bluez: modemmanager: do not log message sender as warning 2023-05-03 11:27:25 +00:00
Barnabás Pőcze
ff62eb59e2 spa: bluez: modemmanager: remove unused member 2023-05-03 11:27:25 +00:00
Barnabás Pőcze
36bfd5263f spa: bluez: do not check if service is running
It is inherently racy, and we have a better way to ensure that
we won't autostart the service:

  dbus_message_set_auto_start()

So use that.

This commit also adds a missing call to `dbus_pending_call_unref()`
and indirectly fixes a type mismatch (`dbus_bool_t` vs. `bool`)
that was present in `is_dbus_service_running()`.
2023-05-03 11:27:25 +00:00
Barnabás Pőcze
934ab3036e treewide: use SPDX tags to specify copyright information
SPDX tags make the licensing information easy to understand and clear,
and they are machine parseable.

See https://spdx.dev for more information.
2023-02-16 10:54:48 +00:00
Barnabás Pőcze
14e044a92c spa: bluez: backend-native: fix filtered number memory leak
The `number_filtered` variable was dynamically allocated but never freed.
2022-11-14 16:15:21 +00:00
Frédéric Danis
fd508d395b bluez5: backend-native: Add a property to select the modem to use
By default no modem is allowed.
Property "bluez5.hfphsp-backend-native-modem" can be 'none', 'any' or the
modem device string has found in 'Device' property of
org.freedesktop.ModemManager1.Modem interface, e.g. for PinePhone
"/sys/devices/platform/soc/1c1b000.usb/usb2/2-1".
2022-10-05 19:31:50 +00:00
Frédéric Danis
c4addb102b bluez5: backend-native: Only use first modem found
Some device may have multiple modems, we should only used one, the first
found and manage changes only for this one.
2022-10-05 19:31:50 +00:00
Frédéric Danis
a37aeac273 bluez5: backend-native: Add AT+VTS support
This allows to send a DTMF key on an active call.
2022-10-05 19:31:50 +00:00
Frédéric Danis
7c05574072 bluez5: backend-native: Add AT+CNUM support
This only support the first subscriber number.
2022-10-05 19:31:50 +00:00
Frédéric Danis
3566b0739b bluez5: backend-native: Add ATDdd...dd; support
This allows to dial a number.

Memory dialing (ATD>nnn...;) is not supported as it requests access to
the contact application.
2022-10-05 19:31:50 +00:00
Frédéric Danis
20572a1789 bluez5: backend-native: Add AT+CLCC support
This allows the HFP HF to retrieve the list of calls with their index,
state and remote number (if available).

This commit shared the list of calls between modemmanager.c and
backend-native.c, and switches call state storage from ModemManager
states to CLCC states
2022-10-05 19:31:50 +00:00
Frédéric Danis
55075915ec bluez5: backend-native: Add AT+CLIP support
This allows to send the caller number of an incoming call with the RING
event.
2022-10-05 19:31:50 +00:00
Frédéric Danis
4a89a13bda bluez5: backend-native: Support of ATA and AT+CHUP
Allow to answer, reject or terminate a call.

Answering or rejecting a call can only be done on an incoming call.
Terminating a call can only be done on active, dialing or alerting call.
2022-10-05 19:31:50 +00:00
Frédéric Danis
43c4d95794 bluez5: backend-native: Link with ModemManager Call object
Update the +CIND call and callsetup indicators when Call object state
change.
2022-10-05 19:31:50 +00:00
Frédéric Danis
5b40ed62b4 bluez5: backend-native: Link with ModemManager Voice object
The Voice object lists the Call objects, which provides status of each call.

+CIND call indicator is set if at least one of the call is active.
+CIND callsetup indicator is set if one of the call is in ringing in or out
or dialing state.
2022-10-05 19:31:50 +00:00
Frédéric Danis
275d2bc603 bluez5: backend-native: Link with ModemManager Modem3GPP object
The Modem3GPP provides information about the network the modem is registered
to like the operator name and roaming status.
2022-10-05 19:31:50 +00:00
Frédéric Danis
13f0a0755e bluez5: backend-native: Link with ModemManager Modem object
The Modem object provides the own number (used by +CNUM), the network
service availability and signal strength (used for the +CIND).

+CIND indicators can be activated/deactivated using AT+BIA except for
call, callsetup and callheld indicators which should always reported.
All indicators are enabled on connection.
2022-10-05 19:31:50 +00:00