Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(114)

Unified Diff: extensions/browser/api/webcam_private/visca_webcam.h

Issue 1144423004: Add support for PTZ via VISCA. Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Minor cleanup. Created 5 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | extensions/browser/api/webcam_private/visca_webcam.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: extensions/browser/api/webcam_private/visca_webcam.h
diff --git a/extensions/browser/api/webcam_private/visca_webcam.h b/extensions/browser/api/webcam_private/visca_webcam.h
new file mode 100644
index 0000000000000000000000000000000000000000..280610e28d538f167c75383bb10d255bf6c99740
--- /dev/null
+++ b/extensions/browser/api/webcam_private/visca_webcam.h
@@ -0,0 +1,69 @@
+// Copyright 2015 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#ifndef EXTENSIONS_BROWSER_API_WEBCAM_PRIVATE_VISCA_WEBCAM_H_
+#define EXTENSIONS_BROWSER_API_WEBCAM_PRIVATE_VISCA_WEBCAM_H_
+
+#include <deque>
+
+#include "base/callback.h"
+#include "base/memory/weak_ptr.h"
+#include "extensions/browser/api/webcam_private/webcam.h"
+#include "extensions/common/api/serial.h"
+
+namespace extensions {
+
+class SerialConnection;
+
+class ViscaWebcam : public Webcam, public base::SupportsWeakPtr<ViscaWebcam> {
+ public:
+ ViscaWebcam(const std::string& path, const std::string& extension_id);
+ ~ViscaWebcam() override;
+
+ typedef base::Callback<void(bool)> OpenCallback;
+ void Open(const OpenCallback& callback);
+
+ private:
+ typedef base::Callback<void(bool, const std::vector<char>&)>
+ CommandCompleteCallback;
+
+ void OpenOnIOThread(const OpenCallback& callback);
+ void OnConnected(const OpenCallback& callback, bool success);
+ void OnClearAllComplete(const OpenCallback& callback,
+ bool success, const std::vector<char>& data);
+
+ void Send(const std::vector<char>& data,
+ const CommandCompleteCallback& callback);
+ void OnSendComplete(const CommandCompleteCallback& callback,
+ int bytes_sent, core_api::serial::SendError error);
+ void ReceiveLoop();
+ void OnReceiveComplete(const std::vector<char>& data,
+ core_api::serial::ReceiveError error);
+
+ // Webcam:
+ void Reset(bool pan, bool tilt, bool zoom) override;
+ bool GetPan(int* value) override;
+ bool GetTilt(int* value) override;
+ bool GetZoom(int* value) override;
+ bool SetPan(int value) override;
+ bool SetTilt(int value) override;
+ bool SetZoom(int value) override;
+ bool SetPanDirection(PanDirection direction) override;
+ bool SetTiltDirection(TiltDirection direction) override;
+
+ const std::string path_;
+ const std::string extension_id_;
+
+ scoped_ptr<SerialConnection> serial_connection_;
+
+ std::deque<char> data_buffer_;
+ std::deque<std::pair<std::vector<char>, CommandCompleteCallback>> commands_;
+
+ DISALLOW_COPY_AND_ASSIGN(ViscaWebcam);
+};
+
+
+} // namespace extensions
+
+#endif // EXTENSIONS_BROWSER_API_WEBCAM_PRIVATE_VISCA_WEBCAM_H_
« no previous file with comments | « no previous file | extensions/browser/api/webcam_private/visca_webcam.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698