-
Notifications
You must be signed in to change notification settings - Fork 51
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #285 from jmlich/ubports-phone
ubports phone calls
- Loading branch information
Showing
9 changed files
with
93 additions
and
6 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Submodule libwatchfish
updated
10 files
+165 −0 | callchannelobserver.cpp | |
+75 −0 | callchannelobserver.h | |
+14 −3 | libwatchfish.pri | |
+5 −39 | voicecallcontroller.h | |
+16 −2 | voicecallcontroller_sailfish.cpp | |
+57 −0 | voicecallcontroller_sailfish.h | |
+107 −0 | voicecallcontroller_ubuntu.cpp | |
+65 −0 | voicecallcontroller_ubuntu.h | |
+61 −0 | voicecallcontrollerbase.cpp | |
+62 −0 | voicecallcontrollerbase.h |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
#include "immediatealertservice.h" | ||
|
||
const char* ImmediateAlertService::UUID_SERVICE_IMMEDIATE_ALERT = "00001802-0000-1000-8000-00805f9b34fb"; | ||
const char* ImmediateAlertService::UUID_CHARACTERISTIC_IMMEDIATE_ALERT_LEVEL = "00002a06-0000-1000-8000-00805f9b34fb"; | ||
|
||
|
||
ImmediateAlertService::ImmediateAlertService(const QString &path, QObject *parent) : QBLEService(UUID_SERVICE_IMMEDIATE_ALERT, path, parent) | ||
{ | ||
qDebug() << Q_FUNC_INFO; | ||
|
||
connect(this, &QBLEService::characteristicRead, this, &ImmediateAlertService::characteristicRead); | ||
} | ||
|
||
void ImmediateAlertService::refreshInformation() | ||
{ | ||
qDebug() << Q_FUNC_INFO; | ||
|
||
readAsync(UUID_CHARACTERISTIC_IMMEDIATE_ALERT_LEVEL); | ||
} | ||
|
||
void ImmediateAlertService::characteristicRead(const QString &characteristic, const QByteArray &value) | ||
{ | ||
qDebug() << Q_FUNC_INFO << "Read:" << characteristic << value; | ||
if (characteristic == UUID_CHARACTERISTIC_IMMEDIATE_ALERT_LEVEL) { | ||
m_alertLevel = value[0]; | ||
emit informationChanged(AbstractDevice::INFO_IMMEDIATE_ALERT, QString::number(m_alertLevel)); | ||
} else { | ||
qWarning() << "Unknown value"; | ||
} | ||
} | ||
|
||
int ImmediateAlertService::alertLevel() const | ||
{ | ||
qDebug() << Q_FUNC_INFO << m_alertLevel; | ||
return m_alertLevel; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
#ifndef IMMEDIATE_ALERT_SERVICE_H | ||
#define IMMEDIATE_ALERT_SERVICE_H | ||
|
||
#include "qble/qbleservice.h" | ||
#include "devices/abstractdevice.h" | ||
|
||
// https://www.bluetooth.com/specifications/specs/immediate-alert-service-1-0/ | ||
|
||
class ImmediateAlertService : public QBLEService | ||
{ | ||
Q_OBJECT | ||
public: | ||
ImmediateAlertService(const QString &path, QObject *parent); | ||
|
||
static const char* UUID_SERVICE_IMMEDIATE_ALERT; | ||
static const char* UUID_CHARACTERISTIC_IMMEDIATE_ALERT_LEVEL; | ||
enum class Levels : uint8_t { NoAlert = 0, MildAlert = 1, HighAlert = 2 }; | ||
|
||
Q_INVOKABLE void refreshInformation(); | ||
|
||
int alertLevel() const; | ||
|
||
Q_SIGNAL void informationChanged(AbstractDevice::Info key, const QString &val); | ||
|
||
private: | ||
int m_alertLevel; | ||
Q_SLOT void characteristicRead(const QString &c, const QByteArray &value); | ||
}; | ||
|
||
#endif // IMMEDIATE_ALERT_SERVICE_H |