blob: 5d521d037dd6c3327d36b20c40250f6edf321f11 [file] [log] [blame]
Phil Burk204a1632017-01-03 17:23:43 -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
17#include <stdint.h>
18
19#include <sys/mman.h>
20#include <binder/Parcel.h>
21#include <binder/Parcelable.h>
22
23#include <oboe/OboeDefinitions.h>
24
25#include "binding/OboeStreamConfiguration.h"
26#include "binding/OboeStreamRequest.h"
27
28using android::NO_ERROR;
29using android::status_t;
30using android::Parcel;
31using android::Parcelable;
32
33using namespace oboe;
34
35OboeStreamRequest::OboeStreamRequest()
36 : mConfiguration()
37 {}
38
39OboeStreamRequest::~OboeStreamRequest() {}
40
41status_t OboeStreamRequest::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 OboeStreamRequest::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
58oboe_result_t OboeStreamRequest::validate() {
59 return mConfiguration.validate();
60}
61
62void OboeStreamRequest::dump() {
63 ALOGD("OboeStreamRequest mUserId = %d -----", mUserId);
64 ALOGD("OboeStreamRequest mProcessId = %d", mProcessId);
65 mConfiguration.dump();
66}