From fec1c8ca74ffdb71cd4d8faf36464b7efcce1178 Mon Sep 17 00:00:00 2001 From: Ghislain MARY Date: Fri, 26 Oct 2012 17:18:30 +0200 Subject: [PATCH] Improve help. - Add examples for each command - Add the --dump-commands-help option to output the entire help --- .../commands/adaptive-jitter-compensation.cc | 13 +++++ daemon/commands/answer.cc | 14 +++++ daemon/commands/audio-codec-get.cc | 25 +++++++++ daemon/commands/audio-codec-move.cc | 22 ++++++++ daemon/commands/audio-codec-set.cc | 33 ++++++++++++ daemon/commands/audio-codec-toggle.cc | 44 +++++++++++++++ daemon/commands/audio-stream-start.cc | 3 ++ daemon/commands/audio-stream-stop.cc | 6 +++ daemon/commands/call-stats.cc | 28 ++++++++++ daemon/commands/call-status.cc | 14 ++++- daemon/commands/call.cc | 6 +++ daemon/commands/dtmf.cc | 6 +++ daemon/commands/firewall-policy.cc | 10 ++++ daemon/commands/help.cc | 10 ++-- daemon/commands/ipv6.cc | 9 ++++ daemon/commands/media-encryption.cc | 9 ++++ daemon/commands/msfilter-add-fmtp.cc | 8 +++ daemon/commands/pop-event.cc | 3 ++ daemon/commands/port.cc | 23 ++++++++ daemon/commands/ptime.cc | 13 +++++ daemon/commands/register-status.cc | 13 +++++ daemon/commands/register.cc | 3 ++ daemon/commands/terminate.cc | 10 ++++ daemon/commands/unregister.cc | 7 +++ daemon/commands/version.cc | 3 ++ daemon/daemon.cc | 54 ++++++++++++++++++- daemon/daemon.h | 30 +++++++++-- 27 files changed, 407 insertions(+), 12 deletions(-) diff --git a/daemon/commands/adaptive-jitter-compensation.cc b/daemon/commands/adaptive-jitter-compensation.cc index f125c78ab..949aa792d 100644 --- a/daemon/commands/adaptive-jitter-compensation.cc +++ b/daemon/commands/adaptive-jitter-compensation.cc @@ -52,6 +52,19 @@ AdaptiveBufferCompensationCommand::AdaptiveBufferCompensationCommand() : "Enable or disable adaptive buffer compensation respectively with the 'enable' and 'disable' parameters for the specified stream, " "return the status of the use of adaptive buffer compensation without parameter.\n" " must be one of these values: audio, video.") { + addExample(new DaemonCommandExample("adaptive-jitter-compensation audio", + "Status: Ok\n\n" + "Audio: enabled")); + addExample(new DaemonCommandExample("adaptive-jitter-compensation video", + "Status: Ok\n\n" + "Video: disabled")); + addExample(new DaemonCommandExample("adaptive-jitter-compensation", + "Status: Ok\n\n" + "Audio: enabled\n" + "Video: disabled")); + addExample(new DaemonCommandExample("adaptive-jitter-compensation video enable", + "Status: Ok\n\n" + "Video: enabled")); } void AdaptiveBufferCompensationCommand::exec(Daemon *app, const char *args) { diff --git a/daemon/commands/answer.cc b/daemon/commands/answer.cc index 82e643034..943aa26fc 100644 --- a/daemon/commands/answer.cc +++ b/daemon/commands/answer.cc @@ -4,7 +4,21 @@ using namespace std; AnswerCommand::AnswerCommand() : DaemonCommand("answer", "answer ", "Answer an incoming call.") { + addExample(new DaemonCommandExample("answer 3", + "Status: Error\n" + "Reason: No call with such id.")); + addExample(new DaemonCommandExample("answer 2", + "Status: Error\n" + "Reason: Can't accept this call.")); + addExample(new DaemonCommandExample("answer 1", + "Status: Ok")); + addExample(new DaemonCommandExample("answer", + "Status: Ok")); + addExample(new DaemonCommandExample("answer", + "Status: Error\n" + "Reason: No call to accept.")); } + void AnswerCommand::exec(Daemon *app, const char *args) { LinphoneCore *lc = app->getCore(); int cid; diff --git a/daemon/commands/audio-codec-get.cc b/daemon/commands/audio-codec-get.cc index 60d1919d2..c8bdd861d 100644 --- a/daemon/commands/audio-codec-get.cc +++ b/daemon/commands/audio-codec-get.cc @@ -6,6 +6,31 @@ AudioCodecGetCommand::AudioCodecGetCommand() : DaemonCommand("audio-codec-get", "audio-codec-get ", "Get an audio codec if a parameter is given, otherwise return the audio codec list.\n" " is of the form mime/rate/channels, eg. speex/16000/1") { + addExample(new DaemonCommandExample("audio-codec-get 9", + "Status: Ok\n\n" + "Index: 9\n" + "Payload-type-number: 9\n" + "Clock-rate: 8000\n" + "Bitrate: 64000\n" + "Mime: G722\n" + "Channels: 1\n" + "Recv-fmtp: \n" + "Send-fmtp: \n" + "Enabled: false")); + addExample(new DaemonCommandExample("audio-codec-get G722/8000/1", + "Status: Ok\n\n" + "Index: 9\n" + "Payload-type-number: 9\n" + "Clock-rate: 8000\n" + "Bitrate: 64000\n" + "Mime: G722\n" + "Channels: 1\n" + "Recv-fmtp: \n" + "Send-fmtp: \n" + "Enabled: false")); + addExample(new DaemonCommandExample("audio-codec-get 2", + "Status: Error\n" + "Reason: Audio codec not found.")); } void AudioCodecGetCommand::exec(Daemon *app, const char *args) { diff --git a/daemon/commands/audio-codec-move.cc b/daemon/commands/audio-codec-move.cc index b5414ac63..b77912f32 100644 --- a/daemon/commands/audio-codec-move.cc +++ b/daemon/commands/audio-codec-move.cc @@ -6,6 +6,28 @@ AudioCodecMoveCommand::AudioCodecMoveCommand() : DaemonCommand("audio-codec-move", "audio-codec-move ", "Move a codec to the specified index.\n" " is of the form mime/rate/channels, eg. speex/16000/1") { + addExample(new DaemonCommandExample("audio-codec-move 9 1", + "Status: Ok\n\n" + "Index: 1\n" + "Payload-type-number: 9\n" + "Clock-rate: 8000\n" + "Bitrate: 64000\n" + "Mime: G722\n" + "Channels: 1\n" + "Recv-fmtp: \n" + "Send-fmtp: \n" + "Enabled: false")); + addExample(new DaemonCommandExample("audio-codec-move G722/8000/1 9", + "Status: Ok\n\n" + "Index: 9\n" + "Payload-type-number: 9\n" + "Clock-rate: 8000\n" + "Bitrate: 64000\n" + "Mime: G722\n" + "Channels: 1\n" + "Recv-fmtp: \n" + "Send-fmtp: \n" + "Enabled: false")); } void AudioCodecMoveCommand::exec(Daemon *app, const char *args) { diff --git a/daemon/commands/audio-codec-set.cc b/daemon/commands/audio-codec-set.cc index b06f49543..28d8005ad 100644 --- a/daemon/commands/audio-codec-set.cc +++ b/daemon/commands/audio-codec-set.cc @@ -10,6 +10,39 @@ AudioCodecSetCommand::AudioCodecSetCommand() : DaemonCommand("audio-codec-set", "audio-codec-set ", "Set a property (number, clock_rate, recv_fmtp, send_fmtp) of a codec. Numbering of payload type is automatically performed at startup, any change will be lost after restart.\n" " is of the form mime/rate/channels, eg. speex/16000/1") { + addExample(new DaemonCommandExample("audio-codec-set 9 number 18", + "Status: Ok\n\n" + "Index: 10\n" + "Payload-type-number: 18\n" + "Clock-rate: 8000\n" + "Bitrate: 64000\n" + "Mime: G722\n" + "Channels: 1\n" + "Recv-fmtp: \n" + "Send-fmtp: \n" + "Enabled: false")); + addExample(new DaemonCommandExample("audio-codec-set G722/8000/1 number 9", + "Status: Ok\n\n" + "Index: 10\n" + "Payload-type-number: 9\n" + "Clock-rate: 8000\n" + "Bitrate: 64000\n" + "Mime: G722\n" + "Channels: 1\n" + "Recv-fmtp: \n" + "Send-fmtp: \n" + "Enabled: false")); + addExample(new DaemonCommandExample("audio-codec-set 9 clock_rate 16000", + "Status: Ok\n\n" + "Index: 10\n" + "Payload-type-number: 9\n" + "Clock-rate: 16000\n" + "Bitrate: 64000\n" + "Mime: G722\n" + "Channels: 1\n" + "Recv-fmtp: \n" + "Send-fmtp: \n" + "Enabled: false")); } static PayloadType *findPayload(LinphoneCore *lc, int payload_type, int *index){ diff --git a/daemon/commands/audio-codec-toggle.cc b/daemon/commands/audio-codec-toggle.cc index e5076c2d0..8d651b03f 100644 --- a/daemon/commands/audio-codec-toggle.cc +++ b/daemon/commands/audio-codec-toggle.cc @@ -50,10 +50,54 @@ AudioCodecEnableCommand::AudioCodecEnableCommand() : AudioCodecToggleCommand("audio-codec-enable", "audio-codec-enable ", "Enable an audio codec.\n" " is of the form mime/rate/channels, eg. speex/16000/1", true) { + addExample(new DaemonCommandExample("audio-codec-enable G722/8000/1", + "Status: Ok\n\n" + "Index: 9\n" + "Payload-type-number: 9\n" + "Clock-rate: 8000\n" + "Bitrate: 64000\n" + "Mime: G722\n" + "Channels: 1\n" + "Recv-fmtp: \n" + "Send-fmtp: \n" + "Enabled: true")); + addExample(new DaemonCommandExample("audio-codec-enable 9", + "Status: Ok\n\n" + "Index: 9\n" + "Payload-type-number: 9\n" + "Clock-rate: 8000\n" + "Bitrate: 64000\n" + "Mime: G722\n" + "Channels: 1\n" + "Recv-fmtp: \n" + "Send-fmtp: \n" + "Enabled: true")); } AudioCodecDisableCommand::AudioCodecDisableCommand() : AudioCodecToggleCommand("audio-codec-disable", "audio-codec-disable ", "Disable an audio codec.\n" " is of the form mime/rate/channels, eg. speex/16000/1", false) { + addExample(new DaemonCommandExample("audio-codec-disable G722/8000/1", + "Status: Ok\n\n" + "Index: 9\n" + "Payload-type-number: 9\n" + "Clock-rate: 8000\n" + "Bitrate: 64000\n" + "Mime: G722\n" + "Channels: 1\n" + "Recv-fmtp: \n" + "Send-fmtp: \n" + "Enabled: false")); + addExample(new DaemonCommandExample("audio-codec-disable 9", + "Status: Ok\n\n" + "Index: 9\n" + "Payload-type-number: 9\n" + "Clock-rate: 8000\n" + "Bitrate: 64000\n" + "Mime: G722\n" + "Channels: 1\n" + "Recv-fmtp: \n" + "Send-fmtp: \n" + "Enabled: false")); } \ No newline at end of file diff --git a/daemon/commands/audio-stream-start.cc b/daemon/commands/audio-stream-start.cc index e853197b6..36304f5a7 100644 --- a/daemon/commands/audio-stream-start.cc +++ b/daemon/commands/audio-stream-start.cc @@ -4,6 +4,9 @@ using namespace std; AudioStreamStartCommand::AudioStreamStartCommand() : DaemonCommand("audio-stream-start", "audio-stream-start ", "Start an audio stream.") { + addExample(new DaemonCommandExample("audio-stream-start 192.168.1.28 7078 9", + "Status: Ok\n\n" + "Id: 1")); } void AudioStreamStartCommand::exec(Daemon *app, const char *args) { diff --git a/daemon/commands/audio-stream-stop.cc b/daemon/commands/audio-stream-stop.cc index 99c2653e5..e05fd79f4 100644 --- a/daemon/commands/audio-stream-stop.cc +++ b/daemon/commands/audio-stream-stop.cc @@ -4,7 +4,13 @@ using namespace std; AudioStreamStopCommand::AudioStreamStopCommand() : DaemonCommand("audio-stream-stop", "audio-stream-stop