import { eiotSessionVarsService } from '../../session-vars/eiot-session-vars.service'; import { eiotDeviceManagerService } from '../eiot-device-manager.service'; class EIoTAppDictionaryService { //#region Initializations //#region Variables appDictModuleIdx: number; appDictModuleInterface: string; //#endregion Variables constructor() { this.appDictModuleIdx = Number(eiotSessionVarsService.DevMgrComps?.appDict?.Idx); this.appDictModuleInterface = String(eiotSessionVarsService.DevMgrComps?.appDict?.Interface); } //#endregion Initializations //#region Private Methods updateParams() { this.appDictModuleIdx = Number(eiotSessionVarsService.DevMgrComps?.appDict?.Idx); this.appDictModuleInterface = String(eiotSessionVarsService.DevMgrComps?.appDict?.Interface); } //#endregion Private Methods //#region Public Methods async getDeviceConfig() { try { const proxy = await eiotDeviceManagerService.getSignalRConn(); this.updateParams(); return await new Promise((resolve, reject) => { const execute = async () => { proxy.invoke('Application_GetDictionary', this.appDictModuleIdx, this.appDictModuleInterface ).done((response: any) => { resolve(response); }).fail((err:any)=>{ console.error(JSON.stringify(err)); reject(err); }) } execute() }); } catch (err) { console.error(JSON.stringify(err)); return err; } } //#endregion Public Methods } export const eiotAppDictionaryService = new EIoTAppDictionaryService()