|
|
@@ -12,37 +12,61 @@ import java.util.HashMap;
|
|
|
*/
|
|
|
|
|
|
public class UserData {
|
|
|
- public static ArrayList<HashMap<String, Object>> getData(String key) {
|
|
|
- ArrayList<HashMap<String, Object>> nes = new ArrayList<HashMap<String, Object>>();
|
|
|
+ //ArrayList<HashMap<String, Object>>
|
|
|
+ public static HashMap<String, Object> getData(String key) {
|
|
|
+ //HashMap<String, ArrayList<HashMap<String, Object>>> assoc = new HashMap<>();
|
|
|
+ HashMap<String, Object> assoc = new HashMap<>();
|
|
|
+ ArrayList<HashMap<String, Object>> actions = new ArrayList<>();
|
|
|
+ HashMap<String, Object> event = new HashMap<>();
|
|
|
+ HashMap<String, Object> action = new HashMap<>();
|
|
|
+
|
|
|
switch (key) {
|
|
|
case "Network":
|
|
|
- HashMap<String, Object> hm = new HashMap();
|
|
|
- hm.put("SSIDs", Arrays.asList("Cueva", "Cueva2"));
|
|
|
- hm.put("type", ConnectivityManager.TYPE_WIFI);
|
|
|
- hm.put("state", NetworkInfo.State.CONNECTED);
|
|
|
- hm.put("trigger_type", "Toast");
|
|
|
- hm.put("trigger_value", "Connected to cuevita");
|
|
|
-
|
|
|
- HashMap<String, Object> hm2 = new HashMap(hm);
|
|
|
- hm2.put("SSIDs", Arrays.asList("Banana"));
|
|
|
- hm2.put("trigger_value", "Connected to banana");
|
|
|
-
|
|
|
- HashMap<String, Object> hm3 = new HashMap(hm);
|
|
|
- hm3.remove("SSIDs");
|
|
|
- hm3.put("type", ConnectivityManager.TYPE_MOBILE);
|
|
|
- hm3.put("trigger_type", "Beep");
|
|
|
-
|
|
|
- HashMap<String, Object> tval = new HashMap<>();
|
|
|
- tval.put("title", "Network status");
|
|
|
- tval.put("value", "Connected to mobile");
|
|
|
- hm3.put("trigger_value", tval);
|
|
|
-
|
|
|
- nes.add(hm);
|
|
|
- nes.add(hm2);
|
|
|
- nes.add(hm3);
|
|
|
+ HashMap<String, Object> action2 = new HashMap<>();
|
|
|
+
|
|
|
+ event.put("SSIDs", Arrays.asList("Cueva", "Cueva2"));
|
|
|
+ event.put("type", ConnectivityManager.TYPE_WIFI);
|
|
|
+ event.put("state", NetworkInfo.State.CONNECTED);
|
|
|
+ event.put("Name", "Cuevita-Wifi");
|
|
|
+
|
|
|
+ action.put("Type", "Toast");
|
|
|
+ action.put("Value", "Connected to cuevita");
|
|
|
+ action.put("Name", "Toast-connected");
|
|
|
+ actions.add(action);
|
|
|
+
|
|
|
+ HashMap<String, String> notif = new HashMap<>();
|
|
|
+ notif.put("Title", "Title 2toast cuevita");
|
|
|
+ notif.put("Value", "2toast connected cuevita");
|
|
|
+
|
|
|
+ action2.put("Type", "Notification");
|
|
|
+ action2.put("Name", "2Toast");
|
|
|
+ action2.put("Value", notif);
|
|
|
+ actions.add(action2);
|
|
|
+
|
|
|
break;
|
|
|
+ case "DateTime":
|
|
|
+
|
|
|
+ event.put("Hour", Arrays.asList(0, 1, 2, 3, 4, 5, 6, 7, 8));
|
|
|
+ event.put("InvertHour", false);
|
|
|
|
|
|
+ event.put("Minute", null); //Null == *
|
|
|
+ event.put("InvertMinute", null);
|
|
|
+
|
|
|
+ event.put("DOM", null); //Null == *
|
|
|
+ event.put("DOW", Arrays.asList(0,1,2,3,4,5)); //Monday through friday, 0-8 AM
|
|
|
+
|
|
|
+ event.put("Month", null); //Null == *
|
|
|
+
|
|
|
+ action.put("Type", "Toast");
|
|
|
+ action.put("Value", "Time's up");
|
|
|
+ action.put("Name", "Sleepy time");
|
|
|
+
|
|
|
+ actions.add(action);
|
|
|
+
|
|
|
+ break;
|
|
|
}
|
|
|
- return nes;
|
|
|
+ assoc.put("Event", event);
|
|
|
+ assoc.put("Actions", actions);
|
|
|
+ return assoc;
|
|
|
}
|
|
|
}
|