Go to the documentation of this file.00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021 package org.xbmc.android.jsonrpc.api.call;
00022
00023 import android.os.Parcel;
00024 import android.os.Parcelable;
00025 import org.codehaus.jackson.JsonNode;
00026 import org.xbmc.android.jsonrpc.api.AbstractCall;
00027 import org.xbmc.android.jsonrpc.api.model.ApplicationModel;
00028 import org.xbmc.android.jsonrpc.api.model.GlobalModel;
00029
00030 public final class Application {
00031
00039 public static class GetProperties extends AbstractCall<ApplicationModel.PropertyValue> {
00040 public final static String API_TYPE = "Application.GetProperties";
00041
00042 @Override
00043 public void writeToParcel(Parcel parcel, int flags) {
00044 super.writeToParcel(parcel, flags);
00045 parcel.writeParcelable(mResult, flags);
00046 }
00047
00051 protected GetProperties(Parcel parcel) {
00052 super(parcel);
00053 }
00054
00058 public static final Parcelable.Creator<GetProperties> CREATOR = new Parcelable.Creator<GetProperties>() {
00059 @Override
00060 public GetProperties createFromParcel(Parcel parcel) {
00061 return new GetProperties(parcel);
00062 }
00063 @Override
00064 public GetProperties[] newArray(int n) {
00065 return new GetProperties[n];
00066 }
00067 };
00068
00073 public GetProperties(String... properties) {
00074 super();
00075 addParameter("properties", properties);
00076 }
00077
00078 @Override
00079 protected ApplicationModel.PropertyValue parseOne(JsonNode node) {
00080 return new ApplicationModel.PropertyValue(node);
00081 }
00082
00083 @Override
00084 public String getName() {
00085 return API_TYPE;
00086 }
00087
00088 @Override
00089 protected boolean returnsList() {
00090 return false;
00091 }
00092 }
00093
00101 public static class Quit extends AbstractCall<String> {
00102 public final static String API_TYPE = "Application.Quit";
00103
00104 @Override
00105 public void writeToParcel(Parcel parcel, int flags) {
00106 super.writeToParcel(parcel, flags);
00107 parcel.writeValue(mResult);
00108 }
00109
00113 protected Quit(Parcel parcel) {
00114 super(parcel);
00115 }
00116
00120 public static final Parcelable.Creator<Quit> CREATOR = new Parcelable.Creator<Quit>() {
00121 @Override
00122 public Quit createFromParcel(Parcel parcel) {
00123 return new Quit(parcel);
00124 }
00125 @Override
00126 public Quit[] newArray(int n) {
00127 return new Quit[n];
00128 }
00129 };
00130
00134 public Quit() {
00135 super();
00136 }
00137
00138 @Override
00139 protected String parseOne(JsonNode node) {
00140 return node.getTextValue();
00141 }
00142
00143 @Override
00144 public String getName() {
00145 return API_TYPE;
00146 }
00147
00148 @Override
00149 protected boolean returnsList() {
00150 return false;
00151 }
00152 }
00153
00161 public static class SetMute extends AbstractCall<Boolean> {
00162 public final static String API_TYPE = "Application.SetMute";
00163
00164 @Override
00165 public void writeToParcel(Parcel parcel, int flags) {
00166 super.writeToParcel(parcel, flags);
00167 parcel.writeValue(mResult);
00168 }
00169
00173 protected SetMute(Parcel parcel) {
00174 super(parcel);
00175 }
00176
00180 public static final Parcelable.Creator<SetMute> CREATOR = new Parcelable.Creator<SetMute>() {
00181 @Override
00182 public SetMute createFromParcel(Parcel parcel) {
00183 return new SetMute(parcel);
00184 }
00185 @Override
00186 public SetMute[] newArray(int n) {
00187 return new SetMute[n];
00188 }
00189 };
00190
00195 public SetMute(GlobalModel.Toggle mute) {
00196 super();
00197 addParameter("mute", mute);
00198 }
00199
00200 @Override
00201 protected Boolean parseOne(JsonNode node) {
00202 return node.getBooleanValue();
00203 }
00204
00205 @Override
00206 public String getName() {
00207 return API_TYPE;
00208 }
00209
00210 @Override
00211 protected boolean returnsList() {
00212 return false;
00213 }
00214 }
00215
00223 public static class SetVolume extends AbstractCall<Integer> {
00224 public final static String API_TYPE = "Application.SetVolume";
00225
00226 @Override
00227 public void writeToParcel(Parcel parcel, int flags) {
00228 super.writeToParcel(parcel, flags);
00229 parcel.writeValue(mResult);
00230 }
00231
00235 protected SetVolume(Parcel parcel) {
00236 super(parcel);
00237 }
00238
00242 public static final Parcelable.Creator<SetVolume> CREATOR = new Parcelable.Creator<SetVolume>() {
00243 @Override
00244 public SetVolume createFromParcel(Parcel parcel) {
00245 return new SetVolume(parcel);
00246 }
00247 @Override
00248 public SetVolume[] newArray(int n) {
00249 return new SetVolume[n];
00250 }
00251 };
00252
00257 public SetVolume(Integer volume) {
00258 super();
00259 addParameter("volume", volume);
00260 }
00261
00266 public SetVolume(String volume) {
00267 super();
00268 addParameter("volume", volume);
00269 }
00270
00271 @Override
00272 protected Integer parseOne(JsonNode node) {
00273 return node.getIntValue();
00274 }
00275
00276 @Override
00277 public String getName() {
00278 return API_TYPE;
00279 }
00280
00281 @Override
00282 protected boolean returnsList() {
00283 return false;
00284 }
00285 }
00286 }