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 import java.net.URI;
19 import java.net.URL;
20 import java.util.List;
21 import org.fourthline.cling.model.types.csv.CSV;
22 import org.fourthline.cling.model.types.csv.CSVInteger;
23
24 @UpnpService(
25 serviceId = @UpnpServiceId("MyService"),
26 serviceType = @UpnpServiceType(namespace = "mydomain", value = "MyService"),
27 stringConvertibleTypes = MyStringConvertible.class
28 )
29 public class MyServiceWithStringConvertibles {
30
31 @UpnpStateVariable
32 private URL myURL;
33
34 @UpnpStateVariable
35 private URI myURI;
36
37 @UpnpStateVariable(datatype = "string")
38 private List<Integer> myNumbers;
39
40 @UpnpStateVariable
41 private MyStringConvertible myStringConvertible;
42
43 @UpnpAction(out = @UpnpOutputArgument(name = "Out"))
44 public URL getMyURL() {
45 return myURL;
46 }
47
48 @UpnpAction
49 public void setMyURL(@UpnpInputArgument(name = "In") URL myURL) {
50 this.myURL = myURL;
51 }
52
53 @UpnpAction(out = @UpnpOutputArgument(name = "Out"))
54 public URI getMyURI() {
55 return myURI;
56 }
57
58 @UpnpAction
59 public void setMyURI(@UpnpInputArgument(name = "In") URI myURI) {
60 this.myURI = myURI;
61 }
62
63 @UpnpAction(out = @UpnpOutputArgument(name = "Out"))
64 public CSV<Integer> getMyNumbers() {
65 CSVInteger wrapper = new CSVInteger();
66 if (myNumbers != null)
67 wrapper.addAll(myNumbers);
68 return wrapper;
69 }
70
71 @UpnpAction
72 public void setMyNumbers(
73 @UpnpInputArgument(name = "In")
74 CSVInteger myNumbers
75 ) {
76 this.myNumbers = myNumbers;
77 }
78
79 @UpnpAction(out = @UpnpOutputArgument(name = "Out"))
80 public MyStringConvertible getMyStringConvertible() {
81 return myStringConvertible;
82 }
83
84 @UpnpAction
85 public void setMyStringConvertible(
86 @UpnpInputArgument(name = "In")
87 MyStringConvertible myStringConvertible
88 ) {
89 this.myStringConvertible = myStringConvertible;
90 }
91 }