• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*
2  * Copyright 2016 The Android Open Source Project
3  *
4  * Licensed under the Apache License, Version 2.0 (the "License");
5  * you may not use this file except in compliance with the License.
6  * You may obtain a copy of the License at
7  *
8  *      http://www.apache.org/licenses/LICENSE-2.0
9  *
10  * Unless required by applicable law or agreed to in writing, software
11  * distributed under the License is distributed on an "AS IS" BASIS,
12  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13  * See the License for the specific language governing permissions and
14  * limitations under the License.
15  */
16 
17 #ifndef ANDROID_BINDING_AAUDIO_STREAM_REQUEST_H
18 #define ANDROID_BINDING_AAUDIO_STREAM_REQUEST_H
19 
20 #include <stdint.h>
21 
22 #include <aaudio/AAudio.h>
23 #include <aaudio/StreamRequest.h>
24 
25 #include "binding/AAudioStreamConfiguration.h"
26 #include <android/content/AttributionSourceState.h>
27 
28 namespace aaudio {
29 
30 using android::content::AttributionSourceState;
31 
32 class AAudioStreamRequest {
33 public:
34     AAudioStreamRequest() = default;
35 
36     // Construct based on a parcelable representation.
37     explicit AAudioStreamRequest(const StreamRequest& parcelable);
38 
getAttributionSource()39     const AttributionSourceState &getAttributionSource() const {
40         return mAttributionSource;
41     }
42 
setAttributionSource(const AttributionSourceState & attributionSource)43     void setAttributionSource(const AttributionSourceState &attributionSource) {
44         mAttributionSource = attributionSource;
45     }
46 
isSharingModeMatchRequired()47     bool isSharingModeMatchRequired() const {
48         return mSharingModeMatchRequired;
49     }
50 
setSharingModeMatchRequired(bool required)51     void setSharingModeMatchRequired(bool required) {
52         mSharingModeMatchRequired = required;
53     }
54 
getConstantConfiguration()55     const AAudioStreamConfiguration &getConstantConfiguration() const {
56         return mConfiguration;
57     }
58 
getConfiguration()59     AAudioStreamConfiguration &getConfiguration() {
60         return mConfiguration;
61     }
62 
isInService()63     bool isInService() const {
64         return mInService;
65     }
66 
setInService(bool inService)67     void setInService(bool inService) {
68         mInService = inService;
69     }
70 
71     aaudio_result_t validate() const;
72 
73     void dump() const;
74 
75     // Extract a parcelable representation of this object.
76     StreamRequest parcelable() const;
77 
78 private:
79     AAudioStreamConfiguration  mConfiguration;
80     AttributionSourceState mAttributionSource;
81     bool                       mSharingModeMatchRequired = false;
82     bool                       mInService = false; // Stream opened by AAudioservice
83 };
84 
85 } /* namespace aaudio */
86 
87 #endif //ANDROID_BINDING_AAUDIO_STREAM_REQUEST_H
88