diff --git a/docs/JSON-RPC.md b/docs/JSON-RPC.md index be3980048c..a6d05cfd23 100644 --- a/docs/JSON-RPC.md +++ b/docs/JSON-RPC.md @@ -148,7 +148,7 @@ Results: | result.skillLevel | string | The musician’s skill level (beginner, intermediate, expert, or null). | | result.countryId | number | The musician’s country ID (see QLocale::Country). | | result.city | string | The musician’s city. | -| result.instrumentId | number | The musician’s instrument ID (see CInstPictures::GetTable). | +| result.instrument | string | The musician’s instrument. | | result.skillLevel | string | Your skill level (beginner, intermediate, expert, or null). | @@ -308,9 +308,9 @@ Results: | 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[*].instrument | string | The instrument name provided by the user for this channel. | | result.clients[*].city | string | The city name provided by the user for this channel. | -| result.clients[*].countryName | number | The text name of the country specified by the user for this channel (see QLocale::Country). | +| result.clients[*].countryName | string | The country name provided by the user for this channel. | | result.clients[*].skillLevelCode | number | The skill level id provided by the user for this channel. | @@ -494,9 +494,9 @@ Parameters: | params.clients[*].id | number | The channel ID. | | params.clients[*].name | string | The musician’s name. | | params.clients[*].skillLevel | string | The musician’s skill level (beginner, intermediate, expert, or null). | -| params.clients[*].countryId | number | The musician’s country ID (see QLocale::Country). | +| params.clients[*].country | string | The musician’s country. | | params.clients[*].city | string | The musician’s city. | -| params.clients[*].instrumentId | number | The musician’s instrument ID (see CInstPictures::GetTable). | +| params.clients[*].instrument | string | The musician’s instrument. | ### jamulusclient/serverListReceived @@ -549,3 +549,14 @@ Parameters: | params | object | No parameters (empty object). | +### jamulusclient/recorderState + +Emitted when the client is connected to a server who's recorder state changes. + +Parameters: + +| Name | Type | Description | +| --- | --- | --- | +| params.state | number | The recorder state (see ERecorderState). | + + diff --git a/src/clientrpc.cpp b/src/clientrpc.cpp index f07f802d1a..2366cb8889 100644 --- a/src/clientrpc.cpp +++ b/src/clientrpc.cpp @@ -55,7 +55,7 @@ CClientRpc::CClientRpc ( CClient* pClient, CRpcServer* pRpcServer, QObject* pare /// @param {string} params.clients[*].skillLevel - The musician’s skill level (beginner, intermediate, expert, or null). /// @param {string} params.clients[*].country - The musician’s country. /// @param {string} params.clients[*].city - The musician’s city. - /// @param {number} params.clients[*].instrumentId - The musician’s instrument ID (see CInstPictures::GetTable). + /// @param {string} params.clients[*].instrument - The musician’s instrument. connect ( pClient, &CClient::ConClientListMesReceived, [=] ( CVector vecChanInfo ) { QJsonArray arrChanInfo; for ( const auto& chanInfo : vecChanInfo ) @@ -66,7 +66,7 @@ CClientRpc::CClientRpc ( CClient* pClient, CRpcServer* pRpcServer, QObject* pare { "skillLevel", SerializeSkillLevel ( chanInfo.eSkillLevel ) }, { "country", QLocale::countryToString ( chanInfo.eCountry ) }, { "city", chanInfo.strCity }, - { "instrumentId", chanInfo.iInstrument }, + { "instrument", CInstPictures::GetName ( chanInfo.iInstrument ) }, }; arrChanInfo.append ( objChanInfo ); } @@ -139,6 +139,16 @@ CClientRpc::CClientRpc ( CClient* pClient, CRpcServer* pRpcServer, QObject* pare /// @param {object} params - No parameters (empty object). connect ( pClient, &CClient::Disconnected, [=]() { pRpcServer->BroadcastNotification ( "jamulusclient/disconnected", QJsonObject{} ); } ); + /// @rpc_notification jamulusclient/recorderState + /// @brief Emitted when the client is connected to a server who's recorder state changes. + /// @param {number} params.state - The recorder state + connect ( pClient, &CClient::RecorderStateReceived, [=] ( const ERecorderState newRecorderState ) { + pRpcServer->BroadcastNotification ( "jamulusclient/recorderState", + QJsonObject{ + {"state", newRecorderState} + } ); + } ); + /// @rpc_method jamulus/pollServerList /// @brief Request list of servers in a directory /// @param {string} params.directory - socket address of directory to query, e.g. anygenre1.jamulus.io:22124. @@ -237,7 +247,7 @@ CClientRpc::CClientRpc ( CClient* pClient, CRpcServer* pRpcServer, QObject* pare /// @result {string} result.skillLevel - The musician’s skill level (beginner, intermediate, expert, or null). /// @result {string} result.country - The musician’s country. /// @result {string} result.city - The musician’s city. - /// @result {number} result.instrumentId - The musician’s instrument ID (see CInstPictures::GetTable). + /// @result {number} result.instrument - The musician’s instrument. /// @result {string} result.skillLevel - Your skill level (beginner, intermediate, expert, or null). pRpcServer->HandleMethod ( "jamulusclient/getChannelInfo", [=] ( const QJsonObject& params, QJsonObject& response ) { QJsonObject result{ @@ -245,7 +255,7 @@ CClientRpc::CClientRpc ( CClient* pClient, CRpcServer* pRpcServer, QObject* pare { "name", pClient->ChannelInfo.strName }, { "country", QLocale::countryToString ( pClient->ChannelInfo.eCountry ) }, { "city", pClient->ChannelInfo.strCity }, - { "instrumentId", pClient->ChannelInfo.iInstrument }, + { "instrument", CInstPictures::GetName ( pClient->ChannelInfo.iInstrument ) }, { "skillLevel", SerializeSkillLevel ( pClient->ChannelInfo.eSkillLevel ) }, }; response["result"] = result;