}
//methods
+ def on(LinkedHashMap metaData) {
+ on()
+ }
+ def on() {
+ if (status != "on") {
+ println("the music player with id:$id is on!")
+ this.status = "on"
+ sendEvent([name: "status", value: "on", deviceId: this.id, descriptionText: "",
+ displayed: true, linkText: "", isStateChange: false, unit: "", data: '{"info": "info"}'])
+ }
+ }
+ def off(LinkedHashMap metaData) {
+ off()
+ }
+ def off() {
+ if (status != "off") {
+ println("the music player with id:$id is off!")
+ this.status = "off"
+ sendEvent([name: "status", value: "off", deviceId: this.id, descriptionText: "",
+ displayed: true, linkText: "", isStateChange: false, unit: "", data: '{"info": "info"}'])
+ }
+ }
+ def mute(LinkedHashMap metaData) {
+ mute()
+ }
def mute() {
if (mute != "muted") {
println("the music player with id:$id is muted!")
displayed: true, linkText: "", isStateChange: false, unit: "", data: '{"info": "info"}'])
}
}
+ def nextTrack(LinkedHashMap metaData) {
+ nextTrack()
+ }
def nextTrack() {
trackNumber = trackNumber+1
def trackPlaying = trackData
println("the $trackPlaying is selected!")
- if (status != "playing") {
- this.status = "playing"
- sendEvent([name: "status", value: "playing", deviceId: this.id, descriptionText: "",
+ if (status != "play") {
+ this.status = "play"
+ sendEvent([name: "status", value: "play", deviceId: this.id, descriptionText: "",
displayed: true, linkText: "", isStateChange: false, unit: "", data: '{"info": "info"}'])
}
sendEvent([name: "trackDescription", value: "someDescriptions", deviceId: this.id, descriptionText: "",
sendEvent([name: "trackData", value: "someTrack", deviceId: this.id, descriptionText: "",
displayed: true, linkText: "", isStateChange: false, unit: "", data: '{"info": "info"}'])
}
+ def pause(LinkedHashMap metaData) {
+ pause()
+ }
def pause() {
- if (status != "paused") {
+ if (status != "pause") {
println("the music player with id:$id is paused!")
- this.status = "paused"
- sendEvent([name: "status", value: "paused", deviceId: this.id, descriptionText: "",
+ this.status = "pause"
+ sendEvent([name: "status", value: "pause", deviceId: this.id, descriptionText: "",
displayed: true, linkText: "", isStateChange: false, unit: "", data: '{"info": "info"}'])
}
}
+ def play(LinkedHashMap metaData) {
+ play()
+ }
def play() {
- if (status != "playing") {
+ if (status != "play") {
println("the music player with id:$id is starting to play!")
- this.status = "playing"
- sendEvent([name: "status", value: "playing", deviceId: this.id, descriptionText: "",
+ this.status = "play"
+ sendEvent([name: "status", value: "play", deviceId: this.id, descriptionText: "",
displayed: true, linkText: "", isStateChange: false, unit: "", data: '{"info": "info"}'])
}
}
+ def playTrack(LinkedHashMap metaData) {
+ playTrack()
+ }
def playTrack(String trackToPlay) {
def trackPlaying = trackData
println("the $trackPlaying is selected to play!")
- if (status != "playing") {
- this.status = "playing"
- sendEvent([name: "status", value: "playing", deviceId: this.id, descriptionText: "",
+ if (status != "play") {
+ this.status = "play"
+ sendEvent([name: "status", value: "play", deviceId: this.id, descriptionText: "",
displayed: true, linkText: "", isStateChange: false, unit: "", data: '{"info": "info"}'])
}
sendEvent([name: "trackDescription", value: "someDescriptions", deviceId: this.id, descriptionText: "",
sendEvent([name: "trackData", value: "someTrack", deviceId: this.id, descriptionText: "",
displayed: true, linkText: "", isStateChange: false, unit: "", data: '{"info": "info"}'])
}
+ def previousTrack(LinkedHashMap metaData) {
+ previousTrack()
+ }
def previousTrack() {
if (trackNumber != 1)
trackNumber = trackNumber-1
/*def restoreTrack(String trackToRestore) {
musicPlayers*.restoreTrack(trackToRestore)
}*/
+ def resumeTrack(LinkedHashMap metaData) {
+ resumeTrack()
+ }
def resumeTrack(String trackToResume) {
def trackPlaying = trackData
println("the $trackPlaying is resumed!")
- if (status != "playing") {
- this.status = "playing"
- sendEvent([name: "status", value: "playing", deviceId: this.id, descriptionText: "",
+ if (status != "play") {
+ this.status = "play"
+ sendEvent([name: "status", value: "play", deviceId: this.id, descriptionText: "",
displayed: true, linkText: "", isStateChange: false, unit: "", data: '{"info": "info"}'])
}
}
+ def setLevel(LinkedHashMap metaData) {
+ setLevel()
+ }
def setLevel(int level) {
if (level != this.level) {
this.level = level
displayed: true, linkText: "", isStateChange: false, unit: "", data: '{"info": "info"}'])
}
}
+ def setTrack(LinkedHashMap metaData) {
+ setTrack()
+ }
def setTrack(String trackToSet) {
def trackPlaying = trackData
println("the $trackPlaying is set!")
- if (status != "playing") {
- this.status = "playing"
- sendEvent([name: "status", value: "playing", deviceId: this.id, descriptionText: "",
+ if (status != "play") {
+ this.status = "play"
+ sendEvent([name: "status", value: "play", deviceId: this.id, descriptionText: "",
displayed: true, linkText: "", isStateChange: false, unit: "", data: '{"info": "info"}'])
}
sendEvent([name: "trackDescription", value: "someDescriptions", deviceId: this.id, descriptionText: "",
sendEvent([name: "trackData", value: "someTrack", deviceId: this.id, descriptionText: "",
displayed: true, linkText: "", isStateChange: false, unit: "", data: '{"info": "info"}'])
}
+ def stop(LinkedHashMap metaData) {
+ stop()
+ }
def stop() {
- if (status != "stopped") {
- println("the music player with id:$id is stopped!")
- this.status = "stopped"
- sendEvent([name: "status", value: "stopped", deviceId: this.id, descriptionText: "",
+ if (status != "stop") {
+ println("the music player with id:$id is stop!")
+ this.status = "stop"
+ sendEvent([name: "status", value: "stop", deviceId: this.id, descriptionText: "",
displayed: true, linkText: "", isStateChange: false, unit: "", data: '{"info": "info"}'])
}
}
+ def playText(LinkedHashMap metaData) {
+ playText()
+ }
def playText(String text) {
println("the music player with id:$id is playing the text:$text!")
- if (status != "playing") {
- this.status = "playing"
- sendEvent([name: "status", value: "playing", deviceId: this.id, descriptionText: "",
+ if (status != "play") {
+ this.status = "play"
+ sendEvent([name: "status", value: "play", deviceId: this.id, descriptionText: "",
displayed: true, linkText: "", isStateChange: false, unit: "", data: '{"info": "info"}'])
}
}
def currentValue(String deviceFeature) {
- if (deviceFeature == "musicPlayer") {
+ if (deviceFeature == "playpause") {
return status
}
}
def latestValue(String deviceFeature) {
- if (deviceFeature == "musicPlayer") {
+ if (deviceFeature == "playpause") {
return status
}
}