소스 검색

LightControl Service Interfaces was defined first time.

Trishia 4 년 전
부모
커밋
4076b73ca1

+ 1 - 1
app/build.gradle

@@ -32,7 +32,7 @@ android {
             enable true
             enable true
             reset()
             reset()
             include 'x86', 'x86_64', 'armeabi', 'arm64-v8a'
             include 'x86', 'x86_64', 'armeabi', 'arm64-v8a'
-            universalApk true
+            universalApk false
         }
         }
     }
     }
 }
 }

+ 94 - 0
app/src/main/aidl/org/iotivity/bridge/homeserver/ILightControlService.aidl

@@ -0,0 +1,94 @@
+package org.iotivity.bridge.homeserver;
+
+interface ILightControlService {
+
+    /**
+     * retrieve all Bridged device list in Light Control Service
+     * @return devices list data with json array format as String
+     * eg.)
+     * [{"n":"Light Switch",                            // Device Name
+     *  "rt":["oic.d.light"],                           // Device Resource Type
+     *  "sn":"2b32e152-3756-4fb6-b3f2-d8db7aafe39f",    // Device Serial Number(Unique Id) will be used for piid in oic/d
+     *  "state":"on-line"},                             // Device On/Off-Line State
+     * {"n":"Television","rt":["oic.d.tv"], "sn":"2cd8e585-ef21-4fd1-7958-6ca7e54adcce","state":"off-line"}]
+     */
+    String retrieveAllDevices();
+
+    /**
+     * retrieve all resources of the Bridged deivce in Light Control Service
+     * @param device_uuid : unique identity of the device (eg. 15ba3c25-8cdd-41f8-6f9e-fe49105dce0a)
+     * @return resource list data with json array format as String
+     * (eg.
+     * [{"n":"Light Switch",                            // Resource Name
+     *   "uri”:”/light",                                // Resource URI
+     *   "rt":["oic.r.switch.binary"],                  // Resource Type
+     *   "if":"RW"},                                    // Resource Interace (eg. RW : Read/Write, R:Read Only, A:Actuator, S:Sensor)
+     * {"n":"Dimming Control","uri":"/dimming","rt":["oic.r.light.dimming"], "if":"RW"},
+     * {"n":"Energy Consumption", "uri":"/EnergyConsumptionResURI", "rt": ["oic.r.energy.consumption"], "if":"S"}
+     * {"n":"Color Temperature", "uri":""/ColourTemperatureResURI", "rt": ["oic.r.colour.colourtemperature"], "if":"A"}]
+     *) */
+    String retrieveAllResources(in String device_uuid) ;
+
+    /**
+     * retrieve Getting all properties of the resource in the Bridged device
+     * @param device_uuid unique identity of the device (eg. 15ba3c25-8cdd-41f8-6f9e-fe49105dce0a)
+     * @param resource_uri uri of the resource (eg. /a/light)
+     * @return properties data with json object format as String
+     * (eg.
+     * { "n":"Light Switch", "value":true } or                                  // Light Switch Properties
+     * { "n":"Dimming Control","dimmingSetting":100,"range":100,"step":10 } or  // Dimming Control Properties
+     * { "n":"Energy Consumption","power":200.1,"energy":3500.4 } or            // Energy Consumption Properties
+     * { "n":"Color Temperature", "ct":457, "range":1000, "step":1 }            // Color Temperature Properties
+     * ) */
+    String doGetResourceProperties(in String device_uuid, in String resource_uri) ;
+
+    /**
+     * request Posting the value of properties to the Bridged device
+     * @param device_uuid unique identity of ocf device (eg. 15ba3c25-8cdd-41f8-6f9e-fe49105dce0a)
+     * @param resource_uri uri of ocf resource (eg. /a/light)
+     * @param prop_data the property values of the resource to control as a json object format
+     * (eg. { "power" : true, "level" : 100 } or { "value" : true } or { "dimmingSetting" : 50} )
+     * @return
+     *   - true : function call success,
+     *   - false : function call fail
+     */
+    boolean doPostResourceProperties(in String device_uuid, in String resource_uri, in String prop_data) ;
+
+    /**
+     * request Observing all properties of the resource to the Bridged device
+     * @param device_uuid unique identity of the device (eg. 15ba3c25-8cdd-41f8-6f9e-fe49105dce0a)
+     * @param resource_uri uri of ocf resource (eg. /a/light)
+     * @return
+     *   - true : function call success,
+     *   - false : function call fail
+     */
+    //boolean doObserveResource(in String device_uuid, in String resource_uri) ;
+
+    /**
+     * request Observing all properties of the resource to the Bridged device
+     * @param device_uuid unique identity of the device (eg. 15ba3c25-8cdd-41f8-6f9e-fe49105dce0a)
+     * @param resource_uri uri of ocf resource (eg. /a/light)
+     * @return
+     *   - true : function call success,
+     *   - false : function call fail
+     */
+    //boolean doStopObserveResource(in String device_uuid, in String resource_uri) ;
+
+    /**
+     * request Observing only device specific resources to the Bridged device
+     * @param device_uuid unique identity of the device (eg. 15ba3c25-8cdd-41f8-6f9e-fe49105dce0a)
+     * @return
+     *   - true : function call success,
+     *   - false : function call fail
+     */
+    //boolean doObserveDeviceSpecificResources(in String device_uuid) ;
+
+    /**
+     * request Observing only device specific resources to the Bridged device
+     * @param device_uuid unique identity of the device (eg. 15ba3c25-8cdd-41f8-6f9e-fe49105dce0a)
+     * @return
+     *   - true : function call success,
+     *   - false : function call fail
+     */
+    //boolean doStopObserveDeviceSpecificResources(in String device_uuid) ;
+}

