From: Youngsoo Choi Date: Tue, 13 Oct 2020 09:35:00 +0000 (-0700) Subject: [Service] Add edge orchestration interface X-Git-Tag: submit/tizen/20201124.112151^2~1 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=d55cc7de0b1ddb97a0eb533558fd51edb382763f;p=platform%2Fframework%2Fweb%2Fwrtjs.git [Service] Add edge orchestration interface This provides initial edge orchestration interface. Change-Id: I44df11d7769e9ed692790cd9efd6735a97de94c5 Signed-off-by: Youngsoo Choi --- diff --git a/wrt_app/service/device_api_router.ts b/wrt_app/service/device_api_router.ts index 7cb70cb3..a7e35634 100644 --- a/wrt_app/service/device_api_router.ts +++ b/wrt_app/service/device_api_router.ts @@ -52,9 +52,34 @@ export class DeviceAPIRouter { global.webapis.getPackageId = () => { return this.packageId; } + this.initEdgeWebapis(); this.initProductWebapis(); } + 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) {