OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #ifndef COMPONENTS_COPRESENCE_PUBLIC_WHISPERNET_CLIENT_H_ | 5 #ifndef COMPONENTS_COPRESENCE_PUBLIC_WHISPERNET_CLIENT_H_ |
6 #define COMPONENTS_COPRESENCE_PUBLIC_WHISPERNET_CLIENT_H_ | 6 #define COMPONENTS_COPRESENCE_PUBLIC_WHISPERNET_CLIENT_H_ |
7 | 7 |
8 #include <string> | 8 #include <string> |
9 #include <vector> | 9 #include <vector> |
10 | 10 |
(...skipping 22 matching lines...) Expand all Loading... |
33 void(const std::string&, const scoped_refptr<media::AudioBusRefCounted>&)> | 33 void(const std::string&, const scoped_refptr<media::AudioBusRefCounted>&)> |
34 SamplesCallback; | 34 SamplesCallback; |
35 | 35 |
36 // Initialize the whispernet client and call the callback when done. The | 36 // Initialize the whispernet client and call the callback when done. The |
37 // parameter indicates whether we succeeded or failed. | 37 // parameter indicates whether we succeeded or failed. |
38 virtual void Initialize(const SuccessCallback& init_callback) = 0; | 38 virtual void Initialize(const SuccessCallback& init_callback) = 0; |
39 // Copresence will call this before making any calls to its destructors. | 39 // Copresence will call this before making any calls to its destructors. |
40 virtual void Shutdown() = 0; | 40 virtual void Shutdown() = 0; |
41 | 41 |
42 // Fires an event to request a token encode. | 42 // Fires an event to request a token encode. |
43 virtual void EncodeToken(const std::string& token) = 0; | 43 virtual void EncodeToken(const std::string& token, bool audible) = 0; |
44 // Fires an event to request a decode for the given samples. | 44 // Fires an event to request a decode for the given samples. |
45 virtual void DecodeSamples(const std::string& samples) = 0; | 45 virtual void DecodeSamples(const std::string& samples) = 0; |
46 // Fires an event to request detection of a whispernet broadcast. | 46 // Fires an event to request detection of a whispernet broadcast. |
47 virtual void DetectBroadcast() = 0; | 47 virtual void DetectBroadcast() = 0; |
48 | 48 |
49 // Callback registreation methods. These are the callbacks that will be | 49 // Callback registreation methods. These are the callbacks that will be |
50 // registered by Copresence to receive data. | 50 // registered by Copresence to receive data. |
51 virtual void RegisterTokensCallback( | 51 virtual void RegisterTokensCallback( |
52 const TokensCallback& tokens_callback) = 0; | 52 const TokensCallback& tokens_callback) = 0; |
53 virtual void RegisterSamplesCallback( | 53 virtual void RegisterSamplesCallback( |
54 const SamplesCallback& samples_callback) = 0; | 54 const SamplesCallback& samples_callback) = 0; |
55 virtual void RegisterDetectBroadcastCallback( | 55 virtual void RegisterDetectBroadcastCallback( |
56 const SuccessCallback& db_callback) = 0; | 56 const SuccessCallback& db_callback) = 0; |
57 | 57 |
58 // Don't cache these callbacks, as they may become invalid at any time. | 58 // Don't cache these callbacks, as they may become invalid at any time. |
59 // Always invoke callbacks directly through these accessors. | 59 // Always invoke callbacks directly through these accessors. |
60 virtual TokensCallback GetTokensCallback() = 0; | 60 virtual TokensCallback GetTokensCallback() = 0; |
61 virtual SamplesCallback GetSamplesCallback() = 0; | 61 virtual SamplesCallback GetSamplesCallback() = 0; |
62 virtual SuccessCallback GetDetectBroadcastCallback() = 0; | 62 virtual SuccessCallback GetDetectBroadcastCallback() = 0; |
63 virtual SuccessCallback GetInitializedCallback() = 0; | 63 virtual SuccessCallback GetInitializedCallback() = 0; |
64 | 64 |
65 virtual ~WhispernetClient() {}; | 65 virtual ~WhispernetClient() {}; |
66 }; | 66 }; |
67 | 67 |
68 } // namespace copresence | 68 } // namespace copresence |
69 | 69 |
70 #endif // COMPONENTS_COPRESENCE_PUBLIC_WHISPERNET_CLIENT_H_ | 70 #endif // COMPONENTS_COPRESENCE_PUBLIC_WHISPERNET_CLIENT_H_ |
OLD | NEW |