2 * Copyright (C) 2014 The Android Open Source Project
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
8 * http://www.apache.org/licenses/LICENSE-2.0
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.
17 #define LOG_TAG "Camera-CaptureResult"
18 #include <utils/Log.h>
20 #include <camera/CaptureResult.h>
21 #include <binder/Parcel.h>
25 bool CaptureResultExtras::isValid() {
26 return requestId >= 0;
29 status_t CaptureResultExtras::readFromParcel(Parcel *parcel) {
31 ALOGE("%s: Null parcel", __FUNCTION__);
35 parcel->readInt32(&requestId);
36 parcel->readInt32(&burstId);
37 parcel->readInt32(&afTriggerId);
38 parcel->readInt32(&precaptureTriggerId);
39 parcel->readInt64(&frameNumber);
40 parcel->readInt32(&partialResultCount);
45 status_t CaptureResultExtras::writeToParcel(Parcel *parcel) const {
47 ALOGE("%s: Null parcel", __FUNCTION__);
51 parcel->writeInt32(requestId);
52 parcel->writeInt32(burstId);
53 parcel->writeInt32(afTriggerId);
54 parcel->writeInt32(precaptureTriggerId);
55 parcel->writeInt64(frameNumber);
56 parcel->writeInt32(partialResultCount);
61 CaptureResult::CaptureResult() :
62 mMetadata(), mResultExtras() {
65 CaptureResult::CaptureResult(const CaptureResult &otherResult) {
66 mResultExtras = otherResult.mResultExtras;
67 mMetadata = otherResult.mMetadata;
70 status_t CaptureResult::readFromParcel(Parcel *parcel) {
72 ALOGV("%s: parcel = %p", __FUNCTION__, parcel);
75 ALOGE("%s: parcel is null", __FUNCTION__);
82 res = mMetadata.readFromParcel(parcel);
84 ALOGE("%s: Failed to read metadata from parcel.",
88 ALOGV("%s: Read metadata from parcel", __FUNCTION__);
90 res = mResultExtras.readFromParcel(parcel);
92 ALOGE("%s: Failed to read result extras from parcel.",
96 ALOGV("%s: Read result extras from parcel", __FUNCTION__);
101 status_t CaptureResult::writeToParcel(Parcel *parcel) const {
103 ALOGV("%s: parcel = %p", __FUNCTION__, parcel);
105 if (parcel == NULL) {
106 ALOGE("%s: parcel is null", __FUNCTION__);
112 res = mMetadata.writeToParcel(parcel);
114 ALOGE("%s: Failed to write metadata to parcel", __FUNCTION__);
117 ALOGV("%s: Wrote metadata to parcel", __FUNCTION__);
119 res = mResultExtras.writeToParcel(parcel);
121 ALOGE("%s: Failed to write result extras to parcel", __FUNCTION__);
124 ALOGV("%s: Wrote result extras to parcel", __FUNCTION__);