From d61c460c0d9f0cf249c6c4e146495ae4b8f95e27 Mon Sep 17 00:00:00 2001
From: Dave Badia <dbadia@gmail.com>
Date: Thu, 20 Mar 2014 17:21:56 -0400
Subject: [PATCH] Trigger system events when devices connect and disconnect to
AirPlay and AirTunes
---
mythtv/libs/libmythtv/AirPlay/mythairplayserver.cpp | 2 ++
mythtv/libs/libmythtv/AirPlay/mythraopdevice.cpp | 2 ++
2 files changed, 4 insertions(+)
diff --git a/mythtv/libs/libmythtv/AirPlay/mythairplayserver.cpp b/mythtv/libs/libmythtv/AirPlay/mythairplayserver.cpp
index f6e1f15..6035493 100644
a
|
b
|
void MythAirplayServer::newConnection(QTcpSocket *client) |
508 | 508 | LOG(VB_GENERAL, LOG_INFO, LOC + QString("New connection from %1:%2") |
509 | 509 | .arg(client->peerAddress().toString()).arg(client->peerPort())); |
510 | 510 | |
| 511 | gCoreContext->SendSystemEvent(QString("AIRPLAY_NEW_CONNECTION")); |
511 | 512 | m_sockets.append(client); |
512 | 513 | connect(client, SIGNAL(disconnected()), this, SLOT(deleteConnection())); |
513 | 514 | connect(client, SIGNAL(readyRead()), this, SLOT(read())); |
… |
… |
void MythAirplayServer::deleteConnection(QTcpSocket *socket) |
531 | 532 | // must have lock |
532 | 533 | LOG(VB_GENERAL, LOG_INFO, LOC + QString("Removing connection %1:%2") |
533 | 534 | .arg(socket->peerAddress().toString()).arg(socket->peerPort())); |
| 535 | gCoreContext->SendSystemEvent(QString("AIRPLAY_DELETE_CONNECTION")); |
534 | 536 | m_sockets.removeOne(socket); |
535 | 537 | |
536 | 538 | QByteArray remove; |
diff --git a/mythtv/libs/libmythtv/AirPlay/mythraopdevice.cpp b/mythtv/libs/libmythtv/AirPlay/mythraopdevice.cpp
index 76fa552..88ef875 100644
a
|
b
|
void MythRAOPDevice::newConnection(QTcpSocket *client) |
210 | 210 | LOG(VB_GENERAL, LOG_INFO, LOC + QString("New connection from %1:%2") |
211 | 211 | .arg(client->peerAddress().toString()).arg(client->peerPort())); |
212 | 212 | |
| 213 | gCoreContext->SendSystemEvent(QString("AIRTUNES_NEW_CONNECTION")); |
213 | 214 | MythNotification n(tr("New Connection"), tr("AirTunes"), |
214 | 215 | tr("from %1:%2").arg(client->peerAddress().toString()).arg(client->peerPort())); |
215 | 216 | // Don't show it during playback |
… |
… |
void MythRAOPDevice::deleteClient(void) |
241 | 242 | QList<MythRAOPConnection *>::iterator it = m_clients.begin(); |
242 | 243 | |
243 | 244 | MythNotification n(tr("Client disconnected"), tr("AirTunes")); |
| 245 | gCoreContext->SendSystemEvent(QString("AIRTUNES_DELETE_CONNECTION")); |
244 | 246 | // Don't show it during playback |
245 | 247 | n.SetVisibility(n.GetVisibility() & ~MythNotification::kPlayback); |
246 | 248 | GetNotificationCenter()->Queue(n); |