MythTV  master
Public Member Functions | Static Public Member Functions | Private Slots | Private Member Functions | Static Private Member Functions | Private Attributes | Static Private Attributes | List of all members
MythAirplayServer Class Reference

#include <libmythtv/AirPlay/mythairplayserver.h>

Inheritance diagram for MythAirplayServer:
[legend]
Collaboration diagram for MythAirplayServer:
[legend]

Public Member Functions

 MythAirplayServer ()
 
- Public Member Functions inherited from ServerPool
 ServerPool (QObject *parent=nullptr)
 
 ~ServerPool (void) override
 
bool listen (QList< QHostAddress > addrs, quint16 port, bool requireall=true, PoolServerType type=kTCPServer)
 
bool listen (QStringList addrs, quint16 port, bool requireall=true, PoolServerType type=kTCPServer)
 
bool listen (quint16 port, bool requireall=true, PoolServerType type=kTCPServer)
 
bool bind (QList< QHostAddress > addrs, quint16 port, bool requireall=true)
 
bool bind (QStringList addrs, quint16 port, bool requireall=true)
 
bool bind (quint16 port, bool requireall=true)
 
qint64 writeDatagram (const char *data, qint64 size, const QHostAddress &addr, quint16 port)
 
qint64 writeDatagram (const QByteArray &datagram, const QHostAddress &addr, quint16 port)
 
bool isListening (void) const
 
int maxPendingConnections (void) const
 
void setMaxPendingConnections (int n)
 
quint16 serverPort (void) const
 
QNetworkProxy proxy (void)
 
void setProxy (const QNetworkProxy &proxy)
 
void close (void)
 
int tryListeningPort (int baseport, int range=1)
 tryListeningPort More...
 
int tryBindingPort (int baseport, int range=1)
 tryBindingPort More...
 

Static Public Member Functions

static bool Create (void)
 
static void Cleanup (void)
 
static MythAirplayServerAirplaySharedInstance (void)
 
- Static Public Member Functions inherited from ServerPool
static void RefreshDefaultListen (void)
 
static QList< QHostAddress > DefaultListen (void)
 
static QList< QHostAddress > DefaultListenIPv4 (void)
 
static QList< QHostAddress > DefaultListenIPv6 (void)
 
static QList< QHostAddress > DefaultBroadcast (void)
 
static QList< QHostAddress > DefaultBroadcastIPv4 (void)
 
static QList< QHostAddress > DefaultBroadcastIPv6 (void)
 
static int tryListeningPort (QTcpServer *server, int baseport, int range=1, bool *isipv6=nullptr)
 tryListeningPort More...
 
static int tryBindingPort (QUdpSocket *socket, int baseport, int range=1, bool *isipv6=nullptr)
 tryBindingPort More...
 

Private Slots

void Start ()
 
void Stop ()
 
void newAirplayConnection (QTcpSocket *client)
 
void deleteConnection ()
 
void read (void)
 
void timeout (void)
 

Private Member Functions

 ~MythAirplayServer (void) override
 
void Teardown (void)
 
void HandleResponse (APHTTPRequest *req, QTcpSocket *socket)
 
bool SendReverseEvent (QByteArray &session, AirplayEvent event)
 
void SendResponse (QTcpSocket *socket, uint16_t status, const QByteArray &header, const QByteArray &content_type, const QString &body)
 
void deleteConnection (QTcpSocket *socket)
 
void DisconnectAllClients (const QByteArray &session)
 
void StopSession (const QByteArray &session)
 
void StartPlayback (const QString &pathname)
 
void StopPlayback (void)
 
void SeekPosition (uint64_t position)
 
void PausePlayback (void)
 
void UnpausePlayback (void)
 
void HideAllPhotos (void)
 

Static Private Member Functions

static QByteArray StatusToString (uint16_t status)
 
static QString eventToString (AirplayEvent event)
 
static void GetPlayerStatus (bool &playing, float &speed, double &position, double &duration, QString &pathname)
 
static QString GetMacAddress ()
 

Private Attributes

QString m_name {"MythTV"}
 
BonjourRegisterm_bonjour {nullptr}
 
bool m_valid {false}
 
QRecursiveMutex * m_lock {nullptr}
 
int m_setupPort {5100}
 
QList< QTcpSocket * > m_sockets
 
QHash< QByteArray, AirplayConnectionm_connections
 
