* @brief Send a message to another client (not the Soar kernel). * The other client must have registered for this message to receive it. * * This mechanism allows one client to send an arbitrary string to another client and * get a response (as a string). The contents of the string are up to the clients to agree upon. * Passing a string is sufficient to support either
| 2245 | * @returns The response (if any) from the receiving client. The string "**NONE**" is reserved to indicate nobody was registered for this event. |
| 2246 | *************************************************************/ |
| 2247 | std::string Kernel::SendClientMessage(Agent* pAgent, char const* pClientName, char const* pMessage) |
| 2248 | { |
| 2249 | AnalyzeXML response ; |
| 2250 | |
| 2251 | bool ok = GetConnection()->SendAgentCommand(&response, sml_Names::kCommand_SendClientMessage, pAgent ? pAgent->GetAgentName() : NULL, sml_Names::kParamName, pClientName, sml_Names::kParamMessage, pMessage) ; |
| 2252 | |
| 2253 | if (ok) |
| 2254 | { |
| 2255 | const char* pResponse = response.GetResultString() ; |
| 2256 | return pResponse ? pResponse : "" ; |
| 2257 | } |
| 2258 | |
| 2259 | return GetLastErrorDescription() ; |
| 2260 | } |
| 2261 | |
| 2262 | /************************************************************* |
| 2263 | * @brief Unregister for a particular event |
no test coverage detected