@@ -17,6 +17,8 @@ import { KeymapEditComponent as SharedKeymapEditComponent } from '../../../share
|
|||||||
|
|
||||||
import { UhkDeviceService } from '../../../services/uhk-device.service';
|
import { UhkDeviceService } from '../../../services/uhk-device.service';
|
||||||
|
|
||||||
|
import { getUserConfiguration } from '../../../shared/store/reducers/user-configuration';
|
||||||
|
|
||||||
@Component({
|
@Component({
|
||||||
selector: 'keymap-edit',
|
selector: 'keymap-edit',
|
||||||
templateUrl: '../../../shared/components/keymap/edit/keymap-edit.component.html',
|
templateUrl: '../../../shared/components/keymap/edit/keymap-edit.component.html',
|
||||||
@@ -53,6 +55,14 @@ export class KeymapEditComponent extends SharedKeymapEditComponent {
|
|||||||
this.sendKeymap();
|
this.sendKeymap();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@HostListener('window:keydown.control.o', ['$event'])
|
||||||
|
onCtrlO(event: KeyboardEvent): void {
|
||||||
|
console.log('ctrl + o pressed');
|
||||||
|
event.preventDefault();
|
||||||
|
event.stopPropagation();
|
||||||
|
this.sendUserConfiguration();
|
||||||
|
}
|
||||||
|
|
||||||
private sendLayer(): void {
|
private sendLayer(): void {
|
||||||
const currentLayer: number = this.wrap.getSelectedLayer();
|
const currentLayer: number = this.wrap.getSelectedLayer();
|
||||||
this.keymap$
|
this.keymap$
|
||||||
@@ -90,4 +100,22 @@ export class KeymapEditComponent extends SharedKeymapEditComponent {
|
|||||||
() => console.log('Keymap has been sucessfully uploaded')
|
() => console.log('Keymap has been sucessfully uploaded')
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private sendUserConfiguration(): void {
|
||||||
|
this.store
|
||||||
|
.let(getUserConfiguration())
|
||||||
|
.map(userConfiguration => {
|
||||||
|
const uhkBuffer = new UhkBuffer();
|
||||||
|
userConfiguration.toBinary(uhkBuffer);
|
||||||
|
return uhkBuffer.getBufferContent();
|
||||||
|
})
|
||||||
|
.switchMap((buffer: Buffer) => this.uhkDevice.sendConfig(buffer))
|
||||||
|
.do(response => console.log('Sending user configuration finished', response))
|
||||||
|
.switchMap(() => this.uhkDevice.applyConfig())
|
||||||
|
.subscribe(
|
||||||
|
(response) => console.log('Applying user configuration finished', response),
|
||||||
|
error => console.error('Error during uploading user configuration', error),
|
||||||
|
() => console.log('User configuration has been sucessfully uploaded')
|
||||||
|
);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -27,7 +27,7 @@ export class KeymapEditComponent {
|
|||||||
private deletable$: Observable<boolean>;
|
private deletable$: Observable<boolean>;
|
||||||
|
|
||||||
constructor(
|
constructor(
|
||||||
private store: Store<AppState>,
|
protected store: Store<AppState>,
|
||||||
private route: ActivatedRoute
|
private route: ActivatedRoute
|
||||||
) {
|
) {
|
||||||
this.keymap$ = route
|
this.keymap$ = route
|
||||||
|
|||||||
Reference in New Issue
Block a user