feat(device): Read user config from eeprom (#413)

* feat(device): Read user config from eeprom

* read data from eeprom

* fix user config serialization

* fix device connected detection

* not allow override default config is eeprom is empty

* add error handling to eeprom parsing

* colorize log output

* add USB[T] feature

* add class name to USB[T] log

* remove redundant error log msg

* Add USB[T] to Apply user config
This commit is contained in:
Róbert Kiss
2017-09-17 12:45:20 +00:00
committed by László Monda
parent d621b1e5e6
commit 96e968729d
11 changed files with 185 additions and 33 deletions
@@ -9,6 +9,7 @@ import {
SaveConfigurationReplyAction,
SetPrivilegeOnLinuxReplyAction
} from '../store/actions/device';
import { LoadUserConfigFromDeviceReplyAction } from '../store/actions/user-config';
@Injectable()
export class DeviceRendererService {
@@ -28,6 +29,10 @@ export class DeviceRendererService {
this.ipcRenderer.send(IpcEvents.device.saveUserConfiguration, JSON.stringify(buffer));
}
loadUserConfiguration(): void {
this.ipcRenderer.send(IpcEvents.device.loadUserConfiguration);
}
private registerEvents(): void {
this.ipcRenderer.on(IpcEvents.device.deviceConnectionStateChanged, (event: string, arg: boolean) => {
this.dispachStoreAction(new ConnectionStateChangedAction(arg));
@@ -40,6 +45,10 @@ export class DeviceRendererService {
this.ipcRenderer.on(IpcEvents.device.saveUserConfigurationReply, (event: string, response: IpcResponse) => {
this.dispachStoreAction(new SaveConfigurationReplyAction(response));
});
this.ipcRenderer.on(IpcEvents.device.loadUserConfigurationReply, (event: string, response: string) => {
this.dispachStoreAction(new LoadUserConfigFromDeviceReplyAction(JSON.parse(response)));
});
}
private dispachStoreAction(action: Action): void {