1/*
2 * Copyright (C) 2014 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
17package com.android.location.provider;
18
19/**
20 * A class that represents an Activity Recognition Event.
21 * @hide
22 */
23public class ActivityRecognitionEvent {
24    private final String mActivity;
25    private final int mEventType;
26    private final long mTimestampNs;
27
28    public ActivityRecognitionEvent(String activity, int eventType, long timestampNs) {
29        mActivity = activity;
30        mEventType = eventType;
31        mTimestampNs = timestampNs;
32    }
33
34    public String getActivity() {
35        return mActivity;
36    }
37
38    public int getEventType() {
39        return mEventType;
40    }
41
42    public long getTimestampNs() {
43        return mTimestampNs;
44    }
45
46    @Override
47    public String toString() {
48        String eventString;
49        switch (mEventType) {
50            case ActivityRecognitionProvider.EVENT_TYPE_ENTER:
51                eventString = "Enter";
52                break;
53            case ActivityRecognitionProvider.EVENT_TYPE_EXIT:
54                eventString = "Exit";
55                break;
56            case ActivityRecognitionProvider.EVENT_TYPE_FLUSH_COMPLETE:
57                eventString = "FlushComplete";
58                break;
59            default:
60                eventString = "<Invalid>";
61                break;
62        }
63
64        return String.format(
65                "Activity='%s', EventType=%s(%s), TimestampNs=%s",
66                mActivity,
67                eventString,
68                mEventType,
69                mTimestampNs);
70    }
71}
72