1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16 package example.localservice;
17
18 import org.fourthline.cling.binding.annotations.UpnpAction;
19 import org.fourthline.cling.binding.annotations.UpnpInputArgument;
20 import org.fourthline.cling.binding.annotations.UpnpOutputArgument;
21 import org.fourthline.cling.binding.annotations.UpnpService;
22 import org.fourthline.cling.binding.annotations.UpnpServiceId;
23 import org.fourthline.cling.binding.annotations.UpnpServiceType;
24 import org.fourthline.cling.binding.annotations.UpnpStateVariable;
25 import org.fourthline.cling.model.ModelUtil;
26
27 import java.beans.PropertyChangeSupport;
28
29 @UpnpService(
30 serviceId = @UpnpServiceId("SwitchPower"),
31 serviceType = @UpnpServiceType(value = "SwitchPower", version = 1)
32 )
33 public class SwitchPowerWithBundledPropertyChange {
34
35 private final PropertyChangeSupport propertyChangeSupport;
36
37 public SwitchPowerWithBundledPropertyChange() {
38 this.propertyChangeSupport = new PropertyChangeSupport(this);
39 }
40
41 public PropertyChangeSupport getPropertyChangeSupport() {
42 return propertyChangeSupport;
43 }
44
45 @UpnpStateVariable(defaultValue = "0")
46 private boolean target = false;
47
48 @UpnpStateVariable(defaultValue = "0")
49 private boolean status = false;
50
51 @UpnpAction
52 public void setTarget(@UpnpInputArgument(name = "NewTargetValue") boolean newTargetValue) {
53
54 target = newTargetValue;
55 status = newTargetValue;
56
57
58 getPropertyChangeSupport().firePropertyChange(
59 "Target, Status", null, null
60 );
61
62
63
64
65
66 }
67
68 @UpnpAction(out = @UpnpOutputArgument(name = "RetTargetValue"))
69 public boolean getTarget() {
70 return target;
71 }
72
73 @UpnpAction(out = @UpnpOutputArgument(name = "ResultStatus"))
74 public boolean getStatus() {
75 return status;
76 }
77
78 }