blob: b0fa96a8ada85494dd6548e3b2157506a6944958 [file] [log] [blame]
Phil Burk828bea52017-01-03 17:22:09 -08001/*
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 Burk5204d312017-05-04 17:16:13 -070017#ifndef ANDROID_BINDING_AAUDIO_STREAM_REQUEST_H
18#define ANDROID_BINDING_AAUDIO_STREAM_REQUEST_H
Phil Burk828bea52017-01-03 17:22:09 -080019
20#include <stdint.h>
21
Phil Burka4eb0d82017-04-12 15:44:06 -070022#include <aaudio/AAudio.h>
Phil Burk828bea52017-01-03 17:22:09 -080023#include <binder/Parcel.h>
24#include <binder/Parcelable.h>
Phil Burk828bea52017-01-03 17:22:09 -080025
Phil Burk5ed503c2017-02-01 09:38:15 -080026#include "binding/AAudioStreamConfiguration.h"
Phil Burk828bea52017-01-03 17:22:09 -080027
28using android::status_t;
29using android::Parcel;
30using android::Parcelable;
31
Phil Burk5ed503c2017-02-01 09:38:15 -080032namespace aaudio {
Phil Burk828bea52017-01-03 17:22:09 -080033
Phil Burk5ed503c2017-02-01 09:38:15 -080034class AAudioStreamRequest : public Parcelable {
Phil Burk828bea52017-01-03 17:22:09 -080035public:
Phil Burk5ed503c2017-02-01 09:38:15 -080036 AAudioStreamRequest();
37 virtual ~AAudioStreamRequest();
Phil Burk828bea52017-01-03 17:22:09 -080038
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 Burkc0c70e32017-02-09 13:18:38 -080055 aaudio_direction_t getDirection() const {
56 return mDirection;
57 }
58
59 void setDirection(aaudio_direction_t direction) {
60 mDirection = direction;
61 }
62
Phil Burk71f35bb2017-04-13 16:05:07 -070063 bool isSharingModeMatchRequired() const {
64 return mSharingModeMatchRequired;
65 }
66
67 void setSharingModeMatchRequired(bool required) {
68 mSharingModeMatchRequired = required;
69 }
70
Phil Burkc0c70e32017-02-09 13:18:38 -080071 const AAudioStreamConfiguration &getConstantConfiguration() const {
72 return mConfiguration;
73 }
74
Phil Burk5ed503c2017-02-01 09:38:15 -080075 AAudioStreamConfiguration &getConfiguration() {
Phil Burk828bea52017-01-03 17:22:09 -080076 return mConfiguration;
77 }
78
Eric Laurenta54f1282017-07-01 19:39:32 -070079 bool isInService() const {
80 return mInService;
81 }
82
83 void setInService(bool inService) {
84 mInService = inService;
85 }
86
Phil Burk828bea52017-01-03 17:22:09 -080087 virtual status_t writeToParcel(Parcel* parcel) const override;
88
89 virtual status_t readFromParcel(const Parcel* parcel) override;
90
Phil Burkc0c70e32017-02-09 13:18:38 -080091 aaudio_result_t validate() const;
Phil Burk828bea52017-01-03 17:22:09 -080092
Phil Burkc0c70e32017-02-09 13:18:38 -080093 void dump() const;
Phil Burk828bea52017-01-03 17:22:09 -080094
95protected:
Phil Burk5ed503c2017-02-01 09:38:15 -080096 AAudioStreamConfiguration mConfiguration;
Phil Burkc0c70e32017-02-09 13:18:38 -080097 uid_t mUserId;
98 pid_t mProcessId;
99 aaudio_direction_t mDirection;
Phil Burk71f35bb2017-04-13 16:05:07 -0700100 bool mSharingModeMatchRequired = false;
Eric Laurenta54f1282017-07-01 19:39:32 -0700101 bool mInService = false; // Stream opened by AAudioservice
Phil Burk828bea52017-01-03 17:22:09 -0800102};
103
Phil Burk5ed503c2017-02-01 09:38:15 -0800104} /* namespace aaudio */
Phil Burk828bea52017-01-03 17:22:09 -0800105
Phil Burk5204d312017-05-04 17:16:13 -0700106#endif //ANDROID_BINDING_AAUDIO_STREAM_REQUEST_H