Merge branch 'master' into auto-write-config
This commit is contained in:
5
package-lock.json
generated
5
package-lock.json
generated
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "uhk-agent",
|
||||
"version": "1.4.1",
|
||||
"version": "1.0.0",
|
||||
"lockfileVersion": 1,
|
||||
"requires": true,
|
||||
"dependencies": {
|
||||
@@ -4085,8 +4085,7 @@
|
||||
"jsbn": {
|
||||
"version": "0.1.1",
|
||||
"bundled": true,
|
||||
"dev": true,
|
||||
"optional": true
|
||||
"dev": true
|
||||
},
|
||||
"json-schema": {
|
||||
"version": "0.2.3",
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
"private": true,
|
||||
"author": "Ultimate Gadget Laboratories",
|
||||
"main": "electron/dist/electron-main.js",
|
||||
"version": "1.4.3",
|
||||
"version": "1.0.0",
|
||||
"description": "Agent is the configuration application of the Ultimate Hacking Keyboard.",
|
||||
"repository": {
|
||||
"type": "git",
|
||||
|
||||
@@ -16,8 +16,9 @@
|
||||
"dependencies": {
|
||||
"node-hid": "0.5.7"
|
||||
},
|
||||
"firmwareVersion": "6.0.0",
|
||||
"dataModelVersion": "4.0.0",
|
||||
"usbProtocolVersion": "3.0.0",
|
||||
"slaveProtocolVersion": "3.0.0"
|
||||
"firmwareVersion": "7.0.0",
|
||||
"deviceProtocolVersion": "4.0.0",
|
||||
"moduleProtocolVersion": "3.0.0",
|
||||
"userConfigVersion": "4.0.0",
|
||||
"hardwareConfigVersion": "1.0.0"
|
||||
}
|
||||
|
||||
@@ -34,10 +34,11 @@ export class AppService extends MainServiceBase {
|
||||
hasPermission: this.uhkHidDeviceService.hasPermission(),
|
||||
agentVersionInfo: {
|
||||
version: packageJson.version,
|
||||
dataModelVersion: packageJson.dataModelVersion,
|
||||
usbProtocolVersion: packageJson.usbProtocolVersion,
|
||||
slaveProtocolVersion: packageJson.slaveProtocolVersion,
|
||||
firmwareVersion: packageJson.firmwareVersion
|
||||
firmwareVersion: packageJson.firmwareVersion,
|
||||
deviceProtocolVersion: packageJson.deviceProtocolVersion,
|
||||
moduleProtocolVersion: packageJson.moduleProtocolVersion,
|
||||
userConfigVersion: packageJson.userConfigVersion,
|
||||
hardwareConfigVersion: packageJson.hardwareConfigVersion
|
||||
}
|
||||
};
|
||||
this.logService.info('[AppService] getAppStartInfo response:', response);
|
||||
|
||||
@@ -3,9 +3,9 @@ import { UserConfiguration } from '../user-configuration';
|
||||
describe('keymap', () => {
|
||||
it('should normalize SwitchLayerAction if non base layer action is not SwitchLayerAction', () => {
|
||||
const inputJsonConfig = {
|
||||
dataModelMajorVersion: 3,
|
||||
dataModelMinorVersion: 0,
|
||||
dataModelPatchVersion: 0,
|
||||
userConfigMajorVersion: 3,
|
||||
userConfigMinorVersion: 0,
|
||||
userConfigPatchVersion: 0,
|
||||
deviceName: 'My UHK',
|
||||
doubleTapSwitchLayerTimeout: 250,
|
||||
iconsAndLayerTextsBrightness: 255,
|
||||
@@ -75,9 +75,9 @@ describe('keymap', () => {
|
||||
]
|
||||
};
|
||||
const expectedJsonConfig = {
|
||||
dataModelMajorVersion: 3,
|
||||
dataModelMinorVersion: 0,
|
||||
dataModelPatchVersion: 0,
|
||||
userConfigMajorVersion: 3,
|
||||
userConfigMinorVersion: 0,
|
||||
userConfigPatchVersion: 0,
|
||||
deviceName: 'My UHK',
|
||||
doubleTapSwitchLayerTimeout: 250,
|
||||
iconsAndLayerTextsBrightness: 255,
|
||||
@@ -156,9 +156,9 @@ describe('keymap', () => {
|
||||
|
||||
it('should normalize SwitchLayerAction if non base layer action is other SwitchLayerAction', () => {
|
||||
const inputJsonConfig = {
|
||||
dataModelMajorVersion: 3,
|
||||
dataModelMinorVersion: 0,
|
||||
dataModelPatchVersion: 0,
|
||||
userConfigMajorVersion: 3,
|
||||
userConfigMinorVersion: 0,
|
||||
userConfigPatchVersion: 0,
|
||||
deviceName: 'My UHK',
|
||||
doubleTapSwitchLayerTimeout: 250,
|
||||
iconsAndLayerTextsBrightness: 255,
|
||||
@@ -228,9 +228,9 @@ describe('keymap', () => {
|
||||
]
|
||||
};
|
||||
const expectedJsonConfig = {
|
||||
dataModelMajorVersion: 3,
|
||||
dataModelMinorVersion: 0,
|
||||
dataModelPatchVersion: 0,
|
||||
userConfigMajorVersion: 3,
|
||||
userConfigMinorVersion: 0,
|
||||
userConfigPatchVersion: 0,
|
||||
deviceName: 'My UHK',
|
||||
doubleTapSwitchLayerTimeout: 250,
|
||||
iconsAndLayerTextsBrightness: 255,
|
||||
|
||||
@@ -8,9 +8,9 @@ describe('user-configuration', () => {
|
||||
|
||||
it('should transform an empty config', () => {
|
||||
jsonTester({
|
||||
dataModelMajorVersion: 3,
|
||||
dataModelMinorVersion: 0,
|
||||
dataModelPatchVersion: 0,
|
||||
userConfigMajorVersion: 3,
|
||||
userConfigMinorVersion: 0,
|
||||
userConfigPatchVersion: 0,
|
||||
deviceName: 'My UHK',
|
||||
doubleTapSwitchLayerTimeout: 250,
|
||||
iconsAndLayerTextsBrightness: 255,
|
||||
@@ -34,9 +34,9 @@ describe('user-configuration', () => {
|
||||
|
||||
it('should transform a null keyActionType ', () => {
|
||||
jsonTester({
|
||||
dataModelMajorVersion: 3,
|
||||
dataModelMinorVersion: 0,
|
||||
dataModelPatchVersion: 0,
|
||||
userConfigMajorVersion: 3,
|
||||
userConfigMinorVersion: 0,
|
||||
userConfigPatchVersion: 0,
|
||||
deviceName: 'My UHK',
|
||||
doubleTapSwitchLayerTimeout: 250,
|
||||
iconsAndLayerTextsBrightness: 255,
|
||||
@@ -75,7 +75,7 @@ describe('user-configuration', () => {
|
||||
|
||||
it('Should set the device name to "My UHK" if not exists in the config', () => {
|
||||
const original = {
|
||||
dataModelVersion: 1,
|
||||
userConfigVersion: 1,
|
||||
moduleConfigurations: [],
|
||||
macros: [],
|
||||
keymaps: []
|
||||
|
||||
@@ -8,13 +8,13 @@ import { ConfigSerializer } from '../config-serializer';
|
||||
export class UserConfiguration {
|
||||
|
||||
@assertUInt16
|
||||
dataModelMajorVersion: number;
|
||||
userConfigMajorVersion: number;
|
||||
|
||||
@assertUInt16
|
||||
dataModelMinorVersion: number;
|
||||
userConfigMinorVersion: number;
|
||||
|
||||
@assertUInt16
|
||||
dataModelPatchVersion: number;
|
||||
userConfigPatchVersion: number;
|
||||
|
||||
@assertUInt16
|
||||
userConfigurationLength: number;
|
||||
@@ -74,9 +74,9 @@ export class UserConfiguration {
|
||||
}
|
||||
|
||||
fromJsonObject(jsonObject: any): UserConfiguration {
|
||||
this.dataModelMajorVersion = jsonObject.dataModelMajorVersion;
|
||||
this.dataModelMinorVersion = jsonObject.dataModelMinorVersion;
|
||||
this.dataModelPatchVersion = jsonObject.dataModelPatchVersion;
|
||||
this.userConfigMajorVersion = jsonObject.userConfigMajorVersion;
|
||||
this.userConfigMinorVersion = jsonObject.userConfigMinorVersion;
|
||||
this.userConfigPatchVersion = jsonObject.userConfigPatchVersion;
|
||||
this.deviceName = jsonObject.deviceName;
|
||||
this.setDefaultDeviceName();
|
||||
this.doubleTapSwitchLayerTimeout = jsonObject.doubleTapSwitchLayerTimeout;
|
||||
@@ -107,9 +107,9 @@ export class UserConfiguration {
|
||||
}
|
||||
|
||||
fromBinary(buffer: UhkBuffer): UserConfiguration {
|
||||
this.dataModelMajorVersion = buffer.readUInt16();
|
||||
this.dataModelMinorVersion = buffer.readUInt16();
|
||||
this.dataModelPatchVersion = buffer.readUInt16();
|
||||
this.userConfigMajorVersion = buffer.readUInt16();
|
||||
this.userConfigMinorVersion = buffer.readUInt16();
|
||||
this.userConfigPatchVersion = buffer.readUInt16();
|
||||
this.userConfigurationLength = buffer.readUInt16();
|
||||
this.deviceName = buffer.readString();
|
||||
this.setDefaultDeviceName();
|
||||
@@ -147,9 +147,9 @@ export class UserConfiguration {
|
||||
|
||||
toJsonObject(): any {
|
||||
return {
|
||||
dataModelMajorVersion: this.dataModelMajorVersion,
|
||||
dataModelMinorVersion: this.dataModelMinorVersion,
|
||||
dataModelPatchVersion: this.dataModelPatchVersion,
|
||||
userConfigMajorVersion: this.userConfigMajorVersion,
|
||||
userConfigMinorVersion: this.userConfigMinorVersion,
|
||||
userConfigPatchVersion: this.userConfigPatchVersion,
|
||||
deviceName: this.deviceName,
|
||||
doubleTapSwitchLayerTimeout: this.doubleTapSwitchLayerTimeout,
|
||||
iconsAndLayerTextsBrightness: this.iconsAndLayerTextsBrightness,
|
||||
@@ -172,9 +172,9 @@ export class UserConfiguration {
|
||||
}
|
||||
|
||||
toBinary(buffer: UhkBuffer): void {
|
||||
buffer.writeUInt16(this.dataModelMajorVersion);
|
||||
buffer.writeUInt16(this.dataModelMinorVersion);
|
||||
buffer.writeUInt16(this.dataModelPatchVersion);
|
||||
buffer.writeUInt16(this.userConfigMajorVersion);
|
||||
buffer.writeUInt16(this.userConfigMinorVersion);
|
||||
buffer.writeUInt16(this.userConfigPatchVersion);
|
||||
buffer.writeUInt16(this.userConfigurationLength);
|
||||
buffer.writeString(this.deviceName);
|
||||
buffer.writeUInt16(this.doubleTapSwitchLayerTimeout);
|
||||
@@ -199,8 +199,8 @@ export class UserConfiguration {
|
||||
}
|
||||
|
||||
toString(): string {
|
||||
return `<UserConfiguration dataModelVersion="${this.dataModelMajorVersion}.\
|
||||
${this.dataModelMinorVersion}.${this.dataModelPatchVersion}">`;
|
||||
return `<UserConfiguration userConfigVersion="${this.userConfigMajorVersion}.\
|
||||
${this.userConfigMinorVersion}.${this.userConfigPatchVersion}">`;
|
||||
}
|
||||
|
||||
getKeymap(keymapAbbreviation: string): Keymap {
|
||||
|
||||
@@ -1,7 +1,8 @@
|
||||
export interface VersionInformation {
|
||||
version: string;
|
||||
dataModelVersion: string;
|
||||
usbProtocolVersion: string;
|
||||
slaveProtocolVersion: string;
|
||||
firmwareVersion: string;
|
||||
deviceProtocolVersion: string;
|
||||
moduleProtocolVersion: string;
|
||||
userConfigVersion: string;
|
||||
hardwareConfigVersion: string;
|
||||
}
|
||||
|
||||
@@ -82,9 +82,9 @@ export class KeymapEditComponent {
|
||||
site: 'https://ultimatehackingkeyboard.com',
|
||||
description: 'Ultimate Hacking Keyboard keymap',
|
||||
keyboardModel: 'UHK60',
|
||||
dataModelMajorVersion: userConfiguration.dataModelMajorVersion,
|
||||
dataModelMinorVersion: userConfiguration.dataModelMinorVersion,
|
||||
dataModelPatchVersion: userConfiguration.dataModelPatchVersion,
|
||||
userConfigMajorVersion: userConfiguration.userConfigMajorVersion,
|
||||
userConfigMinorVersion: userConfiguration.userConfigMinorVersion,
|
||||
userConfigPatchVersion: userConfiguration.userConfigPatchVersion,
|
||||
objectType: 'keymap',
|
||||
objectValue: keymap.toJsonObject()
|
||||
};
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"signature": "UHK",
|
||||
"dataModelVersion": 0,
|
||||
"hardwareConfigVersion": 0,
|
||||
"hardwareId": 0,
|
||||
"brandId": 0,
|
||||
"isIso": false,
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
{
|
||||
"dataModelMajorVersion": 3,
|
||||
"dataModelMinorVersion": 0,
|
||||
"dataModelPatchVersion": 0,
|
||||
"userConfigMajorVersion": 4,
|
||||
"userConfigMinorVersion": 0,
|
||||
"userConfigPatchVersion": 0,
|
||||
"deviceName": "My UHK",
|
||||
"doubleTapSwitchLayerTimeout": 250,
|
||||
"iconsAndLayerTextsBrightness": 255,
|
||||
|
||||
@@ -44,7 +44,7 @@ export class UserConfigEffects {
|
||||
const userConfig = new UserConfiguration();
|
||||
userConfig.fromBinary(UhkBuffer.fromArray(data));
|
||||
|
||||
if (userConfig.dataModelMajorVersion > 0) {
|
||||
if (userConfig.userConfigMajorVersion > 0) {
|
||||
return userConfig;
|
||||
}
|
||||
|
||||
@@ -211,8 +211,8 @@ export class UserConfigEffects {
|
||||
let config: UserConfiguration;
|
||||
|
||||
if (configJsonObject) {
|
||||
if (configJsonObject.dataModelMajorVersion ===
|
||||
this.defaultUserConfigurationService.getDefault().dataModelMajorVersion) {
|
||||
if (configJsonObject.userConfigMajorVersion ===
|
||||
this.defaultUserConfigurationService.getDefault().userConfigMajorVersion) {
|
||||
config = new UserConfiguration().fromJsonObject(configJsonObject);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -56,7 +56,7 @@ describe('user-configuration reducer', () => {
|
||||
const result = reducer(state, saveKeyAction);
|
||||
expect(result).not.toBe(defaultUserConfig);
|
||||
expect(result.toJsonObject()).toEqual({
|
||||
dataModelVersion: 4,
|
||||
userConfigVersion: 4,
|
||||
moduleConfigurations: [
|
||||
{
|
||||
id: 1,
|
||||
@@ -233,7 +233,7 @@ describe('user-configuration reducer', () => {
|
||||
const result = reducer(state, saveKeyAction);
|
||||
expect(result).not.toBe(defaultUserConfig);
|
||||
expect(result.toJsonObject()).toEqual({
|
||||
dataModelVersion: 4,
|
||||
userConfigVersion: 4,
|
||||
moduleConfigurations: [
|
||||
{
|
||||
id: 1,
|
||||
|
||||
@@ -1,9 +1,9 @@
|
||||
import { cloneDeep } from 'lodash';
|
||||
|
||||
const defaultUserConfig = {
|
||||
dataModelMajorVersion: 3,
|
||||
dataModelMinorVersion: 0,
|
||||
dataModelPatchVersion: 0,
|
||||
userConfigMajorVersion: 3,
|
||||
userConfigMinorVersion: 0,
|
||||
userConfigPatchVersion: 0,
|
||||
deviceName: 'My UHK',
|
||||
doubleTapSwitchLayerTimeout: 250,
|
||||
iconsAndLayerTextsBrightness: 255,
|
||||
|
||||
Reference in New Issue
Block a user