[Service] Add edge orchestration interface 44/256844/1
authorYoungsoo Choi <kenshin.choi@samsung.com>
Tue, 13 Oct 2020 09:35:00 +0000 (02:35 -0700)
committerInsoon Kim <is46.kim@samsung.com>
Wed, 14 Apr 2021 01:54:44 +0000 (18:54 -0700)
This provides initial edge orchestration interface.

Change-Id: I432db4ec011a5bbaf83ea65e1f0bfe9877690ac4
Signed-off-by: Youngsoo Choi <kenshin.choi@samsung.com>
wrt_app/service/device_api_router.ts

index 4278274..0c885f6 100644 (file)
@@ -65,6 +65,7 @@ export class DeviceAPIRouter {
       postPlainNotification: { writable: false, enumerable: true },
     });
     this.initMDEWebapis();
+    this.initEdgeWebapis();
     this.initProductWebapis();
   }
 
@@ -102,6 +103,30 @@ export class DeviceAPIRouter {
     }
   }
 
+  initEdgeWebapis() {
+    if (wrt['edge'] && !global.webapis.edge) {
+      let edge = wrt.edge as NativeWRTjs.EdgeExtension;
+      global.webapis.edge = {
+        orchestrationGetDevicelist: (service_name: string, exec_type: string) => {
+          return edge.orchestrationGetDevicelist(service_name, exec_type);
+        },
+        orchestrationReadCapability: (ip: string) => {
+          return edge.orchestrationReadCapability(ip);
+        },
+        orchestrationRequestService: (app_name: string, self_select: boolean, exec_type: string, exec_parameter: string) => {
+          return edge.orchestrationRequestService(app_name, self_select, exec_type, exec_parameter);
+        },
+        orchestrationRequestServiceOnDevice: (app_name: string, self_select: boolean, exec_type: string, exec_parameter: string, ip: string) => {
+          return edge.orchestrationRequestServiceOnDevice(app_name, self_select, exec_type, exec_parameter, ip);
+        },
+        orchestrationWriteCapability: (json: string) => {
+          return edge.orchestrationWriteCapability(json);
+        },
+      }
+      Object.defineProperty(global.webapis, 'edge', { writable: false, enumerable: true });
+    }
+  }
+
   initProductWebapis() {
     // for TV profile
     if (wrt.tv && !global.webapis.productinfo) {