MCPcopy Create free account
hub / github.com/MayaPosch/NymphCast / connectClient

Function connectClient

src/test/test_server.cpp:13–36  ·  view source on GitHub ↗

Callback for the connect function.

Source from the content-addressed store, hash-verified

11
12// Callback for the connect function.
13NymphMessage* 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.

Callers

nothing calls this directly

Calls 3

getPlaybackStatusFunction · 0.85
push_backMethod · 0.80
getValueMethod · 0.45

Tested by

no test coverage detected