+ 23 - 0
app/src/main/aidl/org/iotivity/bridge/homeserver/ILightControlServiceCallback.aidl

@@ -0,0 +1,23 @@
+package org.iotivity.bridge.homeserver;
+
+/**
+ * This callback interface used by IBridgeService to send
+ * synchronous notifications back to its clients.  Note that this is a
+ * one-way interface so the server does not block waiting for the client.
+ */
+
+interface ILightControlServiceCallback {
+
+    /*
+    * This is notifying async result for requests such as GET, POST, OBSERVE
+    * @param result_code 0-OK, 1-FAIL, 2-ERROR
+    * @param result_data json format as string (eg.
+    * {"id":"3481704581734918",                                     // Transaction ID
+    * "sn":"15ba3c25-8cdd-41f8-6f9e-fe49105dce0a",                  // Device UUID
+    * "uri":"/light",                                               // Resource URI
+    * "res_type":"GET",                                             // Response Type
+    * "res_data":{"n":"Light Switch","value":false}}                // Response Data for each resource properties
+    *)*/
+    void onResultReceived(int result_code, String result_data);
+
+}

+ 0 - 1
app/src/main/java/org/iotivity/bridge/homeserver/BridgeServerActivity.java

@@ -337,7 +337,6 @@ public class BridgeServerActivity extends AppCompatActivity {
                 resebridgeDialog.show();
                 resebridgeDialog.show();
                 return true;
                 return true;
             }
             }
-
             case R.id.action_vods_reset:
             case R.id.action_vods_reset:
                 // TODO : do some action like start Activity or show Dialog
                 // TODO : do some action like start Activity or show Dialog
                 {
                 {

+ 1 - 1
app/src/main/res/menu/actionbar_actions.xml

@@ -18,7 +18,7 @@
         android:title="Stop Bridge Service"
         android:title="Stop Bridge Service"
         app:showAsAction="never"/>
         app:showAsAction="never"/>
 
 
-    <!--
+<!--
         <item
         <item
             android:id="@+id/action_settings"
             android:id="@+id/action_settings"
             android:title="Settings"
             android:title="Settings"

+ 4 - 3
app/src/main/res/values/strings.xml

@@ -1,13 +1,14 @@
 <resources>
 <resources>
     <string name="app_name">Energy Hub Bridge</string>
     <string name="app_name">Energy Hub Bridge</string>
+    <!--<string name="app_name">OCF Client</string>-->
 
 
     <!-- Client Strings -->
     <!-- Client Strings -->
     <string name="discoverDevices">Discover Devices</string>
     <string name="discoverDevices">Discover Devices</string>
     <string name="discoveredResources">Discovered Resources</string>
     <string name="discoveredResources">Discovered Resources</string>
-    <string name="resetBridge">Reset Bridge</string>
-    <string name="resetBridgeMessage">Note: All Bridge Resources including SVRs will be reset.</string>
+    <string name="resetBridge">Reset Bridge </string>
+    <string name="resetBridgeMessage">Note: This Bridge including SVRs will be reset.</string>
     <string name="resetVods">Reset Vods</string>
     <string name="resetVods">Reset Vods</string>
-    <string name="resetVodsMessage">Note: All virtual devices will no longer be viable.</string>
+    <string name="resetVodsMessage">Note: All virtual OCF devices will be reset.</string>
     <string name="stopBridgeService">Stop Bridge Service</string>
     <string name="stopBridgeService">Stop Bridge Service</string>
     <string name="stopBridgeMessage">Note: Foregrounding Bridge Service and BridgeServer Activity will be killed.</string>
     <string name="stopBridgeMessage">Note: Foregrounding Bridge Service and BridgeServer Activity will be killed.</string>