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 <binder/Parcel.h> 24#include <binder/Parcelable.h> 25 26#include "binding/AAudioStreamConfiguration.h" 27 28using android::status_t; 29using android::Parcel; 30using android::Parcelable; 31 32namespace aaudio { 33 34class AAudioStreamRequest : public Parcelable { 35public: 36 AAudioStreamRequest(); 37 virtual ~AAudioStreamRequest(); 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 55 aaudio_direction_t getDirection() const { 56 return mDirection; 57 } 58 59 void setDirection(aaudio_direction_t direction) { 60 mDirection = direction; 61 } 62 63 bool isSharingModeMatchRequired() const { 64 return mSharingModeMatchRequired; 65 } 66 67 void setSharingModeMatchRequired(bool required) { 68 mSharingModeMatchRequired = required; 69 } 70 71 72 const AAudioStreamConfiguration &getConstantConfiguration() const { 73 return mConfiguration; 74 } 75 76 AAudioStreamConfiguration &getConfiguration() { 77 return mConfiguration; 78 } 79 80 virtual status_t writeToParcel(Parcel* parcel) const override; 81 82 virtual status_t readFromParcel(const Parcel* parcel) override; 83 84 aaudio_result_t validate() const; 85 86 void dump() const; 87 88protected: 89 AAudioStreamConfiguration mConfiguration; 90 uid_t mUserId; 91 pid_t mProcessId; 92 aaudio_direction_t mDirection; 93 bool mSharingModeMatchRequired = false; 94}; 95 96} /* namespace aaudio */ 97 98#endif //ANDROID_BINDING_AAUDIO_STREAM_REQUEST_H 99