Skip to content

Commit

Permalink
Merge pull request piggz#391 from jmlich/incommingCallEnded
Browse files Browse the repository at this point in the history
Handle incomingCallEnded() separately.
  • Loading branch information
piggz authored Aug 26, 2024
2 parents 7f9c1c7 + e5e34fb commit 40ee174
Show file tree
Hide file tree
Showing 11 changed files with 60 additions and 3 deletions.
10 changes: 8 additions & 2 deletions daemon/src/deviceinterface.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -201,7 +201,7 @@ void DeviceInterface::onRingingChanged()
}

} else {
m_device->immediateAlert(0);
m_device->incomingCallEnded();
}
#endif
}
Expand Down Expand Up @@ -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;
Expand Down Expand Up @@ -1054,4 +1060,4 @@ void DeviceInterface::immediateAlert(int level)
if (m_device) {
m_device->immediateAlert(level);
}
}
}
1 change: 1 addition & 0 deletions daemon/src/deviceinterface.h
Original file line number Diff line number Diff line change
Expand Up @@ -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();
Expand Down
1 change: 1 addition & 0 deletions daemon/src/devices/abstractdevice.h
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down
13 changes: 12 additions & 1 deletion daemon/src/devices/asteroidosdevice.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,17 @@ void AsteroidOSDevice::incomingCall(const QString &caller)

}

void AsteroidOSDevice::incomingCallEnded()
{
qDebug() << Q_FUNC_INFO;

AsteroidNotificationService *notification = qobject_cast<AsteroidNotificationService*>(service(AsteroidNotificationService::UUID_SERVICE_NOTIFICATION));
if (notification) {
notification->incomingCallEnded();
}

}


void AsteroidOSDevice::pair()
{
Expand Down Expand Up @@ -322,4 +333,4 @@ void AsteroidOSDevice::requestScreenshot() {
screenshot->requestScreenshot();
}

}
}
1 change: 1 addition & 0 deletions daemon/src/devices/asteroidosdevice.h
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
18 changes: 18 additions & 0 deletions daemon/src/devices/banglejsdevice.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -101,6 +101,24 @@ void BangleJSDevice::incomingCall(const QString &caller)
uart->txJson(o);
}

void BangleJSDevice::incomingCallEnded()
{
qDebug() << Q_FUNC_INFO;

UARTService *uart = qobject_cast<UARTService*>(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;
Expand Down
1 change: 1 addition & 0 deletions daemon/src/devices/banglejsdevice.h
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
10 changes: 10 additions & 0 deletions daemon/src/devices/huamidevice.cpp
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
#include "huamidevice.h"
#include "bipfirmwareinfo.h"
#include "updatefirmwareoperation.h"
#include "immediatealertservice.h"
#include "amazfishconfig.h"

#include <QtXml/QtXml>
Expand Down Expand Up @@ -166,6 +167,15 @@ void HuamiDevice::incomingCall(const QString &caller)
}
}

void HuamiDevice::incomingCallEnded()
{
ImmediateAlertService *ias = qobject_cast<ImmediateAlertService*>(service(ImmediateAlertService::UUID_SERVICE_IMMEDIATE_ALERT));
if (ias) {
ias->sendAlert(ImmediateAlertService::Levels::NoAlert);
}
}


void HuamiDevice::navigationRunning(bool running)
{
QString msg;
Expand Down
1 change: 1 addition & 0 deletions daemon/src/devices/huamidevice.h
Original file line number Diff line number Diff line change
Expand Up @@ -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();

Expand Down
6 changes: 6 additions & 0 deletions daemon/src/devices/pinetimejfdevice.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
1 change: 1 addition & 0 deletions daemon/src/devices/pinetimejfdevice.h
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down

0 comments on commit 40ee174

Please sign in to comment.