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