answered
2014-10-13 13:55:06 +0200
Here's a patch that I use for using the proximity sensor to automatically switch between speaker phone and the normal earpiece. Among other things, I put in a button lets you turn the proximity sensor on or off while in the call, and when dialing.
If you don't want to use the sensor for audio routing, you can still use the button to control the sensor, and the normal proximity behaviors.
Sorry for the raw patch, I'll figure out the process of posting things for patch manager on openrepos, soonish.
diff --git a/qml/pages/calling/InCallView.qml b/qml/pages/calling/InCallView.qml
index c4aa611..971cd07 100644
--- a/qml/pages/calling/InCallView.qml
+++ b/qml/pages/calling/InCallView.qml
@@ -1,6 +1,8 @@
import QtQuick 2.0
import Sailfish.Silica 1.0
import Sailfish.Bluetooth 1.0
+import MeeGo.QOfono 0.2
+import QtSensors 5.0
import "../../common/CallLog.js" as CallLog
SilicaFlickable {
@@ -69,6 +71,32 @@ SilicaFlickable {
QT_TRID_NOOP("voicecall-la-calling")
}
+ ProximitySensor {
+ id: proxi
+ active: (! proxSpeakerSwitch.checked) || main.state == "active"
+ //active: proxSpeakerSwitch.enabled && proxSpeakerSwitch.checked
+
+ // Always seem to get a bogus "near" triggered when the sensor comes online
+ // even if it should read !near. So I'm adding a reset property to ignore the first event
+ property bool reset: true;
+ onReadingChanged: {
+ if(proxSpeakerSwitch.checked) {
+ console.log("prox triggered, current audioMode: ", telephony.audioMode);
+ if(proxi.reset)
+ proxi.reset = false;
+ else
+ telephony.audioMode = proxi.reading.near ? "earpiece" : "ihf";
+ console.log("prox triggered, audioMode: ", telephony.audioMode);
+ }
+ }
+ onActiveChanged: {
+ if(active) {
+ proxi.reset = true;
+ console.log("prox triggered, current audioMode: ", telephony.audioMode);
+ }
+ }
+ }
+
Behavior on opacity { FadeAnimation { duration: 400 } }
MouseArea {
@@ -299,6 +327,25 @@ SilicaFlickable {
top: stateLabel.bottom
horizontalCenter: parent.horizontalCenter
}
+ Switch {
+ id: proxSpeakerSwitch
+ checked: true
+ icon.source: "image://theme/icon-status-beep"
+ enabled: true
+ onClicked: {
+ console.log("prox triggered, current audioMode: ", telephony.audioMode);
+ console.log("audio routed ",telephony.isAudioRouted);
+ console.log("speaker muted ",telephony.isSpeakerMuted);
+}
+
+/*(! ( bluetoothAudio.available
+ && bluetoothAudio.supportsCallAudio
+ && bluetoothAudioSwitch.checked
+ ))
+ && main.state === "active"
+ && (telephony.audioMode === "earpiece" || telephony.audioMode === "ihf")
+*/
+ }
Switch {
id: bluetoothAudioSwitch
visible: bluetoothAudio.available && bluetoothAudio.supportsCallAudio
Tripple tap *
chemist ( 2014-08-25 14:42:35 +0200 )editI think, everybody knows how to use pause
nix ( 2014-08-25 14:58:01 +0200 )editI need to work on my reading skills, and you need to work on your bug-reporting skills. Have you tried using more than one "p"?
chemist ( 2014-08-25 16:04:24 +0200 )editUsing more than one "p" increases pause time. I have found that this problem occurs only when the screen is turned off (by the light indicator). When I make call the pause before sending dtmf digit is 3 seconds. If I use 2 "p" it is 6 seconds. And it is stable, but If I try making call closing the light indicator, for example, by finger, the pause takes much longer and is different every time.
nix ( 2014-08-26 18:56:54 +0200 )editI updated your question, btw it is the proximity switch not the light sensor that deactivates the display.
chemist ( 2014-08-26 20:21:53 +0200 )edit