soundserver.cpp
Go to the documentation of this file.
00001 #include "soundserver.h"
00002 #include <QDebug>
00003 
00004 SoundServer::SoundServer(QObject *parent) :
00005     QTcpServer(parent)
00006 {
00007 }
00008 
00009 void SoundServer::incomingConnection(int socketDescriptor)
00010 {
00011     ServerSocket *sock = new ServerSocket(socketDescriptor, this);
00012     connect(sock, SIGNAL(disconnected()), this, SLOT(socketFinished()));
00013     connect(sock, SIGNAL(read(QString)), this, SLOT(read(QString)));
00014 
00015     sockets.append(sock);
00016     emit clientConnected(sock->peerAddress());
00017 }
00018 
00019 void SoundServer::socketFinished()
00020 {
00021     ServerSocket *sock = (ServerSocket*)sender();
00022     sockets.removeOne(sock);
00023     sock->deleteLater();
00024 }
00025 
00026 void SoundServer::read(const QString &cmd)
00027 {
00028     emit onCmd(cmd);
00029 }
00030 
00031 void SoundServer::SendStart()
00032 {
00033     qDebug() << "===================START";
00034     for (int i = 0; i < sockets.size(); i++){
00035         sockets[i]->SendStart();
00036     }
00037 }
00038 
00039 void SoundServer::SendData( const void *data, int len )
00040 {
00041     qDebug() << "===================SEND";
00042     for (int i = 0; i < sockets.size(); i++){
00043         sockets[i]->SendData(data,len);
00044     }
00045 }
00046 
00047 void SoundServer::SendEnd()
00048 {
00049     qDebug() << "===================END";
00050     for (int i = 0; i < sockets.size(); i++){
00051         sockets[i]->SendEnd();
00052     }
00053 }
00054 
00055 void SoundServer::SendCancel()
00056 {
00057     qDebug() << "===================CANCEL";
00058     for (int i = 0; i < sockets.size(); i++){
00059         sockets[i]->SendCancel();
00060     }
00061 }
00062 
00063 void SoundServer::SendKeyPressed( int val )
00064 {
00065     qDebug() << "===================KEY";
00066     for (int i = 0; i < sockets.size(); i++){
00067         sockets[i]->SendKeyPressed(val);
00068     }
00069 }
00070 
00071 void SoundServer::SendEpdOn()
00072 {
00073     qDebug() << "===================EPDON";
00074     for (int i = 0; i < sockets.size(); i++){
00075         sockets[i]->SendEpdOn();
00076     }
00077 }
00078 
00079 void SoundServer::SendEpdOff()
00080 {
00081     qDebug() << "===================EPDOFF";
00082     for (int i = 0; i < sockets.size(); i++){
00083         sockets[i]->SendEpdOff();
00084     }
00085 }
00086 


rospeex_audiomonitor
Author(s): Komei Sugiura
autogenerated on Thu Jun 6 2019 18:53:06