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.
Strip initial \n from commands: some devices (Sennheiser HD 350BT) send
them.
Only reply OK to empty command with terminated command line;
non-terminated lines are invalid.
Add some debug in case the RFCOMM reply contains non-printable
characters.
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".
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
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.
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.
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.
HFP 1.8 states in 4.35.1:
Due to the small inconsistency between the GSM standard [2]) and the current
Headset specification ([3]), the HF shall also accept the “=” symbol,
in place of “:”, as a valid separator for this unsolicited result code.
iOS seems to use "=", so accept that as well.
See #2463
Both HFP and HSP require an AT command from HF/HS to AG to
be terminated by CR, not LF. (HFP 1.8, 4.34.1; HSP 1.2, 4.8.1)
See #2463
Fixes: 0b2d3730b6 ("bluez5: Add HFP HF support")
`strsep()` is simpler to use than `strtok()` or `strtok_r()`
while being thread-safe and reentrant.
Although it is an extension, it is available in both glibc and musl.
When rfcomm_hfp_ag() returns false, an "ERROR" reply is sent.
When testing if the SLC is configured, 2 "ERROR" replies are sent, which
should not be done.
Most feature checks already use #ifdef, and do not care about
the value of the macro. Convert all feature checks to do that,
and simplify the meson build scripts by replacing
if cond
cdata.set('X', 1)
endif
with
cdata.set('X', cond)