Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions docs/JSON-RPC.md
Original file line number Diff line number Diff line change
Expand Up @@ -234,12 +234,17 @@ Results:

| Name | Type | Description |
| --- | --- | --- |
| result.connections | number | The number of active connections. |
| result.clients | array | The list of connected clients. |
| result.clients[*].id | number | The client’s channel id. |
| result.clients[*].address | string | The client’s address (ip:port). |
| result.clients[*].name | string | The client’s name. |
| result.clients[*].jitterBufferSize | number | The client’s jitter buffer size. |
| result.clients[*].channels | number | The number of audio channels of the client. |
| result.clients[*].instrumentCode | number | The id of the instrument for this channel. |
| result.clients[*].city | string | The city name provided by the user for this channel. |
Comment thread
ann0see marked this conversation as resolved.
| result.clients[*].countryName | number | The text name of the country specified by the user for this channel (see QLocale::Country). |
| result.clients[*].skillLevelCode | number | The skill level id provided by the user for this channel. |


### jamulusserver/getRecorderStatus
Expand Down
11 changes: 7 additions & 4 deletions src/server.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1469,16 +1469,18 @@ bool CServer::PutAudioData ( const CVector<uint8_t>& vecbyRecBuf, const int iNum
return bNewConnection;
}

void CServer::GetConCliParam ( CVector<CHostAddress>& vecHostAddresses,
CVector<QString>& vecsName,
CVector<int>& veciJitBufNumFrames,
CVector<int>& veciNetwFrameSizeFact )
void CServer::GetConCliParam ( CVector<CHostAddress>& vecHostAddresses,
CVector<QString>& vecsName,
CVector<int>& veciJitBufNumFrames,
CVector<int>& veciNetwFrameSizeFact,
CVector<CChannelCoreInfo>& vecChanInfo )
{
// init return values
vecHostAddresses.Init ( iMaxNumChannels );
vecsName.Init ( iMaxNumChannels );
veciJitBufNumFrames.Init ( iMaxNumChannels );
veciNetwFrameSizeFact.Init ( iMaxNumChannels );
vecChanInfo.Init ( iMaxNumChannels );
Comment thread
Rob-NY marked this conversation as resolved.

// check all possible channels
for ( int i = 0; i < iMaxNumChannels; i++ )
Expand All @@ -1490,6 +1492,7 @@ void CServer::GetConCliParam ( CVector<CHostAddress>& vecHostAddresses,
vecsName[i] = vecChannels[i].GetName();
veciJitBufNumFrames[i] = vecChannels[i].GetSockBufNumFrames();
veciNetwFrameSizeFact[i] = vecChannels[i].GetNetwFrameSizeFact();
vecChanInfo[i] = vecChannels[i].GetChanInfo();
}
}
}
Expand Down
9 changes: 5 additions & 4 deletions src/server.h
Original file line number Diff line number Diff line change
Expand Up @@ -116,10 +116,11 @@ class CServer : public QObject, public CServerSlots<MAX_NUM_CHANNELS>

int GetNumberOfConnectedClients();

void GetConCliParam ( CVector<CHostAddress>& vecHostAddresses,
CVector<QString>& vecsName,
CVector<int>& veciJitBufNumFrames,
CVector<int>& veciNetwFrameSizeFact );
void GetConCliParam ( CVector<CHostAddress>& vecHostAddresses,
CVector<QString>& vecsName,
CVector<int>& veciJitBufNumFrames,
CVector<int>& veciNetwFrameSizeFact,
CVector<CChannelCoreInfo>& vecChanInfo );

void CreateCLServerListReqVerAndOSMes ( const CHostAddress& InetAddr ) { ConnLessProtocol.CreateCLReqVersionAndOSMes ( InetAddr ); }

