implementation of channel name request message, required if server is restarted while client thinks it is still connected
This commit is contained in:
parent
a8a3ebd483
commit
65d61f1c0e
10 changed files with 52 additions and 31 deletions
|
@ -43,7 +43,7 @@ CChannelFader::CChannelFader ( QWidget* pNW,
|
||||||
// TEST custom slider made of custom bitmaps
|
// TEST custom slider made of custom bitmaps
|
||||||
pFader->setStyleSheet (
|
pFader->setStyleSheet (
|
||||||
"QSlider::groove { image: url(:/png/LEDs/res/CLEDYellowSmall.png) }"
|
"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) }" );
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -63,6 +63,10 @@ CChannel::CChannel ( const bool bNIsServer ) :
|
||||||
SIGNAL ( ReqJittBufSize() ),
|
SIGNAL ( ReqJittBufSize() ),
|
||||||
SIGNAL ( ReqJittBufSize() ) );
|
SIGNAL ( ReqJittBufSize() ) );
|
||||||
|
|
||||||
|
QObject::connect ( &Protocol,
|
||||||
|
SIGNAL ( ReqChanName() ),
|
||||||
|
SIGNAL ( ReqChanName() ) );
|
||||||
|
|
||||||
QObject::connect ( &Protocol,
|
QObject::connect ( &Protocol,
|
||||||
SIGNAL ( ReqConnClientsList() ),
|
SIGNAL ( ReqConnClientsList() ),
|
||||||
SIGNAL ( ReqConnClientsList() ) );
|
SIGNAL ( ReqConnClientsList() ) );
|
||||||
|
@ -402,7 +406,7 @@ EPutDataStat CChannel::PutData ( const CVector<uint8_t>& vecbyData,
|
||||||
bNewConnection = !IsConnected();
|
bNewConnection = !IsConnected();
|
||||||
|
|
||||||
// reset time-out counter
|
// reset time-out counter
|
||||||
iConTimeOut = iConTimeOutStartVal;
|
ResetTimeOutCounter();
|
||||||
}
|
}
|
||||||
Mutex.unlock();
|
Mutex.unlock();
|
||||||
}
|
}
|
||||||
|
|
|
@ -68,6 +68,7 @@ public:
|
||||||
|
|
||||||
CVector<uint8_t> PrepSendPacket ( const CVector<uint8_t>& vecbyNPacket );
|
CVector<uint8_t> PrepSendPacket ( const CVector<uint8_t>& vecbyNPacket );
|
||||||
|
|
||||||
|
void ResetTimeOutCounter() { iConTimeOut = iConTimeOutStartVal; }
|
||||||
bool IsConnected() const { return iConTimeOut > 0; }
|
bool IsConnected() const { return iConTimeOut > 0; }
|
||||||
|
|
||||||
void SetEnable ( const bool bNEnStat );
|
void SetEnable ( const bool bNEnStat );
|
||||||
|
@ -79,8 +80,8 @@ public:
|
||||||
void SetName ( const QString sNNa );
|
void SetName ( const QString sNNa );
|
||||||
QString GetName();
|
QString GetName();
|
||||||
|
|
||||||
void SetRemoteName ( const QString strName )
|
void SetRemoteName ( const QString strName ) { Protocol.CreateChanNameMes ( strName ); }
|
||||||
{ Protocol.CreateChanNameMes ( strName ); }
|
void CreateReqChanNameMes() { Protocol.CreateReqChanNameMes(); }
|
||||||
|
|
||||||
void SetGain ( const int iChanID, const double dNewGain );
|
void SetGain ( const int iChanID, const double dNewGain );
|
||||||
double GetGain ( const int iChanID );
|
double GetGain ( const int iChanID );
|
||||||
|
@ -175,6 +176,7 @@ signals:
|
||||||
void ReqConnClientsList();
|
void ReqConnClientsList();
|
||||||
void ConClientListMesReceived ( CVector<CChannelShortInfo> vecChanInfo );
|
void ConClientListMesReceived ( CVector<CChannelShortInfo> vecChanInfo );
|
||||||
void NameHasChanged();
|
void NameHasChanged();
|
||||||
|
void ReqChanName();
|
||||||
void ChatTextReceived ( QString strChatText );
|
void ChatTextReceived ( QString strChatText );
|
||||||
void PingReceived ( int iMs );
|
void PingReceived ( int iMs );
|
||||||
void ReqNetTranspProps();
|
void ReqNetTranspProps();
|
||||||
|
|
|
@ -64,6 +64,9 @@ CClient::CClient ( const quint16 iPortNumber ) :
|
||||||
QObject::connect ( &Channel, SIGNAL ( ReqJittBufSize() ),
|
QObject::connect ( &Channel, SIGNAL ( ReqJittBufSize() ),
|
||||||
this, SLOT ( OnReqJittBufSize() ) );
|
this, SLOT ( OnReqJittBufSize() ) );
|
||||||
|
|
||||||
|
QObject::connect ( &Channel, SIGNAL ( ReqChanName() ),
|
||||||
|
this, SLOT ( OnReqChanName() ) );
|
||||||
|
|
||||||
QObject::connect ( &Channel,
|
QObject::connect ( &Channel,
|
||||||
SIGNAL ( ConClientListMesReceived ( CVector<CChannelShortInfo> ) ),
|
SIGNAL ( ConClientListMesReceived ( CVector<CChannelShortInfo> ) ),
|
||||||
SIGNAL ( ConClientListMesReceived ( CVector<CChannelShortInfo> ) ) );
|
SIGNAL ( ConClientListMesReceived ( CVector<CChannelShortInfo> ) ) );
|
||||||
|
@ -92,12 +95,6 @@ void CClient::OnSendProtMessage ( CVector<uint8_t> vecMessage )
|
||||||
Socket.SendPacket ( vecMessage, Channel.GetAddress() );
|
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()
|
void CClient::OnNewConnection()
|
||||||
{
|
{
|
||||||
// a new connection was successfully initiated, send name and request
|
// a new connection was successfully initiated, send name and request
|
||||||
|
|
|
@ -202,7 +202,8 @@ protected:
|
||||||
|
|
||||||
public slots:
|
public slots:
|
||||||
void OnSendProtMessage ( CVector<uint8_t> vecMessage );
|
void OnSendProtMessage ( CVector<uint8_t> vecMessage );
|
||||||
void OnReqJittBufSize();
|
void OnReqJittBufSize() { Channel.CreateJitBufMes ( Channel.GetSockBufNumFrames() ); }
|
||||||
|
void OnReqChanName() { Channel.SetRemoteName ( strName ); }
|
||||||
void OnNewConnection();
|
void OnNewConnection();
|
||||||
void OnReceivePingMessage ( int iMs );
|
void OnReceivePingMessage ( int iMs );
|
||||||
void OnSndCrdReinitRequest();
|
void OnSndCrdReinitRequest();
|
||||||
|
|
|
@ -91,6 +91,7 @@ MESSAGES
|
||||||
| 2 bytes number n | n bytes UTF-8 string |
|
| 2 bytes number n | n bytes UTF-8 string |
|
||||||
+------------------+----------------------+
|
+------------------+----------------------+
|
||||||
|
|
||||||
|
- Request name of channel: PROTMESSID_REQ_CHANNEL_NAME
|
||||||
|
|
||||||
- Chat text: PROTMESSID_CHAT_TEXT
|
- Chat text: PROTMESSID_CHAT_TEXT
|
||||||
|
|
||||||
|
@ -385,6 +386,10 @@ if ( rand() < ( RAND_MAX / 2 ) ) return false;
|
||||||
bRet = EvaluateChanNameMes ( vecData );
|
bRet = EvaluateChanNameMes ( vecData );
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
case PROTMESSID_REQ_CHANNEL_NAME:
|
||||||
|
bRet = EvaluateReqChanNameMes ( vecData );
|
||||||
|
break;
|
||||||
|
|
||||||
case PROTMESSID_CHAT_TEXT:
|
case PROTMESSID_CHAT_TEXT:
|
||||||
bRet = EvaluateChatTextMes ( vecData );
|
bRet = EvaluateChatTextMes ( vecData );
|
||||||
break;
|
break;
|
||||||
|
@ -692,6 +697,19 @@ bool CProtocol::EvaluateChanNameMes ( const CVector<uint8_t>& vecData )
|
||||||
return false; // no error
|
return false; // no error
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void CProtocol::CreateReqChanNameMes()
|
||||||
|
{
|
||||||
|
CreateAndSendMessage ( PROTMESSID_REQ_CHANNEL_NAME, CVector<uint8_t> ( 0 ) );
|
||||||
|
}
|
||||||
|
|
||||||
|
bool CProtocol::EvaluateReqChanNameMes ( const CVector<uint8_t>& vecData )
|
||||||
|
{
|
||||||
|
// invoke message action
|
||||||
|
emit ReqChanName();
|
||||||
|
|
||||||
|
return false; // no error
|
||||||
|
}
|
||||||
|
|
||||||
void CProtocol::CreateChatTextMes ( const QString strChatText )
|
void CProtocol::CreateChatTextMes ( const QString strChatText )
|
||||||
{
|
{
|
||||||
unsigned int iPos = 0; // init position pointer
|
unsigned int iPos = 0; // init position pointer
|
||||||
|
|
|
@ -51,6 +51,7 @@
|
||||||
#define PROTMESSID_NETW_TRANSPORT_PROPS 20 // properties for network transport
|
#define PROTMESSID_NETW_TRANSPORT_PROPS 20 // properties for network transport
|
||||||
#define PROTMESSID_REQ_NETW_TRANSPORT_PROPS 21 // request properties for network transport
|
#define PROTMESSID_REQ_NETW_TRANSPORT_PROPS 21 // request properties for network transport
|
||||||
#define PROTMESSID_DISCONNECTION 22 // disconnection
|
#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
|
// lengths of message as defined in protocol.cpp file
|
||||||
#define MESS_HEADER_LENGTH_BYTE 7 // TAG (2), ID (2), cnt (1), length (2)
|
#define MESS_HEADER_LENGTH_BYTE 7 // TAG (2), ID (2), cnt (1), length (2)
|
||||||
|
@ -77,6 +78,7 @@ public:
|
||||||
void CreateServerFullMes();
|
void CreateServerFullMes();
|
||||||
void CreateReqConnClientsList();
|
void CreateReqConnClientsList();
|
||||||
void CreateChanNameMes ( const QString strName );
|
void CreateChanNameMes ( const QString strName );
|
||||||
|
void CreateReqChanNameMes();
|
||||||
void CreateChatTextMes ( const QString strChatText );
|
void CreateChatTextMes ( const QString strChatText );
|
||||||
void CreatePingMes ( const int iMs );
|
void CreatePingMes ( const int iMs );
|
||||||
void CreateNetwTranspPropsMes ( const CNetworkTransportProps& NetTrProps );
|
void CreateNetwTranspPropsMes ( const CNetworkTransportProps& NetTrProps );
|
||||||
|
@ -147,6 +149,7 @@ protected:
|
||||||
bool EvaluateServerFullMes ( const CVector<uint8_t>& vecData );
|
bool EvaluateServerFullMes ( const CVector<uint8_t>& vecData );
|
||||||
bool EvaluateReqConnClientsList ( const CVector<uint8_t>& vecData );
|
bool EvaluateReqConnClientsList ( const CVector<uint8_t>& vecData );
|
||||||
bool EvaluateChanNameMes ( const CVector<uint8_t>& vecData );
|
bool EvaluateChanNameMes ( const CVector<uint8_t>& vecData );
|
||||||
|
bool EvaluateReqChanNameMes ( const CVector<uint8_t>& vecData );
|
||||||
bool EvaluateChatTextMes ( const CVector<uint8_t>& vecData );
|
bool EvaluateChatTextMes ( const CVector<uint8_t>& vecData );
|
||||||
bool EvaluatePingMes ( const CVector<uint8_t>& vecData );
|
bool EvaluatePingMes ( const CVector<uint8_t>& vecData );
|
||||||
bool EvaluateNetwTranspPropsMes ( const CVector<uint8_t>& vecData );
|
bool EvaluateNetwTranspPropsMes ( const CVector<uint8_t>& vecData );
|
||||||
|
@ -178,6 +181,7 @@ signals:
|
||||||
void ServerFull();
|
void ServerFull();
|
||||||
void ReqConnClientsList();
|
void ReqConnClientsList();
|
||||||
void ChangeChanName ( QString strName );
|
void ChangeChanName ( QString strName );
|
||||||
|
void ReqChanName();
|
||||||
void ChatTextReceived ( QString strChatText );
|
void ChatTextReceived ( QString strChatText );
|
||||||
void PingReceived ( int iMs );
|
void PingReceived ( int iMs );
|
||||||
void NetTranspPropsReceived ( CNetworkTransportProps NetworkTransportProps );
|
void NetTranspPropsReceived ( CNetworkTransportProps NetworkTransportProps );
|
||||||
|
|
BIN
src/res/faderhandle.png
Executable file
BIN
src/res/faderhandle.png
Executable file
Binary file not shown.
After Width: | Height: | Size: 2 KiB |
|
@ -33,6 +33,9 @@
|
||||||
<file>res/VRLEDYellow.png</file>
|
<file>res/VRLEDYellow.png</file>
|
||||||
<file>res/VRLEDYellowSmall.png</file>
|
<file>res/VRLEDYellowSmall.png</file>
|
||||||
</qresource>
|
</qresource>
|
||||||
|
<qresource prefix="/png/fader" >
|
||||||
|
<file>res/faderhandle.png</file>
|
||||||
|
</qresource>
|
||||||
<qresource prefix="/png/main" >
|
<qresource prefix="/png/main" >
|
||||||
<file>res/gig.png</file>
|
<file>res/gig.png</file>
|
||||||
<file>res/mainicon.png</file>
|
<file>res/mainicon.png</file>
|
||||||
|
|
|
@ -688,25 +688,24 @@ bool CServer::PutData ( const CVector<uint8_t>& vecbyRecBuf,
|
||||||
|
|
||||||
case PS_PROT_ERR:
|
case PS_PROT_ERR:
|
||||||
PostWinMessage ( MS_JIT_BUF_PUT, MUL_COL_LED_YELLOW, iCurChanID );
|
PostWinMessage ( MS_JIT_BUF_PUT, MUL_COL_LED_YELLOW, iCurChanID );
|
||||||
|
|
||||||
// TEST
|
|
||||||
bAudioOK = true;
|
|
||||||
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// after data is put in channel buffer, create channel list message if
|
// act on new channel connection
|
||||||
// requested
|
if ( bNewChannelReserved )
|
||||||
if ( bNewChannelReserved && bAudioOK )
|
|
||||||
{
|
{
|
||||||
// logging of new connected channel
|
// logging of new connected channel
|
||||||
Logging.AddNewConnection ( HostAdr.InetAddr );
|
Logging.AddNewConnection ( HostAdr.InetAddr );
|
||||||
|
|
||||||
// A new client connected to the server, create and
|
// A new client connected to the server, the channel list
|
||||||
// send all clients the updated channel list (the list has to
|
// at all clients have to be updated. This is done by sending
|
||||||
// be created after the received data has to be put to the
|
// a channel name request to the client which causes a channel
|
||||||
// channel first so that this channel is marked as connected)
|
// 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
|
// Usually it is not required to send the channel list to the
|
||||||
// client currently connecting since it automatically requests
|
// 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
|
// in case the client thinks he is still connected but the server
|
||||||
// was restartet, it is important that we send the channel list
|
// was restartet, it is important that we send the channel list
|
||||||
// at this place.
|
// at this place.
|
||||||
|
vecChannels[iCurChanID].ResetTimeOutCounter();
|
||||||
|
vecChannels[iCurChanID].CreateReqChanNameMes();
|
||||||
// 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();
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
Mutex.unlock();
|
Mutex.unlock();
|
||||||
|
|
Loading…
Reference in a new issue