//----------------------------------------------------------------------------- void ConsoleServer::process_command(TCPSocket /*client*/, const char* msg) { JSONParser parser(msg); JSONElement root = parser.root(); JSONElement command = root.key("command"); DynamicString cmd; command.to_string(cmd); if (cmd == "reload") { JSONElement type = root.key_or_nil("resource_type"); JSONElement name = root.key_or_nil("resource_name"); DynamicString resource_type; DynamicString resource_name; type.to_string(resource_type); name.to_string(resource_name); char t[256]; char n[256]; string::strncpy(t, resource_type.c_str(), 256); string::strncpy(n, resource_name.c_str(), 256); device()->reload(t, n); } else if (cmd == "pause") { device()->pause(); } else if (cmd == "unpause") { device()->unpause(); } }