AAudioStreamRequest.cpp revision f53e613b3dedab3ecada2c93d8846233c442d129
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#include <stdint.h> 18 19#include <sys/mman.h> 20#include <binder/Parcel.h> 21#include <binder/Parcelable.h> 22 23#include <aaudio/AAudioDefinitions.h> 24 25#include "binding/AAudioStreamConfiguration.h" 26#include "binding/AAudioStreamRequest.h" 27 28using android::NO_ERROR; 29using android::status_t; 30using android::Parcel; 31using android::Parcelable; 32 33using namespace aaudio; 34 35AAudioStreamRequest::AAudioStreamRequest() 36 : mConfiguration() 37 {} 38 39AAudioStreamRequest::~AAudioStreamRequest() {} 40 41status_t AAudioStreamRequest::writeToParcel(Parcel* parcel) const { 42 parcel->writeInt32((int32_t) mUserId); 43 parcel->writeInt32((int32_t) mProcessId); 44 mConfiguration.writeToParcel(parcel); 45 return NO_ERROR; // TODO check for errors above 46} 47 48status_t AAudioStreamRequest::readFromParcel(const Parcel* parcel) { 49 int32_t temp; 50 parcel->readInt32(&temp); 51 mUserId = (uid_t) temp; 52 parcel->readInt32(&temp); 53 mProcessId = (pid_t) temp; 54 mConfiguration.readFromParcel(parcel); 55 return NO_ERROR; // TODO check for errors above 56} 57 58aaudio_result_t AAudioStreamRequest::validate() { 59 return mConfiguration.validate(); 60} 61 62void AAudioStreamRequest::dump() { 63 ALOGD("AAudioStreamRequest mUserId = %d -----", mUserId); 64 ALOGD("AAudioStreamRequest mProcessId = %d", mProcessId); 65 mConfiguration.dump(); 66} 67