@@ -265,4 +265,68 @@ void CISCO_MuteCommand::ExecutePost(Response * const response)
265265 response->SetError (error);
266266}
267267
268+ CISCO_PlaybackSpeedCommand::CISCO_PlaybackSpeedCommand (
269+ const std::vector<std::string> &path_segments,
270+ const base::DictionaryValue *parameters)
271+ : ElementCommand(path_segments, parameters)
272+ {
273+ }
274+
275+ CISCO_PlaybackSpeedCommand::~CISCO_PlaybackSpeedCommand ()
276+ {
277+ }
278+
279+ bool CISCO_PlaybackSpeedCommand::DoesGet () const
280+ {
281+ return true ;
282+ }
283+
284+ bool CISCO_PlaybackSpeedCommand::DoesPost () const
285+ {
286+ return true ;
287+ }
288+
289+ void CISCO_PlaybackSpeedCommand::ExecuteGet (Response * const response)
290+ {
291+ double speed;
292+ Error* error = NULL ;
293+
294+ session_->RunSessionTask (base::Bind (
295+ &ViewCmdExecutor::GetPlaybackSpeed,
296+ base::Unretained (executor_.get ()),
297+ element,
298+ &speed,
299+ &error));
300+
301+ if (error) {
302+ response->SetError (error);
303+ return ;
304+ }
305+
306+ Value* value = Value::CreateBooleanValue (speed);
307+ response->SetValue (value);
308+ }
309+
310+ void CISCO_PlaybackSpeedCommand::ExecutePost (Response * const response)
311+ {
312+ double speed;
313+ if (!GetDoubleParameter (" speed" , &speed)) {
314+ response->SetError (new Error (
315+ kBadRequest , " 'speed' is missing or invalid" ));
316+ return ;
317+ }
318+
319+ Error* error = NULL ;
320+
321+ session_->RunSessionTask (base::Bind (
322+ &ViewCmdExecutor::SetPlaybackSpeed,
323+ base::Unretained (executor_.get ()),
324+ element,
325+ speed,
326+ &error));
327+
328+ if (error)
329+ response->SetError (error);
330+ }
331+
268332}
0 commit comments