added alert interface
This commit is contained in:
parent
ac6dcf0765
commit
e8be8fc7b9
@ -380,6 +380,53 @@ void Heos::browseSource(SOURCE_ID sourceId)
|
||||
m_socket->write(cmd);
|
||||
}
|
||||
|
||||
void Heos::playStation(int playerId, const QString &sourceId, const QString &containerId, const QString &mediaId, const QString &stationName)
|
||||
{
|
||||
QUrl url("browse");
|
||||
url.setScheme("heos");
|
||||
url.setPath("play_stream");
|
||||
url.setQuery(QString("pid=%1").arg(playerId));
|
||||
url.setQuery(QString("sid=%1").arg(sourceId));
|
||||
url.setQuery(QString("cid=%1").arg(containerId));
|
||||
url.setQuery(QString("mid=%1").arg(mediaId));
|
||||
url.setQuery(QString("name=%1").arg(stationName));
|
||||
qCDebug(dcDenon) << "playing url:" << url;
|
||||
m_socket->write(url.toEncoded());
|
||||
}
|
||||
|
||||
void Heos::playPresetStation(int playerId, int presetNumber)
|
||||
{
|
||||
QUrl url("browse");
|
||||
url.setScheme("heos");
|
||||
url.setPath("play_preset");
|
||||
url.setQuery(QString("pid=%1").arg(playerId));
|
||||
url.setQuery(QString("preset=%1").arg(presetNumber));
|
||||
qCDebug(dcDenon) << "playing url:" << url;
|
||||
m_socket->write(url.toEncoded());
|
||||
}
|
||||
|
||||
void Heos::playInputSource(int playerId, const QString &inputName)
|
||||
{
|
||||
QUrl url("browse");
|
||||
url.setScheme("heos");
|
||||
url.setPath("play_input");
|
||||
url.setQuery(QString("pid=%1").arg(playerId));
|
||||
url.setQuery(QString("input=%1").arg(inputName));
|
||||
qCDebug(dcDenon) << "playing url:" << url;
|
||||
m_socket->write(url.toEncoded());
|
||||
}
|
||||
|
||||
void Heos::playUrl(int playerId, const QUrl &mediaUrl)
|
||||
{
|
||||
QUrl url("browse");
|
||||
url.setScheme("heos");
|
||||
url.setPath("play_stream");
|
||||
url.setQuery(QString("pid=%1").arg(playerId));
|
||||
url.setQuery(QString("url=%1").arg(mediaUrl.toString()));
|
||||
qCDebug(dcDenon) << "playing url:" << url;
|
||||
m_socket->write(url.toEncoded());
|
||||
}
|
||||
|
||||
/* This command is used to perform the following actions:
|
||||
* Create new group: Creates new group. First player id in the list is group leader.
|
||||
* Adds or delete players from the group. First player id should be the group leader id.
|
||||
@ -430,6 +477,7 @@ void Heos::readData()
|
||||
QVariantMap dataMap = jsonDoc.toVariant().toMap();
|
||||
if (dataMap.contains("heos")) {
|
||||
QString command = dataMap.value("heos").toMap().value("command").toString();
|
||||
bool success = dataMap.value("heos").toMap().value("result").toString().contains("success");
|
||||
if (command.contains("register_for_change_events")) {
|
||||
QString enabled = dataMap.value("heos").toMap().value("message").toString();
|
||||
if (enabled.contains("off")) {
|
||||
@ -590,6 +638,11 @@ void Heos::readData()
|
||||
if (command.contains("player_now_playing_changed")) {
|
||||
getNowPlayingMedia(playerId);
|
||||
}
|
||||
if (command.contains("play_stream")) {
|
||||
if (success) {
|
||||
qDebug(dcDenon()) << "Playing Url";
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -102,6 +102,11 @@ public:
|
||||
void browseSource(SOURCE_ID sourceId);
|
||||
//void search();
|
||||
|
||||
//Play commands
|
||||
void playStation(int playerId, const QString &sourceId, const QString &containerId, const QString &mediaId, const QString &stationName);
|
||||
void playPresetStation(int playerId, int presetNumber);
|
||||
void playInputSource(int playerId, const QString &inputName); //Validity of Inputs depends on the type of source HEOS devic
|
||||
void playUrl(int playerId, const QUrl &url);
|
||||
|
||||
private:
|
||||
bool m_eventRegistered = false;
|
||||
|
||||
@ -61,6 +61,7 @@
|
||||
#include <QStringList>
|
||||
#include <QJsonDocument>
|
||||
#include <QTimer>
|
||||
#include <QUrl>
|
||||
|
||||
IntegrationPluginDenon::IntegrationPluginDenon()
|
||||
{
|
||||
@ -304,6 +305,11 @@ void IntegrationPluginDenon::executeAction(ThingActionInfo *info)
|
||||
Heos *heos = m_heos.value(heosThing);
|
||||
int playerId = thing->paramValue(heosPlayerThingPlayerIdParamTypeId).toInt();
|
||||
|
||||
if (action.actionTypeId() == heosPlayerAlertActionTypeId) {
|
||||
heos->playUrl(playerId, QUrl("https://downloads.nymea.io/notification-sounds/definite.mp3"));
|
||||
return Device::DeviceErrorNoError;
|
||||
}
|
||||
|
||||
if (action.actionTypeId() == heosPlayerVolumeActionTypeId) {
|
||||
int volume = action.param(heosPlayerVolumeActionVolumeParamTypeId).value().toInt();
|
||||
heos->setVolume(playerId, volume);
|
||||
|
||||
@ -200,7 +200,7 @@
|
||||
"name": "heosPlayer",
|
||||
"displayName": "Heos player",
|
||||
"createMethods": ["auto"],
|
||||
"interfaces": ["mediaplayer", "mediacontroller", "extendedvolumecontroller", "mediametadataprovider", "shufflerepeat", "connectable"],
|
||||
"interfaces": ["mediaplayer", "mediacontroller", "extendedvolumecontroller", "mediametadataprovider", "shufflerepeat", "alert", "connectable"],
|
||||
"paramTypes":[
|
||||
{
|
||||
"id": "89629008-6ad8-4e92-863d-b86e0e012d0b",
|
||||
@ -349,6 +349,11 @@
|
||||
}
|
||||
],
|
||||
"actionTypes": [
|
||||
{
|
||||
"id": "db8e001a-fcae-4c41-9811-325e14c06109",
|
||||
"name": "alert",
|
||||
"displayName": "Alert"
|
||||
},
|
||||
{
|
||||
"id": "a718f7e9-0b54-4403-b661-49f7b0d13085",
|
||||
"name": "skipBack",
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user