if (strcmp(name, "connect") == 0)
connect(reader, response);
else if (strcmp(name, "disconnect") == 0)
- disconnect(reader, response);
+ call_nullary_method("Disconnect", reader, response);
+ else if (strcmp(name, "remove") == 0)
+ call_nullary_method("Remove", reader, response);
else {
response.send_error(
std::string("Unrecognized connman service request name: ")
}
void
-ivi::settings::service::disconnect(JsonReader * reader,
- response_callback response)
+ivi::settings::service::call_nullary_method(char const * name,
+ JsonReader * reader,
+ response_callback response)
{
bool null = false;
// The value is the second array element.
if (!null) {
response.send_error(
- "connman::service::disconnect parameter is not null.");
+ std::string(name)
+ + " connman::service method parameter is not null.");
return;
}
- call_method("Disconnect", response);
+ call_method(name, response);
}
void
* @brief Connman Service object proxy.
*
* This class exposes functionality found in the connman
- * @c Service interface to the caller.
+ * @c Service interface to the caller.
*/
class service
{
void connect(JsonReader * reader,
response_callback response);
- /// Disconnect from the service.
- void disconnect(JsonReader * reader,
- response_callback response);
+ /**
+ * Call Connman service API method with no arguments.
+ *
+ * @note @c Disconnect, @c Remove, etc.
+ */
+ void call_nullary_method(char const * name,
+ JsonReader * reader,
+ response_callback response);
/**
* Call the method @a name on the connman Service object.