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.AllowedValueProvider;
19 import org.fourthline.cling.binding.annotations.UpnpAction;
20 import org.fourthline.cling.binding.annotations.UpnpInputArgument;
21 import org.fourthline.cling.binding.annotations.UpnpOutputArgument;
22 import org.fourthline.cling.binding.annotations.UpnpService;
23 import org.fourthline.cling.binding.annotations.UpnpServiceId;
24 import org.fourthline.cling.binding.annotations.UpnpServiceType;
25 import org.fourthline.cling.binding.annotations.UpnpStateVariable;
26
27 @UpnpService(
28 serviceId = @UpnpServiceId("MyService"),
29 serviceType = @UpnpServiceType(namespace = "mydomain", value = "MyService")
30 )
31 public class MyServiceWithAllowedValueProvider {
32
33
34 public static class MyAllowedValueProvider implements AllowedValueProvider {
35 @Override
36 public String[] getValues() {
37 return new String[] {"Foo", "Bar", "Baz"};
38 }
39 }
40
41
42
43 @UpnpStateVariable(
44 allowedValueProvider= MyAllowedValueProvider.class
45 )
46 private String restricted;
47
48
49 @UpnpAction(out = @UpnpOutputArgument(name = "Out"))
50 public String getRestricted() {
51 return restricted;
52 }
53
54 @UpnpAction
55 public void setRestricted(@UpnpInputArgument(name = "In") String restricted) {
56 this.restricted = restricted;
57 }
58 }
59