00001 /* 00002 * Copyright (C) 2005-2015 Team XBMC 00003 * http://xbmc.org 00004 * 00005 * This Program is free software; you can redistribute it and/or modify 00006 * it under the terms of the GNU General Public License as published by 00007 * the Free Software Foundation; either version 2, or (at your option) 00008 * any later version. 00009 * 00010 * This Program is distributed in the hope that it will be useful, 00011 * but WITHOUT ANY WARRANTY; without even the implied warranty of 00012 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 00013 * GNU General Public License for more details. 00014 * 00015 * You should have received a copy of the GNU General Public License 00016 * along with XBMC Remote; see the file license. If not, write to 00017 * the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. 00018 * http://www.gnu.org/copyleft/gpl.html 00019 * 00020 */ 00021 00022 package org.xbmc.android.jsonrpc.notification; 00023 00024 import org.codehaus.jackson.node.ObjectNode; 00025 00026 import android.os.Parcel; 00027 import android.os.Parcelable; 00028 00034 public class SystemEvent { 00035 00036 /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * 00037 * notifications: https://github.com/xbmc/xbmc/blob/master/xbmc/interfaces/json-rpc/notifications.json 00038 * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ 00039 00043 public static class Quit extends AbstractEvent { 00044 public final static int ID = 0x11; 00045 public final static String METHOD = "System.OnQuit"; 00046 public Quit(ObjectNode node) { 00047 super(node); 00048 } 00049 protected Quit(Parcel parcel) { 00050 super(parcel); 00051 } 00052 @Override 00053 public String toString() { 00054 return "QUIT"; 00055 } 00056 @Override 00057 public int describeContents() { 00058 return 0; 00059 } 00060 @Override 00061 public void writeToParcel(Parcel parcel, int flags) { 00062 super.writeToParcel(parcel, flags); 00063 } 00064 public static final Parcelable.Creator<Quit> CREATOR = new Parcelable.Creator<Quit>() { 00065 @Override 00066 public Quit createFromParcel(Parcel parcel) { 00067 return new Quit(parcel); 00068 } 00069 @Override 00070 public Quit[] newArray(int n) { 00071 return new Quit[n]; 00072 } 00073 }; 00074 @Override 00075 public int getId() { 00076 return ID; 00077 } 00078 } 00079 00083 public static class Restart extends AbstractEvent { 00084 public final static int ID = 0x12; 00085 public final static String METHOD = "System.OnRestart"; 00086 public Restart(ObjectNode node) { 00087 super(node); 00088 } 00089 protected Restart(Parcel parcel) { 00090 super(parcel); 00091 } 00092 @Override 00093 public String toString() { 00094 return "RESTART"; 00095 } 00096 @Override 00097 public int describeContents() { 00098 return 0; 00099 } 00100 @Override 00101 public void writeToParcel(Parcel parcel, int flags) { 00102 super.writeToParcel(parcel, flags); 00103 } 00104 public static final Parcelable.Creator<Restart> CREATOR = new Parcelable.Creator<Restart>() { 00105 @Override 00106 public Restart createFromParcel(Parcel parcel) { 00107 return new Restart(parcel); 00108 } 00109 @Override 00110 public Restart[] newArray(int n) { 00111 return new Restart[n]; 00112 } 00113 }; 00114 @Override 00115 public int getId() { 00116 return ID; 00117 } 00118 } 00119 00123 public static class Wake extends AbstractEvent { 00124 public final static int ID = 0x13; 00125 public final static String METHOD = "System.OnWake"; 00126 public Wake(ObjectNode node) { 00127 super(node); 00128 } 00129 public Wake(Parcel parcel) { 00130 super(parcel); 00131 } 00132 @Override 00133 public String toString() { 00134 return "WAKEUP"; 00135 } 00136 @Override 00137 public int describeContents() { 00138 return 0; 00139 } 00140 @Override 00141 public void writeToParcel(Parcel parcel, int flags) { 00142 super.writeToParcel(parcel, flags); 00143 } 00144 public static final Parcelable.Creator<Wake> CREATOR = new Parcelable.Creator<Wake>() { 00145 @Override 00146 public Wake createFromParcel(Parcel parcel) { 00147 return new Wake(parcel); 00148 } 00149 @Override 00150 public Wake[] newArray(int n) { 00151 return new Wake[n]; 00152 } 00153 }; 00154 @Override 00155 public int getId() { 00156 return ID; 00157 } 00158 } 00159 00163 public static class LowBattery extends AbstractEvent { 00164 public final static int ID = 0x14; 00165 public final static String METHOD = "System.OnLowBattery"; 00166 public LowBattery(ObjectNode node) { 00167 super(node); 00168 } 00169 public LowBattery(Parcel parcel) { 00170 super(parcel); 00171 } 00172 @Override 00173 public String toString() { 00174 return "LOWBATTERY"; 00175 } 00176 @Override 00177 public int describeContents() { 00178 return 0; 00179 } 00180 @Override 00181 public void writeToParcel(Parcel parcel, int flags) { 00182 super.writeToParcel(parcel, flags); 00183 } 00184 public static final Parcelable.Creator<LowBattery> CREATOR = new Parcelable.Creator<LowBattery>() { 00185 @Override 00186 public LowBattery createFromParcel(Parcel parcel) { 00187 return new LowBattery(parcel); 00188 } 00189 @Override 00190 public LowBattery[] newArray(int n) { 00191 return new LowBattery[n]; 00192 } 00193 }; 00194 @Override 00195 public int getId() { 00196 return ID; 00197 } 00198 } 00199 }