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

#include <mythairplayserver.h>

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

Public Member Functions

 MythAirplayServer ()
 
- Public Member Functions inherited from ServerPool
 ServerPool (QObject *parent=nullptr)
 
 ~ServerPool (void)
 
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)
 
int maxPendingConnections (void)
 
void setMaxPendingConnections (int n)
 
quint16 serverPort (void)
 
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 newConnection (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)
 
QByteArray StatusToString (int status)
 
QString eventToString (AirplayEvent event)
 
void GetPlayerStatus (bool &playing, float &speed, double &position, double &duration, QString &pathname)
 
QString GetMacAddress ()
 
bool SendReverseEvent (QByteArray &session, AirplayEvent event)
 
void SendResponse (QTcpSocket *socket, int 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)
 

Private Attributes

QString m_name {"MythTV"}
 
BonjourRegisterm_bonjour {nullptr}
 
bool m_valid {false}
 
QMutex * 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 QMutex * gMythAirplayServerMutex = new QMutex(QMutex::Recursive)
 
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 (qt_socket_fd_t socket)
 

Detailed Description

Definition at line 67 of file mythairplayserver.h.

Constructor & Destructor Documentation

◆ MythAirplayServer()

MythAirplayServer::MythAirplayServer ( )
inline

Definition at line 77 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

Definition at line 391 of file mythairplayserver.cpp.

◆ AirplaySharedInstance()

static MythAirplayServer* MythAirplayServer::AirplaySharedInstance ( void  )
inlinestatic

Definition at line 74 of file mythairplayserver.h.

◆ Start

void MythAirplayServer::Start ( void  )
privateslot

Definition at line 450 of file mythairplayserver.cpp.

Referenced by Create().

◆ Stop

void MythAirplayServer::Stop ( void  )
privateslot

Definition at line 520 of file mythairplayserver.cpp.

Referenced by Create().

◆ newConnection

void MythAirplayServer::newConnection ( QTcpSocket *  client)
privateslot

Definition at line 525 of file mythairplayserver.cpp.

Referenced by Start().

◆ deleteConnection [1/2]

void MythAirplayServer::deleteConnection ( void  )
privateslot

Definition at line 537 of file mythairplayserver.cpp.

Referenced by newConnection().

◆ read

void MythAirplayServer::read ( void  )
privateslot

Definition at line 601 of file mythairplayserver.cpp.

Referenced by newConnection().

◆ 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 645 of file mythairplayserver.cpp.

Referenced by read().

◆ StatusToString()

QByteArray MythAirplayServer::StatusToString ( int  status)
private

Definition at line 632 of file mythairplayserver.cpp.

Referenced by SendResponse().

◆ eventToString()

QString MythAirplayServer::eventToString ( AirplayEvent  event)
private

Definition at line 1070 of file mythairplayserver.cpp.

Referenced by SendReverseEvent().

◆ GetPlayerStatus()

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

Definition at line 1083 of file mythairplayserver.cpp.

Referenced by HandleResponse(), and StopSession().

◆ GetMacAddress()

QString MythAirplayServer::GetMacAddress ( )
private

Definition at line 1102 of file mythairplayserver.cpp.

Referenced by HandleResponse(), and Start().

◆ SendReverseEvent()

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

Definition at line 1026 of file mythairplayserver.cpp.

Referenced by HandleResponse().

◆ SendResponse()

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

Definition at line 982 of file mythairplayserver.cpp.

Referenced by HandleResponse().

◆ deleteConnection() [2/2]

void MythAirplayServer::deleteConnection ( QTcpSocket *  socket)
private

Definition at line 550 of file mythairplayserver.cpp.

◆ DisconnectAllClients()

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

Definition at line 1151 of file mythairplayserver.cpp.

Referenced by HandleResponse().

◆ StopSession()

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

Definition at line 1118 of file mythairplayserver.cpp.

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

◆ StartPlayback()

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

Definition at line 1207 of file mythairplayserver.cpp.

Referenced by HandleResponse().

◆ StopPlayback()

void MythAirplayServer::StopPlayback ( void  )
private

Definition at line 1227 of file mythairplayserver.cpp.

Referenced by StartPlayback(), and StopSession().

◆ SeekPosition()

void MythAirplayServer::SeekPosition ( uint64_t  position)
private

Definition at line 1252 of file mythairplayserver.cpp.

Referenced by HandleResponse().

◆ PausePlayback()

void MythAirplayServer::PausePlayback ( void  )
private

Definition at line 1279 of file mythairplayserver.cpp.

Referenced by HandleResponse().

◆ UnpausePlayback()

void MythAirplayServer::UnpausePlayback ( void  )
private

Definition at line 1305 of file mythairplayserver.cpp.

Referenced by HandleResponse().

◆ HideAllPhotos()

void MythAirplayServer::HideAllPhotos ( void  )
private

Definition at line 1331 of file mythairplayserver.cpp.

Referenced by HandleResponse().

Member Data Documentation

◆ gMythAirplayServer

MythAirplayServer * MythAirplayServer::gMythAirplayServer = nullptr
staticprivate

Definition at line 114 of file mythairplayserver.h.

Referenced by Cleanup(), and Create().

◆ gMythAirplayServerMutex

QMutex * MythAirplayServer::gMythAirplayServerMutex = new QMutex(QMutex::Recursive)
staticprivate

Definition at line 115 of file mythairplayserver.h.

Referenced by Cleanup(), and Create().

◆ gMythAirplayServerThread

MThread * MythAirplayServer::gMythAirplayServerThread = nullptr
staticprivate

Definition at line 116 of file mythairplayserver.h.

Referenced by Cleanup(), and Create().

◆ m_name

QString MythAirplayServer::m_name {"MythTV"}
private

Definition at line 119 of file mythairplayserver.h.

Referenced by Start().

◆ m_bonjour

BonjourRegister* MythAirplayServer::m_bonjour {nullptr}
private

Definition at line 120 of file mythairplayserver.h.

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

◆ m_valid

bool MythAirplayServer::m_valid {false}
private

Definition at line 121 of file mythairplayserver.h.

Referenced by Start(), and Teardown().

◆ m_lock

QMutex* MythAirplayServer::m_lock {nullptr}
private

◆ m_setupPort

int MythAirplayServer::m_setupPort {5100}
private

Definition at line 123 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 129 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 135 of file mythairplayserver.h.

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


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