Adding missing methods etc.
[smartthings-infrastructure.git] / MusicPlayer / MusicPlayers.groovy
index 1906b01..5a8aed0 100644 (file)
@@ -12,6 +12,7 @@ public class MusicPlayers {
        private String label = "musicPlayer0"
        private String displayName = "musicPlayer0"
        private int level = 20
+       private int duration = 10
        private String mute = "unmuted"
        private String status = "pause"
        private int trackNumber = 1
@@ -27,6 +28,7 @@ public class MusicPlayers {
                
                if (init) {
                        this.level = 20
+                       this.duration = 10
                        this.mute = "unmuted"
                        this.status = "paused"
                        this.trackNumber = 1
@@ -34,6 +36,7 @@ public class MusicPlayers {
                        this.trackDescription = "someDescriptions"
                } else {
                        this.level = 30
+                       this.duration = 20
                        this.mute = "muted"
                        this.status = "playing"
                        this.trackNumber = 2
@@ -155,7 +158,25 @@ public class MusicPlayers {
                }
        }
        def playTrack(LinkedHashMap metaData) {
-               playTrack()
+               playTrack("someTrack")
+       }
+       def playTrackAndResume(String trackData, int duration) {
+               playTrack(trackData)
+               if (duration != this.duration) {
+                       this.duration = duration
+               }
+       }
+       def playTrackAndResume(String trackData, int duration, int level) {
+               playTrackAndResume(trackData, duration)
+               if (level != this.level) {
+                       this.level = level
+               }
+       }
+       def playTrackAtVolume(String trackData, int level) {
+               playTrack(trackData)
+               if (level != this.level) {
+                       this.level = level
+               }
        }
        def playTrack(String trackToPlay) {
                if (status != "play") {