diff --git a/src/audiomixerboard.cpp b/src/audiomixerboard.cpp index f9ba7f76..23447d78 100755 --- a/src/audiomixerboard.cpp +++ b/src/audiomixerboard.cpp @@ -43,7 +43,7 @@ CChannelFader::CChannelFader ( QWidget* pNW, // TEST custom slider made of custom bitmaps pFader->setStyleSheet ( "QSlider::groove { image: url(:/png/LEDs/res/CLEDYellowSmall.png) }" - "QSlider::handle { image: url(:/png/LEDs/res/CLEDGreySmall.png) }" ); + "QSlider::handle { image: url(:/png/fader/res/faderhandle.png) }" ); */ diff --git a/src/channel.cpp b/src/channel.cpp index f8f17ee0..b4c6378b 100755 --- a/src/channel.cpp +++ b/src/channel.cpp @@ -63,6 +63,10 @@ CChannel::CChannel ( const bool bNIsServer ) : SIGNAL ( ReqJittBufSize() ), SIGNAL ( ReqJittBufSize() ) ); + QObject::connect ( &Protocol, + SIGNAL ( ReqChanName() ), + SIGNAL ( ReqChanName() ) ); + QObject::connect ( &Protocol, SIGNAL ( ReqConnClientsList() ), SIGNAL ( ReqConnClientsList() ) ); @@ -402,7 +406,7 @@ EPutDataStat CChannel::PutData ( const CVector& vecbyData, bNewConnection = !IsConnected(); // reset time-out counter - iConTimeOut = iConTimeOutStartVal; + ResetTimeOutCounter(); } Mutex.unlock(); } diff --git a/src/channel.h b/src/channel.h index 615c3a2c..ce397304 100755 --- a/src/channel.h +++ b/src/channel.h @@ -68,6 +68,7 @@ public: CVector PrepSendPacket ( const CVector& vecbyNPacket ); + void ResetTimeOutCounter() { iConTimeOut = iConTimeOutStartVal; } bool IsConnected() const { return iConTimeOut > 0; } void SetEnable ( const bool bNEnStat ); @@ -79,8 +80,8 @@ public: void SetName ( const QString sNNa ); QString GetName(); - void SetRemoteName ( const QString strName ) - { Protocol.CreateChanNameMes ( strName ); } + void SetRemoteName ( const QString strName ) { Protocol.CreateChanNameMes ( strName ); } + void CreateReqChanNameMes() { Protocol.CreateReqChanNameMes(); } void SetGain ( const int iChanID, const double dNewGain ); double GetGain ( const int iChanID ); @@ -175,6 +176,7 @@ signals: void ReqConnClientsList(); void ConClientListMesReceived ( CVector vecChanInfo ); void NameHasChanged(); + void ReqChanName(); void ChatTextReceived ( QString strChatText ); void PingReceived ( int iMs ); void ReqNetTranspProps(); diff --git a/src/client.cpp b/src/client.cpp index 986bb42d..9688b3db 100755 --- a/src/client.cpp +++ b/src/client.cpp @@ -64,6 +64,9 @@ CClient::CClient ( const quint16 iPortNumber ) : QObject::connect ( &Channel, SIGNAL ( ReqJittBufSize() ), this, SLOT ( OnReqJittBufSize() ) ); + QObject::connect ( &Channel, SIGNAL ( ReqChanName() ), + this, SLOT ( OnReqChanName() ) ); + QObject::connect ( &Channel, SIGNAL ( ConClientListMesReceived ( CVector ) ), SIGNAL ( ConClientListMesReceived ( CVector ) ) ); @@ -92,12 +95,6 @@ void CClient::OnSendProtMessage ( CVector vecMessage ) Socket.SendPacket ( vecMessage, Channel.GetAddress() ); } -void CClient::OnReqJittBufSize() -{ -// TODO cant we implement this OnReqJjittBufSize inside the channel object? - Channel.CreateJitBufMes ( Channel.GetSockBufNumFrames() ); -} - void CClient::OnNewConnection() { // a new connection was successfully initiated, send name and request diff --git a/src/client.h b/src/client.h index 56e4a906..b71e2def 100755 --- a/src/client.h +++ b/src/client.h @@ -202,7 +202,8 @@ protected: public slots: void OnSendProtMessage ( CVector vecMessage ); - void OnReqJittBufSize(); + void OnReqJittBufSize() { Channel.CreateJitBufMes ( Channel.GetSockBufNumFrames() ); } + void OnReqChanName() { Channel.SetRemoteName ( strName ); } void OnNewConnection(); void OnReceivePingMessage ( int iMs ); void OnSndCrdReinitRequest(); diff --git a/src/protocol.cpp b/src/protocol.cpp index ce0c62bb..db4bbc78 100755 --- a/src/protocol.cpp +++ b/src/protocol.cpp @@ -91,6 +91,7 @@ MESSAGES | 2 bytes number n | n bytes UTF-8 string | +------------------+----------------------+ +- Request name of channel: PROTMESSID_REQ_CHANNEL_NAME - Chat text: PROTMESSID_CHAT_TEXT @@ -385,6 +386,10 @@ if ( rand() < ( RAND_MAX / 2 ) ) return false; bRet = EvaluateChanNameMes ( vecData ); break; + case PROTMESSID_REQ_CHANNEL_NAME: + bRet = EvaluateReqChanNameMes ( vecData ); + break; + case PROTMESSID_CHAT_TEXT: bRet = EvaluateChatTextMes ( vecData ); break; @@ -692,6 +697,19 @@ bool CProtocol::EvaluateChanNameMes ( const CVector& vecData ) return false; // no error } +void CProtocol::CreateReqChanNameMes() +{ + CreateAndSendMessage ( PROTMESSID_REQ_CHANNEL_NAME, CVector ( 0 ) ); +} + +bool CProtocol::EvaluateReqChanNameMes ( const CVector& vecData ) +{ + // invoke message action + emit ReqChanName(); + + return false; // no error +} + void CProtocol::CreateChatTextMes ( const QString strChatText ) { unsigned int iPos = 0; // init position pointer diff --git a/src/protocol.h b/src/protocol.h index b4381fb5..d398efcf 100755 --- a/src/protocol.h +++ b/src/protocol.h @@ -51,6 +51,7 @@ #define PROTMESSID_NETW_TRANSPORT_PROPS 20 // properties for network transport #define PROTMESSID_REQ_NETW_TRANSPORT_PROPS 21 // request properties for network transport #define PROTMESSID_DISCONNECTION 22 // disconnection +#define PROTMESSID_REQ_CHANNEL_NAME 23 // request channel name for fader tag // lengths of message as defined in protocol.cpp file #define MESS_HEADER_LENGTH_BYTE 7 // TAG (2), ID (2), cnt (1), length (2) @@ -77,6 +78,7 @@ public: void CreateServerFullMes(); void CreateReqConnClientsList(); void CreateChanNameMes ( const QString strName ); + void CreateReqChanNameMes(); void CreateChatTextMes ( const QString strChatText ); void CreatePingMes ( const int iMs ); void CreateNetwTranspPropsMes ( const CNetworkTransportProps& NetTrProps ); @@ -147,6 +149,7 @@ protected: bool EvaluateServerFullMes ( const CVector& vecData ); bool EvaluateReqConnClientsList ( const CVector& vecData ); bool EvaluateChanNameMes ( const CVector& vecData ); + bool EvaluateReqChanNameMes ( const CVector& vecData ); bool EvaluateChatTextMes ( const CVector& vecData ); bool EvaluatePingMes ( const CVector& vecData ); bool EvaluateNetwTranspPropsMes ( const CVector& vecData ); @@ -178,6 +181,7 @@ signals: void ServerFull(); void ReqConnClientsList(); void ChangeChanName ( QString strName ); + void ReqChanName(); void ChatTextReceived ( QString strChatText ); void PingReceived ( int iMs ); void NetTranspPropsReceived ( CNetworkTransportProps NetworkTransportProps ); diff --git a/src/res/faderhandle.png b/src/res/faderhandle.png new file mode 100755 index 00000000..2382059b Binary files /dev/null and b/src/res/faderhandle.png differ diff --git a/src/resources.qrc b/src/resources.qrc index 7fd235c3..619856d6 100755 --- a/src/resources.qrc +++ b/src/resources.qrc @@ -33,6 +33,9 @@ res/VRLEDYellow.png res/VRLEDYellowSmall.png + + res/faderhandle.png + res/gig.png res/mainicon.png diff --git a/src/server.cpp b/src/server.cpp index ea84c278..ad21242d 100755 --- a/src/server.cpp +++ b/src/server.cpp @@ -688,25 +688,24 @@ bool CServer::PutData ( const CVector& vecbyRecBuf, case PS_PROT_ERR: PostWinMessage ( MS_JIT_BUF_PUT, MUL_COL_LED_YELLOW, iCurChanID ); - -// TEST -bAudioOK = true; - break; } } - // after data is put in channel buffer, create channel list message if - // requested - if ( bNewChannelReserved && bAudioOK ) + // act on new channel connection + if ( bNewChannelReserved ) { // logging of new connected channel Logging.AddNewConnection ( HostAdr.InetAddr ); - // A new client connected to the server, create and - // send all clients the updated channel list (the list has to - // be created after the received data has to be put to the - // channel first so that this channel is marked as connected) + // A new client connected to the server, the channel list + // at all clients have to be updated. This is done by sending + // a channel name request to the client which causes a channel + // name message to be transmitted to the server. If the server + // receives this message, the channel list will be automatically + // updated (implicitely). + // To make sure the protocol message is transmitted, the channel + // first has to be marked as connected. // // Usually it is not required to send the channel list to the // client currently connecting since it automatically requests @@ -716,15 +715,8 @@ bAudioOK = true; // in case the client thinks he is still connected but the server // was restartet, it is important that we send the channel list // at this place. - - -// TODO this does not work somehow (another problem: the channel name -// is not yet received from the new client) -// possible solution: create (new) request channel name message, if this one -// is received, the channel list for all clients are automatically sent -// by the server - - CreateAndSendChanListForAllConChannels(); + vecChannels[iCurChanID].ResetTimeOutCounter(); + vecChannels[iCurChanID].CreateReqChanNameMes(); } } Mutex.unlock();