import { eiotAppManagerService } from '../eiot-app-manager.service'; class EIoTSQLiteService { //#region Initializations //#region Variables public DeviceConfig = []; public constConfigValues = { className: 'LWAppManager.Common.LWSQLite', key: 'Common', }; //#endregion Variables //#endregion Initializations //#region Public Methods async getDeviceConfig() { try { const ISignalRVM = { Key: this.constConfigValues.key, ClassName: this.constConfigValues.className, MethodName: 'GetDeviceConfig', ReqParams: '', }; return await new Promise((resolve, reject) => { const execute = async () => { const proxy = await eiotAppManagerService.getSignalRConn(); proxy.invoke('action', ISignalRVM).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; } } async getValueFromUtilityTbl(key: string) { try { const proxy = await eiotAppManagerService.getSignalRConn(); const methodName = 'GetValueFromUtilityTbl'; const ISignalRVM = { Key: this.constConfigValues.key, ClassName: this.constConfigValues.className, MethodName: methodName, ReqParams: key }; return await new Promise((resolve, reject) => { const execute = async () => { proxy.invoke('action', ISignalRVM).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; } } async saveValueInUtilityTbl(data: string) { try { const proxy = await eiotAppManagerService.getSignalRConn(); const methodName = 'UtilityTblAddUpdate'; const ISignalRVM = { Key: this.constConfigValues.key, ClassName: this.constConfigValues.className, MethodName: methodName, ReqParams: data }; return await new Promise((resolve, reject) => { const execute = async () => { proxy.invoke('action', ISignalRVM).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 eiotSQLiteService = new EIoTSQLiteService()