Addons.java
Go to the documentation of this file.
00001 /*
00002  *      Copyright (C) 2005-2013 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 package org.xbmc.android.jsonrpc.api.call;
00022 
00023 import android.os.Parcel;
00024 import android.os.Parcelable;
00025 import java.util.ArrayList;
00026 import java.util.Arrays;
00027 import java.util.HashMap;
00028 import java.util.HashSet;
00029 import java.util.Set;
00030 import org.codehaus.jackson.JsonNode;
00031 import org.codehaus.jackson.node.ArrayNode;
00032 import org.codehaus.jackson.node.ObjectNode;
00033 import org.xbmc.android.jsonrpc.api.AbstractCall;
00034 import org.xbmc.android.jsonrpc.api.call.Addons;
00035 import org.xbmc.android.jsonrpc.api.model.AddonModel;
00036 import org.xbmc.android.jsonrpc.api.model.GlobalModel;
00037 import org.xbmc.android.jsonrpc.api.model.ListModel;
00038 
00039 public final class Addons {
00040 
00048         public static class ExecuteAddon extends AbstractCall<String> {
00049                 public final static String API_TYPE = "Addons.ExecuteAddon";
00050 
00051                 @Override
00052                 public void writeToParcel(Parcel parcel, int flags) {
00053                         super.writeToParcel(parcel, flags);
00054                         parcel.writeValue(mResult);
00055                 }
00056 
00060                 protected ExecuteAddon(Parcel parcel) {
00061                         super(parcel);
00062                 }
00063 
00067                 public static final Parcelable.Creator<ExecuteAddon> CREATOR = new Parcelable.Creator<ExecuteAddon>() {
00068                         @Override
00069                         public ExecuteAddon createFromParcel(Parcel parcel) {
00070                                 return new ExecuteAddon(parcel);
00071                         }
00072                         @Override
00073                         public ExecuteAddon[] newArray(int n) {
00074                                 return new ExecuteAddon[n];
00075                         }
00076                 };
00077 
00084                 public ExecuteAddon(String addonid, HashMap<String, String> params, Boolean wait) {
00085                         super();
00086                         addParameter("addonid", addonid);
00087                         addParameter("params", params);
00088                         addParameter("wait", wait);
00089                 }
00090 
00097                 public ExecuteAddon(String addonid, String[] params, Boolean wait) {
00098                         super();
00099                         addParameter("addonid", addonid);
00100                         addParameter("params", params);
00101                         addParameter("wait", wait);
00102                 }
00103 
00108                 public ExecuteAddon(String addonid) {
00109                         super();
00110                         addParameter("addonid", addonid);
00111                 }
00112 
00118                 public ExecuteAddon(String addonid, HashMap<String, String> params) {
00119                         super();
00120                         addParameter("addonid", addonid);
00121                         addParameter("params", params);
00122                 }
00123 
00129                 public ExecuteAddon(String addonid, Boolean wait) {
00130                         super();
00131                         addParameter("addonid", addonid);
00132                         addParameter("wait", wait);
00133                 }
00134 
00140                 public ExecuteAddon(String addonid, String... params) {
00141                         super();
00142                         addParameter("addonid", addonid);
00143                         addParameter("params", params);
00144                 }
00145 
00146                 @Override
00147                 protected String parseOne(JsonNode node) {
00148                         return node.getTextValue();
00149                 }
00150 
00151                 @Override
00152                 public String getName() {
00153                         return API_TYPE;
00154                 }
00155 
00156                 @Override
00157                 protected boolean returnsList() {
00158                         return false;
00159                 }
00160         }
00161 
00169         public static class GetAddonDetails extends AbstractCall<AddonModel.Detail> {
00170                 public final static String API_TYPE = "Addons.GetAddonDetails";
00171 
00172                 @Override
00173                 public void writeToParcel(Parcel parcel, int flags) {
00174                         super.writeToParcel(parcel, flags);
00175                         parcel.writeParcelable(mResult, flags);
00176                 }
00177 
00181                 protected GetAddonDetails(Parcel parcel) {
00182                         super(parcel);
00183                 }
00184 
00188                 public static final Parcelable.Creator<GetAddonDetails> CREATOR = new Parcelable.Creator<GetAddonDetails>() {
00189                         @Override
00190                         public GetAddonDetails createFromParcel(Parcel parcel) {
00191                                 return new GetAddonDetails(parcel);
00192                         }
00193                         @Override
00194                         public GetAddonDetails[] newArray(int n) {
00195                                 return new GetAddonDetails[n];
00196                         }
00197                 };
00198                 public final static String RESULT = "addon";
00199 
00205                 public GetAddonDetails(String addonid, String... properties) {
00206                         super();
00207                         addParameter("addonid", addonid);
00208                         addParameter("properties", properties);
00209                 }
00210 
00211                 @Override
00212                 protected AddonModel.Detail parseOne(JsonNode node) {
00213                         return new AddonModel.Detail((ObjectNode)node.get(RESULT));
00214                 }
00215 
00216                 @Override
00217                 public String getName() {
00218                         return API_TYPE;
00219                 }
00220 
00221                 @Override
00222                 protected boolean returnsList() {
00223                         return false;
00224                 }
00225         }
00226 
00234         public static class GetAddons extends AbstractCall<AddonModel.Detail> {
00235                 public final static String API_TYPE = "Addons.GetAddons";
00236 
00237                 @Override
00238                 public void writeToParcel(Parcel parcel, int flags) {
00239                         super.writeToParcel(parcel, flags);
00240                         parcel.writeParcelable(mResult, flags);
00241                 }
00242 
00246                 protected GetAddons(Parcel parcel) {
00247                         super(parcel);
00248                 }
00249 
00253                 public static final Parcelable.Creator<GetAddons> CREATOR = new Parcelable.Creator<GetAddons>() {
00254                         @Override
00255                         public GetAddons createFromParcel(Parcel parcel) {
00256                                 return new GetAddons(parcel);
00257                         }
00258                         @Override
00259                         public GetAddons[] newArray(int n) {
00260                                 return new GetAddons[n];
00261                         }
00262                 };
00263                 public final static String RESULT = "addons";
00264 
00273                 public GetAddons(String type, String content, Boolean enabled, ListModel.Limits limits, String... properties) {
00274                         super();
00275                         addParameter("type", type);
00276                         addParameter("content", content);
00277                         addParameter("enabled", enabled);
00278                         addParameter("limits", limits);
00279                         addParameter("properties", properties);
00280                 }
00281 
00286                 public GetAddons(String... properties) {
00287                         super();
00288                         addParameter("properties", properties);
00289                 }
00290 
00296                 public GetAddons(String type, String... properties) {
00297                         super();
00298                         addParameter("type", type);
00299                         addParameter("properties", properties);
00300                 }
00301 
00308                 public GetAddons(String type, String content, String... properties) {
00309                         super();
00310                         addParameter("type", type);
00311                         addParameter("content", content);
00312                         addParameter("properties", properties);
00313                 }
00314 
00320                 public GetAddons(Boolean enabled, String... properties) {
00321                         super();
00322                         addParameter("enabled", enabled);
00323                         addParameter("properties", properties);
00324                 }
00325 
00333                 public GetAddons(String type, String content, Boolean enabled, String... properties) {
00334                         super();
00335                         addParameter("type", type);
00336                         addParameter("content", content);
00337                         addParameter("enabled", enabled);
00338                         addParameter("properties", properties);
00339                 }
00340 
00346                 public GetAddons(ListModel.Limits limits, String... properties) {
00347                         super();
00348                         addParameter("limits", limits);
00349                         addParameter("properties", properties);
00350                 }
00351 
00358                 public GetAddons(Boolean enabled, ListModel.Limits limits, String... properties) {
00359                         super();
00360                         addParameter("enabled", enabled);
00361                         addParameter("limits", limits);
00362                         addParameter("properties", properties);
00363                 }
00364 
00365                 @Override
00366                 protected ArrayList<AddonModel.Detail> parseMany(JsonNode node) {
00367                         final ArrayNode addons = parseResults(node, RESULT);
00368                         if (addons != null) {
00369                                 final ArrayList<AddonModel.Detail> ret = new ArrayList<AddonModel.Detail>(addons.size());
00370                                 for (int i = 0; i < addons.size(); i++) {
00371                                         final ObjectNode item = (ObjectNode)addons.get(i);
00372                                         ret.add(new AddonModel.Detail(item));
00373                                 }
00374                                 return ret;
00375                         } else {
00376                                 return new ArrayList<AddonModel.Detail>(0);
00377                         }
00378                 }
00379 
00380                 @Override
00381                 public String getName() {
00382                         return API_TYPE;
00383                 }
00384 
00385                 @Override
00386                 protected boolean returnsList() {
00387                         return true;
00388                 }
00389 
00393                 public interface Enabled {
00394 
00395                         public final String ALL = "all";
00396 
00397                         public final static Set<String> values = new HashSet<String>(Arrays.asList(ALL));
00398                 }
00399         }
00400 
00408         public static class SetAddonEnabled extends AbstractCall<String> {
00409                 public final static String API_TYPE = "Addons.SetAddonEnabled";
00410 
00411                 @Override
00412                 public void writeToParcel(Parcel parcel, int flags) {
00413                         super.writeToParcel(parcel, flags);
00414                         parcel.writeValue(mResult);
00415                 }
00416 
00420                 protected SetAddonEnabled(Parcel parcel) {
00421                         super(parcel);
00422                 }
00423 
00427                 public static final Parcelable.Creator<SetAddonEnabled> CREATOR = new Parcelable.Creator<SetAddonEnabled>() {
00428                         @Override
00429                         public SetAddonEnabled createFromParcel(Parcel parcel) {
00430                                 return new SetAddonEnabled(parcel);
00431                         }
00432                         @Override
00433                         public SetAddonEnabled[] newArray(int n) {
00434                                 return new SetAddonEnabled[n];
00435                         }
00436                 };
00437 
00443                 public SetAddonEnabled(String addonid, GlobalModel.Toggle enabled) {
00444                         super();
00445                         addParameter("addonid", addonid);
00446                         addParameter("enabled", enabled);
00447                 }
00448 
00449                 @Override
00450                 protected String parseOne(JsonNode node) {
00451                         return node.getTextValue();
00452                 }
00453 
00454                 @Override
00455                 public String getName() {
00456                         return API_TYPE;
00457                 }
00458 
00459                 @Override
00460                 protected boolean returnsList() {
00461                         return false;
00462                 }
00463         }
00464 }


smarthome_media_kodi_driver
Author(s): Mickael Gaillard , Erwan Le Huitouze
autogenerated on Thu Jun 6 2019 21:03:49