Expand Down
11 changes: 6 additions & 5 deletions src/serverdlg.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -679,14 +679,15 @@ void CServerDlg::OnCLVersionAndOSReceived ( CHostAddress, COSUtil::EOpSystemType

void CServerDlg::OnTimer()
{
CVector<CHostAddress> vecHostAddresses;
CVector<QString> vecsName;
CVector<int> veciJitBufNumFrames;
CVector<int> veciNetwFrameSizeFact;
CVector<CHostAddress> vecHostAddresses;
CVector<QString> vecsName;
CVector<int> veciJitBufNumFrames;
CVector<int> veciNetwFrameSizeFact;
CVector<CChannelCoreInfo> vecChanInfo;

ListViewMutex.lock();
{
pServer->GetConCliParam ( vecHostAddresses, vecsName, veciJitBufNumFrames, veciNetwFrameSizeFact );
pServer->GetConCliParam ( vecHostAddresses, vecsName, veciJitBufNumFrames, veciNetwFrameSizeFact, vecChanInfo );
Comment thread
Rob-NY marked this conversation as resolved.

// we assume that all vectors have the same length
const int iNumChannels = vecHostAddresses.Size();
Expand Down
30 changes: 23 additions & 7 deletions src/serverrpc.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -56,20 +56,28 @@ CServerRpc::CServerRpc ( CServer* pServer, CRpcServer* pRpcServer, QObject* pare
/// @rpc_method jamulusserver/getClients
/// @brief Returns the list of connected clients along with details about them.
/// @param {object} params - No parameters (empty object).
/// @result {array} result.clients - The list of connected clients.
/// @result {number} result.connections - The number of active connections.
/// @result {array} result.clients - The list of connected clients.
/// @result {number} result.clients[*].id - The client’s channel id.
/// @result {string} result.clients[*].address - The client’s address (ip:port).
/// @result {string} result.clients[*].name - The client’s name.
/// @result {number} result.clients[*].jitterBufferSize - The client’s jitter buffer size.
/// @result {number} result.clients[*].channels - The number of audio channels of the client.
/// @result {number} result.clients[*].instrumentCode - The id of the instrument for this channel.
/// @result {string} result.clients[*].city - The city name provided by the user for this channel.
/// @result {number} result.clients[*].countryName - The text name of the country specified by the user for this channel (see QLocale::Country).
/// @result {number} result.clients[*].skillLevelCode - The skill level id provided by the user for this channel.
pRpcServer->HandleMethod ( "jamulusserver/getClients", [=] ( const QJsonObject& params, QJsonObject& response ) {
QJsonArray clients;
CVector<CHostAddress> vecHostAddresses;
CVector<QString> vecsName;
CVector<int> veciJitBufNumFrames;
CVector<int> veciNetwFrameSizeFact;
QJsonArray clients;
CVector<CHostAddress> vecHostAddresses;
CVector<QString> vecsName;
CVector<int> veciJitBufNumFrames;
CVector<int> veciNetwFrameSizeFact;
CVector<CChannelCoreInfo> vecChanInfo;

pServer->GetConCliParam ( vecHostAddresses, vecsName, veciJitBufNumFrames, veciNetwFrameSizeFact );
int connections = 0;

pServer->GetConCliParam ( vecHostAddresses, vecsName, veciJitBufNumFrames, veciNetwFrameSizeFact, vecChanInfo );

// we assume that all vectors have the same length
const int iNumChannels = vecHostAddresses.Size();
Expand All @@ -81,18 +89,26 @@ CServerRpc::CServerRpc ( CServer* pServer, CRpcServer* pRpcServer, QObject* pare
{
continue;
}

QJsonObject client{
{ "id", i },
{ "address", vecHostAddresses[i].toString ( CHostAddress::SM_IP_PORT ) },
{ "name", vecsName[i] },
{ "jitterBufferSize", veciJitBufNumFrames[i] },
{ "channels", pServer->GetClientNumAudioChannels ( i ) },
{ "instrumentCode", vecChanInfo[i].iInstrument },
{ "city", vecChanInfo[i].strCity },
{ "countryName", QLocale::countryToString ( vecChanInfo[i].eCountry ) },
{ "skillLevelCode", vecChanInfo[i].eSkillLevel },
};
clients.append ( client );

++connections;
}

// create result object
QJsonObject result{
{ "connections", connections },
{ "clients", clients },
};
response["result"] = result;
Expand Down