blob: 79fc3a40e217ea57fcf4d98be425f687f912cad1 [file] [log] [blame]
Sanket Agarwal8f1f27c2016-01-22 17:34:24 -08001/*
2 * Copyright (C) 2015 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.google.android.auto.mapservice;
18
19import android.os.Parcel;
20import android.os.Parcelable;
21
22/** Class representing various events that can be triggered for SMS/MMS on the phone. */
23public final class BluetoothMapEventReport implements Parcelable {
24 // List of all codes. To ensure there is no name space collision they are all listed here but
25 // segmented by their types.
26
27 /** Status that command executed successfully. */
28 public static final int STATUS_OK = 0;
29 /** Status that command executed but failed. */
30 public static final int STATUS_FAILED = 1;
31
32 /** Type of events. To avoid name space clash they are listed together */
33
34 /** A new message has been received. */
35 public static final int TYPE_NEW_MESSAGE = 1;
36
37 /**
38 * A message send goes through (not all compulsary) following phases:
39 * a) The message is first pushed to remote device.
40 * b) The message is then sent out by the remote device to SMSC server.
41 * c) Depending on the configuration between remote device and SMSC
42 * server there can be a delivery notification.
43 */
44 public static final int TYPE_DELIVERY_SUCCESS = 1;
45 public static final int TYPE_SENDING_SUCCESS = 2;
46 public static final int TYPE_DELIVERY_FAILURE = 3;
47 public static final int TYPE_SENDING_FAILURE = 4;
48
49 /** Message has been deleted */
50 public static final int TYPE_MESSAGE_DELETED = 5;
51 /** Message shifted from one folder to another */
52 public static final int TYPE_MESSAGE_SHIFT = 6;
53
54 // Contains the handle of message in context.
55 private String mHandle;
56
57 // Folder in which the message is currently stored.
58 private String mFolder;
59
60 // Folder in which the message was stored previously.
61 private String mOldFolder;
62
63 // Return code for the event.
64 private int mReturnCode;
65
66 // Type of message.
67 private int mType;
68
69 public static final Parcelable.Creator<BluetoothMapEventReport> CREATOR =
70 new Parcelable.Creator<BluetoothMapEventReport>() {
71
72 public BluetoothMapEventReport createFromParcel(Parcel in) {
73 return new BluetoothMapEventReport(in);
74 }
75
76 public BluetoothMapEventReport[] newArray(int size) {
77 return new BluetoothMapEventReport[size];
78 }
79 };
80
81 public BluetoothMapEventReport() {
82 }
83
84 private BluetoothMapEventReport(Parcel in) {
85 readFromParcel(in);
86 }
87
88 public int describeContents() {
89 return 0;
90 }
91
92 public void writeToParcel(Parcel out, int flags) {
93 out.writeString(mHandle);
94 out.writeString(mFolder);
95 out.writeString(mOldFolder);
96 out.writeInt(mType);
97 }
98
99 public void readFromParcel(Parcel in) {
100 mHandle = in.readString();
101 mFolder = in.readString();
102 mOldFolder = in.readString();
103 mType = in.readInt();
104 }
105
106 public void setType(int type) {
107 mType = type;
108 }
109
110 public int getType() {
111 return mType;
112 }
113
114 public void setReturnCode(int retCode) {
115 mReturnCode = retCode;
116 }
117
118 public int getReturnCode() {
119 return mReturnCode;
120 }
121
122 public void setHandle(String handle) {
123 mHandle = handle;
124 }
125
126 public String getHandle() {
127 return mHandle;
128 }
129
130 public String getFolder() {
131 return mFolder;
132 }
133
134 public void setFolder(String folder) {
135 mFolder = folder;
136 }
137
138 public String getOldFolder() {
139 return mOldFolder;
140 }
141
142 public void setOldFolder(String oldFolder) {
143 mOldFolder = oldFolder;
144 }
145
146 public String toString() {
147 return "Type: " + getType() + " return code: " + getReturnCode() + "Handle: " + mHandle;
148 }
149}