Index: components/audio_modem/public/whispernet_client.h |
diff --git a/components/copresence/public/whispernet_client.h b/components/audio_modem/public/whispernet_client.h |
similarity index 58% |
rename from components/copresence/public/whispernet_client.h |
rename to components/audio_modem/public/whispernet_client.h |
index e8a1cd30aff1350e13897e0997c913afc549af98..c7219c8ff2d263a8822de593d77f12aacad6cbf1 100644 |
--- a/components/copresence/public/whispernet_client.h |
+++ b/components/audio_modem/public/whispernet_client.h |
@@ -2,30 +2,36 @@ |
// Use of this source code is governed by a BSD-style license that can be |
// found in the LICENSE file. |
-#ifndef COMPONENTS_COPRESENCE_PUBLIC_WHISPERNET_CLIENT_H_ |
-#define COMPONENTS_COPRESENCE_PUBLIC_WHISPERNET_CLIENT_H_ |
+#ifndef COMPONENTS_AUDIO_MODEM_PUBLIC_WHISPERNET_CLIENT_H_ |
+#define COMPONENTS_AUDIO_MODEM_PUBLIC_WHISPERNET_CLIENT_H_ |
#include <string> |
-#include "components/copresence/public/copresence_constants.h" |
+#include "base/memory/ref_counted.h" |
+#include "components/audio_modem/public/audio_modem_types.h" |
+#include "media/base/audio_bus.h" |
-namespace media { |
-class AudioBusRefCounted; |
-} |
+namespace audio_modem { |
-namespace copresence { |
+// Generic callback to indicate a boolean success or failure. |
+using SuccessCallback = base::Callback<void(bool)>; |
-// The interface that the whispernet client needs to implement. These methods |
-// provide us the ability to use the audio medium in copresence. Currently since |
-// the only medium that copresence uses is audio, the implementation of this |
-// interface is required. |
+// Callback to receive encoded samples from Whispernet. |
+// AudioType type: Type of audio encoding - AUDIBLE or INAUDIBLE. |
+// const std::string& token: The token that we encoded. |
+// const scoped_refptr<media::AudioBusRefCounted>& samples - Encoded samples. |
+using SamplesCallback = |
+ base::Callback<void(AudioType, |
+ const std::string&, |
+ const scoped_refptr<media::AudioBusRefCounted>&)>; |
+ |
+// A client for the Whispernet audio library, |
+// responsible for the actual encoding and decoding of tokens. |
class WhispernetClient { |
public: |
// Initialize the whispernet client and call the callback when done. The |
// parameter indicates whether we succeeded or failed. |
virtual void Initialize(const SuccessCallback& init_callback) = 0; |
- // Copresence will call this before making any calls to its destructors. |
- virtual void Shutdown() = 0; |
// Fires an event to request a token encode. |
virtual void EncodeToken(const std::string& token, AudioType type) = 0; |
@@ -36,8 +42,7 @@ class WhispernetClient { |
// Fires an event to request detection of a whispernet broadcast. |
virtual void DetectBroadcast() = 0; |
- // Callback registreation methods. These are the callbacks that will be |
- // registered by Copresence to receive data. |
+ // Callback registration methods. The modem will set these to receive data. |
virtual void RegisterTokensCallback( |
const TokensCallback& tokens_callback) = 0; |
virtual void RegisterSamplesCallback( |
@@ -55,6 +60,6 @@ class WhispernetClient { |
virtual ~WhispernetClient() {} |
}; |
-} // namespace copresence |
+} // namespace audio_modem |
-#endif // COMPONENTS_COPRESENCE_PUBLIC_WHISPERNET_CLIENT_H_ |
+#endif // COMPONENTS_AUDIO_MODEM_PUBLIC_WHISPERNET_CLIENT_H_ |