feat(device): flash device firmware from Agent (#499)
* add dataModelVersion, usbProtocolVersion, slaveProtocolVersion * read the package.json at appstart * flash firmware * update firmware * fix extra resource path * fix import modules * update lock files * fix imports * terminal window * exclude tmp folder from git repo * ok button * auto scroll in xterm * fix maxTry count calculation * optimize logging * optimize timeout * readSync * Add extra delay * fix async call * fix error message in log * fix ok button disable state * retry * list devices * close device after reenumeration * retry snooze * kboot maxtry 10 * retry 100 * remove deprecated toPayload ngrx helper * flash firmware with custom file * fix tslint
This commit is contained in:
committed by
László Monda
parent
f608791a09
commit
297fd3be79
@@ -1,9 +1,9 @@
|
||||
import { Injectable, NgZone } from '@angular/core';
|
||||
import { Action, Store } from '@ngrx/store';
|
||||
|
||||
import { IpcEvents, AppStartInfo, LogService } from 'uhk-common';
|
||||
import { AppState } from '../store/index';
|
||||
import { ProcessAppStartInfoAction } from '../store/actions/app';
|
||||
import { AppStartInfo, IpcEvents, LogService } from 'uhk-common';
|
||||
import { AppState } from '../store';
|
||||
import { ElectronMainLogReceivedAction, ProcessAppStartInfoAction } from '../store/actions/app';
|
||||
import { IpcCommonRenderer } from './ipc-common-renderer';
|
||||
|
||||
@Injectable()
|
||||
@@ -25,6 +25,10 @@ export class AppRendererService {
|
||||
this.ipcRenderer.on(IpcEvents.app.getAppStartInfoReply, (event: string, arg: AppStartInfo) => {
|
||||
this.dispachStoreAction(new ProcessAppStartInfoAction(arg));
|
||||
});
|
||||
|
||||
this.ipcRenderer.on('__ELECTRON_LOG_RENDERER__', (event: string, level: string, message: string) => {
|
||||
this.zone.run(() => this.store.dispatch(new ElectronMainLogReceivedAction({level, message})));
|
||||
});
|
||||
}
|
||||
|
||||
private dispachStoreAction(action: Action) {
|
||||
|
||||
@@ -1,13 +1,14 @@
|
||||
import { Injectable, NgZone } from '@angular/core';
|
||||
import { Action, Store } from '@ngrx/store';
|
||||
|
||||
import { IpcEvents, LogService, IpcResponse } from 'uhk-common';
|
||||
import { AppState } from '../store/index';
|
||||
import { IpcEvents, IpcResponse, LogService } from 'uhk-common';
|
||||
import { AppState } from '../store';
|
||||
import { IpcCommonRenderer } from './ipc-common-renderer';
|
||||
import {
|
||||
ConnectionStateChangedAction,
|
||||
SaveConfigurationReplyAction,
|
||||
SetPrivilegeOnLinuxReplyAction
|
||||
SetPrivilegeOnLinuxReplyAction,
|
||||
UpdateFirmwareReplyAction
|
||||
} from '../store/actions/device';
|
||||
import { LoadConfigFromDeviceReplyAction } from '../store/actions/user-config';
|
||||
|
||||
@@ -33,6 +34,14 @@ export class DeviceRendererService {
|
||||
this.ipcRenderer.send(IpcEvents.device.loadConfigurations);
|
||||
}
|
||||
|
||||
updateFirmware(data?: Array<number>): void {
|
||||
this.ipcRenderer.send(IpcEvents.device.updateFirmware, JSON.stringify(data));
|
||||
}
|
||||
|
||||
startConnectionPoller(): void {
|
||||
this.ipcRenderer.send(IpcEvents.device.startConnectionPoller);
|
||||
}
|
||||
|
||||
private registerEvents(): void {
|
||||
this.ipcRenderer.on(IpcEvents.device.deviceConnectionStateChanged, (event: string, arg: boolean) => {
|
||||
this.dispachStoreAction(new ConnectionStateChangedAction(arg));
|
||||
@@ -49,10 +58,14 @@ export class DeviceRendererService {
|
||||
this.ipcRenderer.on(IpcEvents.device.loadConfigurationReply, (event: string, response: string) => {
|
||||
this.dispachStoreAction(new LoadConfigFromDeviceReplyAction(JSON.parse(response)));
|
||||
});
|
||||
|
||||
this.ipcRenderer.on(IpcEvents.device.updateFirmwareReply, (event: string, response: IpcResponse) => {
|
||||
this.dispachStoreAction(new UpdateFirmwareReplyAction(response));
|
||||
});
|
||||
}
|
||||
|
||||
private dispachStoreAction(action: Action): void {
|
||||
this.logService.info('[DeviceRendererService] dispatch action', action);
|
||||
this.logService.info('[DeviceRendererService] dispatch action', JSON.stringify(action));
|
||||
this.zone.run(() => this.store.dispatch(action));
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user