1 /*
2  * Copyright (C) 2023 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 package android.health.connect.internal.datatypes;
17 
18 import android.annotation.NonNull;
19 import android.health.connect.datatypes.Identifier;
20 import android.health.connect.datatypes.RecordTypeIdentifier;
21 import android.health.connect.datatypes.WheelchairPushesRecord;
22 import android.os.Parcel;
23 
24 /**
25  * @see WheelchairPushesRecord
26  * @hide
27  */
28 @Identifier(recordIdentifier = RecordTypeIdentifier.RECORD_TYPE_WHEELCHAIR_PUSHES)
29 public final class WheelchairPushesRecordInternal
30         extends IntervalRecordInternal<WheelchairPushesRecord> {
31     private int mCount;
32 
getCount()33     public long getCount() {
34         return mCount;
35     }
36 
37     /** returns this object with the specified count */
38     @NonNull
setCount(int count)39     public WheelchairPushesRecordInternal setCount(int count) {
40         this.mCount = count;
41         return this;
42     }
43 
44     @NonNull
45     @Override
toExternalRecord()46     public WheelchairPushesRecord toExternalRecord() {
47         return new WheelchairPushesRecord.Builder(
48                         buildMetaData(), getStartTime(), getEndTime(), getCount())
49                 .setStartZoneOffset(getStartZoneOffset())
50                 .setEndZoneOffset(getEndZoneOffset())
51                 .buildWithoutValidation();
52     }
53 
54     @Override
populateIntervalRecordFrom(@onNull Parcel parcel)55     void populateIntervalRecordFrom(@NonNull Parcel parcel) {
56         mCount = parcel.readInt();
57     }
58 
59     @Override
populateIntervalRecordTo(@onNull Parcel parcel)60     void populateIntervalRecordTo(@NonNull Parcel parcel) {
61         parcel.writeInt(mCount);
62     }
63 }
64