QString m_pathname
 
QString m_nonce
 
QHash< QTcpSocket *, APHTTPRequest * > m_incoming
 
QTimer * m_serviceRefresh {nullptr}
 

Static Private Attributes

static MythAirplayServergMythAirplayServer = nullptr
 
static QRecursiveMutex * gMythAirplayServerMutex = new QRecursiveMutex()
 
static MThreadgMythAirplayServerThread = nullptr
 

Additional Inherited Members

- Signals inherited from ServerPool
void newConnection (QTcpSocket *)
 
void newDatagram (QByteArray, QHostAddress, quint16)
 
- Protected Slots inherited from ServerPool
virtual void newUdpDatagram (void)
 
virtual void newTcpConnection (qintptr socket)
 

Detailed Description

Definition at line 68 of file mythairplayserver.h.

Constructor & Destructor Documentation

◆ MythAirplayServer()

MythAirplayServer::MythAirplayServer ( )
inline

Definition at line 78 of file mythairplayserver.h.

Referenced by Create().

◆ ~MythAirplayServer()

MythAirplayServer::~MythAirplayServer ( void  )
overrideprivate

Definition at line 409 of file mythairplayserver.cpp.

Member Function Documentation

◆ Create()

bool MythAirplayServer::Create ( void  )
static

Definition at line 352 of file mythairplayserver.cpp.

Referenced by main().

◆ Cleanup()

void MythAirplayServer::Cleanup ( void  )
static

◆ AirplaySharedInstance()

static MythAirplayServer* MythAirplayServer::AirplaySharedInstance ( void  )
inlinestatic

Definition at line 75 of file mythairplayserver.h.

◆ Start

void MythAirplayServer::Start ( )
privateslot

Definition at line 450 of file mythairplayserver.cpp.

Referenced by Create().

◆ Stop

void MythAirplayServer::Stop ( )
privateslot

Definition at line 520 of file mythairplayserver.cpp.

Referenced by Create().

◆ newAirplayConnection

void MythAirplayServer::newAirplayConnection ( QTcpSocket *  client)
privateslot

Definition at line 525 of file mythairplayserver.cpp.

Referenced by Start().

◆ deleteConnection [1/2]

void MythAirplayServer::deleteConnection ( )
privateslot

Definition at line 538 of file mythairplayserver.cpp.

Referenced by newAirplayConnection().

◆ read

void MythAirplayServer::read ( void  )
privateslot

Definition at line 602 of file mythairplayserver.cpp.

Referenced by newAirplayConnection().

◆ timeout

void MythAirplayServer::timeout ( void  )
privateslot

Definition at line 514 of file mythairplayserver.cpp.

Referenced by Start().

◆ Teardown()

void MythAirplayServer::Teardown ( void  )
private

Definition at line 415 of file mythairplayserver.cpp.

Referenced by Stop().

◆ HandleResponse()

void MythAirplayServer::HandleResponse ( APHTTPRequest req,
QTcpSocket *  socket 
)
private

Definition at line 646 of file mythairplayserver.cpp.

Referenced by read().

◆ StatusToString()

QByteArray MythAirplayServer::StatusToString ( uint16_t  status)
staticprivate

Definition at line 633 of file mythairplayserver.cpp.

Referenced by SendResponse().

◆ eventToString()

QString MythAirplayServer::eventToString ( AirplayEvent  event)
staticprivate

Definition at line 1076 of file mythairplayserver.cpp.

Referenced by SendReverseEvent().

◆ GetPlayerStatus()

void MythAirplayServer::GetPlayerStatus ( bool playing,
float &  speed,
double &  position,
double &  duration,
QString &  pathname 
)
staticprivate

Definition at line 1089 of file mythairplayserver.cpp.

Referenced by HandleResponse(), and StopSession().

◆ GetMacAddress()

QString MythAirplayServer::GetMacAddress ( )
staticprivate

Definition at line 1108 of file mythairplayserver.cpp.

Referenced by HandleResponse(), and Start().

◆ SendReverseEvent()

bool MythAirplayServer::SendReverseEvent ( QByteArray &  session,
AirplayEvent  event 
)
private

Definition at line 1028 of file mythairplayserver.cpp.

Referenced by HandleResponse().

◆ SendResponse()

