Adding missing methods.
authorrtrimana <rtrimana@uci.edu>
Fri, 9 Aug 2019 22:21:10 +0000 (15:21 -0700)
committerrtrimana <rtrimana@uci.edu>
Fri, 9 Aug 2019 22:21:10 +0000 (15:21 -0700)
MusicPlayer/MusicPlayer.groovy
MusicPlayer/MusicPlayers.groovy

index b21dbf9..8372772 100644 (file)
@@ -208,6 +208,53 @@ public class MusicPlayer {
                                   displayed: true, linkText: "", isStateChange: false, unit: "", data: '{"info": "info"}'])
                }
        }
+       def statesSince(String info, Date dateObj) {
+               statesSince()
+       }
+       def statesSince() {
+               eventsSince()
+       }
+       def eventsSince(Date dateObj) {
+               eventsSince()
+       }
+
+       def eventsSince() {
+               def evtActive = [[name: "status", value: "on", deviceId: "musicPlayerID0", descriptionText: "",
+                                 displayed: true, linkText: "", isStateChange: false, unit: "", data: '{"info": "info"}']]
+               def evtInactive = [[name: "status", value: "off", deviceId: "musicPlayerID0", descriptionText: "",
+                                   displayed: true, linkText: "", isStateChange: false, unit: "", data: '{"info": "info"}']]
+               def init = Verify.getInt(0,4)
+               def evtToSend = []
+               if (init == 0) {//return empty set
+                       return evtToSend
+               } else if (init == 1) {//send one active event
+                       evtActive.each{
+                               evtToSend.add(it)
+                       }
+                       return evtToSend
+               } else if (init == 2) {//send two active events
+                       evtActive.each{
+                               evtToSend.add(it)
+                       }
+                       evtActive.each{
+                               evtToSend.add(it)
+                       }
+                       return evtToSend
+               } else if (init == 3) {//send one inactive event
+                       evtInactive.each{
+                               evtToSend.add(it)
+                       }
+                       return evtToSend
+               } else if (init == 4) {//send two inactive events
+                       evtInactive.each{
+                               evtToSend.add(it)
+                       }
+                       evtInactive.each{
+                               evtToSend.add(it)
+                       }
+                       return evtToSend
+               }
+       }
        def playText(LinkedHashMap metaData) {
                playText()
        }
index 5a8aed0..a9693db 100644 (file)
@@ -237,6 +237,9 @@ public class MusicPlayers {
                        musicPlayers[0].stop()
                }
        }
+       def statesSince(String info, Date dateObj, LinkedHashMap map) {
+               return presenceSensors[0].statesSince()
+       }
        def playText(LinkedHashMap metaData) {
                playText()
        }