Callback for the connect function.
| 11 | |
| 12 | // Callback for the connect function. |
| 13 | NymphMessage* connectClient(int session, NymphMessage* msg, void* data) { |
| 14 | std::cout << "Received message for session: " << session << ", msg ID: " << msg->getMessageId() << "\n"; |
| 15 | |
| 16 | std::string clientStr = ((NymphString*) msg->parameters()[0])->getValue(); |
| 17 | std::cout << "Client string: " << clientStr << "\n"; |
| 18 | |
| 19 | // Register this client with its ID. Return error if the client ID already exists. |
| 20 | NymphMessage* returnMsg = msg->getReplyMessage(); |
| 21 | |
| 22 | NymphBoolean* retVal = 0; |
| 23 | retVal = new NymphBoolean(true); |
| 24 | |
| 25 | // Send the client the current playback status. |
| 26 | std::vector<NymphType*> values; |
| 27 | values.push_back(getPlaybackStatus()); |
| 28 | std::string result; |
| 29 | NymphBoolean* resVal = 0; |
| 30 | if (!NymphRemoteClient::callCallback(session, "MediaStatusCallback", values, result)) { |
| 31 | std::cerr << "Calling media status callback failed: " << result << std::endl; |
| 32 | } |
| 33 | |
| 34 | returnMsg->setResultValue(retVal); |
| 35 | return returnMsg; |
| 36 | } |
| 37 | |
| 38 | |
| 39 | // Client disconnects from server. |
nothing calls this directly
no test coverage detected