Initial merge-commit of the OIC code. Should successfully do discovery for single...
[platform/upstream/iotivity.git] / csdk / android / OCServer / src / com / oc / ub / sample / LightControl.java
1 //******************************************************************
2 //
3 // Copyright 2014 Intel Corporation All Rights Reserved.
4 //-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
5
6 package com.oc.ub.sample;
7
8 import com.oc.OCObserver;
9 import com.oc.annotations.OCInterface;
10 import com.oc.annotations.OCProperty;
11
12 /**
13  * APPLICATION NOTE: This interface is exposed to via the framework because of the @OCInterface
14  * annotation. Without the annotation, this interface would be ignored by the framework.
15  * 
16  * APPLICATION NOTE: This interface needs to be accessible on the client and the server as the
17  * contract for operation.
18  * 
19  */
20 @OCInterface
21 public interface LightControl {
22   /**
23    * APPLICATION NOTE: This is a synchronous request. It will throw immediately if the stack is down
24    * or the network is otherwise not available. It may throw is the remote side does not responds or
25    * returns an error.
26    * 
27    * @param powered - The new power state of this implemented interface.
28    */
29   @OCProperty(name = "powered")
30   void setPowered(boolean powered);
31
32   /**
33    * APPLICATION NOTE: This is a synchronous request. It will throw immediately if the stack is down
34    * or the network is otherwise not available. It may throw is the remote side does not responds or
35    * returns an error.
36    * 
37    * @return Returns power state of this implemented interface.
38    */
39   @OCProperty(name = "powered")
40   boolean isPowered();
41
42   /**
43    * APPLICATION NOTE: It is the objects responsibility to throw an exception (TBD) if it cannot
44    * handle an additional observers which will in turn return an error to the requestor.
45    * 
46    * @param observer the observer that will be notified when a change to the power property has
47    *        occurred.
48    */
49   @OCProperty(name = "powered")
50   void addPoweredObserver(OCObserver<Boolean> observer);
51
52   /**
53    * 
54    * @param observer the observer that will be no longer notified when a change to the power
55    *        property has occurred.
56    */
57   @OCProperty(name = "powered")
58   void removePoweredObserver(OCObserver<Boolean> observer);
59
60   /**
61    * APPLICATION NOTE: Even properties (or methods) that are not annotated are exposed, by default,
62    * via the framework. Getter and setter methods are assumed to be properties unless annotated
63    * otherwise.
64    * 
65    * @param level - Sets the power level of this implemented interface.
66    */
67   void setLevel(int level);
68
69   int getLevel();
70
71   /**
72    * APPLICATION NOTE: This is an example of a method. The annotation is not required except to
73    * override the defaults.
74    */
75   void flash();
76 }