aboutsummaryrefslogtreecommitdiffstats
path: root/src/command/OutputCommands.cxx
diff options
context:
space:
mode:
Diffstat (limited to 'src/command/OutputCommands.cxx')
-rw-r--r--src/command/OutputCommands.cxx37
1 files changed, 19 insertions, 18 deletions
diff --git a/src/command/OutputCommands.cxx b/src/command/OutputCommands.cxx
index c69a0dd65..7bbe5f905 100644
--- a/src/command/OutputCommands.cxx
+++ b/src/command/OutputCommands.cxx
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2003-2014 The Music Player Daemon Project
+ * Copyright (C) 2003-2015 The Music Player Daemon Project
* http://www.musicpd.org
*
* This program is free software; you can redistribute it and/or modify
@@ -19,23 +19,24 @@
#include "config.h"
#include "OutputCommands.hxx"
+#include "Request.hxx"
#include "output/OutputPrint.hxx"
#include "output/OutputCommand.hxx"
-#include "protocol/Result.hxx"
-#include "protocol/ArgParser.hxx"
#include "client/Client.hxx"
+#include "client/Response.hxx"
#include "Partition.hxx"
+#include "util/ConstBuffer.hxx"
CommandResult
-handle_enableoutput(Client &client, gcc_unused unsigned argc, char *argv[])
+handle_enableoutput(Client &client, Request args, Response &r)
{
+ assert(args.size == 1);
unsigned device;
- if (!check_unsigned(client, &device, argv[1]))
+ if (!args.Parse(0, device, r))
return CommandResult::ERROR;
if (!audio_output_enable_index(client.partition.outputs, device)) {
- command_error(client, ACK_ERROR_NO_EXIST,
- "No such audio output");
+ r.Error(ACK_ERROR_NO_EXIST, "No such audio output");
return CommandResult::ERROR;
}
@@ -43,15 +44,15 @@ handle_enableoutput(Client &client, gcc_unused unsigned argc, char *argv[])
}
CommandResult
-handle_disableoutput(Client &client, gcc_unused unsigned argc, char *argv[])
+handle_disableoutput(Client &client, Request args, Response &r)
{
+ assert(args.size == 1);
unsigned device;
- if (!check_unsigned(client, &device, argv[1]))
+ if (!args.Parse(0, device, r))
return CommandResult::ERROR;
if (!audio_output_disable_index(client.partition.outputs, device)) {
- command_error(client, ACK_ERROR_NO_EXIST,
- "No such audio output");
+ r.Error(ACK_ERROR_NO_EXIST, "No such audio output");
return CommandResult::ERROR;
}
@@ -59,15 +60,15 @@ handle_disableoutput(Client &client, gcc_unused unsigned argc, char *argv[])
}
CommandResult
-handle_toggleoutput(Client &client, gcc_unused unsigned argc, char *argv[])
+handle_toggleoutput(Client &client, Request args, Response &r)
{
+ assert(args.size == 1);
unsigned device;
- if (!check_unsigned(client, &device, argv[1]))
+ if (!args.Parse(0, device, r))
return CommandResult::ERROR;
if (!audio_output_toggle_index(client.partition.outputs, device)) {
- command_error(client, ACK_ERROR_NO_EXIST,
- "No such audio output");
+ r.Error(ACK_ERROR_NO_EXIST, "No such audio output");
return CommandResult::ERROR;
}
@@ -75,10 +76,10 @@ handle_toggleoutput(Client &client, gcc_unused unsigned argc, char *argv[])
}
CommandResult
-handle_devices(Client &client,
- gcc_unused unsigned argc, gcc_unused char *argv[])
+handle_devices(Client &client, gcc_unused Request args, Response &r)
{
- printAudioDevices(client, client.partition.outputs);
+ assert(args.IsEmpty());
+ printAudioDevices(r, client.partition.outputs);
return CommandResult::OK;
}