| Phil Burk | 828bea5 | 2017-01-03 17:22:09 -0800 | [diff] [blame] | 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 |  | 
| Phil Burk | 5204d31 | 2017-05-04 17:16:13 -0700 | [diff] [blame] | 17 | #ifndef ANDROID_BINDING_AAUDIO_STREAM_REQUEST_H | 
 | 18 | #define ANDROID_BINDING_AAUDIO_STREAM_REQUEST_H | 
| Phil Burk | 828bea5 | 2017-01-03 17:22:09 -0800 | [diff] [blame] | 19 |  | 
 | 20 | #include <stdint.h> | 
 | 21 |  | 
| Phil Burk | a4eb0d8 | 2017-04-12 15:44:06 -0700 | [diff] [blame] | 22 | #include <aaudio/AAudio.h> | 
| Phil Burk | 828bea5 | 2017-01-03 17:22:09 -0800 | [diff] [blame] | 23 | #include <binder/Parcel.h> | 
 | 24 | #include <binder/Parcelable.h> | 
| Phil Burk | 828bea5 | 2017-01-03 17:22:09 -0800 | [diff] [blame] | 25 |  | 
| Phil Burk | 5ed503c | 2017-02-01 09:38:15 -0800 | [diff] [blame] | 26 | #include "binding/AAudioStreamConfiguration.h" | 
| Phil Burk | 828bea5 | 2017-01-03 17:22:09 -0800 | [diff] [blame] | 27 |  | 
 | 28 | using android::status_t; | 
 | 29 | using android::Parcel; | 
 | 30 | using android::Parcelable; | 
 | 31 |  | 
| Phil Burk | 5ed503c | 2017-02-01 09:38:15 -0800 | [diff] [blame] | 32 | namespace aaudio { | 
| Phil Burk | 828bea5 | 2017-01-03 17:22:09 -0800 | [diff] [blame] | 33 |  | 
| Phil Burk | 5ed503c | 2017-02-01 09:38:15 -0800 | [diff] [blame] | 34 | class AAudioStreamRequest : public Parcelable { | 
| Phil Burk | 828bea5 | 2017-01-03 17:22:09 -0800 | [diff] [blame] | 35 | public: | 
| Phil Burk | 5ed503c | 2017-02-01 09:38:15 -0800 | [diff] [blame] | 36 |     AAudioStreamRequest(); | 
 | 37 |     virtual ~AAudioStreamRequest(); | 
| Phil Burk | 828bea5 | 2017-01-03 17:22:09 -0800 | [diff] [blame] | 38 |  | 
 | 39 |     uid_t getUserId() const { | 
 | 40 |         return mUserId; | 
 | 41 |     } | 
 | 42 |  | 
 | 43 |     void setUserId(uid_t userId) { | 
 | 44 |         mUserId = userId; | 
 | 45 |     } | 
 | 46 |  | 
 | 47 |     pid_t getProcessId() const { | 
 | 48 |         return mProcessId; | 
 | 49 |     } | 
 | 50 |  | 
 | 51 |     void setProcessId(pid_t processId) { | 
 | 52 |         mProcessId = processId; | 
 | 53 |     } | 
 | 54 |  | 
| Phil Burk | 71f35bb | 2017-04-13 16:05:07 -0700 | [diff] [blame] | 55 |     bool isSharingModeMatchRequired() const { | 
 | 56 |         return mSharingModeMatchRequired; | 
 | 57 |     } | 
 | 58 |  | 
 | 59 |     void setSharingModeMatchRequired(bool required) { | 
 | 60 |         mSharingModeMatchRequired = required; | 
 | 61 |     } | 
 | 62 |  | 
| Phil Burk | c0c70e3 | 2017-02-09 13:18:38 -0800 | [diff] [blame] | 63 |     const AAudioStreamConfiguration &getConstantConfiguration() const { | 
 | 64 |         return mConfiguration; | 
 | 65 |     } | 
 | 66 |  | 
| Phil Burk | 5ed503c | 2017-02-01 09:38:15 -0800 | [diff] [blame] | 67 |     AAudioStreamConfiguration &getConfiguration() { | 
| Phil Burk | 828bea5 | 2017-01-03 17:22:09 -0800 | [diff] [blame] | 68 |         return mConfiguration; | 
 | 69 |     } | 
 | 70 |  | 
| Eric Laurent | a54f128 | 2017-07-01 19:39:32 -0700 | [diff] [blame] | 71 |     bool isInService() const { | 
 | 72 |         return mInService; | 
 | 73 |     } | 
 | 74 |  | 
 | 75 |     void setInService(bool inService) { | 
 | 76 |         mInService = inService; | 
 | 77 |     } | 
 | 78 |  | 
| Phil Burk | 828bea5 | 2017-01-03 17:22:09 -0800 | [diff] [blame] | 79 |     virtual status_t writeToParcel(Parcel* parcel) const override; | 
 | 80 |  | 
 | 81 |     virtual status_t readFromParcel(const Parcel* parcel) override; | 
 | 82 |  | 
| Phil Burk | c0c70e3 | 2017-02-09 13:18:38 -0800 | [diff] [blame] | 83 |     aaudio_result_t validate() const; | 
| Phil Burk | 828bea5 | 2017-01-03 17:22:09 -0800 | [diff] [blame] | 84 |  | 
| Phil Burk | c0c70e3 | 2017-02-09 13:18:38 -0800 | [diff] [blame] | 85 |     void dump() const; | 
| Phil Burk | 828bea5 | 2017-01-03 17:22:09 -0800 | [diff] [blame] | 86 |  | 
 | 87 | protected: | 
| Phil Burk | 5ed503c | 2017-02-01 09:38:15 -0800 | [diff] [blame] | 88 |     AAudioStreamConfiguration  mConfiguration; | 
| Phil Burk | 15f7cab | 2017-08-04 09:13:31 -0700 | [diff] [blame] | 89 |     uid_t                      mUserId = (uid_t) -1; | 
 | 90 |     pid_t                      mProcessId = (pid_t) -1; | 
| Phil Burk | 71f35bb | 2017-04-13 16:05:07 -0700 | [diff] [blame] | 91 |     bool                       mSharingModeMatchRequired = false; | 
| Eric Laurent | a54f128 | 2017-07-01 19:39:32 -0700 | [diff] [blame] | 92 |     bool                       mInService = false; // Stream opened by AAudioservice | 
| Phil Burk | 828bea5 | 2017-01-03 17:22:09 -0800 | [diff] [blame] | 93 | }; | 
 | 94 |  | 
| Phil Burk | 5ed503c | 2017-02-01 09:38:15 -0800 | [diff] [blame] | 95 | } /* namespace aaudio */ | 
| Phil Burk | 828bea5 | 2017-01-03 17:22:09 -0800 | [diff] [blame] | 96 |  | 
| Phil Burk | 5204d31 | 2017-05-04 17:16:13 -0700 | [diff] [blame] | 97 | #endif //ANDROID_BINDING_AAUDIO_STREAM_REQUEST_H |