void MythAirplayServer::SendResponse ( QTcpSocket *  socket,
uint16_t  status,
const QByteArray &  header,
const QByteArray &  content_type,
const QString &  body 
)
private

Definition at line 980 of file mythairplayserver.cpp.

Referenced by HandleResponse().

◆ deleteConnection() [2/2]

void MythAirplayServer::deleteConnection ( QTcpSocket *  socket)
private

Definition at line 551 of file mythairplayserver.cpp.

◆ DisconnectAllClients()

void MythAirplayServer::DisconnectAllClients ( const QByteArray &  session)
private

Definition at line 1157 of file mythairplayserver.cpp.

Referenced by HandleResponse().

◆ StopSession()

void MythAirplayServer::StopSession ( const QByteArray &  session)
private

Definition at line 1124 of file mythairplayserver.cpp.

Referenced by deleteConnection(), DisconnectAllClients(), and HandleResponse().

◆ StartPlayback()

void MythAirplayServer::StartPlayback ( const QString &  pathname)
private

Definition at line 1212 of file mythairplayserver.cpp.

Referenced by HandleResponse().

◆ StopPlayback()

void MythAirplayServer::StopPlayback ( void  )
private

Definition at line 1232 of file mythairplayserver.cpp.

Referenced by StartPlayback(), and StopSession().

◆ SeekPosition()

void MythAirplayServer::SeekPosition ( uint64_t  position)
private

Definition at line 1258 of file mythairplayserver.cpp.

Referenced by HandleResponse().

◆ PausePlayback()

void MythAirplayServer::PausePlayback ( void  )
private

Definition at line 1286 of file mythairplayserver.cpp.

Referenced by HandleResponse().

◆ UnpausePlayback()

void MythAirplayServer::UnpausePlayback ( void  )
private

Definition at line 1313 of file mythairplayserver.cpp.

Referenced by HandleResponse().

◆ HideAllPhotos()

void MythAirplayServer::HideAllPhotos ( void  )
private

Definition at line 1340 of file mythairplayserver.cpp.

Referenced by HandleResponse().

Member Data Documentation

◆ gMythAirplayServer

MythAirplayServer * MythAirplayServer::gMythAirplayServer = nullptr
staticprivate

Definition at line 116 of file mythairplayserver.h.

Referenced by Cleanup(), and Create().

◆ gMythAirplayServerMutex

QRecursiveMutex * MythAirplayServer::gMythAirplayServerMutex = new QRecursiveMutex()
staticprivate

Definition at line 117 of file mythairplayserver.h.

Referenced by Cleanup(), and Create().

◆ gMythAirplayServerThread

MThread * MythAirplayServer::gMythAirplayServerThread = nullptr
staticprivate

Definition at line 118 of file mythairplayserver.h.

Referenced by Cleanup(), and Create().

◆ m_name

QString MythAirplayServer::m_name {"MythTV"}
private

Definition at line 121 of file mythairplayserver.h.

Referenced by Start().

◆ m_bonjour

BonjourRegister* MythAirplayServer::m_bonjour {nullptr}
private

Definition at line 122 of file mythairplayserver.h.

Referenced by Start(), Teardown(), and timeout().

◆ m_valid

bool MythAirplayServer::m_valid {false}
private

Definition at line 123 of file mythairplayserver.h.

Referenced by Start(), and Teardown().

◆ m_lock

QRecursiveMutex* MythAirplayServer::m_lock {nullptr}
private

◆ m_setupPort

int MythAirplayServer::m_setupPort {5100}
private

Definition at line 125 of file mythairplayserver.h.

Referenced by Start().

◆ m_sockets

QList<QTcpSocket*> MythAirplayServer::m_sockets
private

◆ m_connections

QHash<QByteArray,AirplayConnection> MythAirplayServer::m_connections
private

◆ m_pathname

QString MythAirplayServer::m_pathname
private

◆ m_nonce

QString MythAirplayServer::m_nonce
private

Definition at line 131 of file mythairplayserver.h.

Referenced by HandleResponse().

◆ m_incoming

QHash<QTcpSocket*, APHTTPRequest*> MythAirplayServer::m_incoming
private

◆ m_serviceRefresh

QTimer* MythAirplayServer::m_serviceRefresh {nullptr}
private

Definition at line 137 of file mythairplayserver.h.

Referenced by Start(), Teardown(), and timeout().


The documentation for this class was generated from the following files: