diff --git a/daemon/src/deviceinterface.cpp b/daemon/src/deviceinterface.cpp index 35f7208e..05e4e2df 100644 --- a/daemon/src/deviceinterface.cpp +++ b/daemon/src/deviceinterface.cpp @@ -201,7 +201,7 @@ void DeviceInterface::onRingingChanged() } } else { - m_device->immediateAlert(0); + m_device->incomingCallEnded(); } #endif } @@ -880,6 +880,12 @@ void DeviceInterface::incomingCall(const QString &caller) } } +void DeviceInterface::incomingCallEnded() { + if (m_device) { + m_device->incomingCallEnded(); + } +} + void DeviceInterface::applyDeviceSetting(int s) { qDebug() << Q_FUNC_INFO << "Setting:" << s << (int)s; @@ -1054,4 +1060,4 @@ void DeviceInterface::immediateAlert(int level) if (m_device) { m_device->immediateAlert(level); } -} \ No newline at end of file +} diff --git a/daemon/src/deviceinterface.h b/daemon/src/deviceinterface.h index c7ac1bac..84e13a71 100644 --- a/daemon/src/deviceinterface.h +++ b/daemon/src/deviceinterface.h @@ -70,6 +70,7 @@ class DeviceInterface : public QObject Q_INVOKABLE QString information(int i); Q_INVOKABLE void sendAlert(const QString &sender, const QString &subject, const QString &message, bool allowDuplicate = false); Q_INVOKABLE void incomingCall(const QString &caller); + Q_INVOKABLE void incomingCallEnded(); Q_INVOKABLE void applyDeviceSetting(int s); Q_INVOKABLE void requestManualHeartrate(); Q_INVOKABLE void triggerSendWeather(); diff --git a/daemon/src/devices/abstractdevice.h b/daemon/src/devices/abstractdevice.h index 2436d58c..0c172413 100644 --- a/daemon/src/devices/abstractdevice.h +++ b/daemon/src/devices/abstractdevice.h @@ -114,6 +114,7 @@ class AbstractDevice : public QBLEDevice virtual void rebootWatch(); virtual void sendAlert(const QString &sender, const QString &subject, const QString &message) = 0; virtual void incomingCall(const QString &caller) = 0; + virtual void incomingCallEnded() = 0; virtual void sendEventReminder(int id, const QDateTime &dt, const QString &event); virtual void enableFeature(AbstractDevice::Feature feature); virtual void setMusicStatus(bool playing, const QString &title, const QString &artist, const QString &album, int duration = 0, int position = 0); diff --git a/daemon/src/devices/asteroidosdevice.cpp b/daemon/src/devices/asteroidosdevice.cpp index e49038ba..bd47f82f 100644 --- a/daemon/src/devices/asteroidosdevice.cpp +++ b/daemon/src/devices/asteroidosdevice.cpp @@ -55,6 +55,17 @@ void AsteroidOSDevice::incomingCall(const QString &caller) } +void AsteroidOSDevice::incomingCallEnded() +{ + qDebug() << Q_FUNC_INFO; + + AsteroidNotificationService *notification = qobject_cast(service(AsteroidNotificationService::UUID_SERVICE_NOTIFICATION)); + if (notification) { + notification->incomingCallEnded(); + } + +} + void AsteroidOSDevice::pair() { @@ -322,4 +333,4 @@ void AsteroidOSDevice::requestScreenshot() { screenshot->requestScreenshot(); } -} \ No newline at end of file +} diff --git a/daemon/src/devices/asteroidosdevice.h b/daemon/src/devices/asteroidosdevice.h index 76313374..424950f1 100644 --- a/daemon/src/devices/asteroidosdevice.h +++ b/daemon/src/devices/asteroidosdevice.h @@ -14,6 +14,7 @@ class AsteroidOSDevice : public AbstractDevice virtual QString deviceType() const override; virtual void sendAlert(const QString &sender, const QString &subject, const QString &message) override; virtual void incomingCall(const QString &caller) override; + virtual void incomingCallEnded() override; virtual AbstractFirmwareInfo *firmwareInfo(const QByteArray &bytes) override; virtual void setMusicStatus(bool playing, const QString &title, const QString &artist, const QString &album, int duration = 0, int position = 0) override; virtual void requestScreenshot() override; diff --git a/daemon/src/devices/banglejsdevice.cpp b/daemon/src/devices/banglejsdevice.cpp index 3988f2c9..73bba5f3 100644 --- a/daemon/src/devices/banglejsdevice.cpp +++ b/daemon/src/devices/banglejsdevice.cpp @@ -101,6 +101,24 @@ void BangleJSDevice::incomingCall(const QString &caller) uart->txJson(o); } +void BangleJSDevice::incomingCallEnded() +{ + qDebug() << Q_FUNC_INFO; + + UARTService *uart = qobject_cast(service(UARTService::UUID_SERVICE_UART)); + if (!uart){ + return; + } + + QJsonObject o; + o.insert("t", "call"); + o.insert("cmd", "end"); + o.insert("name", ""); + o.insert("number", ""); + uart->txJson(o); +} + + void BangleJSDevice::parseServices() { qDebug() << Q_FUNC_INFO; diff --git a/daemon/src/devices/banglejsdevice.h b/daemon/src/devices/banglejsdevice.h index 7061dea0..c2c2b512 100644 --- a/daemon/src/devices/banglejsdevice.h +++ b/daemon/src/devices/banglejsdevice.h @@ -16,6 +16,7 @@ class BangleJSDevice : public AbstractDevice void sendAlert(const QString &sender, const QString &subject, const QString &message) override; void incomingCall(const QString &caller) override; + void incomingCallEnded() override; void refreshInformation() override; QString information(Info i) const override; diff --git a/daemon/src/devices/huamidevice.cpp b/daemon/src/devices/huamidevice.cpp index 28f599a7..8cb0e847 100644 --- a/daemon/src/devices/huamidevice.cpp +++ b/daemon/src/devices/huamidevice.cpp @@ -1,6 +1,7 @@ #include "huamidevice.h" #include "bipfirmwareinfo.h" #include "updatefirmwareoperation.h" +#include "immediatealertservice.h" #include "amazfishconfig.h" #include @@ -166,6 +167,15 @@ void HuamiDevice::incomingCall(const QString &caller) } } +void HuamiDevice::incomingCallEnded() +{ + ImmediateAlertService *ias = qobject_cast(service(ImmediateAlertService::UUID_SERVICE_IMMEDIATE_ALERT)); + if (ias) { + ias->sendAlert(ImmediateAlertService::Levels::NoAlert); + } +} + + void HuamiDevice::navigationRunning(bool running) { QString msg; diff --git a/daemon/src/devices/huamidevice.h b/daemon/src/devices/huamidevice.h index f987c8c5..a98d70e1 100644 --- a/daemon/src/devices/huamidevice.h +++ b/daemon/src/devices/huamidevice.h @@ -29,6 +29,7 @@ class HuamiDevice : public AbstractDevice virtual void sendAlert(const QString &sender, const QString &subject, const QString &message) override; void incomingCall(const QString &caller) override; + void incomingCallEnded() override; QString softwareRevision(); diff --git a/daemon/src/devices/pinetimejfdevice.cpp b/daemon/src/devices/pinetimejfdevice.cpp index 4d6cd72e..e860bce0 100644 --- a/daemon/src/devices/pinetimejfdevice.cpp +++ b/daemon/src/devices/pinetimejfdevice.cpp @@ -108,6 +108,12 @@ void PinetimeJFDevice::incomingCall(const QString &caller) } } +void PinetimeJFDevice::incomingCallEnded() +{ + qDebug() << Q_FUNC_INFO << "not available"; +} + + void PinetimeJFDevice::parseServices() { qDebug() << Q_FUNC_INFO; diff --git a/daemon/src/devices/pinetimejfdevice.h b/daemon/src/devices/pinetimejfdevice.h index 4e523817..bffe2077 100644 --- a/daemon/src/devices/pinetimejfdevice.h +++ b/daemon/src/devices/pinetimejfdevice.h @@ -17,6 +17,7 @@ class PinetimeJFDevice : public AbstractDevice void sendAlert(const QString &sender, const QString &subject, const QString &message) override; void incomingCall(const QString &caller) override; + void incomingCallEnded() override; void refreshInformation() override; QString information(Info i) const override;