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:
committed by
László Monda
parent
d621b1e5e6
commit
96e968729d
@@ -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 {
|
||||
|
||||
Reference in New Issue
Block a user