From bb660042e170745cf2f6b59d2d0d2075f0ac0928 Mon Sep 17 00:00:00 2001 From: Youngsoo Choi Date: Tue, 13 Oct 2020 02:35:00 -0700 Subject: [PATCH] [Service] Add edge orchestration interface This provides initial edge orchestration interface. Change-Id: I432db4ec011a5bbaf83ea65e1f0bfe9877690ac4 Signed-off-by: Youngsoo Choi --- wrt_app/service/device_api_router.ts | 25 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+) diff --git a/wrt_app/service/device_api_router.ts b/wrt_app/service/device_api_router.ts index 4278274..0c885f6 100644 --- a/wrt_app/service/device_api_router.ts +++ b/wrt_app/service/device_api_router.ts @@ -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) { -- 2.7.4