diff --git a/.travis.yml b/.travis.yml index 19345ae2..2ff64b02 100644 --- a/.travis.yml +++ b/.travis.yml @@ -32,7 +32,6 @@ install: before_script: - npm run build - - npm run build:test - npm run lint script: diff --git a/package-lock.json b/package-lock.json index 88d878cc..038e6e5f 100644 --- a/package-lock.json +++ b/package-lock.json @@ -16,13 +16,19 @@ "integrity": "sha1-ixuKArfpLRDOibzRbnroza5xKZ8=", "dev": true, "requires": { - "@types/node": "8.0.25" + "@types/node": "8.0.30" } }, + "@types/jasmine": { + "version": "2.6.0", + "resolved": "https://registry.npmjs.org/@types/jasmine/-/jasmine-2.6.0.tgz", + "integrity": "sha512-1ZZdFvYA5zARDXPj5+VF0bwDZWH/o0QQWJVDc5srdC/DngcCZXskR33eR/4PielGvBjLQpQOd6KiQbmtqVkeZA==", + "dev": true + }, "@types/node": { - "version": "8.0.25", - "resolved": "https://registry.npmjs.org/@types/node/-/node-8.0.25.tgz", - "integrity": "sha512-zT+t9841g1HsjLtPMCYxmb1U4pcZ2TOegAKiomlmj6bIziuaEYHUavxLE9NRwdntY0vOCrgHho6OXjDX7fm/Kw==", + "version": "8.0.30", + "resolved": "https://registry.npmjs.org/@types/node/-/node-8.0.30.tgz", + "integrity": "sha512-IaQtG3DWe9gRsmk1DqNnYyRVjGDVcBdZywkRVF2f62Boe8XKmlR7lNcwC6pk4V4W8nk+Zu+vdGMsOdRTDj1JPA==", "dev": true }, "@types/node-hid": { @@ -37,7 +43,7 @@ "integrity": "sha1-+9YF06q7WccUFqj1ku7krinppuE=", "dev": true, "requires": { - "@types/node": "8.0.25" + "@types/node": "8.0.30" } }, "7zip": { @@ -8816,9 +8822,9 @@ "dev": true }, "typescript": { - "version": "2.4.2", - "resolved": "https://registry.npmjs.org/typescript/-/typescript-2.4.2.tgz", - "integrity": "sha1-+DlfhdRZJ2BnyYiqQYN6j4KHCEQ=", + "version": "2.5.2", + "resolved": "https://registry.npmjs.org/typescript/-/typescript-2.5.2.tgz", + "integrity": "sha1-A4qV99m7tCCxvzW6MdTFwd0//jQ=", "dev": true }, "uglify-js": { diff --git a/package.json b/package.json index fb59c630..ff0bcb47 100644 --- a/package.json +++ b/package.json @@ -16,7 +16,8 @@ "devDependencies": { "@types/electron-devtools-installer": "^2.0.2", "@types/electron-settings": "^3.0.0", - "@types/node": "~8.0.25", + "@types/jasmine": "2.6.0", + "@types/node": "8.0.30", "@types/node-hid": "^0.5.2", "@types/usb": "^1.1.3", "autoprefixer": "^6.5.3", @@ -44,25 +45,27 @@ "ts-loader": "^2.3.1", "ts-node": "~3.0.4", "tslint": "~5.5.0", - "typescript": "^2.4.2", + "typescript": "2.5.2", "webpack": "^2.4.1" }, "scripts": { "postinstall": "lerna bootstrap", "test": "lerna exec --scope test-serializer npm test", "lint": "run-s -scn lint:ts lint:style", - "lint:ts": "run-p -sn lint:ts:electron-main lint:ts:electron-renderer lint:ts:web lint:ts:test-serializer", + "lint:ts": "run-p -sn lint:ts:electron-main lint:ts:electron-renderer lint:ts:web lint:ts:test-serializer lint:ts:uhk-usb", "lint:ts:electron-main": "tslint --type-check --project ./packages/uhk-agent/tsconfig.json", "lint:ts:electron-renderer": "tslint --type-check --project ./packages/uhk-web/src/tsconfig.renderer.json", "lint:ts:web": "tslint --type-check --project ./packages/uhk-web/src/tsconfig.app.json", "lint:ts:test-serializer": "tslint --type-check --project ./packages/test-serializer/tsconfig.json", + "lint:ts:uhk-usb": "tslint --type-check --project ./packages/uhk-usb/tsconfig.json", "lint:style": "stylelint \"packages/uhk-agent/src/**/*.scss\" \"packages/uhk-web/src/**/*.scss\" --syntax scss", - "build": "run-s build:web build:electron", + "build": "run-s build:web build:electron build:usb build:common", "build:web": "lerna exec --scope uhk-web npm run build", "build:electron": "cross-env AOT_BUILD=true run-s -sn build:electron:renderer build:electron:main", "build:electron:main": "lerna exec --scope uhk-agent npm run build", "build:electron:renderer": "lerna exec --scope uhk-web npm run build:renderer", - "build:test": "lerna exec --scope test-serializer npm run build", + "build:common": "lerna exec --scope uhk-common npm run build", + "build:usb": "lerna exec --scope uhk-usb npm run build", "server:web": "lerna exec --scope uhk-web npm start", "server:electron": "lerna exec --scope uhk-web npm run server:renderer", "electron": "lerna exec --scope uhk-agent npm start", @@ -70,6 +73,6 @@ "pack": "node ./scripts/release.js", "sprites": "node ./scripts/generate-svg-sprites", "release": "node ./scripts/release.js", - "clean": "lerna exec rimraf ./node_modules ./dist && rimraf ./node_modules ./dist package-lock.json" + "clean": "lerna exec rimraf ./node_modules ./dist && rimraf ./node_modules ./dist" } } diff --git a/packages/test-serializer/.gitignore b/packages/test-serializer/.gitignore index e95d08bb..7ff427fc 100644 --- a/packages/test-serializer/.gitignore +++ b/packages/test-serializer/.gitignore @@ -1,4 +1,3 @@ -uhk-config.bin -uhk-config-serialized.json -uhk-config-serialized.bin -test-serializer.js +user-config.bin +user-config-serialized.json +user-config-serialized.bin diff --git a/packages/test-serializer/jasmine.json b/packages/test-serializer/jasmine.json new file mode 100644 index 00000000..262298da --- /dev/null +++ b/packages/test-serializer/jasmine.json @@ -0,0 +1,8 @@ +{ + "spec_dir": "spec", + "spec_files": [ + "**/*[sS]pec.ts" + ], + "stopSpecOnExpectationFailure": true, + "random": false +} diff --git a/packages/test-serializer/package-lock.json b/packages/test-serializer/package-lock.json new file mode 100644 index 00000000..5d3f0f90 --- /dev/null +++ b/packages/test-serializer/package-lock.json @@ -0,0 +1,1029 @@ +{ + "name": "test-serializer", + "version": "0.0.0", + "lockfileVersion": 1, + "requires": true, + "dependencies": { + "@types/jasmine": { + "version": "2.6.0", + "resolved": "https://registry.npmjs.org/@types/jasmine/-/jasmine-2.6.0.tgz", + "integrity": "sha512-1ZZdFvYA5zARDXPj5+VF0bwDZWH/o0QQWJVDc5srdC/DngcCZXskR33eR/4PielGvBjLQpQOd6KiQbmtqVkeZA==", + "dev": true + }, + "@types/node": { + "version": "8.0.30", + "resolved": "https://registry.npmjs.org/@types/node/-/node-8.0.30.tgz", + "integrity": "sha512-IaQtG3DWe9gRsmk1DqNnYyRVjGDVcBdZywkRVF2f62Boe8XKmlR7lNcwC6pk4V4W8nk+Zu+vdGMsOdRTDj1JPA==", + "dev": true + }, + "ansi-regex": { + "version": "2.1.1", + "resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-2.1.1.tgz", + "integrity": "sha1-w7M6te42DYbg5ijwRorn7yfWVN8=", + "dev": true + }, + "ansi-styles": { + "version": "3.2.0", + "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-3.2.0.tgz", + "integrity": "sha512-NnSOmMEYtVR2JVMIGTzynRkkaxtiq1xnFBcdQD/DnNCYPoEPsVJhM98BDyaoNOQIi7p4okdi3E27eN7GQbsUug==", + "dev": true, + "requires": { + "color-convert": "1.9.0" + } + }, + "arrify": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/arrify/-/arrify-1.0.1.tgz", + "integrity": "sha1-iYUI2iIm84DfkEcoRWhJwVAaSw0=", + "dev": true + }, + "balanced-match": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/balanced-match/-/balanced-match-1.0.0.tgz", + "integrity": "sha1-ibTRmasr7kneFk6gK4nORi1xt2c=", + "dev": true + }, + "brace-expansion": { + "version": "1.1.8", + "resolved": "https://registry.npmjs.org/brace-expansion/-/brace-expansion-1.1.8.tgz", + "integrity": "sha1-wHshHHyVLsH479Uad+8NHTmQopI=", + "dev": true, + "requires": { + "balanced-match": "1.0.0", + "concat-map": "0.0.1" + } + }, + "builtin-modules": { + "version": "1.1.1", + "resolved": "https://registry.npmjs.org/builtin-modules/-/builtin-modules-1.1.1.tgz", + "integrity": "sha1-Jw8HbFpywC9bZaR9+Uxf46J4iS8=", + "dev": true + }, + "camelcase": { + "version": "4.1.0", + "resolved": "https://registry.npmjs.org/camelcase/-/camelcase-4.1.0.tgz", + "integrity": "sha1-1UVjW+HjPFQmScaRc+Xeas+uNN0=", + "dev": true + }, + "chalk": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/chalk/-/chalk-2.1.0.tgz", + "integrity": "sha512-LUHGS/dge4ujbXMJrnihYMcL4AoOweGnw9Tp3kQuqy1Kx5c1qKjqvMJZ6nVJPMWJtKCTN72ZogH3oeSO9g9rXQ==", + "dev": true, + "requires": { + "ansi-styles": "3.2.0", + "escape-string-regexp": "1.0.5", + "supports-color": "4.4.0" + } + }, + "cliui": { + "version": "3.2.0", + "resolved": "https://registry.npmjs.org/cliui/-/cliui-3.2.0.tgz", + "integrity": "sha1-EgYBU3qRbSmUD5NNo7SNWFo5IT0=", + "dev": true, + "requires": { + "string-width": "1.0.2", + "strip-ansi": "3.0.1", + "wrap-ansi": "2.1.0" + }, + "dependencies": { + "string-width": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/string-width/-/string-width-1.0.2.tgz", + "integrity": "sha1-EYvfW4zcUaKn5w0hHgfisLmxB9M=", + "dev": true, + "requires": { + "code-point-at": "1.1.0", + "is-fullwidth-code-point": "1.0.0", + "strip-ansi": "3.0.1" + } + } + } + }, + "code-point-at": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/code-point-at/-/code-point-at-1.1.0.tgz", + "integrity": "sha1-DQcLTQQ6W+ozovGkDi7bPZpMz3c=", + "dev": true + }, + "coffee-script": { + "version": "1.7.1", + "resolved": "https://registry.npmjs.org/coffee-script/-/coffee-script-1.7.1.tgz", + "integrity": "sha1-YplqhheAx15tUGnROCJyO3NAS/w=", + "dev": true, + "requires": { + "mkdirp": "0.3.5" + }, + "dependencies": { + "mkdirp": { + "version": "0.3.5", + "resolved": "https://registry.npmjs.org/mkdirp/-/mkdirp-0.3.5.tgz", + "integrity": "sha1-3j5fiWHIjHh+4TaN+EmsRBPsqNc=", + "dev": true + } + } + }, + "color-convert": { + "version": "1.9.0", + "resolved": "https://registry.npmjs.org/color-convert/-/color-convert-1.9.0.tgz", + "integrity": "sha1-Gsz5fdc5uYO/mU1W/sj5WFNkG3o=", + "dev": true, + "requires": { + "color-name": "1.1.3" + } + }, + "color-name": { + "version": "1.1.3", + "resolved": "https://registry.npmjs.org/color-name/-/color-name-1.1.3.tgz", + "integrity": "sha1-p9BVi9icQveV3UIyj3QIMcpTvCU=", + "dev": true + }, + "concat-map": { + "version": "0.0.1", + "resolved": "https://registry.npmjs.org/concat-map/-/concat-map-0.0.1.tgz", + "integrity": "sha1-2Klr13/Wjfd5OnMDajug1UBdR3s=", + "dev": true + }, + "cross-spawn": { + "version": "5.1.0", + "resolved": "https://registry.npmjs.org/cross-spawn/-/cross-spawn-5.1.0.tgz", + "integrity": "sha1-6L0O/uWPz/b4+UUQoKVUu/ojVEk=", + "dev": true, + "requires": { + "lru-cache": "4.1.1", + "shebang-command": "1.2.0", + "which": "1.3.0" + }, + "dependencies": { + "lru-cache": { + "version": "4.1.1", + "resolved": "https://registry.npmjs.org/lru-cache/-/lru-cache-4.1.1.tgz", + "integrity": "sha512-q4spe4KTfsAS1SUHLO0wz8Qiyf1+vMIAgpRYioFYDMNqKfHQbg+AVDH3i4fvpl71/P1L0dBl+fQi+P37UYf0ew==", + "dev": true, + "requires": { + "pseudomap": "1.0.2", + "yallist": "2.1.2" + } + } + } + }, + "decamelize": { + "version": "1.2.0", + "resolved": "https://registry.npmjs.org/decamelize/-/decamelize-1.2.0.tgz", + "integrity": "sha1-9lNNFRSCabIDUue+4m9QH5oZEpA=", + "dev": true + }, + "diff": { + "version": "3.3.1", + "resolved": "https://registry.npmjs.org/diff/-/diff-3.3.1.tgz", + "integrity": "sha512-MKPHZDMB0o6yHyDryUOScqZibp914ksXwAMYMTHj6KO8UeKsRYNJD3oNCKjTqZon+V488P7N/HzXF8t7ZR95ww==", + "dev": true + }, + "error-ex": { + "version": "1.3.1", + "resolved": "https://registry.npmjs.org/error-ex/-/error-ex-1.3.1.tgz", + "integrity": "sha1-+FWobOYa3E6GIcPNoh56dhLDqNw=", + "dev": true, + "requires": { + "is-arrayish": "0.2.1" + } + }, + "escape-string-regexp": { + "version": "1.0.5", + "resolved": "https://registry.npmjs.org/escape-string-regexp/-/escape-string-regexp-1.0.5.tgz", + "integrity": "sha1-G2HAViGQqN/2rjuyzwIAyhMLhtQ=", + "dev": true + }, + "execa": { + "version": "0.7.0", + "resolved": "https://registry.npmjs.org/execa/-/execa-0.7.0.tgz", + "integrity": "sha1-lEvs00zEHuMqY6n68nrVpl/Fl3c=", + "dev": true, + "requires": { + "cross-spawn": "5.1.0", + "get-stream": "3.0.0", + "is-stream": "1.1.0", + "npm-run-path": "2.0.2", + "p-finally": "1.0.0", + "signal-exit": "3.0.2", + "strip-eof": "1.0.0" + } + }, + "exit": { + "version": "0.1.2", + "resolved": "https://registry.npmjs.org/exit/-/exit-0.1.2.tgz", + "integrity": "sha1-BjJjj42HfMghB9MKD/8aF8uhzQw=", + "dev": true + }, + "find-up": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/find-up/-/find-up-2.1.0.tgz", + "integrity": "sha1-RdG35QbHF93UgndaK3eSCjwMV6c=", + "dev": true, + "requires": { + "locate-path": "2.0.0" + } + }, + "fs.realpath": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/fs.realpath/-/fs.realpath-1.0.0.tgz", + "integrity": "sha1-FQStJSMVjKpA20onh8sBQRmU6k8=", + "dev": true + }, + "gaze": { + "version": "0.5.2", + "resolved": "https://registry.npmjs.org/gaze/-/gaze-0.5.2.tgz", + "integrity": "sha1-QLcJU30k0dRXZ9takIaJ3+aaxE8=", + "dev": true, + "requires": { + "globule": "0.1.0" + } + }, + "get-caller-file": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/get-caller-file/-/get-caller-file-1.0.2.tgz", + "integrity": "sha1-9wLmMSfn4jHBYKgMFVSstw1QR+U=", + "dev": true + }, + "get-stream": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/get-stream/-/get-stream-3.0.0.tgz", + "integrity": "sha1-jpQ9E1jcN1VQVOy+LtsFqhdO3hQ=", + "dev": true + }, + "glob": { + "version": "3.1.21", + "resolved": "https://registry.npmjs.org/glob/-/glob-3.1.21.tgz", + "integrity": "sha1-0p4KBV3qUTj00H7UDomC6DwgZs0=", + "dev": true, + "requires": { + "graceful-fs": "1.2.3", + "inherits": "1.0.2", + "minimatch": "0.2.14" + }, + "dependencies": { + "inherits": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/inherits/-/inherits-1.0.2.tgz", + "integrity": "sha1-ykMJ2t7mtUzAuNJH6NfHoJdb3Js=", + "dev": true + } + } + }, + "globule": { + "version": "0.1.0", + "resolved": "https://registry.npmjs.org/globule/-/globule-0.1.0.tgz", + "integrity": "sha1-2cjt3h2nnRJaFRt5UzuXhnY0auU=", + "dev": true, + "requires": { + "glob": "3.1.21", + "lodash": "1.0.2", + "minimatch": "0.2.14" + } + }, + "graceful-fs": { + "version": "1.2.3", + "resolved": "https://registry.npmjs.org/graceful-fs/-/graceful-fs-1.2.3.tgz", + "integrity": "sha1-FaSAaldUfLLS2/J/QuiajDRRs2Q=", + "dev": true + }, + "growl": { + "version": "1.7.0", + "resolved": "https://registry.npmjs.org/growl/-/growl-1.7.0.tgz", + "integrity": "sha1-3i1mE20ALhErpw8/EMMc98NQsto=", + "dev": true + }, + "has-flag": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/has-flag/-/has-flag-2.0.0.tgz", + "integrity": "sha1-6CB68cx7MNRGzHC3NLXovhj4jVE=", + "dev": true + }, + "homedir-polyfill": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/homedir-polyfill/-/homedir-polyfill-1.0.1.tgz", + "integrity": "sha1-TCu8inWJmP7r9e1oWA921GdotLw=", + "dev": true, + "requires": { + "parse-passwd": "1.0.0" + } + }, + "hosted-git-info": { + "version": "2.5.0", + "resolved": "https://registry.npmjs.org/hosted-git-info/-/hosted-git-info-2.5.0.tgz", + "integrity": "sha512-pNgbURSuab90KbTqvRPsseaTxOJCZBD0a7t+haSN33piP9cCM4l0CqdzAif2hUqm716UovKB2ROmiabGAKVXyg==", + "dev": true + }, + "inflight": { + "version": "1.0.6", + "resolved": "https://registry.npmjs.org/inflight/-/inflight-1.0.6.tgz", + "integrity": "sha1-Sb1jMdfQLQwJvJEKEHW6gWW1bfk=", + "dev": true, + "requires": { + "once": "1.4.0", + "wrappy": "1.0.2" + } + }, + "inherits": { + "version": "2.0.3", + "resolved": "https://registry.npmjs.org/inherits/-/inherits-2.0.3.tgz", + "integrity": "sha1-Yzwsg+PaQqUC9SRmAiSA9CCCYd4=", + "dev": true + }, + "invert-kv": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/invert-kv/-/invert-kv-1.0.0.tgz", + "integrity": "sha1-EEqOSqym09jNFXqO+L+rLXo//bY=", + "dev": true + }, + "is-arrayish": { + "version": "0.2.1", + "resolved": "https://registry.npmjs.org/is-arrayish/-/is-arrayish-0.2.1.tgz", + "integrity": "sha1-d8mYQFJ6qOyxqLppe4BkWnqSap0=", + "dev": true + }, + "is-builtin-module": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/is-builtin-module/-/is-builtin-module-1.0.0.tgz", + "integrity": "sha1-VAVy0096wxGfj3bDDLwbHgN6/74=", + "dev": true, + "requires": { + "builtin-modules": "1.1.1" + } + }, + "is-fullwidth-code-point": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/is-fullwidth-code-point/-/is-fullwidth-code-point-1.0.0.tgz", + "integrity": "sha1-754xOG8DGn8NZDr4L95QxFfvAMs=", + "dev": true, + "requires": { + "number-is-nan": "1.0.1" + } + }, + "is-stream": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/is-stream/-/is-stream-1.1.0.tgz", + "integrity": "sha1-EtSj3U5o4Lec6428hBc66A2RykQ=", + "dev": true + }, + "isexe": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/isexe/-/isexe-2.0.0.tgz", + "integrity": "sha1-6PvzdNxVb/iUehDcsFctYz8s+hA=", + "dev": true + }, + "jasmine": { + "version": "2.8.0", + "resolved": "https://registry.npmjs.org/jasmine/-/jasmine-2.8.0.tgz", + "integrity": "sha1-awicChFXax8W3xG4AUbZHU6Lij4=", + "dev": true, + "requires": { + "exit": "0.1.2", + "glob": "7.1.2", + "jasmine-core": "2.8.0" + }, + "dependencies": { + "glob": { + "version": "7.1.2", + "resolved": "https://registry.npmjs.org/glob/-/glob-7.1.2.tgz", + "integrity": "sha512-MJTUg1kjuLeQCJ+ccE4Vpa6kKVXkPYJ2mOCQyUuKLcLQsdrMCpBPUi8qVE6+YuaJkozeA9NusTAw3hLr8Xe5EQ==", + "dev": true, + "requires": { + "fs.realpath": "1.0.0", + "inflight": "1.0.6", + "inherits": "2.0.3", + "minimatch": "3.0.4", + "once": "1.4.0", + "path-is-absolute": "1.0.1" + } + }, + "minimatch": { + "version": "3.0.4", + "resolved": "https://registry.npmjs.org/minimatch/-/minimatch-3.0.4.tgz", + "integrity": "sha512-yJHVQEhyqPLUTgt9B83PXu6W3rx4MvvHvSUvToogpwoGDOUQ+yDrR0HRot+yOCdCO7u4hX3pWft6kWBBcqh0UA==", + "dev": true, + "requires": { + "brace-expansion": "1.1.8" + } + } + } + }, + "jasmine-core": { + "version": "2.8.0", + "resolved": "https://registry.npmjs.org/jasmine-core/-/jasmine-core-2.8.0.tgz", + "integrity": "sha1-vMl5rh+f0FcB5F5S5l06XWPxok4=", + "dev": true + }, + "jasmine-growl-reporter": { + "version": "0.2.1", + "resolved": "https://registry.npmjs.org/jasmine-growl-reporter/-/jasmine-growl-reporter-0.2.1.tgz", + "integrity": "sha1-1fCje5L2qD/VxkgrgJSVyQqLVf4=", + "dev": true, + "requires": { + "growl": "1.7.0" + } + }, + "jasmine-node": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/jasmine-node/-/jasmine-node-2.0.0.tgz", + "integrity": "sha1-gXUacjJfVJdJCxQYGlUIfxsDcf8=", + "dev": true, + "requires": { + "coffee-script": "1.7.1", + "gaze": "0.5.2", + "jasmine-growl-reporter": "0.2.1", + "minimist": "0.0.8", + "mkdirp": "0.3.5", + "underscore": "1.6.0", + "walkdir": "0.0.12" + }, + "dependencies": { + "minimist": { + "version": "0.0.8", + "resolved": "https://registry.npmjs.org/minimist/-/minimist-0.0.8.tgz", + "integrity": "sha1-hX/Kv8M5fSYluCKCYuhqp6ARsF0=", + "dev": true + }, + "mkdirp": { + "version": "0.3.5", + "resolved": "https://registry.npmjs.org/mkdirp/-/mkdirp-0.3.5.tgz", + "integrity": "sha1-3j5fiWHIjHh+4TaN+EmsRBPsqNc=", + "dev": true + } + } + }, + "jasmine-ts": { + "version": "0.2.1", + "resolved": "https://registry.npmjs.org/jasmine-ts/-/jasmine-ts-0.2.1.tgz", + "integrity": "sha512-Ljieg2aAfd8JHSmSQgQpGNTCWzD05LdbX21dkmRKuk9xqEz9ip17+033UiWKOUeIy2t+adiOfo0vZzEV61z96A==", + "dev": true, + "requires": { + "jasmine": "2.8.0", + "ts-node": "3.3.0", + "typescript": "2.5.2", + "yargs": "8.0.2" + } + }, + "lcid": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/lcid/-/lcid-1.0.0.tgz", + "integrity": "sha1-MIrMr6C8SDo4Z7S28rlQYlHRuDU=", + "dev": true, + "requires": { + "invert-kv": "1.0.0" + } + }, + "load-json-file": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/load-json-file/-/load-json-file-2.0.0.tgz", + "integrity": "sha1-eUfkIUmvgNaWy/eXvKq8/h/inKg=", + "dev": true, + "requires": { + "graceful-fs": "4.1.11", + "parse-json": "2.2.0", + "pify": "2.3.0", + "strip-bom": "3.0.0" + }, + "dependencies": { + "graceful-fs": { + "version": "4.1.11", + "resolved": "https://registry.npmjs.org/graceful-fs/-/graceful-fs-4.1.11.tgz", + "integrity": "sha1-Dovf5NHduIVNZOBOp8AOKgJuVlg=", + "dev": true + } + } + }, + "locate-path": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/locate-path/-/locate-path-2.0.0.tgz", + "integrity": "sha1-K1aLJl7slExtnA3pw9u7ygNUzY4=", + "dev": true, + "requires": { + "p-locate": "2.0.0", + "path-exists": "3.0.0" + } + }, + "lodash": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/lodash/-/lodash-1.0.2.tgz", + "integrity": "sha1-j1dWDIO1n8JwvT1WG2kAQ0MOJVE=", + "dev": true + }, + "lru-cache": { + "version": "2.7.3", + "resolved": "https://registry.npmjs.org/lru-cache/-/lru-cache-2.7.3.tgz", + "integrity": "sha1-bUUk6LlV+V1PW1iFHOId1y+06VI=", + "dev": true + }, + "make-error": { + "version": "1.3.0", + "resolved": "https://registry.npmjs.org/make-error/-/make-error-1.3.0.tgz", + "integrity": "sha1-Uq06M5zPEM5itAQLcI/nByRLi5Y=", + "dev": true + }, + "mem": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/mem/-/mem-1.1.0.tgz", + "integrity": "sha1-Xt1StIXKHZAP5kiVUFOZoN+kX3Y=", + "dev": true, + "requires": { + "mimic-fn": "1.1.0" + } + }, + "mimic-fn": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/mimic-fn/-/mimic-fn-1.1.0.tgz", + "integrity": "sha1-5md4PZLonb00KBi1IwudYqZyrRg=", + "dev": true + }, + "minimatch": { + "version": "0.2.14", + "resolved": "https://registry.npmjs.org/minimatch/-/minimatch-0.2.14.tgz", + "integrity": "sha1-x054BXT2PG+aCQ6Q775u9TpqdWo=", + "dev": true, + "requires": { + "lru-cache": "2.7.3", + "sigmund": "1.0.1" + } + }, + "minimist": { + "version": "1.2.0", + "resolved": "https://registry.npmjs.org/minimist/-/minimist-1.2.0.tgz", + "integrity": "sha1-o1AIsg9BOD7sH7kU9M1d95omQoQ=", + "dev": true + }, + "mkdirp": { + "version": "0.5.1", + "resolved": "https://registry.npmjs.org/mkdirp/-/mkdirp-0.5.1.tgz", + "integrity": "sha1-MAV0OOrGz3+MR2fzhkjWaX11yQM=", + "dev": true, + "requires": { + "minimist": "0.0.8" + }, + "dependencies": { + "minimist": { + "version": "0.0.8", + "resolved": "https://registry.npmjs.org/minimist/-/minimist-0.0.8.tgz", + "integrity": "sha1-hX/Kv8M5fSYluCKCYuhqp6ARsF0=", + "dev": true + } + } + }, + "normalize-package-data": { + "version": "2.4.0", + "resolved": "https://registry.npmjs.org/normalize-package-data/-/normalize-package-data-2.4.0.tgz", + "integrity": "sha512-9jjUFbTPfEy3R/ad/2oNbKtW9Hgovl5O1FvFWKkKblNXoN/Oou6+9+KKohPK13Yc3/TyunyWhJp6gvRNR/PPAw==", + "dev": true, + "requires": { + "hosted-git-info": "2.5.0", + "is-builtin-module": "1.0.0", + "semver": "5.4.1", + "validate-npm-package-license": "3.0.1" + } + }, + "npm-run-path": { + "version": "2.0.2", + "resolved": "https://registry.npmjs.org/npm-run-path/-/npm-run-path-2.0.2.tgz", + "integrity": "sha1-NakjLfo11wZ7TLLd8jV7GHFTbF8=", + "dev": true, + "requires": { + "path-key": "2.0.1" + } + }, + "number-is-nan": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/number-is-nan/-/number-is-nan-1.0.1.tgz", + "integrity": "sha1-CXtgK1NCKlIsGvuHkDGDNpQaAR0=", + "dev": true + }, + "once": { + "version": "1.4.0", + "resolved": "https://registry.npmjs.org/once/-/once-1.4.0.tgz", + "integrity": "sha1-WDsap3WWHUsROsF9nFC6753Xa9E=", + "dev": true, + "requires": { + "wrappy": "1.0.2" + } + }, + "os-locale": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/os-locale/-/os-locale-2.1.0.tgz", + "integrity": "sha512-3sslG3zJbEYcaC4YVAvDorjGxc7tv6KVATnLPZONiljsUncvihe9BQoVCEs0RZ1kmf4Hk9OBqlZfJZWI4GanKA==", + "dev": true, + "requires": { + "execa": "0.7.0", + "lcid": "1.0.0", + "mem": "1.1.0" + } + }, + "p-finally": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/p-finally/-/p-finally-1.0.0.tgz", + "integrity": "sha1-P7z7FbiZpEEjs0ttzBi3JDNqLK4=", + "dev": true + }, + "p-limit": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/p-limit/-/p-limit-1.1.0.tgz", + "integrity": "sha1-sH/y2aXYi+yAYDWJWiurZqJ5iLw=", + "dev": true + }, + "p-locate": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/p-locate/-/p-locate-2.0.0.tgz", + "integrity": "sha1-IKAQOyIqcMj9OcwuWAaA893l7EM=", + "dev": true, + "requires": { + "p-limit": "1.1.0" + } + }, + "parse-json": { + "version": "2.2.0", + "resolved": "https://registry.npmjs.org/parse-json/-/parse-json-2.2.0.tgz", + "integrity": "sha1-9ID0BDTvgHQfhGkJn43qGPVaTck=", + "dev": true, + "requires": { + "error-ex": "1.3.1" + } + }, + "parse-passwd": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/parse-passwd/-/parse-passwd-1.0.0.tgz", + "integrity": "sha1-bVuTSkVpk7I9N/QKOC1vFmao5cY=", + "dev": true + }, + "path-exists": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/path-exists/-/path-exists-3.0.0.tgz", + "integrity": "sha1-zg6+ql94yxiSXqfYENe1mwEP1RU=", + "dev": true + }, + "path-is-absolute": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/path-is-absolute/-/path-is-absolute-1.0.1.tgz", + "integrity": "sha1-F0uSaHNVNP+8es5r9TpanhtcX18=", + "dev": true + }, + "path-key": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/path-key/-/path-key-2.0.1.tgz", + "integrity": "sha1-QRyttXTFoUDTpLGRDUDYDMn0C0A=", + "dev": true + }, + "path-type": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/path-type/-/path-type-2.0.0.tgz", + "integrity": "sha1-8BLMuEFbcJb8LaoQVMPXI4lZTHM=", + "dev": true, + "requires": { + "pify": "2.3.0" + } + }, + "pify": { + "version": "2.3.0", + "resolved": "https://registry.npmjs.org/pify/-/pify-2.3.0.tgz", + "integrity": "sha1-7RQaasBDqEnqWISY59yosVMw6Qw=", + "dev": true + }, + "pseudomap": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/pseudomap/-/pseudomap-1.0.2.tgz", + "integrity": "sha1-8FKijacOYYkX7wqKw0wa5aaChrM=", + "dev": true + }, + "read-pkg": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/read-pkg/-/read-pkg-2.0.0.tgz", + "integrity": "sha1-jvHAYjxqbbDcZxPEv6xGMysjaPg=", + "dev": true, + "requires": { + "load-json-file": "2.0.0", + "normalize-package-data": "2.4.0", + "path-type": "2.0.0" + } + }, + "read-pkg-up": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/read-pkg-up/-/read-pkg-up-2.0.0.tgz", + "integrity": "sha1-a3KoBImE4MQeeVEP1en6mbO1Sb4=", + "dev": true, + "requires": { + "find-up": "2.1.0", + "read-pkg": "2.0.0" + } + }, + "require-directory": { + "version": "2.1.1", + "resolved": "https://registry.npmjs.org/require-directory/-/require-directory-2.1.1.tgz", + "integrity": "sha1-jGStX9MNqxyXbiNE/+f3kqam30I=", + "dev": true + }, + "require-main-filename": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/require-main-filename/-/require-main-filename-1.0.1.tgz", + "integrity": "sha1-l/cXtp1IeE9fUmpsWqj/3aBVpNE=", + "dev": true + }, + "semver": { + "version": "5.4.1", + "resolved": "https://registry.npmjs.org/semver/-/semver-5.4.1.tgz", + "integrity": "sha512-WfG/X9+oATh81XtllIo/I8gOiY9EXRdv1cQdyykeXK17YcUW3EXUAi2To4pcH6nZtJPr7ZOpM5OMyWJZm+8Rsg==", + "dev": true + }, + "set-blocking": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/set-blocking/-/set-blocking-2.0.0.tgz", + "integrity": "sha1-BF+XgtARrppoA93TgrJDkrPYkPc=", + "dev": true + }, + "shebang-command": { + "version": "1.2.0", + "resolved": "https://registry.npmjs.org/shebang-command/-/shebang-command-1.2.0.tgz", + "integrity": "sha1-RKrGW2lbAzmJaMOfNj/uXer98eo=", + "dev": true, + "requires": { + "shebang-regex": "1.0.0" + } + }, + "shebang-regex": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/shebang-regex/-/shebang-regex-1.0.0.tgz", + "integrity": "sha1-2kL0l0DAtC2yypcoVxyxkMmO/qM=", + "dev": true + }, + "sigmund": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/sigmund/-/sigmund-1.0.1.tgz", + "integrity": "sha1-P/IfGYytIXX587eBhT/ZTQ0ZtZA=", + "dev": true + }, + "signal-exit": { + "version": "3.0.2", + "resolved": "https://registry.npmjs.org/signal-exit/-/signal-exit-3.0.2.tgz", + "integrity": "sha1-tf3AjxKH6hF4Yo5BXiUTK3NkbG0=", + "dev": true + }, + "source-map": { + "version": "0.5.7", + "resolved": "https://registry.npmjs.org/source-map/-/source-map-0.5.7.tgz", + "integrity": "sha1-igOdLRAh0i0eoUyA2OpGi6LvP8w=", + "dev": true + }, + "source-map-support": { + "version": "0.4.18", + "resolved": "https://registry.npmjs.org/source-map-support/-/source-map-support-0.4.18.tgz", + "integrity": "sha512-try0/JqxPLF9nOjvSta7tVondkP5dwgyLDjVoyMDlmjugT2lRZ1OfsrYTkCd2hkDnJTKRbO/Rl3orm8vlsUzbA==", + "dev": true, + "requires": { + "source-map": "0.5.7" + } + }, + "spdx-correct": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/spdx-correct/-/spdx-correct-1.0.2.tgz", + "integrity": "sha1-SzBz2TP/UfORLwOsVRlJikFQ20A=", + "dev": true, + "requires": { + "spdx-license-ids": "1.2.2" + } + }, + "spdx-expression-parse": { + "version": "1.0.4", + "resolved": "https://registry.npmjs.org/spdx-expression-parse/-/spdx-expression-parse-1.0.4.tgz", + "integrity": "sha1-m98vIOH0DtRH++JzJmGR/O1RYmw=", + "dev": true + }, + "spdx-license-ids": { + "version": "1.2.2", + "resolved": "https://registry.npmjs.org/spdx-license-ids/-/spdx-license-ids-1.2.2.tgz", + "integrity": "sha1-yd96NCRZSt5r0RkA1ZZpbcBrrFc=", + "dev": true + }, + "string-width": { + "version": "2.1.1", + "resolved": "https://registry.npmjs.org/string-width/-/string-width-2.1.1.tgz", + "integrity": "sha512-nOqH59deCq9SRHlxq1Aw85Jnt4w6KvLKqWVik6oA9ZklXLNIOlqg4F2yrT1MVaTjAqvVwdfeZ7w7aCvJD7ugkw==", + "dev": true, + "requires": { + "is-fullwidth-code-point": "2.0.0", + "strip-ansi": "4.0.0" + }, + "dependencies": { + "ansi-regex": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-3.0.0.tgz", + "integrity": "sha1-7QMXwyIGT3lGbAKWa922Bas32Zg=", + "dev": true + }, + "is-fullwidth-code-point": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/is-fullwidth-code-point/-/is-fullwidth-code-point-2.0.0.tgz", + "integrity": "sha1-o7MKXE8ZkYMWeqq5O+764937ZU8=", + "dev": true + }, + "strip-ansi": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-4.0.0.tgz", + "integrity": "sha1-qEeQIusaw2iocTibY1JixQXuNo8=", + "dev": true, + "requires": { + "ansi-regex": "3.0.0" + } + } + } + }, + "strip-ansi": { + "version": "3.0.1", + "resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-3.0.1.tgz", + "integrity": "sha1-ajhfuIU9lS1f8F0Oiq+UJ43GPc8=", + "dev": true, + "requires": { + "ansi-regex": "2.1.1" + } + }, + "strip-bom": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/strip-bom/-/strip-bom-3.0.0.tgz", + "integrity": "sha1-IzTBjpx1n3vdVv3vfprj1YjmjtM=", + "dev": true + }, + "strip-eof": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/strip-eof/-/strip-eof-1.0.0.tgz", + "integrity": "sha1-u0P/VZim6wXYm1n80SnJgzE2Br8=", + "dev": true + }, + "strip-json-comments": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/strip-json-comments/-/strip-json-comments-2.0.1.tgz", + "integrity": "sha1-PFMZQukIwml8DsNEhYwobHygpgo=", + "dev": true + }, + "supports-color": { + "version": "4.4.0", + "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-4.4.0.tgz", + "integrity": "sha512-rKC3+DyXWgK0ZLKwmRsrkyHVZAjNkfzeehuFWdGGcqGDTZFH73+RH6S/RDAAxl9GusSjZSUWYLmT9N5pzXFOXQ==", + "dev": true, + "requires": { + "has-flag": "2.0.0" + } + }, + "ts-node": { + "version": "3.3.0", + "resolved": "https://registry.npmjs.org/ts-node/-/ts-node-3.3.0.tgz", + "integrity": "sha1-wTxqMCTjC+EYDdUwOPwgkonUv2k=", + "dev": true, + "requires": { + "arrify": "1.0.1", + "chalk": "2.1.0", + "diff": "3.3.1", + "make-error": "1.3.0", + "minimist": "1.2.0", + "mkdirp": "0.5.1", + "source-map-support": "0.4.18", + "tsconfig": "6.0.0", + "v8flags": "3.0.1", + "yn": "2.0.0" + } + }, + "tsconfig": { + "version": "6.0.0", + "resolved": "https://registry.npmjs.org/tsconfig/-/tsconfig-6.0.0.tgz", + "integrity": "sha1-aw6DdgA9evGGT434+J3QBZ/80DI=", + "dev": true, + "requires": { + "strip-bom": "3.0.0", + "strip-json-comments": "2.0.1" + } + }, + "typescript": { + "version": "2.5.2", + "resolved": "https://registry.npmjs.org/typescript/-/typescript-2.5.2.tgz", + "integrity": "sha1-A4qV99m7tCCxvzW6MdTFwd0//jQ=", + "dev": true + }, + "underscore": { + "version": "1.6.0", + "resolved": "https://registry.npmjs.org/underscore/-/underscore-1.6.0.tgz", + "integrity": "sha1-izixDKze9jM3uLJOT/htRa6lKag=", + "dev": true + }, + "v8flags": { + "version": "3.0.1", + "resolved": "https://registry.npmjs.org/v8flags/-/v8flags-3.0.1.tgz", + "integrity": "sha1-3Oj8N5wX2fLJ6e142JzgAFKxt2s=", + "dev": true, + "requires": { + "homedir-polyfill": "1.0.1" + } + }, + "validate-npm-package-license": { + "version": "3.0.1", + "resolved": "https://registry.npmjs.org/validate-npm-package-license/-/validate-npm-package-license-3.0.1.tgz", + "integrity": "sha1-KAS6vnEq0zeUWaz74kdGqywwP7w=", + "dev": true, + "requires": { + "spdx-correct": "1.0.2", + "spdx-expression-parse": "1.0.4" + } + }, + "walkdir": { + "version": "0.0.12", + "resolved": "https://registry.npmjs.org/walkdir/-/walkdir-0.0.12.tgz", + "integrity": "sha512-HFhaD4mMWPzFSqhpyDG48KDdrjfn409YQuVW7ckZYhW4sE87mYtWifdB/+73RA7+p4s4K18n5Jfx1kHthE1gBw==", + "dev": true + }, + "which": { + "version": "1.3.0", + "resolved": "https://registry.npmjs.org/which/-/which-1.3.0.tgz", + "integrity": "sha512-xcJpopdamTuY5duC/KnTTNBraPK54YwpenP4lzxU8H91GudWpFv38u0CKjclE1Wi2EH2EDz5LRcHcKbCIzqGyg==", + "dev": true, + "requires": { + "isexe": "2.0.0" + } + }, + "which-module": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/which-module/-/which-module-2.0.0.tgz", + "integrity": "sha1-2e8H3Od7mQK4o6j6SzHD4/fm6Ho=", + "dev": true + }, + "wrap-ansi": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/wrap-ansi/-/wrap-ansi-2.1.0.tgz", + "integrity": "sha1-2Pw9KE3QV5T+hJc8rs3Rz4JP3YU=", + "dev": true, + "requires": { + "string-width": "1.0.2", + "strip-ansi": "3.0.1" + }, + "dependencies": { + "string-width": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/string-width/-/string-width-1.0.2.tgz", + "integrity": "sha1-EYvfW4zcUaKn5w0hHgfisLmxB9M=", + "dev": true, + "requires": { + "code-point-at": "1.1.0", + "is-fullwidth-code-point": "1.0.0", + "strip-ansi": "3.0.1" + } + } + } + }, + "wrappy": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/wrappy/-/wrappy-1.0.2.tgz", + "integrity": "sha1-tSQ9jz7BqjXxNkYFvA0QNuMKtp8=", + "dev": true + }, + "y18n": { + "version": "3.2.1", + "resolved": "https://registry.npmjs.org/y18n/-/y18n-3.2.1.tgz", + "integrity": "sha1-bRX7qITAhnnA136I53WegR4H+kE=", + "dev": true + }, + "yallist": { + "version": "2.1.2", + "resolved": "https://registry.npmjs.org/yallist/-/yallist-2.1.2.tgz", + "integrity": "sha1-HBH5IY8HYImkfdUS+TxmmaaoHVI=", + "dev": true + }, + "yargs": { + "version": "8.0.2", + "resolved": "https://registry.npmjs.org/yargs/-/yargs-8.0.2.tgz", + "integrity": "sha1-YpmpBVsc78lp/355wdkY3Osiw2A=", + "dev": true, + "requires": { + "camelcase": "4.1.0", + "cliui": "3.2.0", + "decamelize": "1.2.0", + "get-caller-file": "1.0.2", + "os-locale": "2.1.0", + "read-pkg-up": "2.0.0", + "require-directory": "2.1.1", + "require-main-filename": "1.0.1", + "set-blocking": "2.0.0", + "string-width": "2.1.1", + "which-module": "2.0.0", + "y18n": "3.2.1", + "yargs-parser": "7.0.0" + } + }, + "yargs-parser": { + "version": "7.0.0", + "resolved": "https://registry.npmjs.org/yargs-parser/-/yargs-parser-7.0.0.tgz", + "integrity": "sha1-jQrELxbqVd69MyyvTEA4s+P139k=", + "dev": true, + "requires": { + "camelcase": "4.1.0" + } + }, + "yn": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/yn/-/yn-2.0.0.tgz", + "integrity": "sha1-5a2ryKz0CPY4X8dklWhMiOavaJo=", + "dev": true + } + } +} diff --git a/packages/test-serializer/package.json b/packages/test-serializer/package.json index 979dad32..245af6f4 100644 --- a/packages/test-serializer/package.json +++ b/packages/test-serializer/package.json @@ -16,10 +16,16 @@ "dependencies": { }, "devDependencies": { - "uhk-web": "^1.0.0" + "@types/jasmine": "^2.6.0", + "@types/node": "8.0.30", + "jasmine": "^2.8.0", + "jasmine-core": "^2.8.0", + "jasmine-node": "2.0.0", + "jasmine-ts": "^0.2.1", + "ts-node": "3.3.0", + "uhk-common": "1.0.0" }, "scripts": { - "build": "webpack", - "test": "node ./test-serializer.js" + "test": "jasmine-ts --config=jasmine.json" } } diff --git a/packages/test-serializer/spec/test-serializer.spec.ts b/packages/test-serializer/spec/test-serializer.spec.ts new file mode 100644 index 00000000..3319dc6e --- /dev/null +++ b/packages/test-serializer/spec/test-serializer.spec.ts @@ -0,0 +1,33 @@ +import { UhkBuffer, UserConfiguration } from '../../uhk-common/index'; + +const fs = require('fs'); + +const userConfig = JSON.parse(fs.readFileSync('../uhk-web/src/app/services/user-config.json')); + +describe('Test Serializer', () => { + it('full config match', () => { + const config1Js = userConfig; + const config1Ts: UserConfiguration = new UserConfiguration().fromJsonObject(config1Js); + const config1Buffer = new UhkBuffer(); + config1Ts.toBinary(config1Buffer); + const config1BufferContent = config1Buffer.getBufferContent(); + fs.writeFileSync('user-config.bin', config1BufferContent); + + config1Buffer.offset = 0; + console.log(); + const config2Ts = new UserConfiguration().fromBinary(config1Buffer); + console.log('\n'); + const config2Js = config2Ts.toJsonObject(); + const config2Buffer = new UhkBuffer(); + config2Ts.toBinary(config2Buffer); + fs.writeFileSync('user-config-serialized.json', JSON.stringify(config2Js, undefined, 4)); + const config2BufferContent = config1Buffer.getBufferContent(); + fs.writeFileSync('user-config-serialized.bin', config2BufferContent); + + expect(config1Js).toEqual(config2Js); + + const buffersContentsAreEqual: boolean = Buffer.compare(config1BufferContent, config2BufferContent) === 0; + expect(buffersContentsAreEqual).toBe(true); + + }); +}); diff --git a/packages/test-serializer/test-serializer.ts b/packages/test-serializer/test-serializer.ts deleted file mode 100644 index f0c80fa8..00000000 --- a/packages/test-serializer/test-serializer.ts +++ /dev/null @@ -1,45 +0,0 @@ -import { UserConfiguration } from '../uhk-web/src/app/config-serializer/config-items/user-configuration'; -import { UhkBuffer } from '../uhk-web/src/app/config-serializer/uhk-buffer'; - -const assert = require('assert'); -const fs = require('fs'); - -const userConfig = JSON.parse(fs.readFileSync('../uhk-web/src/app/config-serializer/user-config.json')); - -const config1Js = userConfig; -const config1Ts: UserConfiguration = new UserConfiguration().fromJsonObject(config1Js); -const config1Buffer = new UhkBuffer(); -config1Ts.toBinary(config1Buffer); -const config1BufferContent = config1Buffer.getBufferContent(); -fs.writeFileSync('user-config.bin', config1BufferContent); - -config1Buffer.offset = 0; -console.log(); -const config2Ts = new UserConfiguration().fromBinary(config1Buffer); -console.log('\n'); -const config2Js = config2Ts.toJsonObject(); -const config2Buffer = new UhkBuffer(); -config2Ts.toBinary(config2Buffer); -fs.writeFileSync('user-config-serialized.json', JSON.stringify(config2Js, undefined, 4)); -const config2BufferContent = config1Buffer.getBufferContent(); -fs.writeFileSync('user-config-serialized.bin', config2BufferContent); - -console.log('\n'); -let returnValue = 0; -try { - assert.deepEqual(config1Js, config2Js); - console.log('JSON configurations are identical.'); -} catch (error) { - console.log('JSON configurations differ.'); - returnValue = 1; -} - -const buffersContentsAreEqual: boolean = Buffer.compare(config1BufferContent, config2BufferContent) === 0; -if (buffersContentsAreEqual) { - console.log('Binary configurations are identical.'); -} else { - console.log('Binary configurations differ.'); - returnValue += 2; -} - -process.exit(returnValue); diff --git a/packages/test-serializer/tsconfig.json b/packages/test-serializer/tsconfig.json index cfe52ce5..de579eaa 100644 --- a/packages/test-serializer/tsconfig.json +++ b/packages/test-serializer/tsconfig.json @@ -5,10 +5,7 @@ "moduleResolution": "node", "experimentalDecorators": true, "typeRoots": [ - "../node_modules/@types" - ], - "types": [ - "node" + "./node_modules/@types" ] } } diff --git a/packages/test-serializer/user-config-serialized.bin b/packages/test-serializer/user-config-serialized.bin index 00d907aa..9ff0f1d3 100644 Binary files a/packages/test-serializer/user-config-serialized.bin and b/packages/test-serializer/user-config-serialized.bin differ diff --git a/packages/test-serializer/user-config-serialized.json b/packages/test-serializer/user-config-serialized.json index eae6292e..ae535411 100644 --- a/packages/test-serializer/user-config-serialized.json +++ b/packages/test-serializer/user-config-serialized.json @@ -1,5 +1,5 @@ { - "dataModelVersion": 3, + "dataModelVersion": 4, "moduleConfigurations": [ { "id": 1, @@ -11,7 +11,7 @@ "keymaps": [ { "isDefault": true, - "abbreviation": "QTY", + "abbreviation": "QWR", "name": "QWERTY", "description": "", "layers": [ @@ -23,120 +23,155 @@ "keyActions": [ { "keyActionType": "keystroke", + "type": "basic", "scancode": 36 }, { "keyActionType": "keystroke", + "type": "basic", "scancode": 37 }, { "keyActionType": "keystroke", + "type": "basic", "scancode": 38 }, { "keyActionType": "keystroke", + "type": "basic", "scancode": 39 }, { "keyActionType": "keystroke", + "type": "basic", "scancode": 45 }, { "keyActionType": "keystroke", + "type": "basic", "scancode": 46 }, { "keyActionType": "keystroke", + "type": "basic", "scancode": 42 }, { "keyActionType": "keystroke", - "scancode": 28 - }, - { - "keyActionType": "keystroke", + "type": "basic", "scancode": 24 }, { "keyActionType": "keystroke", + "type": "basic", "scancode": 12 }, { "keyActionType": "keystroke", + "type": "basic", "scancode": 18 }, { "keyActionType": "keystroke", + "type": "basic", "scancode": 19 }, { "keyActionType": "keystroke", + "type": "basic", "scancode": 47 }, { "keyActionType": "keystroke", + "type": "basic", "scancode": 48 }, { "keyActionType": "keystroke", + "type": "basic", "scancode": 49 }, { "keyActionType": "keystroke", - "scancode": 11 + "type": "basic", + "scancode": 28 }, { "keyActionType": "keystroke", + "type": "basic", "scancode": 13 }, { "keyActionType": "keystroke", + "type": "basic", "scancode": 14 }, { "keyActionType": "keystroke", + "type": "basic", "scancode": 15 }, { "keyActionType": "keystroke", + "type": "basic", "scancode": 51 }, { "keyActionType": "keystroke", + "type": "basic", "scancode": 52 }, { "keyActionType": "keystroke", + "type": "basic", "scancode": 40 }, { "keyActionType": "keystroke", + "type": "basic", + "scancode": 11 + }, + { + "keyActionType": "keystroke", + "type": "basic", "scancode": 17 }, { "keyActionType": "keystroke", + "type": "basic", "scancode": 16 }, { "keyActionType": "keystroke", + "type": "basic", "scancode": 54 }, { "keyActionType": "keystroke", + "type": "basic", "scancode": 55 }, { "keyActionType": "keystroke", + "type": "basic", "scancode": 56 }, { "keyActionType": "keystroke", + "type": "basic", "modifierMask": 32 }, + null, { "keyActionType": "keystroke", + "type": "basic", "scancode": 44 }, + { + "keyActionType": "switchLayer", + "layer": "mod", + "toggle": false + }, { "keyActionType": "switchLayer", "layer": "fn", @@ -144,20 +179,18 @@ }, { "keyActionType": "keystroke", + "type": "basic", "modifierMask": 64 }, { "keyActionType": "keystroke", + "type": "basic", "modifierMask": 128 }, { "keyActionType": "keystroke", + "type": "basic", "modifierMask": 16 - }, - { - "keyActionType": "switchLayer", - "layer": "mod", - "toggle": false } ] }, @@ -167,54 +200,68 @@ "keyActions": [ { "keyActionType": "keystroke", + "type": "basic", "scancode": 53 }, { "keyActionType": "keystroke", + "type": "basic", "scancode": 30 }, { "keyActionType": "keystroke", + "type": "basic", "scancode": 31 }, { "keyActionType": "keystroke", + "type": "basic", "scancode": 32 }, { "keyActionType": "keystroke", + "type": "basic", "scancode": 33 }, { "keyActionType": "keystroke", + "type": "basic", "scancode": 34 }, { "keyActionType": "keystroke", + "type": "basic", "scancode": 35 }, { "keyActionType": "keystroke", + "type": "basic", "scancode": 43 }, { "keyActionType": "keystroke", + "type": "basic", "scancode": 20 }, { "keyActionType": "keystroke", + "type": "basic", "scancode": 26 }, { "keyActionType": "keystroke", + "type": "basic", "scancode": 8 }, { "keyActionType": "keystroke", + "type": "basic", "scancode": 21 }, + null, { "keyActionType": "keystroke", + "type": "basic", "scancode": 23 }, { @@ -224,58 +271,74 @@ }, { "keyActionType": "keystroke", + "type": "basic", "scancode": 4 }, { "keyActionType": "keystroke", + "type": "basic", "scancode": 22 }, { "keyActionType": "keystroke", + "type": "basic", "scancode": 7 }, { "keyActionType": "keystroke", + "type": "basic", "scancode": 9 }, + null, { "keyActionType": "keystroke", + "type": "basic", "scancode": 10 }, { "keyActionType": "keystroke", + "type": "basic", "modifierMask": 2 }, + null, { "keyActionType": "keystroke", + "type": "basic", "scancode": 29 }, { "keyActionType": "keystroke", + "type": "basic", "scancode": 27 }, { "keyActionType": "keystroke", + "type": "basic", "scancode": 6 }, { "keyActionType": "keystroke", + "type": "basic", "scancode": 25 }, { "keyActionType": "keystroke", + "type": "basic", "scancode": 5 }, { "keyActionType": "keystroke", + "type": "basic", "modifierMask": 1 }, { "keyActionType": "keystroke", + "type": "basic", "modifierMask": 8 }, { "keyActionType": "keystroke", + "type": "basic", "modifierMask": 4 }, { @@ -283,15 +346,17 @@ "layer": "fn", "toggle": false }, + { + "keyActionType": "keystroke", + "type": "basic", + "scancode": 44 + }, { "keyActionType": "switchLayer", "layer": "mod", "toggle": false }, - { - "keyActionType": "keystroke", - "scancode": 44 - } + null ] }, { @@ -307,68 +372,133 @@ "id": 0, "pointerRole": "none", "keyActions": [ - null, - null, - null, - null, - null, - null, - null, { "keyActionType": "keystroke", - "scancode": 75 + "type": "basic", + "scancode": 64 }, { "keyActionType": "keystroke", + "type": "basic", + "scancode": 65 + }, + { + "keyActionType": "keystroke", + "type": "basic", + "scancode": 66 + }, + { + "keyActionType": "keystroke", + "type": "basic", + "scancode": 67 + }, + { + "keyActionType": "keystroke", + "type": "basic", + "scancode": 68 + }, + { + "keyActionType": "keystroke", + "type": "basic", + "scancode": 69 + }, + { + "keyActionType": "keystroke", + "type": "basic", + "scancode": 76 + }, + { + "keyActionType": "keystroke", + "type": "basic", "scancode": 74 }, { "keyActionType": "keystroke", + "type": "basic", "scancode": 82 }, { "keyActionType": "keystroke", + "type": "basic", "scancode": 77 }, - null, - null, - null, - null, { "keyActionType": "keystroke", - "scancode": 78 + "type": "basic", + "scancode": 76 }, { "keyActionType": "keystroke", + "type": "basic", + "scancode": 70 + }, + { + "keyActionType": "keystroke", + "type": "basic", + "scancode": 71 + }, + { + "keyActionType": "keystroke", + "type": "basic", + "scancode": 72 + }, + { + "keyActionType": "keystroke", + "type": "basic", + "scancode": 75 + }, + { + "keyActionType": "keystroke", + "type": "basic", "scancode": 80 }, { "keyActionType": "keystroke", + "type": "basic", "scancode": 81 }, { "keyActionType": "keystroke", + "type": "basic", "scancode": 79 }, - null, - null, - null, - null, - null, { - "keyActionType": "switchKeymap", - "keymapAbbreviation": "VIM" + "keyActionType": "keystroke", + "type": "basic", + "scancode": 73 }, null, + null, { "keyActionType": "keystroke", + "type": "basic", + "scancode": 78 + }, + { + "keyActionType": "keystroke", + "type": "basic", + "scancode": 41 + }, + null, + null, + null, + { + "keyActionType": "keystroke", + "type": "basic", "scancode": 118 }, { "keyActionType": "keystroke", + "type": "basic", "modifierMask": 32 }, null, + null, + { + "keyActionType": "switchLayer", + "layer": "mod", + "toggle": false + }, { "keyActionType": "switchLayer", "layer": "fn", @@ -376,20 +506,18 @@ }, { "keyActionType": "keystroke", + "type": "basic", "modifierMask": 64 }, { "keyActionType": "keystroke", + "type": "basic", "modifierMask": 128 }, { "keyActionType": "keystroke", + "type": "basic", "modifierMask": 16 - }, - { - "keyActionType": "switchLayer", - "layer": "mod", - "toggle": false } ] }, @@ -397,17 +525,65 @@ "id": 1, "pointerRole": "none", "keyActions": [ + { + "keyActionType": "keystroke", + "type": "basic", + "scancode": 41 + }, + { + "keyActionType": "keystroke", + "type": "basic", + "scancode": 58 + }, + { + "keyActionType": "keystroke", + "type": "basic", + "scancode": 59 + }, + { + "keyActionType": "keystroke", + "type": "basic", + "scancode": 60 + }, + { + "keyActionType": "keystroke", + "type": "basic", + "scancode": 61 + }, + { + "keyActionType": "keystroke", + "type": "basic", + "scancode": 62 + }, + { + "keyActionType": "keystroke", + "type": "basic", + "scancode": 63 + }, null, - null, - null, - null, - null, - null, - null, - null, - null, - null, - null, + { + "keyActionType": "keystroke", + "type": "basic", + "scancode": 41 + }, + { + "keyActionType": "keystroke", + "type": "basic", + "scancode": 75, + "modifierMask": 1 + }, + { + "keyActionType": "keystroke", + "type": "basic", + "scancode": 23, + "modifierMask": 1 + }, + { + "keyActionType": "keystroke", + "type": "basic", + "scancode": 78, + "modifierMask": 1 + }, null, null, { @@ -415,30 +591,71 @@ "layer": "mouse", "toggle": false }, - null, - null, - null, - null, - null, - { - "keyActionType": "keystroke", - "modifierMask": 2 - }, - null, - null, - null, - null, - null, { "keyActionType": "keystroke", + "type": "basic", + "scancode": 57, "modifierMask": 1 }, { "keyActionType": "keystroke", + "type": "basic", + "scancode": 80, + "modifierMask": 5 + }, + { + "keyActionType": "keystroke", + "type": "basic", + "scancode": 43, + "modifierMask": 4 + }, + { + "keyActionType": "keystroke", + "type": "basic", + "scancode": 79, + "modifierMask": 5 + }, + null, + null, + { + "keyActionType": "keystroke", + "type": "basic", + "modifierMask": 2 + }, + null, + null, + { + "keyActionType": "keystroke", + "type": "basic", + "scancode": 75, + "modifierMask": 3 + }, + { + "keyActionType": "keystroke", + "type": "basic", + "scancode": 26, + "modifierMask": 1 + }, + { + "keyActionType": "keystroke", + "type": "basic", + "scancode": 78, + "modifierMask": 3 + }, + null, + { + "keyActionType": "keystroke", + "type": "basic", + "modifierMask": 1 + }, + { + "keyActionType": "keystroke", + "type": "basic", "modifierMask": 8 }, { "keyActionType": "keystroke", + "type": "basic", "modifierMask": 4 }, { @@ -446,6 +663,7 @@ "layer": "fn", "toggle": false }, + null, { "keyActionType": "switchLayer", "layer": "mod", @@ -462,11 +680,6 @@ "id": 0, "pointerRole": "move", "keyActions": [ - { - "keyActionType": "switchLayer", - "layer": "fn", - "toggle": true - }, null, null, null, @@ -476,49 +689,78 @@ null, { "keyActionType": "keystroke", - "scancode": 232 - }, - { - "keyActionType": "keystroke", - "scancode": 237 + "type": "media", + "scancode": 176 }, { "keyActionType": "keystroke", + "type": "media", "scancode": 233 }, + { + "keyActionType": "keystroke", + "type": "media", + "scancode": 183 + }, null, - null, - null, + { + "keyActionType": "switchKeymap", + "keymapAbbreviation": "EGG" + }, + { + "keyActionType": "switchKeymap", + "keymapAbbreviation": "DVO" + }, null, null, { "keyActionType": "keystroke", + "type": "media", + "scancode": 182 + }, + { + "keyActionType": "keystroke", + "type": "media", "scancode": 234 }, { "keyActionType": "keystroke", - "scancode": 238 - }, - { - "keyActionType": "keystroke", - "scancode": 235 + "type": "media", + "scancode": 181 }, null, + { + "keyActionType": "keystroke", + "type": "system", + "scancode": 131 + }, null, null, null, null, { "keyActionType": "keystroke", - "scancode": 239 + "type": "media", + "scancode": 226 }, null, - null, { "keyActionType": "keystroke", + "type": "system", + "scancode": 130 + }, + { + "keyActionType": "keystroke", + "type": "basic", "modifierMask": 32 }, null, + null, + { + "keyActionType": "switchLayer", + "layer": "mod", + "toggle": false + }, { "keyActionType": "switchLayer", "layer": "fn", @@ -526,20 +768,18 @@ }, { "keyActionType": "keystroke", + "type": "basic", "modifierMask": 64 }, { "keyActionType": "keystroke", + "type": "basic", "modifierMask": 128 }, { "keyActionType": "keystroke", + "type": "basic", "modifierMask": 16 - }, - { - "keyActionType": "switchLayer", - "layer": "mod", - "toggle": true } ] }, @@ -547,21 +787,32 @@ "id": 1, "pointerRole": "scroll", "keyActions": [ - null, - null, - null, - null, null, { - "keyActionType": "switchLayer", - "layer": "mouse", - "toggle": true + "keyActionType": "switchKeymap", + "keymapAbbreviation": "DVO" }, { - "keyActionType": "switchLayer", - "layer": "mod", - "toggle": true + "keyActionType": "switchKeymap", + "keymapAbbreviation": "COL" }, + { + "keyActionType": "switchKeymap", + "keymapAbbreviation": "WOR" + }, + { + "keyActionType": "switchKeymap", + "keymapAbbreviation": "1HA" + }, + { + "keyActionType": "switchKeymap", + "keymapAbbreviation": "KAP" + }, + { + "keyActionType": "switchKeymap", + "keymapAbbreviation": "EGG" + }, + null, null, null, null, @@ -571,32 +822,50 @@ { "keyActionType": "switchLayer", "layer": "mouse", - "toggle": true + "toggle": false }, null, null, + { + "keyActionType": "keystroke", + "type": "media", + "scancode": 406 + }, null, null, null, { "keyActionType": "keystroke", + "type": "basic", "modifierMask": 2 }, null, null, null, - null, + { + "keyActionType": "keystroke", + "type": "media", + "scancode": 402 + }, + { + "keyActionType": "keystroke", + "type": "media", + "scancode": 184 + }, null, { "keyActionType": "keystroke", + "type": "basic", "modifierMask": 1 }, { "keyActionType": "keystroke", + "type": "basic", "modifierMask": 8 }, { "keyActionType": "keystroke", + "type": "basic", "modifierMask": 4 }, { @@ -604,10 +873,11 @@ "layer": "fn", "toggle": false }, + null, { "keyActionType": "switchLayer", "layer": "mod", - "toggle": true + "toggle": false }, null ] @@ -627,10 +897,6 @@ null, null, null, - { - "keyActionType": "mouse", - "mouseAction": "scrollUp" - }, null, { "keyActionType": "mouse", @@ -643,7 +909,7 @@ null, { "keyActionType": "mouse", - "mouseAction": "scrollDown" + "mouseAction": "scrollUp" }, { "keyActionType": "mouse", @@ -660,6 +926,10 @@ null, null, null, + { + "keyActionType": "mouse", + "mouseAction": "scrollDown" + }, null, null, null, @@ -668,19 +938,31 @@ null, null, null, + { + "keyActionType": "switchLayer", + "layer": "mod", + "toggle": false + }, + { + "keyActionType": "switchLayer", + "layer": "fn", + "toggle": false + }, { "keyActionType": "keystroke", + "type": "basic", "modifierMask": 64 }, { "keyActionType": "keystroke", + "type": "basic", "modifierMask": 128 }, { "keyActionType": "keystroke", + "type": "basic", "modifierMask": 16 - }, - null + } ] }, { @@ -700,6 +982,7 @@ null, null, null, + null, { "keyActionType": "switchLayer", "layer": "mouse", @@ -725,27 +1008,38 @@ null, null, null, + null, + null, { "keyActionType": "keystroke", + "type": "basic", "modifierMask": 1 }, { "keyActionType": "keystroke", + "type": "basic", "modifierMask": 8 }, { "keyActionType": "keystroke", + "type": "basic", "modifierMask": 4 }, - null, { - "keyActionType": "mouse", - "mouseAction": "accelerate" + "keyActionType": "switchLayer", + "layer": "fn", + "toggle": false }, { "keyActionType": "mouse", "mouseAction": "decelerate" - } + }, + { + "keyActionType": "switchLayer", + "layer": "mod", + "toggle": false + }, + null ] } ] @@ -754,8 +1048,8 @@ }, { "isDefault": false, - "abbreviation": "VIM", - "name": "VIM", + "abbreviation": "DVO", + "name": "DVORAK", "description": "", "layers": [ { @@ -765,96 +1059,655 @@ "pointerRole": "move", "keyActions": [ { - "keyActionType": "mouse", - "mouseAction": "scrollDown" + "keyActionType": "keystroke", + "type": "basic", + "scancode": 36 }, { - "keyActionType": "playMacro", - "macroIndex": 0 + "keyActionType": "keystroke", + "type": "basic", + "scancode": 37 }, { - "keyActionType": "switchKeymap", - "keymapAbbreviation": "QTY" + "keyActionType": "keystroke", + "type": "basic", + "scancode": 38 + }, + { + "keyActionType": "keystroke", + "type": "basic", + "scancode": 39 + }, + { + "keyActionType": "keystroke", + "type": "basic", + "scancode": 47 + }, + { + "keyActionType": "keystroke", + "type": "basic", + "scancode": 48 + }, + { + "keyActionType": "keystroke", + "type": "basic", + "scancode": 42 + }, + { + "keyActionType": "keystroke", + "type": "basic", + "scancode": 10 + }, + { + "keyActionType": "keystroke", + "type": "basic", + "scancode": 6 + }, + { + "keyActionType": "keystroke", + "type": "basic", + "scancode": 21 + }, + { + "keyActionType": "keystroke", + "type": "basic", + "scancode": 15 + }, + { + "keyActionType": "keystroke", + "type": "basic", + "scancode": 56 + }, + { + "keyActionType": "keystroke", + "type": "basic", + "scancode": 46 + }, + { + "keyActionType": "keystroke", + "type": "basic", + "scancode": 49 + }, + { + "keyActionType": "keystroke", + "type": "basic", + "scancode": 9 + }, + { + "keyActionType": "keystroke", + "type": "basic", + "scancode": 11 + }, + { + "keyActionType": "keystroke", + "type": "basic", + "scancode": 23 + }, + { + "keyActionType": "keystroke", + "type": "basic", + "scancode": 17 + }, + { + "keyActionType": "keystroke", + "type": "basic", + "scancode": 22 + }, + { + "keyActionType": "keystroke", + "type": "basic", + "scancode": 45 + }, + { + "keyActionType": "keystroke", + "type": "basic", + "scancode": 40 + }, + { + "keyActionType": "keystroke", + "type": "basic", + "scancode": 7 + }, + { + "keyActionType": "keystroke", + "type": "basic", + "scancode": 5 + }, + { + "keyActionType": "keystroke", + "type": "basic", + "scancode": 16 + }, + { + "keyActionType": "keystroke", + "type": "basic", + "scancode": 26 + }, + { + "keyActionType": "keystroke", + "type": "basic", + "scancode": 25 + }, + { + "keyActionType": "keystroke", + "type": "basic", + "scancode": 29 + }, + { + "keyActionType": "keystroke", + "type": "basic", + "modifierMask": 32 }, null, - null, - null, - null, - null, - null, - null, - null, - null, - null, - null, - null, - null, - null, - null, - null, - null, - null, - null, - null, - null, - null, - null, - null, - null, - null, - null, - null, - null, - null, - null + { + "keyActionType": "keystroke", + "type": "basic", + "scancode": 44 + }, + { + "keyActionType": "switchLayer", + "layer": "mod", + "toggle": false + }, + { + "keyActionType": "switchLayer", + "layer": "fn", + "toggle": false + }, + { + "keyActionType": "keystroke", + "type": "basic", + "modifierMask": 64 + }, + { + "keyActionType": "keystroke", + "type": "basic", + "modifierMask": 128 + }, + { + "keyActionType": "keystroke", + "type": "basic", + "modifierMask": 16 + } ] }, { "id": 1, - "pointerRole": "scroll", + "pointerRole": "move", "keyActions": [ + { + "keyActionType": "keystroke", + "type": "basic", + "scancode": 53 + }, + { + "keyActionType": "keystroke", + "type": "basic", + "scancode": 30 + }, + { + "keyActionType": "keystroke", + "type": "basic", + "scancode": 31 + }, + { + "keyActionType": "keystroke", + "type": "basic", + "scancode": 32 + }, + { + "keyActionType": "keystroke", + "type": "basic", + "scancode": 33 + }, + { + "keyActionType": "keystroke", + "type": "basic", + "scancode": 34 + }, + { + "keyActionType": "keystroke", + "type": "basic", + "scancode": 35 + }, + { + "keyActionType": "keystroke", + "type": "basic", + "scancode": 43 + }, + { + "keyActionType": "keystroke", + "type": "basic", + "scancode": 52 + }, + { + "keyActionType": "keystroke", + "type": "basic", + "scancode": 54 + }, + { + "keyActionType": "keystroke", + "type": "basic", + "scancode": 55 + }, + { + "keyActionType": "keystroke", + "type": "basic", + "scancode": 19 + }, null, + { + "keyActionType": "keystroke", + "type": "basic", + "scancode": 28 + }, + { + "keyActionType": "switchLayer", + "layer": "mouse", + "toggle": false + }, + { + "keyActionType": "keystroke", + "type": "basic", + "scancode": 4 + }, + { + "keyActionType": "keystroke", + "type": "basic", + "scancode": 18 + }, + { + "keyActionType": "keystroke", + "type": "basic", + "scancode": 8 + }, + { + "keyActionType": "keystroke", + "type": "basic", + "scancode": 24 + }, null, + { + "keyActionType": "keystroke", + "type": "basic", + "scancode": 12 + }, + { + "keyActionType": "keystroke", + "type": "basic", + "modifierMask": 2 + }, null, - null, - null, - null, - null, - null, - null, - null, - null, - null, - null, - null, - null, - null, - null, - null, - null, - null, - null, - null, - null, - null, - null, - null, - null, - null, - null, - null, + { + "keyActionType": "keystroke", + "type": "basic", + "scancode": 51 + }, + { + "keyActionType": "keystroke", + "type": "basic", + "scancode": 20 + }, + { + "keyActionType": "keystroke", + "type": "basic", + "scancode": 13 + }, + { + "keyActionType": "keystroke", + "type": "basic", + "scancode": 14 + }, + { + "keyActionType": "keystroke", + "type": "basic", + "scancode": 27 + }, + { + "keyActionType": "keystroke", + "type": "basic", + "modifierMask": 1 + }, + { + "keyActionType": "keystroke", + "type": "basic", + "modifierMask": 8 + }, + { + "keyActionType": "keystroke", + "type": "basic", + "modifierMask": 4 + }, + { + "keyActionType": "switchLayer", + "layer": "fn", + "toggle": false + }, + { + "keyActionType": "keystroke", + "type": "basic", + "scancode": 44 + }, + { + "keyActionType": "switchLayer", + "layer": "mod", + "toggle": false + }, null ] }, { "id": 2, - "pointerRole": "move", + "pointerRole": "scroll", + "keyActions": [] + } + ] + }, + { + "modules": [ + { + "id": 0, + "pointerRole": "none", "keyActions": [ { "keyActionType": "keystroke", - "scancode": 111 + "type": "basic", + "scancode": 64 + }, + { + "keyActionType": "keystroke", + "type": "basic", + "scancode": 65 + }, + { + "keyActionType": "keystroke", + "type": "basic", + "scancode": 66 + }, + { + "keyActionType": "keystroke", + "type": "basic", + "scancode": 67 + }, + { + "keyActionType": "keystroke", + "type": "basic", + "scancode": 68 + }, + { + "keyActionType": "keystroke", + "type": "basic", + "scancode": 69 + }, + { + "keyActionType": "keystroke", + "type": "basic", + "scancode": 76 + }, + { + "keyActionType": "keystroke", + "type": "basic", + "scancode": 74 + }, + { + "keyActionType": "keystroke", + "type": "basic", + "scancode": 82 + }, + { + "keyActionType": "keystroke", + "type": "basic", + "scancode": 77 + }, + { + "keyActionType": "keystroke", + "type": "basic", + "scancode": 76 + }, + { + "keyActionType": "keystroke", + "type": "basic", + "scancode": 70 + }, + { + "keyActionType": "keystroke", + "type": "basic", + "scancode": 71 + }, + { + "keyActionType": "keystroke", + "type": "basic", + "scancode": 72 + }, + { + "keyActionType": "keystroke", + "type": "basic", + "scancode": 75 + }, + { + "keyActionType": "keystroke", + "type": "basic", + "scancode": 80 + }, + { + "keyActionType": "keystroke", + "type": "basic", + "scancode": 81 + }, + { + "keyActionType": "keystroke", + "type": "basic", + "scancode": 79 + }, + { + "keyActionType": "keystroke", + "type": "basic", + "scancode": 73 + }, + null, + null, + { + "keyActionType": "keystroke", + "type": "basic", + "scancode": 78 + }, + { + "keyActionType": "keystroke", + "type": "basic", + "scancode": 41 + }, + null, + null, + null, + { + "keyActionType": "keystroke", + "type": "basic", + "scancode": 118 + }, + { + "keyActionType": "keystroke", + "type": "basic", + "modifierMask": 32 + }, + null, + null, + { + "keyActionType": "switchLayer", + "layer": "mod", + "toggle": false + }, + { + "keyActionType": "switchLayer", + "layer": "fn", + "toggle": false + }, + { + "keyActionType": "keystroke", + "type": "basic", + "modifierMask": 64 + }, + { + "keyActionType": "keystroke", + "type": "basic", + "modifierMask": 128 + }, + { + "keyActionType": "keystroke", + "type": "basic", + "modifierMask": 16 } ] + }, + { + "id": 1, + "pointerRole": "none", + "keyActions": [ + { + "keyActionType": "keystroke", + "type": "basic", + "scancode": 41 + }, + { + "keyActionType": "keystroke", + "type": "basic", + "scancode": 58 + }, + { + "keyActionType": "keystroke", + "type": "basic", + "scancode": 59 + }, + { + "keyActionType": "keystroke", + "type": "basic", + "scancode": 60 + }, + { + "keyActionType": "keystroke", + "type": "basic", + "scancode": 61 + }, + { + "keyActionType": "keystroke", + "type": "basic", + "scancode": 62 + }, + { + "keyActionType": "keystroke", + "type": "basic", + "scancode": 63 + }, + null, + { + "keyActionType": "keystroke", + "type": "basic", + "scancode": 41 + }, + { + "keyActionType": "keystroke", + "type": "basic", + "scancode": 75, + "modifierMask": 1 + }, + { + "keyActionType": "keystroke", + "type": "basic", + "scancode": 23, + "modifierMask": 1 + }, + { + "keyActionType": "keystroke", + "type": "basic", + "scancode": 78, + "modifierMask": 1 + }, + null, + null, + { + "keyActionType": "switchLayer", + "layer": "mouse", + "toggle": false + }, + { + "keyActionType": "keystroke", + "type": "basic", + "scancode": 57, + "modifierMask": 1 + }, + { + "keyActionType": "keystroke", + "type": "basic", + "scancode": 80, + "modifierMask": 5 + }, + { + "keyActionType": "keystroke", + "type": "basic", + "scancode": 43, + "modifierMask": 4 + }, + { + "keyActionType": "keystroke", + "type": "basic", + "scancode": 79, + "modifierMask": 5 + }, + null, + null, + { + "keyActionType": "keystroke", + "type": "basic", + "modifierMask": 2 + }, + null, + null, + { + "keyActionType": "keystroke", + "type": "basic", + "scancode": 75, + "modifierMask": 3 + }, + { + "keyActionType": "keystroke", + "type": "basic", + "scancode": 26, + "modifierMask": 1 + }, + { + "keyActionType": "keystroke", + "type": "basic", + "scancode": 78, + "modifierMask": 3 + }, + null, + { + "keyActionType": "keystroke", + "type": "basic", + "modifierMask": 1 + }, + { + "keyActionType": "keystroke", + "type": "basic", + "modifierMask": 8 + }, + { + "keyActionType": "keystroke", + "type": "basic", + "modifierMask": 4 + }, + { + "keyActionType": "switchLayer", + "layer": "fn", + "toggle": false + }, + null, + { + "keyActionType": "switchLayer", + "layer": "mod", + "toggle": false + }, + null + ] } ] }, @@ -862,7 +1715,225 @@ "modules": [ { "id": 0, + "pointerRole": "move", + "keyActions": [ + null, + null, + null, + null, + { + "keyActionType": "keystroke", + "type": "system", + "scancode": 131 + }, + { + "keyActionType": "keystroke", + "type": "system", + "scancode": 130 + }, + null, + { + "keyActionType": "keystroke", + "type": "media", + "scancode": 176 + }, + { + "keyActionType": "keystroke", + "type": "media", + "scancode": 233 + }, + { + "keyActionType": "keystroke", + "type": "media", + "scancode": 183 + }, + null, + { + "keyActionType": "switchKeymap", + "keymapAbbreviation": "QWR" + }, + { + "keyActionType": "switchKeymap", + "keymapAbbreviation": "COL" + }, + null, + null, + { + "keyActionType": "keystroke", + "type": "media", + "scancode": 182 + }, + { + "keyActionType": "keystroke", + "type": "media", + "scancode": 234 + }, + { + "keyActionType": "keystroke", + "type": "media", + "scancode": 181 + }, + null, + { + "keyActionType": "keystroke", + "type": "system", + "scancode": 131 + }, + null, + null, + null, + null, + { + "keyActionType": "keystroke", + "type": "media", + "scancode": 226 + }, + null, + { + "keyActionType": "keystroke", + "type": "system", + "scancode": 130 + }, + { + "keyActionType": "keystroke", + "type": "basic", + "modifierMask": 32 + }, + null, + null, + { + "keyActionType": "switchLayer", + "layer": "mod", + "toggle": false + }, + { + "keyActionType": "switchLayer", + "layer": "fn", + "toggle": false + }, + { + "keyActionType": "keystroke", + "type": "basic", + "modifierMask": 64 + }, + { + "keyActionType": "keystroke", + "type": "basic", + "modifierMask": 128 + }, + { + "keyActionType": "keystroke", + "type": "basic", + "modifierMask": 16 + } + ] + }, + { + "id": 1, "pointerRole": "scroll", + "keyActions": [ + { + "keyActionType": "switchKeymap", + "keymapAbbreviation": "QWR" + }, + null, + { + "keyActionType": "switchKeymap", + "keymapAbbreviation": "COL" + }, + { + "keyActionType": "switchKeymap", + "keymapAbbreviation": "WOR" + }, + { + "keyActionType": "switchKeymap", + "keymapAbbreviation": "1HA" + }, + { + "keyActionType": "switchKeymap", + "keymapAbbreviation": "KAP" + }, + { + "keyActionType": "switchKeymap", + "keymapAbbreviation": "EGG" + }, + null, + null, + null, + null, + null, + null, + null, + { + "keyActionType": "switchLayer", + "layer": "mouse", + "toggle": false + }, + null, + null, + { + "keyActionType": "keystroke", + "type": "media", + "scancode": 406 + }, + null, + null, + null, + { + "keyActionType": "keystroke", + "type": "basic", + "modifierMask": 2 + }, + null, + null, + null, + { + "keyActionType": "keystroke", + "type": "media", + "scancode": 402 + }, + { + "keyActionType": "keystroke", + "type": "media", + "scancode": 184 + }, + null, + { + "keyActionType": "keystroke", + "type": "basic", + "modifierMask": 1 + }, + { + "keyActionType": "keystroke", + "type": "basic", + "modifierMask": 8 + }, + { + "keyActionType": "keystroke", + "type": "basic", + "modifierMask": 4 + }, + { + "keyActionType": "switchLayer", + "layer": "fn", + "toggle": false + }, + null, + { + "keyActionType": "switchLayer", + "layer": "mod", + "toggle": false + }, + null + ] + } + ] + }, + { + "modules": [ + { + "id": 0, + "pointerRole": "move", "keyActions": [ null, null, @@ -872,6 +1943,38 @@ null, null, null, + { + "keyActionType": "mouse", + "mouseAction": "moveUp" + }, + null, + null, + null, + null, + null, + { + "keyActionType": "mouse", + "mouseAction": "scrollUp" + }, + { + "keyActionType": "mouse", + "mouseAction": "moveLeft" + }, + { + "keyActionType": "mouse", + "mouseAction": "moveDown" + }, + { + "keyActionType": "mouse", + "mouseAction": "moveRight" + }, + null, + null, + null, + { + "keyActionType": "mouse", + "mouseAction": "scrollDown" + }, null, null, null, @@ -880,33 +1983,68 @@ null, null, null, - null, - null, - null, - null, - null, - null, - null, - null, - null, - null, - null, - null, - null, - null, - null, - null, - null, - null + { + "keyActionType": "switchLayer", + "layer": "mod", + "toggle": false + }, + { + "keyActionType": "switchLayer", + "layer": "fn", + "toggle": false + }, + { + "keyActionType": "keystroke", + "type": "basic", + "modifierMask": 64 + }, + { + "keyActionType": "keystroke", + "type": "basic", + "modifierMask": 128 + }, + { + "keyActionType": "keystroke", + "type": "basic", + "modifierMask": 16 + } ] }, { "id": 1, "pointerRole": "move", "keyActions": [ + null, + null, + null, + null, + null, + null, + null, + null, + null, + null, + null, + null, + null, + null, { - "keyActionType": "keystroke", - "scancode": 111 + "keyActionType": "switchLayer", + "layer": "mouse", + "toggle": false + }, + null, + { + "keyActionType": "mouse", + "mouseAction": "rightClick" + }, + { + "keyActionType": "mouse", + "mouseAction": "middleClick" + }, + { + "keyActionType": "mouse", + "mouseAction": "leftClick" }, null, null, @@ -917,194 +2055,35 @@ null, null, null, - null, - null, - null, - null, - null, - null, - null, - null, - null, - null, - null, - null, - null, - null, - null, - null, - null, - null, - null, - null, - null - ] - } - ] - }, - { - "modules": [ - { - "id": 0, - "pointerRole": "scroll", - "keyActions": [ - null, - null, - null, - null, - null, - null, - null, - null, - null, - null, - null, - null, - null, - null, - null, - null, - null, - null, - null, - null, - null, - null, - null, - null, - null, - null, - null, - null, - null, - null, - null, - null, - null, - null - ] - }, - { - "id": 1, - "pointerRole": "move", - "keyActions": [ { "keyActionType": "keystroke", - "scancode": 111 + "type": "basic", + "modifierMask": 1 }, - null, - null, - null, - null, - null, - null, - null, - null, - null, - null, - null, - null, - null, - null, - null, - null, - null, - null, - null, - null, - null, - null, - null, - null, - null, - null, - null, - null, - null, - null - ] - } - ] - }, - { - "modules": [ - { - "id": 0, - "pointerRole": "scroll", - "keyActions": [ - null, - null, - null, - null, - null, - null, - null, - null, - null, - null, - null, - null, - null, - null, - null, - null, - null, - null, - null, - null, - null, - null, - null, - null, - null, - null, - null, - null, - null, - null, - null, - null, - null, - null - ] - }, - { - "id": 1, - "pointerRole": "move", - "keyActions": [ { "keyActionType": "keystroke", - "scancode": 111 + "type": "basic", + "modifierMask": 8 + }, + { + "keyActionType": "keystroke", + "type": "basic", + "modifierMask": 4 + }, + { + "keyActionType": "switchLayer", + "layer": "fn", + "toggle": false + }, + { + "keyActionType": "mouse", + "mouseAction": "decelerate" + }, + { + "keyActionType": "switchLayer", + "layer": "mod", + "toggle": false }, - null, - null, - null, - null, - null, - null, - null, - null, - null, - null, - null, - null, - null, - null, - null, - null, - null, - null, - null, - null, - null, - null, - null, - null, - null, - null, - null, - null, - null, null ] } @@ -1114,8 +2093,3241 @@ }, { "isDefault": false, - "abbreviation": "DVR", - "name": "DVR", + "abbreviation": "COL", + "name": "COLEMAK", + "description": "", + "layers": [ + { + "modules": [ + { + "id": 0, + "pointerRole": "move", + "keyActions": [ + { + "keyActionType": "keystroke", + "type": "basic", + "scancode": 36 + }, + { + "keyActionType": "keystroke", + "type": "basic", + "scancode": 37 + }, + { + "keyActionType": "keystroke", + "type": "basic", + "scancode": 38 + }, + { + "keyActionType": "keystroke", + "type": "basic", + "scancode": 39 + }, + { + "keyActionType": "keystroke", + "type": "basic", + "scancode": 45 + }, + { + "keyActionType": "keystroke", + "type": "basic", + "scancode": 46 + }, + { + "keyActionType": "keystroke", + "type": "basic", + "scancode": 42 + }, + { + "keyActionType": "keystroke", + "type": "basic", + "scancode": 15 + }, + { + "keyActionType": "keystroke", + "type": "basic", + "scancode": 24 + }, + { + "keyActionType": "keystroke", + "type": "basic", + "scancode": 28 + }, + { + "keyActionType": "keystroke", + "type": "basic", + "scancode": 51 + }, + { + "keyActionType": "keystroke", + "type": "basic", + "scancode": 47 + }, + { + "keyActionType": "keystroke", + "type": "basic", + "scancode": 48 + }, + { + "keyActionType": "keystroke", + "type": "basic", + "scancode": 49 + }, + { + "keyActionType": "keystroke", + "type": "basic", + "scancode": 13 + }, + { + "keyActionType": "keystroke", + "type": "basic", + "scancode": 17 + }, + { + "keyActionType": "keystroke", + "type": "basic", + "scancode": 8 + }, + { + "keyActionType": "keystroke", + "type": "basic", + "scancode": 12 + }, + { + "keyActionType": "keystroke", + "type": "basic", + "scancode": 18 + }, + { + "keyActionType": "keystroke", + "type": "basic", + "scancode": 52 + }, + { + "keyActionType": "keystroke", + "type": "basic", + "scancode": 40 + }, + { + "keyActionType": "keystroke", + "type": "basic", + "scancode": 11 + }, + { + "keyActionType": "keystroke", + "type": "basic", + "scancode": 14 + }, + { + "keyActionType": "keystroke", + "type": "basic", + "scancode": 16 + }, + { + "keyActionType": "keystroke", + "type": "basic", + "scancode": 54 + }, + { + "keyActionType": "keystroke", + "type": "basic", + "scancode": 55 + }, + { + "keyActionType": "keystroke", + "type": "basic", + "scancode": 56 + }, + { + "keyActionType": "keystroke", + "type": "basic", + "modifierMask": 32 + }, + null, + { + "keyActionType": "keystroke", + "type": "basic", + "scancode": 44 + }, + { + "keyActionType": "switchLayer", + "layer": "mod", + "toggle": false + }, + { + "keyActionType": "switchLayer", + "layer": "fn", + "toggle": false + }, + { + "keyActionType": "keystroke", + "type": "basic", + "modifierMask": 64 + }, + { + "keyActionType": "keystroke", + "type": "basic", + "modifierMask": 128 + }, + { + "keyActionType": "keystroke", + "type": "basic", + "modifierMask": 16 + } + ] + }, + { + "id": 1, + "pointerRole": "move", + "keyActions": [ + { + "keyActionType": "keystroke", + "type": "basic", + "scancode": 53 + }, + { + "keyActionType": "keystroke", + "type": "basic", + "scancode": 30 + }, + { + "keyActionType": "keystroke", + "type": "basic", + "scancode": 31 + }, + { + "keyActionType": "keystroke", + "type": "basic", + "scancode": 32 + }, + { + "keyActionType": "keystroke", + "type": "basic", + "scancode": 33 + }, + { + "keyActionType": "keystroke", + "type": "basic", + "scancode": 34 + }, + { + "keyActionType": "keystroke", + "type": "basic", + "scancode": 35 + }, + { + "keyActionType": "keystroke", + "type": "basic", + "scancode": 43 + }, + { + "keyActionType": "keystroke", + "type": "basic", + "scancode": 20 + }, + { + "keyActionType": "keystroke", + "type": "basic", + "scancode": 26 + }, + { + "keyActionType": "keystroke", + "type": "basic", + "scancode": 9 + }, + { + "keyActionType": "keystroke", + "type": "basic", + "scancode": 19 + }, + null, + { + "keyActionType": "keystroke", + "type": "basic", + "scancode": 10 + }, + { + "keyActionType": "switchLayer", + "layer": "mouse", + "toggle": false + }, + { + "keyActionType": "keystroke", + "type": "basic", + "scancode": 4 + }, + { + "keyActionType": "keystroke", + "type": "basic", + "scancode": 21 + }, + { + "keyActionType": "keystroke", + "type": "basic", + "scancode": 22 + }, + { + "keyActionType": "keystroke", + "type": "basic", + "scancode": 23 + }, + null, + { + "keyActionType": "keystroke", + "type": "basic", + "scancode": 7 + }, + { + "keyActionType": "keystroke", + "type": "basic", + "modifierMask": 2 + }, + null, + { + "keyActionType": "keystroke", + "type": "basic", + "scancode": 29 + }, + { + "keyActionType": "keystroke", + "type": "basic", + "scancode": 27 + }, + { + "keyActionType": "keystroke", + "type": "basic", + "scancode": 6 + }, + { + "keyActionType": "keystroke", + "type": "basic", + "scancode": 25 + }, + { + "keyActionType": "keystroke", + "type": "basic", + "scancode": 5 + }, + { + "keyActionType": "keystroke", + "type": "basic", + "modifierMask": 1 + }, + { + "keyActionType": "keystroke", + "type": "basic", + "modifierMask": 8 + }, + { + "keyActionType": "keystroke", + "type": "basic", + "modifierMask": 4 + }, + { + "keyActionType": "switchLayer", + "layer": "fn", + "toggle": false + }, + { + "keyActionType": "keystroke", + "type": "basic", + "scancode": 44 + }, + { + "keyActionType": "switchLayer", + "layer": "mod", + "toggle": false + }, + null + ] + }, + { + "id": 2, + "pointerRole": "scroll", + "keyActions": [] + } + ] + }, + { + "modules": [ + { + "id": 0, + "pointerRole": "none", + "keyActions": [ + { + "keyActionType": "keystroke", + "type": "basic", + "scancode": 64 + }, + { + "keyActionType": "keystroke", + "type": "basic", + "scancode": 65 + }, + { + "keyActionType": "keystroke", + "type": "basic", + "scancode": 66 + }, + { + "keyActionType": "keystroke", + "type": "basic", + "scancode": 67 + }, + { + "keyActionType": "keystroke", + "type": "basic", + "scancode": 68 + }, + { + "keyActionType": "keystroke", + "type": "basic", + "scancode": 69 + }, + { + "keyActionType": "keystroke", + "type": "basic", + "scancode": 76 + }, + { + "keyActionType": "keystroke", + "type": "basic", + "scancode": 74 + }, + { + "keyActionType": "keystroke", + "type": "basic", + "scancode": 82 + }, + { + "keyActionType": "keystroke", + "type": "basic", + "scancode": 77 + }, + { + "keyActionType": "keystroke", + "type": "basic", + "scancode": 76 + }, + { + "keyActionType": "keystroke", + "type": "basic", + "scancode": 70 + }, + { + "keyActionType": "keystroke", + "type": "basic", + "scancode": 71 + }, + { + "keyActionType": "keystroke", + "type": "basic", + "scancode": 72 + }, + { + "keyActionType": "keystroke", + "type": "basic", + "scancode": 75 + }, + { + "keyActionType": "keystroke", + "type": "basic", + "scancode": 80 + }, + { + "keyActionType": "keystroke", + "type": "basic", + "scancode": 81 + }, + { + "keyActionType": "keystroke", + "type": "basic", + "scancode": 79 + }, + { + "keyActionType": "keystroke", + "type": "basic", + "scancode": 73 + }, + null, + null, + { + "keyActionType": "keystroke", + "type": "basic", + "scancode": 78 + }, + { + "keyActionType": "keystroke", + "type": "basic", + "scancode": 41 + }, + null, + null, + null, + { + "keyActionType": "keystroke", + "type": "basic", + "scancode": 118 + }, + { + "keyActionType": "keystroke", + "type": "basic", + "modifierMask": 32 + }, + null, + null, + { + "keyActionType": "switchLayer", + "layer": "mod", + "toggle": false + }, + { + "keyActionType": "switchLayer", + "layer": "fn", + "toggle": false + }, + { + "keyActionType": "keystroke", + "type": "basic", + "modifierMask": 64 + }, + { + "keyActionType": "keystroke", + "type": "basic", + "modifierMask": 128 + }, + { + "keyActionType": "keystroke", + "type": "basic", + "modifierMask": 16 + } + ] + }, + { + "id": 1, + "pointerRole": "none", + "keyActions": [ + { + "keyActionType": "keystroke", + "type": "basic", + "scancode": 41 + }, + { + "keyActionType": "keystroke", + "type": "basic", + "scancode": 58 + }, + { + "keyActionType": "keystroke", + "type": "basic", + "scancode": 59 + }, + { + "keyActionType": "keystroke", + "type": "basic", + "scancode": 60 + }, + { + "keyActionType": "keystroke", + "type": "basic", + "scancode": 61 + }, + { + "keyActionType": "keystroke", + "type": "basic", + "scancode": 62 + }, + { + "keyActionType": "keystroke", + "type": "basic", + "scancode": 63 + }, + null, + { + "keyActionType": "keystroke", + "type": "basic", + "scancode": 41 + }, + { + "keyActionType": "keystroke", + "type": "basic", + "scancode": 75, + "modifierMask": 1 + }, + { + "keyActionType": "keystroke", + "type": "basic", + "scancode": 23, + "modifierMask": 1 + }, + { + "keyActionType": "keystroke", + "type": "basic", + "scancode": 78, + "modifierMask": 1 + }, + null, + null, + { + "keyActionType": "switchLayer", + "layer": "mouse", + "toggle": false + }, + { + "keyActionType": "keystroke", + "type": "basic", + "scancode": 57, + "modifierMask": 1 + }, + { + "keyActionType": "keystroke", + "type": "basic", + "scancode": 80, + "modifierMask": 5 + }, + { + "keyActionType": "keystroke", + "type": "basic", + "scancode": 43, + "modifierMask": 4 + }, + { + "keyActionType": "keystroke", + "type": "basic", + "scancode": 79, + "modifierMask": 5 + }, + null, + null, + { + "keyActionType": "keystroke", + "type": "basic", + "modifierMask": 2 + }, + null, + null, + { + "keyActionType": "keystroke", + "type": "basic", + "scancode": 75, + "modifierMask": 3 + }, + { + "keyActionType": "keystroke", + "type": "basic", + "scancode": 26, + "modifierMask": 1 + }, + { + "keyActionType": "keystroke", + "type": "basic", + "scancode": 78, + "modifierMask": 3 + }, + null, + { + "keyActionType": "keystroke", + "type": "basic", + "modifierMask": 1 + }, + { + "keyActionType": "keystroke", + "type": "basic", + "modifierMask": 8 + }, + { + "keyActionType": "keystroke", + "type": "basic", + "modifierMask": 4 + }, + { + "keyActionType": "switchLayer", + "layer": "fn", + "toggle": false + }, + null, + { + "keyActionType": "switchLayer", + "layer": "mod", + "toggle": false + }, + null + ] + } + ] + }, + { + "modules": [ + { + "id": 0, + "pointerRole": "move", + "keyActions": [ + null, + null, + null, + null, + { + "keyActionType": "keystroke", + "type": "system", + "scancode": 131 + }, + { + "keyActionType": "keystroke", + "type": "system", + "scancode": 130 + }, + null, + { + "keyActionType": "keystroke", + "type": "media", + "scancode": 176 + }, + { + "keyActionType": "keystroke", + "type": "media", + "scancode": 233 + }, + { + "keyActionType": "keystroke", + "type": "media", + "scancode": 183 + }, + null, + { + "keyActionType": "switchKeymap", + "keymapAbbreviation": "DVO" + }, + { + "keyActionType": "switchKeymap", + "keymapAbbreviation": "WOR" + }, + null, + null, + { + "keyActionType": "keystroke", + "type": "media", + "scancode": 182 + }, + { + "keyActionType": "keystroke", + "type": "media", + "scancode": 234 + }, + { + "keyActionType": "keystroke", + "type": "media", + "scancode": 181 + }, + null, + { + "keyActionType": "keystroke", + "type": "system", + "scancode": 131 + }, + null, + null, + null, + null, + { + "keyActionType": "keystroke", + "type": "media", + "scancode": 226 + }, + null, + { + "keyActionType": "keystroke", + "type": "system", + "scancode": 130 + }, + { + "keyActionType": "keystroke", + "type": "basic", + "modifierMask": 32 + }, + null, + null, + { + "keyActionType": "switchLayer", + "layer": "mod", + "toggle": false + }, + { + "keyActionType": "switchLayer", + "layer": "fn", + "toggle": false + }, + { + "keyActionType": "keystroke", + "type": "basic", + "modifierMask": 64 + }, + { + "keyActionType": "keystroke", + "type": "basic", + "modifierMask": 128 + }, + { + "keyActionType": "keystroke", + "type": "basic", + "modifierMask": 16 + } + ] + }, + { + "id": 1, + "pointerRole": "scroll", + "keyActions": [ + { + "keyActionType": "switchKeymap", + "keymapAbbreviation": "QWR" + }, + { + "keyActionType": "switchKeymap", + "keymapAbbreviation": "DVO" + }, + null, + { + "keyActionType": "switchKeymap", + "keymapAbbreviation": "WOR" + }, + { + "keyActionType": "switchKeymap", + "keymapAbbreviation": "1HA" + }, + { + "keyActionType": "switchKeymap", + "keymapAbbreviation": "KAP" + }, + { + "keyActionType": "switchKeymap", + "keymapAbbreviation": "EGG" + }, + null, + null, + null, + null, + null, + null, + null, + { + "keyActionType": "switchLayer", + "layer": "mouse", + "toggle": false + }, + null, + null, + { + "keyActionType": "keystroke", + "type": "media", + "scancode": 406 + }, + null, + null, + null, + { + "keyActionType": "keystroke", + "type": "basic", + "modifierMask": 2 + }, + null, + null, + null, + { + "keyActionType": "keystroke", + "type": "media", + "scancode": 402 + }, + { + "keyActionType": "keystroke", + "type": "media", + "scancode": 184 + }, + null, + { + "keyActionType": "keystroke", + "type": "basic", + "modifierMask": 1 + }, + { + "keyActionType": "keystroke", + "type": "basic", + "modifierMask": 8 + }, + { + "keyActionType": "keystroke", + "type": "basic", + "modifierMask": 4 + }, + { + "keyActionType": "switchLayer", + "layer": "fn", + "toggle": false + }, + null, + { + "keyActionType": "switchLayer", + "layer": "mod", + "toggle": false + }, + null + ] + } + ] + }, + { + "modules": [ + { + "id": 0, + "pointerRole": "move", + "keyActions": [ + null, + null, + null, + null, + null, + null, + null, + null, + { + "keyActionType": "mouse", + "mouseAction": "moveUp" + }, + null, + null, + null, + null, + null, + { + "keyActionType": "mouse", + "mouseAction": "scrollUp" + }, + { + "keyActionType": "mouse", + "mouseAction": "moveLeft" + }, + { + "keyActionType": "mouse", + "mouseAction": "moveDown" + }, + { + "keyActionType": "mouse", + "mouseAction": "moveRight" + }, + null, + null, + null, + { + "keyActionType": "mouse", + "mouseAction": "scrollDown" + }, + null, + null, + null, + null, + null, + null, + null, + null, + { + "keyActionType": "switchLayer", + "layer": "mod", + "toggle": false + }, + { + "keyActionType": "switchLayer", + "layer": "fn", + "toggle": false + }, + { + "keyActionType": "keystroke", + "type": "basic", + "modifierMask": 64 + }, + { + "keyActionType": "keystroke", + "type": "basic", + "modifierMask": 128 + }, + { + "keyActionType": "keystroke", + "type": "basic", + "modifierMask": 16 + } + ] + }, + { + "id": 1, + "pointerRole": "move", + "keyActions": [ + null, + null, + null, + null, + null, + null, + null, + null, + null, + null, + null, + null, + null, + null, + { + "keyActionType": "switchLayer", + "layer": "mouse", + "toggle": false + }, + null, + { + "keyActionType": "mouse", + "mouseAction": "rightClick" + }, + { + "keyActionType": "mouse", + "mouseAction": "middleClick" + }, + { + "keyActionType": "mouse", + "mouseAction": "leftClick" + }, + null, + null, + null, + null, + null, + null, + null, + null, + null, + { + "keyActionType": "keystroke", + "type": "basic", + "modifierMask": 1 + }, + { + "keyActionType": "keystroke", + "type": "basic", + "modifierMask": 8 + }, + { + "keyActionType": "keystroke", + "type": "basic", + "modifierMask": 4 + }, + { + "keyActionType": "switchLayer", + "layer": "fn", + "toggle": false + }, + { + "keyActionType": "mouse", + "mouseAction": "decelerate" + }, + { + "keyActionType": "switchLayer", + "layer": "mod", + "toggle": false + }, + null + ] + } + ] + } + ] + }, + { + "isDefault": false, + "abbreviation": "WOR", + "name": "WORKMAN", + "description": "", + "layers": [ + { + "modules": [ + { + "id": 0, + "pointerRole": "move", + "keyActions": [ + { + "keyActionType": "keystroke", + "type": "basic", + "scancode": 36 + }, + { + "keyActionType": "keystroke", + "type": "basic", + "scancode": 37 + }, + { + "keyActionType": "keystroke", + "type": "basic", + "scancode": 38 + }, + { + "keyActionType": "keystroke", + "type": "basic", + "scancode": 39 + }, + { + "keyActionType": "keystroke", + "type": "basic", + "scancode": 45 + }, + { + "keyActionType": "keystroke", + "type": "basic", + "scancode": 46 + }, + { + "keyActionType": "keystroke", + "type": "basic", + "scancode": 42 + }, + { + "keyActionType": "keystroke", + "type": "basic", + "scancode": 9 + }, + { + "keyActionType": "keystroke", + "type": "basic", + "scancode": 24 + }, + { + "keyActionType": "keystroke", + "type": "basic", + "scancode": 19 + }, + { + "keyActionType": "keystroke", + "type": "basic", + "scancode": 51 + }, + { + "keyActionType": "keystroke", + "type": "basic", + "scancode": 47 + }, + { + "keyActionType": "keystroke", + "type": "basic", + "scancode": 48 + }, + { + "keyActionType": "keystroke", + "type": "basic", + "scancode": 49 + }, + { + "keyActionType": "keystroke", + "type": "basic", + "scancode": 13 + }, + { + "keyActionType": "keystroke", + "type": "basic", + "scancode": 17 + }, + { + "keyActionType": "keystroke", + "type": "basic", + "scancode": 8 + }, + { + "keyActionType": "keystroke", + "type": "basic", + "scancode": 18 + }, + { + "keyActionType": "keystroke", + "type": "basic", + "scancode": 12 + }, + { + "keyActionType": "keystroke", + "type": "basic", + "scancode": 52 + }, + { + "keyActionType": "keystroke", + "type": "basic", + "scancode": 40 + }, + { + "keyActionType": "keystroke", + "type": "basic", + "scancode": 28 + }, + { + "keyActionType": "keystroke", + "type": "basic", + "scancode": 14 + }, + { + "keyActionType": "keystroke", + "type": "basic", + "scancode": 15 + }, + { + "keyActionType": "keystroke", + "type": "basic", + "scancode": 54 + }, + { + "keyActionType": "keystroke", + "type": "basic", + "scancode": 55 + }, + { + "keyActionType": "keystroke", + "type": "basic", + "scancode": 56 + }, + { + "keyActionType": "keystroke", + "type": "basic", + "modifierMask": 32 + }, + null, + { + "keyActionType": "keystroke", + "type": "basic", + "scancode": 44 + }, + { + "keyActionType": "switchLayer", + "layer": "mod", + "toggle": false + }, + { + "keyActionType": "switchLayer", + "layer": "fn", + "toggle": false + }, + { + "keyActionType": "keystroke", + "type": "basic", + "modifierMask": 64 + }, + { + "keyActionType": "keystroke", + "type": "basic", + "modifierMask": 128 + }, + { + "keyActionType": "keystroke", + "type": "basic", + "modifierMask": 16 + } + ] + }, + { + "id": 1, + "pointerRole": "move", + "keyActions": [ + { + "keyActionType": "keystroke", + "type": "basic", + "scancode": 53 + }, + { + "keyActionType": "keystroke", + "type": "basic", + "scancode": 30 + }, + { + "keyActionType": "keystroke", + "type": "basic", + "scancode": 31 + }, + { + "keyActionType": "keystroke", + "type": "basic", + "scancode": 32 + }, + { + "keyActionType": "keystroke", + "type": "basic", + "scancode": 33 + }, + { + "keyActionType": "keystroke", + "type": "basic", + "scancode": 34 + }, + { + "keyActionType": "keystroke", + "type": "basic", + "scancode": 35 + }, + { + "keyActionType": "keystroke", + "type": "basic", + "scancode": 43 + }, + { + "keyActionType": "keystroke", + "type": "basic", + "scancode": 20 + }, + { + "keyActionType": "keystroke", + "type": "basic", + "scancode": 7 + }, + { + "keyActionType": "keystroke", + "type": "basic", + "scancode": 21 + }, + { + "keyActionType": "keystroke", + "type": "basic", + "scancode": 26 + }, + null, + { + "keyActionType": "keystroke", + "type": "basic", + "scancode": 5 + }, + { + "keyActionType": "switchLayer", + "layer": "mouse", + "toggle": false + }, + { + "keyActionType": "keystroke", + "type": "basic", + "scancode": 4 + }, + { + "keyActionType": "keystroke", + "type": "basic", + "scancode": 22 + }, + { + "keyActionType": "keystroke", + "type": "basic", + "scancode": 11 + }, + { + "keyActionType": "keystroke", + "type": "basic", + "scancode": 23 + }, + null, + { + "keyActionType": "keystroke", + "type": "basic", + "scancode": 10 + }, + { + "keyActionType": "keystroke", + "type": "basic", + "modifierMask": 2 + }, + null, + { + "keyActionType": "keystroke", + "type": "basic", + "scancode": 29 + }, + { + "keyActionType": "keystroke", + "type": "basic", + "scancode": 27 + }, + { + "keyActionType": "keystroke", + "type": "basic", + "scancode": 16 + }, + { + "keyActionType": "keystroke", + "type": "basic", + "scancode": 6 + }, + { + "keyActionType": "keystroke", + "type": "basic", + "scancode": 25 + }, + { + "keyActionType": "keystroke", + "type": "basic", + "modifierMask": 1 + }, + { + "keyActionType": "keystroke", + "type": "basic", + "modifierMask": 8 + }, + { + "keyActionType": "keystroke", + "type": "basic", + "modifierMask": 4 + }, + { + "keyActionType": "switchLayer", + "layer": "fn", + "toggle": false + }, + { + "keyActionType": "keystroke", + "type": "basic", + "scancode": 44 + }, + { + "keyActionType": "switchLayer", + "layer": "mod", + "toggle": false + }, + null + ] + }, + { + "id": 2, + "pointerRole": "scroll", + "keyActions": [] + } + ] + }, + { + "modules": [ + { + "id": 0, + "pointerRole": "none", + "keyActions": [ + { + "keyActionType": "keystroke", + "type": "basic", + "scancode": 64 + }, + { + "keyActionType": "keystroke", + "type": "basic", + "scancode": 65 + }, + { + "keyActionType": "keystroke", + "type": "basic", + "scancode": 66 + }, + { + "keyActionType": "keystroke", + "type": "basic", + "scancode": 67 + }, + { + "keyActionType": "keystroke", + "type": "basic", + "scancode": 68 + }, + { + "keyActionType": "keystroke", + "type": "basic", + "scancode": 69 + }, + { + "keyActionType": "keystroke", + "type": "basic", + "scancode": 76 + }, + { + "keyActionType": "keystroke", + "type": "basic", + "scancode": 74 + }, + { + "keyActionType": "keystroke", + "type": "basic", + "scancode": 82 + }, + { + "keyActionType": "keystroke", + "type": "basic", + "scancode": 77 + }, + { + "keyActionType": "keystroke", + "type": "basic", + "scancode": 76 + }, + { + "keyActionType": "keystroke", + "type": "basic", + "scancode": 70 + }, + { + "keyActionType": "keystroke", + "type": "basic", + "scancode": 71 + }, + { + "keyActionType": "keystroke", + "type": "basic", + "scancode": 72 + }, + { + "keyActionType": "keystroke", + "type": "basic", + "scancode": 75 + }, + { + "keyActionType": "keystroke", + "type": "basic", + "scancode": 80 + }, + { + "keyActionType": "keystroke", + "type": "basic", + "scancode": 81 + }, + { + "keyActionType": "keystroke", + "type": "basic", + "scancode": 79 + }, + { + "keyActionType": "keystroke", + "type": "basic", + "scancode": 73 + }, + null, + null, + { + "keyActionType": "keystroke", + "type": "basic", + "scancode": 78 + }, + { + "keyActionType": "keystroke", + "type": "basic", + "scancode": 41 + }, + null, + null, + null, + { + "keyActionType": "keystroke", + "type": "basic", + "scancode": 118 + }, + { + "keyActionType": "keystroke", + "type": "basic", + "modifierMask": 32 + }, + null, + null, + { + "keyActionType": "switchLayer", + "layer": "mod", + "toggle": false + }, + { + "keyActionType": "switchLayer", + "layer": "fn", + "toggle": false + }, + { + "keyActionType": "keystroke", + "type": "basic", + "modifierMask": 64 + }, + { + "keyActionType": "keystroke", + "type": "basic", + "modifierMask": 128 + }, + { + "keyActionType": "keystroke", + "type": "basic", + "modifierMask": 16 + } + ] + }, + { + "id": 1, + "pointerRole": "none", + "keyActions": [ + { + "keyActionType": "keystroke", + "type": "basic", + "scancode": 41 + }, + { + "keyActionType": "keystroke", + "type": "basic", + "scancode": 58 + }, + { + "keyActionType": "keystroke", + "type": "basic", + "scancode": 59 + }, + { + "keyActionType": "keystroke", + "type": "basic", + "scancode": 60 + }, + { + "keyActionType": "keystroke", + "type": "basic", + "scancode": 61 + }, + { + "keyActionType": "keystroke", + "type": "basic", + "scancode": 62 + }, + { + "keyActionType": "keystroke", + "type": "basic", + "scancode": 63 + }, + null, + { + "keyActionType": "keystroke", + "type": "basic", + "scancode": 41 + }, + { + "keyActionType": "keystroke", + "type": "basic", + "scancode": 75, + "modifierMask": 1 + }, + { + "keyActionType": "keystroke", + "type": "basic", + "scancode": 23, + "modifierMask": 1 + }, + { + "keyActionType": "keystroke", + "type": "basic", + "scancode": 78, + "modifierMask": 1 + }, + null, + null, + { + "keyActionType": "switchLayer", + "layer": "mouse", + "toggle": false + }, + { + "keyActionType": "keystroke", + "type": "basic", + "scancode": 57, + "modifierMask": 1 + }, + { + "keyActionType": "keystroke", + "type": "basic", + "scancode": 80, + "modifierMask": 5 + }, + { + "keyActionType": "keystroke", + "type": "basic", + "scancode": 43, + "modifierMask": 4 + }, + { + "keyActionType": "keystroke", + "type": "basic", + "scancode": 79, + "modifierMask": 5 + }, + null, + null, + { + "keyActionType": "keystroke", + "type": "basic", + "modifierMask": 2 + }, + null, + null, + { + "keyActionType": "keystroke", + "type": "basic", + "scancode": 75, + "modifierMask": 3 + }, + { + "keyActionType": "keystroke", + "type": "basic", + "scancode": 26, + "modifierMask": 1 + }, + { + "keyActionType": "keystroke", + "type": "basic", + "scancode": 78, + "modifierMask": 3 + }, + null, + { + "keyActionType": "keystroke", + "type": "basic", + "modifierMask": 1 + }, + { + "keyActionType": "keystroke", + "type": "basic", + "modifierMask": 8 + }, + { + "keyActionType": "keystroke", + "type": "basic", + "modifierMask": 4 + }, + { + "keyActionType": "switchLayer", + "layer": "fn", + "toggle": false + }, + null, + { + "keyActionType": "switchLayer", + "layer": "mod", + "toggle": false + }, + null + ] + } + ] + }, + { + "modules": [ + { + "id": 0, + "pointerRole": "move", + "keyActions": [ + null, + null, + null, + null, + null, + null, + null, + { + "keyActionType": "keystroke", + "type": "media", + "scancode": 176 + }, + { + "keyActionType": "keystroke", + "type": "media", + "scancode": 233 + }, + { + "keyActionType": "keystroke", + "type": "media", + "scancode": 183 + }, + null, + { + "keyActionType": "switchKeymap", + "keymapAbbreviation": "COL" + }, + { + "keyActionType": "switchKeymap", + "keymapAbbreviation": "1HA" + }, + null, + null, + { + "keyActionType": "keystroke", + "type": "media", + "scancode": 182 + }, + { + "keyActionType": "keystroke", + "type": "media", + "scancode": 234 + }, + { + "keyActionType": "keystroke", + "type": "media", + "scancode": 181 + }, + null, + { + "keyActionType": "keystroke", + "type": "system", + "scancode": 131 + }, + null, + null, + null, + null, + { + "keyActionType": "keystroke", + "type": "media", + "scancode": 226 + }, + null, + { + "keyActionType": "keystroke", + "type": "system", + "scancode": 130 + }, + { + "keyActionType": "keystroke", + "type": "basic", + "modifierMask": 32 + }, + null, + null, + { + "keyActionType": "switchLayer", + "layer": "mod", + "toggle": false + }, + { + "keyActionType": "switchLayer", + "layer": "fn", + "toggle": false + }, + { + "keyActionType": "keystroke", + "type": "basic", + "modifierMask": 64 + }, + { + "keyActionType": "keystroke", + "type": "basic", + "modifierMask": 128 + }, + { + "keyActionType": "keystroke", + "type": "basic", + "modifierMask": 16 + } + ] + }, + { + "id": 1, + "pointerRole": "scroll", + "keyActions": [ + { + "keyActionType": "switchKeymap", + "keymapAbbreviation": "QWR" + }, + { + "keyActionType": "switchKeymap", + "keymapAbbreviation": "DVO" + }, + { + "keyActionType": "switchKeymap", + "keymapAbbreviation": "COL" + }, + null, + { + "keyActionType": "switchKeymap", + "keymapAbbreviation": "1HA" + }, + { + "keyActionType": "switchKeymap", + "keymapAbbreviation": "KAP" + }, + { + "keyActionType": "switchKeymap", + "keymapAbbreviation": "EGG" + }, + null, + null, + null, + null, + null, + null, + null, + { + "keyActionType": "switchLayer", + "layer": "mouse", + "toggle": false + }, + null, + null, + { + "keyActionType": "keystroke", + "type": "media", + "scancode": 406 + }, + null, + null, + null, + { + "keyActionType": "keystroke", + "type": "basic", + "modifierMask": 2 + }, + null, + null, + null, + { + "keyActionType": "keystroke", + "type": "media", + "scancode": 402 + }, + { + "keyActionType": "keystroke", + "type": "media", + "scancode": 184 + }, + null, + { + "keyActionType": "keystroke", + "type": "basic", + "modifierMask": 1 + }, + { + "keyActionType": "keystroke", + "type": "basic", + "modifierMask": 8 + }, + { + "keyActionType": "keystroke", + "type": "basic", + "modifierMask": 4 + }, + { + "keyActionType": "switchLayer", + "layer": "fn", + "toggle": false + }, + null, + { + "keyActionType": "switchLayer", + "layer": "mod", + "toggle": false + }, + null + ] + } + ] + }, + { + "modules": [ + { + "id": 0, + "pointerRole": "move", + "keyActions": [ + null, + null, + null, + null, + null, + null, + null, + null, + { + "keyActionType": "mouse", + "mouseAction": "moveUp" + }, + null, + null, + null, + null, + null, + { + "keyActionType": "mouse", + "mouseAction": "scrollUp" + }, + { + "keyActionType": "mouse", + "mouseAction": "moveLeft" + }, + { + "keyActionType": "mouse", + "mouseAction": "moveDown" + }, + { + "keyActionType": "mouse", + "mouseAction": "moveRight" + }, + null, + null, + null, + { + "keyActionType": "mouse", + "mouseAction": "scrollDown" + }, + null, + null, + null, + null, + null, + null, + null, + null, + { + "keyActionType": "switchLayer", + "layer": "mod", + "toggle": false + }, + { + "keyActionType": "switchLayer", + "layer": "fn", + "toggle": false + }, + { + "keyActionType": "keystroke", + "type": "basic", + "modifierMask": 64 + }, + { + "keyActionType": "keystroke", + "type": "basic", + "modifierMask": 128 + }, + { + "keyActionType": "keystroke", + "type": "basic", + "modifierMask": 16 + } + ] + }, + { + "id": 1, + "pointerRole": "move", + "keyActions": [ + null, + null, + null, + null, + null, + null, + null, + null, + null, + null, + null, + null, + null, + null, + { + "keyActionType": "switchLayer", + "layer": "mouse", + "toggle": false + }, + null, + { + "keyActionType": "mouse", + "mouseAction": "rightClick" + }, + { + "keyActionType": "mouse", + "mouseAction": "middleClick" + }, + { + "keyActionType": "mouse", + "mouseAction": "leftClick" + }, + null, + null, + null, + null, + null, + null, + null, + null, + null, + { + "keyActionType": "keystroke", + "type": "basic", + "modifierMask": 1 + }, + { + "keyActionType": "keystroke", + "type": "basic", + "modifierMask": 8 + }, + { + "keyActionType": "keystroke", + "type": "basic", + "modifierMask": 4 + }, + { + "keyActionType": "switchLayer", + "layer": "fn", + "toggle": false + }, + { + "keyActionType": "mouse", + "mouseAction": "decelerate" + }, + { + "keyActionType": "switchLayer", + "layer": "mod", + "toggle": false + }, + null + ] + } + ] + } + ] + }, + { + "isDefault": false, + "abbreviation": "1HA", + "name": "ONE-HANDED", + "description": "", + "layers": [ + { + "modules": [ + { + "id": 0, + "pointerRole": "move", + "keyActions": [ + { + "keyActionType": "keystroke", + "type": "basic", + "scancode": 36 + }, + { + "keyActionType": "keystroke", + "type": "basic", + "scancode": 37 + }, + { + "keyActionType": "keystroke", + "type": "basic", + "scancode": 38 + }, + { + "keyActionType": "keystroke", + "type": "basic", + "scancode": 39 + }, + { + "keyActionType": "keystroke", + "type": "basic", + "scancode": 45 + }, + { + "keyActionType": "keystroke", + "type": "basic", + "scancode": 46 + }, + { + "keyActionType": "keystroke", + "type": "basic", + "scancode": 42 + }, + { + "keyActionType": "keystroke", + "type": "basic", + "scancode": 24 + }, + { + "keyActionType": "keystroke", + "type": "basic", + "scancode": 12 + }, + { + "keyActionType": "keystroke", + "type": "basic", + "scancode": 18 + }, + { + "keyActionType": "keystroke", + "type": "basic", + "scancode": 19 + }, + { + "keyActionType": "keystroke", + "type": "basic", + "scancode": 47 + }, + { + "keyActionType": "keystroke", + "type": "basic", + "scancode": 48 + }, + { + "keyActionType": "keystroke", + "type": "basic", + "scancode": 49 + }, + { + "keyActionType": "keystroke", + "type": "basic", + "scancode": 28 + }, + { + "keyActionType": "keystroke", + "type": "basic", + "scancode": 13 + }, + { + "keyActionType": "keystroke", + "type": "basic", + "scancode": 14 + }, + { + "keyActionType": "keystroke", + "type": "basic", + "scancode": 15 + }, + { + "keyActionType": "keystroke", + "type": "basic", + "scancode": 51 + }, + { + "keyActionType": "switchLayer", + "layer": "mouse", + "toggle": false + }, + { + "keyActionType": "keystroke", + "type": "basic", + "scancode": 40 + }, + { + "keyActionType": "keystroke", + "type": "basic", + "scancode": 11 + }, + { + "keyActionType": "keystroke", + "type": "basic", + "scancode": 17 + }, + { + "keyActionType": "keystroke", + "type": "basic", + "scancode": 16 + }, + { + "keyActionType": "keystroke", + "type": "basic", + "scancode": 54 + }, + { + "keyActionType": "keystroke", + "type": "basic", + "scancode": 55 + }, + { + "keyActionType": "keystroke", + "type": "basic", + "scancode": 56 + }, + { + "keyActionType": "keystroke", + "type": "basic", + "modifierMask": 32 + }, + null, + { + "keyActionType": "switchLayer", + "layer": "mod", + "toggle": false + }, + { + "keyActionType": "switchLayer", + "layer": "fn", + "toggle": false + }, + { + "keyActionType": "keystroke", + "type": "basic", + "scancode": 44 + }, + { + "keyActionType": "keystroke", + "type": "basic", + "modifierMask": 64 + }, + { + "keyActionType": "keystroke", + "type": "basic", + "modifierMask": 128 + }, + { + "keyActionType": "keystroke", + "type": "basic", + "modifierMask": 16 + } + ] + }, + { + "id": 1, + "pointerRole": "move", + "keyActions": [ + { + "keyActionType": "keystroke", + "type": "basic", + "scancode": 53 + }, + { + "keyActionType": "keystroke", + "type": "basic", + "scancode": 30 + }, + { + "keyActionType": "keystroke", + "type": "basic", + "scancode": 31 + }, + { + "keyActionType": "keystroke", + "type": "basic", + "scancode": 32 + }, + { + "keyActionType": "keystroke", + "type": "basic", + "scancode": 33 + }, + { + "keyActionType": "keystroke", + "type": "basic", + "scancode": 34 + }, + { + "keyActionType": "keystroke", + "type": "basic", + "scancode": 35 + }, + { + "keyActionType": "keystroke", + "type": "basic", + "scancode": 43 + }, + { + "keyActionType": "keystroke", + "type": "basic", + "scancode": 20 + }, + { + "keyActionType": "keystroke", + "type": "basic", + "scancode": 26 + }, + { + "keyActionType": "keystroke", + "type": "basic", + "scancode": 8 + }, + { + "keyActionType": "keystroke", + "type": "basic", + "scancode": 21 + }, + null, + { + "keyActionType": "keystroke", + "type": "basic", + "scancode": 23 + }, + { + "keyActionType": "switchLayer", + "layer": "mouse", + "toggle": false + }, + { + "keyActionType": "keystroke", + "type": "basic", + "scancode": 4 + }, + { + "keyActionType": "keystroke", + "type": "basic", + "scancode": 22 + }, + { + "keyActionType": "keystroke", + "type": "basic", + "scancode": 7 + }, + { + "keyActionType": "keystroke", + "type": "basic", + "scancode": 9 + }, + null, + { + "keyActionType": "keystroke", + "type": "basic", + "scancode": 10 + }, + { + "keyActionType": "keystroke", + "type": "basic", + "modifierMask": 2 + }, + null, + { + "keyActionType": "keystroke", + "type": "basic", + "scancode": 29 + }, + { + "keyActionType": "keystroke", + "type": "basic", + "scancode": 27 + }, + { + "keyActionType": "keystroke", + "type": "basic", + "scancode": 6 + }, + { + "keyActionType": "keystroke", + "type": "basic", + "scancode": 25 + }, + { + "keyActionType": "keystroke", + "type": "basic", + "scancode": 5 + }, + { + "keyActionType": "keystroke", + "type": "basic", + "modifierMask": 1 + }, + { + "keyActionType": "keystroke", + "type": "basic", + "modifierMask": 8 + }, + { + "keyActionType": "keystroke", + "type": "basic", + "modifierMask": 4 + }, + { + "keyActionType": "keystroke", + "type": "basic", + "scancode": 44 + }, + { + "keyActionType": "switchLayer", + "layer": "fn", + "toggle": false + }, + { + "keyActionType": "switchLayer", + "layer": "mod", + "toggle": false + }, + null + ] + }, + { + "id": 2, + "pointerRole": "scroll", + "keyActions": [] + } + ] + }, + { + "modules": [ + { + "id": 0, + "pointerRole": "none", + "keyActions": [ + { + "keyActionType": "keystroke", + "type": "basic", + "scancode": 35 + }, + { + "keyActionType": "keystroke", + "type": "basic", + "scancode": 34 + }, + { + "keyActionType": "keystroke", + "type": "basic", + "scancode": 33 + }, + { + "keyActionType": "keystroke", + "type": "basic", + "scancode": 32 + }, + { + "keyActionType": "keystroke", + "type": "basic", + "scancode": 31 + }, + { + "keyActionType": "keystroke", + "type": "basic", + "scancode": 30 + }, + { + "keyActionType": "keystroke", + "type": "basic", + "scancode": 53 + }, + { + "keyActionType": "keystroke", + "type": "basic", + "scancode": 21 + }, + { + "keyActionType": "keystroke", + "type": "basic", + "scancode": 8 + }, + { + "keyActionType": "keystroke", + "type": "basic", + "scancode": 26 + }, + { + "keyActionType": "keystroke", + "type": "basic", + "scancode": 20 + }, + { + "keyActionType": "keystroke", + "type": "basic", + "scancode": 43 + }, + null, + null, + { + "keyActionType": "keystroke", + "type": "basic", + "scancode": 23 + }, + { + "keyActionType": "keystroke", + "type": "basic", + "scancode": 9 + }, + { + "keyActionType": "keystroke", + "type": "basic", + "scancode": 7 + }, + { + "keyActionType": "keystroke", + "type": "basic", + "scancode": 22 + }, + { + "keyActionType": "keystroke", + "type": "basic", + "scancode": 4 + }, + { + "keyActionType": "switchLayer", + "layer": "mouse", + "toggle": false + }, + null, + { + "keyActionType": "keystroke", + "type": "basic", + "scancode": 10 + }, + { + "keyActionType": "keystroke", + "type": "basic", + "scancode": 5 + }, + { + "keyActionType": "keystroke", + "type": "basic", + "scancode": 25 + }, + { + "keyActionType": "keystroke", + "type": "basic", + "scancode": 6 + }, + { + "keyActionType": "keystroke", + "type": "basic", + "scancode": 27 + }, + { + "keyActionType": "keystroke", + "type": "basic", + "scancode": 29 + }, + { + "keyActionType": "keystroke", + "type": "basic", + "modifierMask": 32 + }, + null, + { + "keyActionType": "switchLayer", + "layer": "mod", + "toggle": false + }, + { + "keyActionType": "switchLayer", + "layer": "fn", + "toggle": false + }, + null, + { + "keyActionType": "keystroke", + "type": "basic", + "modifierMask": 64 + }, + { + "keyActionType": "keystroke", + "type": "basic", + "modifierMask": 128 + }, + { + "keyActionType": "keystroke", + "type": "basic", + "modifierMask": 16 + } + ] + }, + { + "id": 1, + "pointerRole": "none", + "keyActions": [ + { + "keyActionType": "keystroke", + "type": "basic", + "scancode": 42 + }, + { + "keyActionType": "keystroke", + "type": "basic", + "scancode": 46 + }, + { + "keyActionType": "keystroke", + "type": "basic", + "scancode": 45 + }, + { + "keyActionType": "keystroke", + "type": "basic", + "scancode": 39 + }, + { + "keyActionType": "keystroke", + "type": "basic", + "scancode": 38 + }, + { + "keyActionType": "keystroke", + "type": "basic", + "scancode": 37 + }, + { + "keyActionType": "keystroke", + "type": "basic", + "scancode": 36 + }, + { + "keyActionType": "keystroke", + "type": "basic", + "scancode": 49 + }, + { + "keyActionType": "keystroke", + "type": "basic", + "scancode": 19 + }, + { + "keyActionType": "keystroke", + "type": "basic", + "scancode": 18 + }, + { + "keyActionType": "keystroke", + "type": "basic", + "scancode": 12 + }, + { + "keyActionType": "keystroke", + "type": "basic", + "scancode": 24 + }, + null, + { + "keyActionType": "keystroke", + "type": "basic", + "scancode": 28 + }, + { + "keyActionType": "switchLayer", + "layer": "mouse", + "toggle": false + }, + { + "keyActionType": "keystroke", + "type": "basic", + "scancode": 51 + }, + { + "keyActionType": "keystroke", + "type": "basic", + "scancode": 15 + }, + { + "keyActionType": "keystroke", + "type": "basic", + "scancode": 14 + }, + { + "keyActionType": "keystroke", + "type": "basic", + "scancode": 13 + }, + null, + { + "keyActionType": "keystroke", + "type": "basic", + "scancode": 11 + }, + { + "keyActionType": "keystroke", + "type": "basic", + "modifierMask": 2 + }, + null, + { + "keyActionType": "keystroke", + "type": "basic", + "scancode": 56 + }, + { + "keyActionType": "keystroke", + "type": "basic", + "scancode": 55 + }, + { + "keyActionType": "keystroke", + "type": "basic", + "scancode": 54 + }, + { + "keyActionType": "keystroke", + "type": "basic", + "scancode": 16 + }, + { + "keyActionType": "keystroke", + "type": "basic", + "scancode": 17 + }, + { + "keyActionType": "keystroke", + "type": "basic", + "modifierMask": 1 + }, + { + "keyActionType": "keystroke", + "type": "basic", + "modifierMask": 8 + }, + { + "keyActionType": "keystroke", + "type": "basic", + "modifierMask": 4 + }, + { + "keyActionType": "keystroke", + "type": "basic", + "scancode": 40 + }, + { + "keyActionType": "switchLayer", + "layer": "fn", + "toggle": false + }, + { + "keyActionType": "switchLayer", + "layer": "mod", + "toggle": false + }, + null + ] + } + ] + }, + { + "modules": [ + { + "id": 0, + "pointerRole": "move", + "keyActions": [ + null, + null, + null, + null, + null, + null, + null, + { + "keyActionType": "keystroke", + "type": "basic", + "scancode": 74 + }, + { + "keyActionType": "keystroke", + "type": "basic", + "scancode": 82 + }, + { + "keyActionType": "keystroke", + "type": "basic", + "scancode": 77 + }, + { + "keyActionType": "keystroke", + "type": "basic", + "scancode": 76 + }, + { + "keyActionType": "switchKeymap", + "keymapAbbreviation": "WOR" + }, + { + "keyActionType": "switchKeymap", + "keymapAbbreviation": "KAP" + }, + null, + { + "keyActionType": "keystroke", + "type": "basic", + "scancode": 75 + }, + { + "keyActionType": "keystroke", + "type": "basic", + "scancode": 80 + }, + { + "keyActionType": "keystroke", + "type": "basic", + "scancode": 81 + }, + { + "keyActionType": "keystroke", + "type": "basic", + "scancode": 79 + }, + { + "keyActionType": "keystroke", + "type": "basic", + "scancode": 73 + }, + { + "keyActionType": "switchLayer", + "layer": "mouse", + "toggle": false + }, + null, + { + "keyActionType": "keystroke", + "type": "basic", + "scancode": 78 + }, + null, + null, + null, + null, + { + "keyActionType": "keystroke", + "type": "system", + "scancode": 130 + }, + { + "keyActionType": "keystroke", + "type": "basic", + "modifierMask": 32 + }, + null, + { + "keyActionType": "switchLayer", + "layer": "mod", + "toggle": false + }, + { + "keyActionType": "switchLayer", + "layer": "fn", + "toggle": false + }, + null, + { + "keyActionType": "keystroke", + "type": "basic", + "modifierMask": 64 + }, + { + "keyActionType": "keystroke", + "type": "basic", + "modifierMask": 128 + }, + { + "keyActionType": "keystroke", + "type": "basic", + "modifierMask": 16 + } + ] + }, + { + "id": 1, + "pointerRole": "scroll", + "keyActions": [ + { + "keyActionType": "switchKeymap", + "keymapAbbreviation": "QWR" + }, + { + "keyActionType": "switchKeymap", + "keymapAbbreviation": "DVO" + }, + { + "keyActionType": "switchKeymap", + "keymapAbbreviation": "COL" + }, + { + "keyActionType": "switchKeymap", + "keymapAbbreviation": "WOR" + }, + null, + { + "keyActionType": "switchKeymap", + "keymapAbbreviation": "KAP" + }, + { + "keyActionType": "switchKeymap", + "keymapAbbreviation": "EGG" + }, + null, + { + "keyActionType": "keystroke", + "type": "basic", + "scancode": 75 + }, + { + "keyActionType": "keystroke", + "type": "basic", + "scancode": 74 + }, + { + "keyActionType": "keystroke", + "type": "basic", + "scancode": 82 + }, + { + "keyActionType": "keystroke", + "type": "basic", + "scancode": 77 + }, + null, + { + "keyActionType": "keystroke", + "type": "basic", + "scancode": 76 + }, + { + "keyActionType": "switchLayer", + "layer": "mouse", + "toggle": false + }, + { + "keyActionType": "keystroke", + "type": "basic", + "scancode": 78 + }, + { + "keyActionType": "keystroke", + "type": "basic", + "scancode": 80 + }, + { + "keyActionType": "keystroke", + "type": "basic", + "scancode": 81 + }, + { + "keyActionType": "keystroke", + "type": "basic", + "scancode": 79 + }, + null, + { + "keyActionType": "keystroke", + "type": "basic", + "scancode": 73 + }, + { + "keyActionType": "keystroke", + "type": "basic", + "modifierMask": 2 + }, + null, + { + "keyActionType": "keystroke", + "type": "basic", + "scancode": 52 + }, + null, + { + "keyActionType": "keystroke", + "type": "basic", + "scancode": 47 + }, + { + "keyActionType": "keystroke", + "type": "basic", + "scancode": 48 + }, + null, + { + "keyActionType": "keystroke", + "type": "basic", + "modifierMask": 1 + }, + { + "keyActionType": "keystroke", + "type": "basic", + "modifierMask": 8 + }, + { + "keyActionType": "keystroke", + "type": "basic", + "modifierMask": 4 + }, + null, + { + "keyActionType": "switchLayer", + "layer": "fn", + "toggle": false + }, + { + "keyActionType": "switchLayer", + "layer": "mod", + "toggle": false + }, + null + ] + } + ] + }, + { + "modules": [ + { + "id": 0, + "pointerRole": "move", + "keyActions": [ + null, + null, + null, + null, + null, + null, + null, + { + "keyActionType": "mouse", + "mouseAction": "leftClick" + }, + { + "keyActionType": "mouse", + "mouseAction": "moveUp" + }, + { + "keyActionType": "mouse", + "mouseAction": "rightClick" + }, + null, + null, + null, + null, + { + "keyActionType": "mouse", + "mouseAction": "scrollUp" + }, + { + "keyActionType": "mouse", + "mouseAction": "moveLeft" + }, + { + "keyActionType": "mouse", + "mouseAction": "moveDown" + }, + { + "keyActionType": "mouse", + "mouseAction": "moveRight" + }, + null, + { + "keyActionType": "switchLayer", + "layer": "mouse", + "toggle": false + }, + null, + { + "keyActionType": "mouse", + "mouseAction": "scrollDown" + }, + null, + { + "keyActionType": "mouse", + "mouseAction": "scrollLeft" + }, + { + "keyActionType": "mouse", + "mouseAction": "middleClick" + }, + { + "keyActionType": "mouse", + "mouseAction": "scrollRight" + }, + null, + null, + null, + { + "keyActionType": "switchLayer", + "layer": "mod", + "toggle": false + }, + { + "keyActionType": "switchLayer", + "layer": "fn", + "toggle": false + }, + null, + { + "keyActionType": "keystroke", + "type": "basic", + "modifierMask": 64 + }, + { + "keyActionType": "keystroke", + "type": "basic", + "modifierMask": 128 + }, + { + "keyActionType": "keystroke", + "type": "basic", + "modifierMask": 16 + } + ] + }, + { + "id": 1, + "pointerRole": "move", + "keyActions": [ + null, + null, + null, + null, + null, + null, + null, + null, + { + "keyActionType": "mouse", + "mouseAction": "scrollUp" + }, + { + "keyActionType": "mouse", + "mouseAction": "leftClick" + }, + { + "keyActionType": "mouse", + "mouseAction": "moveUp" + }, + { + "keyActionType": "mouse", + "mouseAction": "rightClick" + }, + null, + null, + { + "keyActionType": "switchLayer", + "layer": "mouse", + "toggle": false + }, + { + "keyActionType": "mouse", + "mouseAction": "scrollDown" + }, + { + "keyActionType": "mouse", + "mouseAction": "moveLeft" + }, + { + "keyActionType": "mouse", + "mouseAction": "moveDown" + }, + { + "keyActionType": "mouse", + "mouseAction": "moveRight" + }, + null, + null, + null, + null, + null, + { + "keyActionType": "mouse", + "mouseAction": "scrollLeft" + }, + { + "keyActionType": "mouse", + "mouseAction": "middleClick" + }, + { + "keyActionType": "mouse", + "mouseAction": "scrollRight" + }, + null, + { + "keyActionType": "keystroke", + "type": "basic", + "modifierMask": 1 + }, + { + "keyActionType": "keystroke", + "type": "basic", + "modifierMask": 8 + }, + { + "keyActionType": "keystroke", + "type": "basic", + "modifierMask": 4 + }, + null, + { + "keyActionType": "switchLayer", + "layer": "fn", + "toggle": false + }, + { + "keyActionType": "switchLayer", + "layer": "mod", + "toggle": false + }, + null + ] + } + ] + } + ] + }, + { + "isDefault": false, + "abbreviation": "KAP", + "name": "KEYBOARD+MOUSE", "description": "", "layers": [ { @@ -1131,38 +5343,596 @@ null, null, null, + { + "keyActionType": "mouse", + "mouseAction": "leftClick" + }, + { + "keyActionType": "mouse", + "mouseAction": "moveUp" + }, + { + "keyActionType": "mouse", + "mouseAction": "rightClick" + }, null, null, null, null, + { + "keyActionType": "mouse", + "mouseAction": "scrollUp" + }, + { + "keyActionType": "mouse", + "mouseAction": "moveLeft" + }, + { + "keyActionType": "mouse", + "mouseAction": "moveDown" + }, + { + "keyActionType": "mouse", + "mouseAction": "moveRight" + }, null, null, null, + { + "keyActionType": "mouse", + "mouseAction": "scrollDown" + }, null, + { + "keyActionType": "mouse", + "mouseAction": "scrollLeft" + }, + { + "keyActionType": "mouse", + "mouseAction": "middleClick" + }, + { + "keyActionType": "mouse", + "mouseAction": "scrollRight" + }, null, + { + "keyActionType": "keystroke", + "type": "basic", + "modifierMask": 32 + }, null, - null, - null, - null, - null, - null, - null, - null, - null, - null, - null, - null, - null, - null, - null, - null, - null, - null + { + "keyActionType": "switchLayer", + "layer": "mod", + "toggle": false + }, + { + "keyActionType": "switchLayer", + "layer": "fn", + "toggle": false + }, + { + "keyActionType": "keystroke", + "type": "basic", + "scancode": 44 + }, + { + "keyActionType": "keystroke", + "type": "basic", + "modifierMask": 64 + }, + { + "keyActionType": "keystroke", + "type": "basic", + "modifierMask": 128 + }, + { + "keyActionType": "keystroke", + "type": "basic", + "modifierMask": 16 + } ] }, { "id": 1, "pointerRole": "move", + "keyActions": [ + { + "keyActionType": "keystroke", + "type": "basic", + "scancode": 53 + }, + { + "keyActionType": "keystroke", + "type": "basic", + "scancode": 30 + }, + { + "keyActionType": "keystroke", + "type": "basic", + "scancode": 31 + }, + { + "keyActionType": "keystroke", + "type": "basic", + "scancode": 32 + }, + { + "keyActionType": "keystroke", + "type": "basic", + "scancode": 33 + }, + { + "keyActionType": "keystroke", + "type": "basic", + "scancode": 34 + }, + { + "keyActionType": "keystroke", + "type": "basic", + "scancode": 35 + }, + { + "keyActionType": "keystroke", + "type": "basic", + "scancode": 43 + }, + { + "keyActionType": "keystroke", + "type": "basic", + "scancode": 20 + }, + { + "keyActionType": "keystroke", + "type": "basic", + "scancode": 26 + }, + { + "keyActionType": "keystroke", + "type": "basic", + "scancode": 8 + }, + { + "keyActionType": "keystroke", + "type": "basic", + "scancode": 21 + }, + null, + { + "keyActionType": "keystroke", + "type": "basic", + "scancode": 23 + }, + { + "keyActionType": "keystroke", + "type": "basic", + "scancode": 40 + }, + { + "keyActionType": "keystroke", + "type": "basic", + "scancode": 4 + }, + { + "keyActionType": "keystroke", + "type": "basic", + "scancode": 22 + }, + { + "keyActionType": "keystroke", + "type": "basic", + "scancode": 7 + }, + { + "keyActionType": "keystroke", + "type": "basic", + "scancode": 9 + }, + null, + { + "keyActionType": "keystroke", + "type": "basic", + "scancode": 10 + }, + { + "keyActionType": "keystroke", + "type": "basic", + "modifierMask": 2 + }, + null, + { + "keyActionType": "keystroke", + "type": "basic", + "scancode": 29 + }, + { + "keyActionType": "keystroke", + "type": "basic", + "scancode": 27 + }, + { + "keyActionType": "keystroke", + "type": "basic", + "scancode": 6 + }, + { + "keyActionType": "keystroke", + "type": "basic", + "scancode": 25 + }, + { + "keyActionType": "keystroke", + "type": "basic", + "scancode": 5 + }, + { + "keyActionType": "keystroke", + "type": "basic", + "modifierMask": 1 + }, + { + "keyActionType": "keystroke", + "type": "basic", + "modifierMask": 8 + }, + { + "keyActionType": "keystroke", + "type": "basic", + "modifierMask": 4 + }, + { + "keyActionType": "keystroke", + "type": "basic", + "scancode": 44 + }, + { + "keyActionType": "switchLayer", + "layer": "fn", + "toggle": false + }, + { + "keyActionType": "switchLayer", + "layer": "mod", + "toggle": false + }, + null + ] + }, + { + "id": 2, + "pointerRole": "scroll", + "keyActions": [] + } + ] + }, + { + "modules": [ + { + "id": 0, + "pointerRole": "none", + "keyActions": [ + { + "keyActionType": "keystroke", + "type": "basic", + "scancode": 35 + }, + { + "keyActionType": "keystroke", + "type": "basic", + "scancode": 34 + }, + { + "keyActionType": "keystroke", + "type": "basic", + "scancode": 33 + }, + { + "keyActionType": "keystroke", + "type": "basic", + "scancode": 32 + }, + { + "keyActionType": "keystroke", + "type": "basic", + "scancode": 31 + }, + { + "keyActionType": "keystroke", + "type": "basic", + "scancode": 30 + }, + { + "keyActionType": "keystroke", + "type": "basic", + "scancode": 53 + }, + { + "keyActionType": "keystroke", + "type": "basic", + "scancode": 21 + }, + { + "keyActionType": "keystroke", + "type": "basic", + "scancode": 8 + }, + { + "keyActionType": "keystroke", + "type": "basic", + "scancode": 26 + }, + { + "keyActionType": "keystroke", + "type": "basic", + "scancode": 20 + }, + { + "keyActionType": "keystroke", + "type": "basic", + "scancode": 43 + }, + null, + null, + { + "keyActionType": "keystroke", + "type": "basic", + "scancode": 23 + }, + { + "keyActionType": "keystroke", + "type": "basic", + "scancode": 9 + }, + { + "keyActionType": "keystroke", + "type": "basic", + "scancode": 7 + }, + { + "keyActionType": "keystroke", + "type": "basic", + "scancode": 22 + }, + { + "keyActionType": "keystroke", + "type": "basic", + "scancode": 4 + }, + { + "keyActionType": "keystroke", + "type": "basic", + "scancode": 52 + }, + null, + { + "keyActionType": "keystroke", + "type": "basic", + "scancode": 10 + }, + { + "keyActionType": "keystroke", + "type": "basic", + "scancode": 5 + }, + { + "keyActionType": "keystroke", + "type": "basic", + "scancode": 25 + }, + { + "keyActionType": "keystroke", + "type": "basic", + "scancode": 6 + }, + { + "keyActionType": "keystroke", + "type": "basic", + "scancode": 27 + }, + { + "keyActionType": "keystroke", + "type": "basic", + "scancode": 29 + }, + { + "keyActionType": "keystroke", + "type": "basic", + "modifierMask": 32 + }, + null, + { + "keyActionType": "switchLayer", + "layer": "mod", + "toggle": false + }, + { + "keyActionType": "switchLayer", + "layer": "fn", + "toggle": false + }, + null, + { + "keyActionType": "keystroke", + "type": "basic", + "modifierMask": 64 + }, + { + "keyActionType": "keystroke", + "type": "basic", + "modifierMask": 128 + }, + { + "keyActionType": "keystroke", + "type": "basic", + "modifierMask": 16 + } + ] + }, + { + "id": 1, + "pointerRole": "none", + "keyActions": [ + { + "keyActionType": "keystroke", + "type": "basic", + "scancode": 42 + }, + { + "keyActionType": "keystroke", + "type": "basic", + "scancode": 46 + }, + { + "keyActionType": "keystroke", + "type": "basic", + "scancode": 45 + }, + { + "keyActionType": "keystroke", + "type": "basic", + "scancode": 39 + }, + { + "keyActionType": "keystroke", + "type": "basic", + "scancode": 38 + }, + { + "keyActionType": "keystroke", + "type": "basic", + "scancode": 37 + }, + { + "keyActionType": "keystroke", + "type": "basic", + "scancode": 36 + }, + { + "keyActionType": "keystroke", + "type": "basic", + "scancode": 49 + }, + { + "keyActionType": "keystroke", + "type": "basic", + "scancode": 19 + }, + { + "keyActionType": "keystroke", + "type": "basic", + "scancode": 18 + }, + { + "keyActionType": "keystroke", + "type": "basic", + "scancode": 12 + }, + { + "keyActionType": "keystroke", + "type": "basic", + "scancode": 24 + }, + null, + { + "keyActionType": "keystroke", + "type": "basic", + "scancode": 28 + }, + null, + { + "keyActionType": "keystroke", + "type": "basic", + "scancode": 51 + }, + { + "keyActionType": "keystroke", + "type": "basic", + "scancode": 15 + }, + { + "keyActionType": "keystroke", + "type": "basic", + "scancode": 14 + }, + { + "keyActionType": "keystroke", + "type": "basic", + "scancode": 13 + }, + null, + { + "keyActionType": "keystroke", + "type": "basic", + "scancode": 11 + }, + { + "keyActionType": "keystroke", + "type": "basic", + "modifierMask": 2 + }, + null, + { + "keyActionType": "keystroke", + "type": "basic", + "scancode": 56 + }, + { + "keyActionType": "keystroke", + "type": "basic", + "scancode": 55 + }, + { + "keyActionType": "keystroke", + "type": "basic", + "scancode": 54 + }, + { + "keyActionType": "keystroke", + "type": "basic", + "scancode": 16 + }, + { + "keyActionType": "keystroke", + "type": "basic", + "scancode": 17 + }, + { + "keyActionType": "keystroke", + "type": "basic", + "modifierMask": 1 + }, + { + "keyActionType": "keystroke", + "type": "basic", + "modifierMask": 8 + }, + { + "keyActionType": "keystroke", + "type": "basic", + "modifierMask": 4 + }, + null, + { + "keyActionType": "switchLayer", + "layer": "fn", + "toggle": false + }, + { + "keyActionType": "switchLayer", + "layer": "mod", + "toggle": false + }, + null + ] + } + ] + }, + { + "modules": [ + { + "id": 0, + "pointerRole": "move", "keyActions": [ null, null, @@ -1171,29 +5941,246 @@ null, null, null, + { + "keyActionType": "keystroke", + "type": "basic", + "scancode": 74 + }, + { + "keyActionType": "keystroke", + "type": "basic", + "scancode": 82 + }, + { + "keyActionType": "keystroke", + "type": "basic", + "scancode": 77 + }, + { + "keyActionType": "keystroke", + "type": "basic", + "scancode": 76 + }, + { + "keyActionType": "switchKeymap", + "keymapAbbreviation": "1HA" + }, + { + "keyActionType": "switchKeymap", + "keymapAbbreviation": "EGG" + }, + null, + { + "keyActionType": "keystroke", + "type": "basic", + "scancode": 75 + }, + { + "keyActionType": "keystroke", + "type": "basic", + "scancode": 80 + }, + { + "keyActionType": "keystroke", + "type": "basic", + "scancode": 81 + }, + { + "keyActionType": "keystroke", + "type": "basic", + "scancode": 79 + }, + { + "keyActionType": "keystroke", + "type": "basic", + "scancode": 73 + }, + { + "keyActionType": "keystroke", + "type": "system", + "scancode": 131 + }, + null, + { + "keyActionType": "keystroke", + "type": "basic", + "scancode": 78 + }, null, null, null, null, + { + "keyActionType": "keystroke", + "type": "system", + "scancode": 130 + }, + { + "keyActionType": "keystroke", + "type": "basic", + "modifierMask": 32 + }, null, + { + "keyActionType": "switchLayer", + "layer": "mod", + "toggle": false + }, + { + "keyActionType": "switchLayer", + "layer": "fn", + "toggle": false + }, null, + { + "keyActionType": "keystroke", + "type": "basic", + "modifierMask": 64 + }, + { + "keyActionType": "keystroke", + "type": "basic", + "modifierMask": 128 + }, + { + "keyActionType": "keystroke", + "type": "basic", + "modifierMask": 16 + } + ] + }, + { + "id": 1, + "pointerRole": "scroll", + "keyActions": [ + { + "keyActionType": "switchKeymap", + "keymapAbbreviation": "QWR" + }, + { + "keyActionType": "switchKeymap", + "keymapAbbreviation": "DVO" + }, + { + "keyActionType": "switchKeymap", + "keymapAbbreviation": "COL" + }, + { + "keyActionType": "switchKeymap", + "keymapAbbreviation": "WOR" + }, + { + "keyActionType": "switchKeymap", + "keymapAbbreviation": "1HA" + }, null, + { + "keyActionType": "switchKeymap", + "keymapAbbreviation": "EGG" + }, null, + { + "keyActionType": "keystroke", + "type": "basic", + "scancode": 75 + }, + { + "keyActionType": "keystroke", + "type": "basic", + "scancode": 74 + }, + { + "keyActionType": "keystroke", + "type": "basic", + "scancode": 82 + }, + { + "keyActionType": "keystroke", + "type": "basic", + "scancode": 77 + }, null, + { + "keyActionType": "keystroke", + "type": "basic", + "scancode": 76 + }, null, + { + "keyActionType": "keystroke", + "type": "basic", + "scancode": 78 + }, + { + "keyActionType": "keystroke", + "type": "basic", + "scancode": 80 + }, + { + "keyActionType": "keystroke", + "type": "basic", + "scancode": 81 + }, + { + "keyActionType": "keystroke", + "type": "basic", + "scancode": 79 + }, null, + { + "keyActionType": "keystroke", + "type": "basic", + "scancode": 73 + }, + { + "keyActionType": "keystroke", + "type": "basic", + "modifierMask": 2 + }, null, + { + "keyActionType": "keystroke", + "type": "basic", + "scancode": 52 + }, null, + { + "keyActionType": "keystroke", + "type": "basic", + "scancode": 47 + }, + { + "keyActionType": "keystroke", + "type": "basic", + "scancode": 48 + }, null, + { + "keyActionType": "keystroke", + "type": "basic", + "modifierMask": 1 + }, + { + "keyActionType": "keystroke", + "type": "basic", + "modifierMask": 8 + }, + { + "keyActionType": "keystroke", + "type": "basic", + "modifierMask": 4 + }, null, - null, - null, - null, - null, - null, - null, - null, - null, + { + "keyActionType": "switchLayer", + "layer": "fn", + "toggle": false + }, + { + "keyActionType": "switchLayer", + "layer": "mod", + "toggle": false + }, null ] } @@ -1234,7 +6221,16 @@ null, null, null, - null, + { + "keyActionType": "switchLayer", + "layer": "mod", + "toggle": false + }, + { + "keyActionType": "switchLayer", + "layer": "fn", + "toggle": false + }, null, null, null, @@ -1275,6 +6271,900 @@ null, null, null, + null, + null, + { + "keyActionType": "switchLayer", + "layer": "fn", + "toggle": false + }, + { + "keyActionType": "switchLayer", + "layer": "mod", + "toggle": false + }, + null + ] + } + ] + } + ] + }, + { + "isDefault": false, + "abbreviation": "EGG", + "name": "EGGHEAD.IO", + "description": "", + "layers": [ + { + "modules": [ + { + "id": 0, + "pointerRole": "move", + "keyActions": [ + { + "keyActionType": "keystroke", + "type": "basic", + "scancode": 36 + }, + { + "keyActionType": "keystroke", + "type": "basic", + "scancode": 37 + }, + { + "keyActionType": "keystroke", + "type": "basic", + "scancode": 38 + }, + { + "keyActionType": "keystroke", + "type": "basic", + "scancode": 39 + }, + { + "keyActionType": "keystroke", + "type": "basic", + "scancode": 45 + }, + { + "keyActionType": "keystroke", + "type": "basic", + "scancode": 46 + }, + { + "keyActionType": "keystroke", + "type": "basic", + "scancode": 42 + }, + { + "keyActionType": "keystroke", + "type": "basic", + "scancode": 24 + }, + { + "keyActionType": "keystroke", + "type": "basic", + "scancode": 12 + }, + { + "keyActionType": "keystroke", + "type": "basic", + "scancode": 18 + }, + { + "keyActionType": "keystroke", + "type": "basic", + "scancode": 19 + }, + { + "keyActionType": "keystroke", + "type": "basic", + "scancode": 47 + }, + { + "keyActionType": "keystroke", + "type": "basic", + "scancode": 48 + }, + { + "keyActionType": "keystroke", + "type": "basic", + "scancode": 49 + }, + { + "keyActionType": "keystroke", + "type": "basic", + "scancode": 28 + }, + { + "keyActionType": "keystroke", + "type": "basic", + "scancode": 13 + }, + { + "keyActionType": "keystroke", + "type": "basic", + "scancode": 14 + }, + { + "keyActionType": "keystroke", + "type": "basic", + "scancode": 15 + }, + { + "keyActionType": "keystroke", + "type": "basic", + "scancode": 51 + }, + { + "keyActionType": "keystroke", + "type": "basic", + "scancode": 52 + }, + { + "keyActionType": "keystroke", + "type": "basic", + "scancode": 40 + }, + { + "keyActionType": "keystroke", + "type": "basic", + "scancode": 11 + }, + { + "keyActionType": "keystroke", + "type": "basic", + "scancode": 17 + }, + { + "keyActionType": "keystroke", + "type": "basic", + "scancode": 16 + }, + { + "keyActionType": "keystroke", + "type": "basic", + "scancode": 54 + }, + { + "keyActionType": "keystroke", + "type": "basic", + "scancode": 55 + }, + { + "keyActionType": "keystroke", + "type": "basic", + "scancode": 56 + }, + { + "keyActionType": "keystroke", + "type": "basic", + "modifierMask": 32 + }, + null, + { + "keyActionType": "keystroke", + "type": "basic", + "scancode": 44 + }, + { + "keyActionType": "switchLayer", + "layer": "mod", + "toggle": false + }, + { + "keyActionType": "switchLayer", + "layer": "fn", + "toggle": false + }, + { + "keyActionType": "keystroke", + "type": "basic", + "modifierMask": 64 + }, + { + "keyActionType": "keystroke", + "type": "basic", + "modifierMask": 128 + }, + { + "keyActionType": "keystroke", + "type": "basic", + "modifierMask": 16 + } + ] + }, + { + "id": 1, + "pointerRole": "move", + "keyActions": [ + { + "keyActionType": "keystroke", + "type": "basic", + "scancode": 53 + }, + { + "keyActionType": "keystroke", + "type": "basic", + "scancode": 30 + }, + { + "keyActionType": "keystroke", + "type": "basic", + "scancode": 31 + }, + { + "keyActionType": "keystroke", + "type": "basic", + "scancode": 32 + }, + { + "keyActionType": "keystroke", + "type": "basic", + "scancode": 33 + }, + { + "keyActionType": "keystroke", + "type": "basic", + "scancode": 34 + }, + { + "keyActionType": "keystroke", + "type": "basic", + "scancode": 35 + }, + { + "keyActionType": "keystroke", + "type": "basic", + "scancode": 43 + }, + { + "keyActionType": "keystroke", + "type": "basic", + "scancode": 20 + }, + { + "keyActionType": "keystroke", + "type": "basic", + "scancode": 26 + }, + { + "keyActionType": "keystroke", + "type": "basic", + "scancode": 8 + }, + { + "keyActionType": "keystroke", + "type": "basic", + "scancode": 21 + }, + null, + { + "keyActionType": "keystroke", + "type": "basic", + "scancode": 23 + }, + { + "keyActionType": "switchLayer", + "layer": "mouse", + "toggle": false + }, + { + "keyActionType": "keystroke", + "type": "basic", + "scancode": 4 + }, + { + "keyActionType": "keystroke", + "type": "basic", + "scancode": 22 + }, + { + "keyActionType": "keystroke", + "type": "basic", + "scancode": 7 + }, + { + "keyActionType": "keystroke", + "type": "basic", + "scancode": 9 + }, + null, + { + "keyActionType": "keystroke", + "type": "basic", + "scancode": 10 + }, + { + "keyActionType": "keystroke", + "type": "basic", + "modifierMask": 2 + }, + null, + { + "keyActionType": "keystroke", + "type": "basic", + "scancode": 29 + }, + { + "keyActionType": "keystroke", + "type": "basic", + "scancode": 27 + }, + { + "keyActionType": "keystroke", + "type": "basic", + "scancode": 6 + }, + { + "keyActionType": "keystroke", + "type": "basic", + "scancode": 25 + }, + { + "keyActionType": "keystroke", + "type": "basic", + "scancode": 5 + }, + { + "keyActionType": "keystroke", + "type": "basic", + "modifierMask": 1 + }, + { + "keyActionType": "keystroke", + "type": "basic", + "modifierMask": 8 + }, + { + "keyActionType": "keystroke", + "type": "basic", + "modifierMask": 4 + }, + { + "keyActionType": "switchLayer", + "layer": "fn", + "toggle": false + }, + { + "keyActionType": "keystroke", + "type": "basic", + "scancode": 44 + }, + { + "keyActionType": "switchLayer", + "layer": "mod", + "toggle": false + }, + null + ] + }, + { + "id": 2, + "pointerRole": "scroll", + "keyActions": [] + } + ] + }, + { + "modules": [ + { + "id": 0, + "pointerRole": "none", + "keyActions": [ + { + "keyActionType": "keystroke", + "type": "basic", + "scancode": 64 + }, + { + "keyActionType": "keystroke", + "type": "basic", + "scancode": 65 + }, + { + "keyActionType": "keystroke", + "type": "basic", + "scancode": 66 + }, + { + "keyActionType": "keystroke", + "type": "basic", + "scancode": 67 + }, + { + "keyActionType": "keystroke", + "type": "basic", + "scancode": 68 + }, + { + "keyActionType": "keystroke", + "type": "basic", + "scancode": 69 + }, + { + "keyActionType": "keystroke", + "type": "basic", + "scancode": 76 + }, + { + "keyActionType": "keystroke", + "type": "basic", + "scancode": 74 + }, + { + "keyActionType": "keystroke", + "type": "basic", + "scancode": 82 + }, + { + "keyActionType": "keystroke", + "type": "basic", + "scancode": 77 + }, + { + "keyActionType": "keystroke", + "type": "basic", + "scancode": 76 + }, + { + "keyActionType": "keystroke", + "type": "basic", + "scancode": 70 + }, + { + "keyActionType": "keystroke", + "type": "basic", + "scancode": 71 + }, + { + "keyActionType": "keystroke", + "type": "basic", + "scancode": 72 + }, + { + "keyActionType": "keystroke", + "type": "basic", + "scancode": 75 + }, + { + "keyActionType": "keystroke", + "type": "basic", + "scancode": 80 + }, + { + "keyActionType": "keystroke", + "type": "basic", + "scancode": 81 + }, + { + "keyActionType": "keystroke", + "type": "basic", + "scancode": 79 + }, + { + "keyActionType": "keystroke", + "type": "basic", + "scancode": 73 + }, + null, + null, + { + "keyActionType": "keystroke", + "type": "basic", + "scancode": 78 + }, + { + "keyActionType": "keystroke", + "type": "basic", + "scancode": 41 + }, + null, + null, + null, + { + "keyActionType": "keystroke", + "type": "basic", + "scancode": 118 + }, + { + "keyActionType": "keystroke", + "type": "basic", + "modifierMask": 32 + }, + null, + null, + { + "keyActionType": "switchLayer", + "layer": "mod", + "toggle": false + }, + { + "keyActionType": "switchLayer", + "layer": "fn", + "toggle": false + }, + { + "keyActionType": "keystroke", + "type": "basic", + "modifierMask": 64 + }, + { + "keyActionType": "keystroke", + "type": "basic", + "modifierMask": 128 + }, + { + "keyActionType": "keystroke", + "type": "basic", + "modifierMask": 16 + } + ] + }, + { + "id": 1, + "pointerRole": "none", + "keyActions": [ + { + "keyActionType": "keystroke", + "type": "basic", + "scancode": 41 + }, + { + "keyActionType": "keystroke", + "type": "basic", + "scancode": 58 + }, + { + "keyActionType": "keystroke", + "type": "basic", + "scancode": 59 + }, + { + "keyActionType": "keystroke", + "type": "basic", + "scancode": 60 + }, + { + "keyActionType": "keystroke", + "type": "basic", + "scancode": 61 + }, + { + "keyActionType": "keystroke", + "type": "basic", + "scancode": 62 + }, + { + "keyActionType": "keystroke", + "type": "basic", + "scancode": 63 + }, + null, + { + "keyActionType": "keystroke", + "type": "basic", + "scancode": 41 + }, + { + "keyActionType": "keystroke", + "type": "basic", + "scancode": 75, + "modifierMask": 1 + }, + { + "keyActionType": "keystroke", + "type": "basic", + "scancode": 23, + "modifierMask": 1 + }, + { + "keyActionType": "keystroke", + "type": "basic", + "scancode": 78, + "modifierMask": 1 + }, + null, + null, + { + "keyActionType": "switchLayer", + "layer": "mouse", + "toggle": false + }, + { + "keyActionType": "keystroke", + "type": "basic", + "scancode": 57, + "modifierMask": 1 + }, + { + "keyActionType": "keystroke", + "type": "basic", + "modifierMask": 4 + }, + { + "keyActionType": "keystroke", + "type": "basic", + "modifierMask": 1 + }, + { + "keyActionType": "keystroke", + "type": "basic", + "modifierMask": 2 + }, + null, + null, + { + "keyActionType": "keystroke", + "type": "basic", + "modifierMask": 2 + }, + null, + null, + { + "keyActionType": "keystroke", + "type": "basic", + "scancode": 75, + "modifierMask": 3 + }, + { + "keyActionType": "keystroke", + "type": "basic", + "scancode": 26, + "modifierMask": 1 + }, + { + "keyActionType": "keystroke", + "type": "basic", + "scancode": 78, + "modifierMask": 3 + }, + null, + { + "keyActionType": "keystroke", + "type": "basic", + "modifierMask": 1 + }, + { + "keyActionType": "keystroke", + "type": "basic", + "modifierMask": 8 + }, + { + "keyActionType": "keystroke", + "type": "basic", + "modifierMask": 4 + }, + { + "keyActionType": "switchLayer", + "layer": "fn", + "toggle": false + }, + null, + { + "keyActionType": "switchLayer", + "layer": "mod", + "toggle": false + }, + null + ] + } + ] + }, + { + "modules": [ + { + "id": 0, + "pointerRole": "move", + "keyActions": [ + null, + null, + null, + null, + { + "keyActionType": "keystroke", + "type": "system", + "scancode": 131 + }, + { + "keyActionType": "keystroke", + "type": "system", + "scancode": 130 + }, + null, + { + "keyActionType": "keystroke", + "type": "media", + "scancode": 176 + }, + { + "keyActionType": "keystroke", + "type": "media", + "scancode": 233 + }, + { + "keyActionType": "keystroke", + "type": "media", + "scancode": 183 + }, + null, + { + "keyActionType": "switchKeymap", + "keymapAbbreviation": "KAP" + }, + { + "keyActionType": "switchKeymap", + "keymapAbbreviation": "QWR" + }, + null, + null, + { + "keyActionType": "keystroke", + "type": "media", + "scancode": 182 + }, + { + "keyActionType": "keystroke", + "type": "media", + "scancode": 234 + }, + { + "keyActionType": "keystroke", + "type": "media", + "scancode": 181 + }, + null, + { + "keyActionType": "keystroke", + "type": "system", + "scancode": 131 + }, + null, + null, + null, + null, + { + "keyActionType": "keystroke", + "type": "media", + "scancode": 226 + }, + null, + { + "keyActionType": "keystroke", + "type": "system", + "scancode": 130 + }, + { + "keyActionType": "keystroke", + "type": "basic", + "modifierMask": 32 + }, + null, + null, + { + "keyActionType": "switchLayer", + "layer": "mod", + "toggle": false + }, + { + "keyActionType": "switchLayer", + "layer": "fn", + "toggle": false + }, + { + "keyActionType": "keystroke", + "type": "basic", + "modifierMask": 64 + }, + { + "keyActionType": "keystroke", + "type": "basic", + "modifierMask": 128 + }, + { + "keyActionType": "keystroke", + "type": "basic", + "modifierMask": 16 + } + ] + }, + { + "id": 1, + "pointerRole": "scroll", + "keyActions": [ + { + "keyActionType": "switchKeymap", + "keymapAbbreviation": "QWR" + }, + { + "keyActionType": "switchKeymap", + "keymapAbbreviation": "DVO" + }, + { + "keyActionType": "switchKeymap", + "keymapAbbreviation": "COL" + }, + { + "keyActionType": "switchKeymap", + "keymapAbbreviation": "WOR" + }, + { + "keyActionType": "switchKeymap", + "keymapAbbreviation": "1HA" + }, + { + "keyActionType": "switchKeymap", + "keymapAbbreviation": "KAP" + }, + null, + null, + null, + null, + null, + null, + null, + null, + { + "keyActionType": "switchLayer", + "layer": "mouse", + "toggle": false + }, + null, + null, + { + "keyActionType": "keystroke", + "type": "media", + "scancode": 406 + }, + null, + null, + null, + { + "keyActionType": "keystroke", + "type": "basic", + "modifierMask": 2 + }, + null, + null, + null, + { + "keyActionType": "keystroke", + "type": "media", + "scancode": 402 + }, + { + "keyActionType": "keystroke", + "type": "media", + "scancode": 184 + }, + null, + { + "keyActionType": "keystroke", + "type": "basic", + "modifierMask": 1 + }, + { + "keyActionType": "keystroke", + "type": "basic", + "modifierMask": 8 + }, + { + "keyActionType": "keystroke", + "type": "basic", + "modifierMask": 4 + }, + { + "keyActionType": "switchLayer", + "layer": "fn", + "toggle": false + }, + null, + { + "keyActionType": "switchLayer", + "layer": "mod", + "toggle": false + }, null ] } @@ -1294,6 +7184,38 @@ null, null, null, + { + "keyActionType": "mouse", + "mouseAction": "moveUp" + }, + null, + null, + null, + null, + null, + { + "keyActionType": "mouse", + "mouseAction": "scrollUp" + }, + { + "keyActionType": "mouse", + "mouseAction": "moveLeft" + }, + { + "keyActionType": "mouse", + "mouseAction": "moveDown" + }, + { + "keyActionType": "mouse", + "mouseAction": "moveRight" + }, + null, + null, + null, + { + "keyActionType": "mouse", + "mouseAction": "scrollDown" + }, null, null, null, @@ -1302,24 +7224,31 @@ null, null, null, - null, - null, - null, - null, - null, - null, - null, - null, - null, - null, - null, - null, - null, - null, - null, - null, - null, - null + { + "keyActionType": "switchLayer", + "layer": "mod", + "toggle": false + }, + { + "keyActionType": "switchLayer", + "layer": "fn", + "toggle": false + }, + { + "keyActionType": "keystroke", + "type": "basic", + "modifierMask": 64 + }, + { + "keyActionType": "keystroke", + "type": "basic", + "modifierMask": 128 + }, + { + "keyActionType": "keystroke", + "type": "basic", + "modifierMask": 16 + } ] }, { @@ -1340,103 +7269,62 @@ null, null, null, - null, - null, - null, - null, - null, - null, - null, - null, - null, - null, - null, - null, - null, - null, - null, - null, - null - ] - } - ] - }, - { - "modules": [ - { - "id": 0, - "pointerRole": "move", - "keyActions": [ - null, - null, - null, - null, - null, - null, - null, - null, - null, - null, - null, - null, - null, - null, - null, - null, - null, - null, - null, - null, - null, - null, - null, - null, - null, - null, - null, - null, - null, - null, - null, - null, - null, - null - ] - }, - { - "id": 1, - "pointerRole": "move", - "keyActions": [ - null, - null, - null, - null, - null, - null, - null, - null, - null, - null, - null, - null, - null, - null, - null, - null, - null, - null, - null, - null, - null, - null, - null, - null, - null, - null, - null, - null, - null, - null, + { + "keyActionType": "switchLayer", + "layer": "mouse", + "toggle": false + }, + null, + { + "keyActionType": "mouse", + "mouseAction": "rightClick" + }, + { + "keyActionType": "mouse", + "mouseAction": "middleClick" + }, + { + "keyActionType": "mouse", + "mouseAction": "leftClick" + }, + null, + null, + null, + null, + null, + null, + null, + null, + null, + { + "keyActionType": "keystroke", + "type": "basic", + "modifierMask": 1 + }, + { + "keyActionType": "keystroke", + "type": "basic", + "modifierMask": 8 + }, + { + "keyActionType": "keystroke", + "type": "basic", + "modifierMask": 4 + }, + { + "keyActionType": "switchLayer", + "layer": "fn", + "toggle": false + }, + { + "keyActionType": "mouse", + "mouseAction": "decelerate" + }, + { + "keyActionType": "switchLayer", + "layer": "mod", + "toggle": false + }, null ] } @@ -1454,16 +7342,19 @@ { "macroActionType": "key", "action": "press", + "type": "basic", "scancode": 111 }, { "macroActionType": "key", "action": "hold", + "type": "basic", "scancode": 83 }, { "macroActionType": "key", "action": "release", + "type": "basic", "scancode": 112 }, { @@ -1524,6 +7415,7 @@ { "macroActionType": "key", "action": "press", + "type": "basic", "scancode": 111 }, { diff --git a/packages/test-serializer/user-config.bin b/packages/test-serializer/user-config.bin index 00d907aa..9ff0f1d3 100644 Binary files a/packages/test-serializer/user-config.bin and b/packages/test-serializer/user-config.bin differ diff --git a/packages/uhk-agent/package-lock.json b/packages/uhk-agent/package-lock.json index 75f7924c..59a1efdf 100644 --- a/packages/uhk-agent/package-lock.json +++ b/packages/uhk-agent/package-lock.json @@ -392,9 +392,9 @@ } }, "electron": { - "version": "1.7.6", - "resolved": "https://registry.npmjs.org/electron/-/electron-1.7.6.tgz", - "integrity": "sha1-+2nqMb0D3w7/JH8m8LU4vSm27nI=", + "version": "1.7.5", + "resolved": "https://registry.npmjs.org/electron/-/electron-1.7.5.tgz", + "integrity": "sha1-BloxAr+LhxAt9QxQmF/v5sVpBFs=", "requires": { "@types/node": "7.0.43", "electron-download": "3.3.0", @@ -432,9 +432,9 @@ "integrity": "sha1-ihBD4ys6HaHD9VPc4oznZCRhZ+M=" }, "electron-log": { - "version": "2.2.9", - "resolved": "https://registry.npmjs.org/electron-log/-/electron-log-2.2.9.tgz", - "integrity": "sha512-WNMSipQYurNxY14RO6IKgcxcZg1e4aNVpUUJK9q7Bqe0TZEKn1e5h4HiQKhTgVLqKrUn++ugOZrty450P9vpjA==" + "version": "2.2.6", + "resolved": "https://registry.npmjs.org/electron-log/-/electron-log-2.2.6.tgz", + "integrity": "sha1-zPo+CbOfMhRoyQpkJwE4CjQHnxo=" }, "electron-rebuild": { "version": "1.6.0", diff --git a/packages/uhk-agent/package.json b/packages/uhk-agent/package.json index d38eff37..65bf38ff 100644 --- a/packages/uhk-agent/package.json +++ b/packages/uhk-agent/package.json @@ -22,7 +22,8 @@ "electron-settings": "3.0.14", "electron-updater": "2.2.0", "node-hid": "0.5.4", - "sudo-prompt": "^7.0.0" + "sudo-prompt": "^7.0.0", + "uhk-usb": "1.0.0" }, "devDependencies": { "uhk-common": "^1.0.0" diff --git a/packages/uhk-agent/src/electron-main.ts b/packages/uhk-agent/src/electron-main.ts index 926f668d..619c8634 100644 --- a/packages/uhk-agent/src/electron-main.ts +++ b/packages/uhk-agent/src/electron-main.ts @@ -8,6 +8,7 @@ import { autoUpdater } from 'electron-updater'; import * as path from 'path'; import * as url from 'url'; import * as commandLineArgs from 'command-line-args'; +import { UhkHidDevice } from 'uhk-usb'; // import { ElectronDataStorageRepositoryService } from './services/electron-datastorage-repository.service'; import { CommandLineArgs } from 'uhk-common'; @@ -16,7 +17,6 @@ import { logger } from './services/logger.service'; import { AppUpdateService } from './services/app-update.service'; import { AppService } from './services/app.service'; import { SudoService } from './services/sudo.service'; -import { UhkHidDeviceService } from './services/uhk-hid-device.service'; const optionDefinitions = [ { name: 'addons', type: Boolean, defaultOption: false } @@ -33,7 +33,7 @@ let win: Electron.BrowserWindow; autoUpdater.logger = logger; let deviceService: DeviceService; -let uhkHidDeviceService: UhkHidDeviceService; +let uhkHidDeviceService: UhkHidDevice; let appUpdateService: AppUpdateService; let appService: AppService; let sudoService: SudoService; @@ -51,7 +51,7 @@ function createWindow() { }); win.setMenuBarVisibility(false); win.maximize(); - uhkHidDeviceService = new UhkHidDeviceService(logger); + uhkHidDeviceService = new UhkHidDevice(logger); deviceService = new DeviceService(logger, win, uhkHidDeviceService); appUpdateService = new AppUpdateService(logger, win, app); appService = new AppService(logger, win, deviceService, options, uhkHidDeviceService); diff --git a/packages/uhk-agent/src/services/app.service.ts b/packages/uhk-agent/src/services/app.service.ts index 28112737..c14c6930 100644 --- a/packages/uhk-agent/src/services/app.service.ts +++ b/packages/uhk-agent/src/services/app.service.ts @@ -1,16 +1,16 @@ import { ipcMain, BrowserWindow } from 'electron'; +import { UhkHidDevice } from 'uhk-usb'; import { CommandLineArgs, IpcEvents, AppStartInfo, LogService } from 'uhk-common'; import { MainServiceBase } from './main-service-base'; import { DeviceService } from './device.service'; -import { UhkHidDeviceService } from './uhk-hid-device.service'; export class AppService extends MainServiceBase { constructor(protected logService: LogService, protected win: Electron.BrowserWindow, private deviceService: DeviceService, private options: CommandLineArgs, - private uhkHidDeviceService: UhkHidDeviceService) { + private uhkHidDeviceService: UhkHidDevice) { super(logService, win); ipcMain.on(IpcEvents.app.getAppStartInfo, this.handleAppStartInfo.bind(this)); diff --git a/packages/uhk-agent/src/services/device.service.ts b/packages/uhk-agent/src/services/device.service.ts index 1c0340fb..08161d9e 100644 --- a/packages/uhk-agent/src/services/device.service.ts +++ b/packages/uhk-agent/src/services/device.service.ts @@ -1,10 +1,10 @@ import { ipcMain } from 'electron'; - -import { Constants, IpcEvents, LogService, IpcResponse } from 'uhk-common'; - +import { IpcEvents, LogService, IpcResponse, ConfigurationReply } from 'uhk-common'; +import { Constants, EepromTransfer, SystemPropertyIds, UsbCommand } from 'uhk-usb'; import { Observable } from 'rxjs/Observable'; import { Subscription } from 'rxjs/Subscription'; import { Device, devices } from 'node-hid'; +import { UhkHidDevice } from 'uhk-usb'; import 'rxjs/add/observable/interval'; import 'rxjs/add/operator/startWith'; @@ -12,38 +12,6 @@ import 'rxjs/add/operator/map'; import 'rxjs/add/operator/do'; import 'rxjs/add/operator/distinctUntilChanged'; -import { UhkHidDeviceService } from './uhk-hid-device.service'; - -/** - * UHK USB Communications command. All communication package should have start with a command code. - */ -enum Command { - GetProperty = 0, - UploadConfig = 8, - ApplyConfig = 9, - LaunchEepromTransfer = 12, - ReadUserConfig = 15, - GetKeyboardState = 16 -} - -enum EepromTransfer { - ReadHardwareConfig = 0, - WriteHardwareConfig = 1, - ReadUserConfig = 2, - WriteUserConfig = 3 -} - -enum SystemPropertyIds { - UsbProtocolVersion = 0, - BridgeProtocolVersion = 1, - DataModelVersion = 2, - FirmwareVersion = 3, - HardwareConfigSize = 4, - UserConfigSize = 5 -} - -const snooze = ms => new Promise(resolve => setTimeout(resolve, ms)); - /** * IpcMain pair of the UHK Communication * Functionality: @@ -57,10 +25,10 @@ export class DeviceService { constructor(private logService: LogService, private win: Electron.BrowserWindow, - private device: UhkHidDeviceService) { + private device: UhkHidDevice) { this.pollUhkDevice(); ipcMain.on(IpcEvents.device.saveUserConfiguration, this.saveUserConfiguration.bind(this)); - ipcMain.on(IpcEvents.device.loadUserConfiguration, this.loadUserConfiguration.bind(this)); + ipcMain.on(IpcEvents.device.loadConfigurations, this.loadConfigurations.bind(this)); logService.debug('[DeviceService] init success'); } @@ -76,32 +44,64 @@ export class DeviceService { * Return with the actual UserConfiguration from UHK Device * @returns {Promise} */ - public async loadUserConfiguration(event: Electron.Event): Promise { + public async loadConfigurations(event: Electron.Event): Promise { + try { + const userConfiguration = await this.loadConfiguration( + SystemPropertyIds.UserConfigSize, + UsbCommand.ReadUserConfig, + 'user configuration'); + + const hardwareConfiguration = await this.loadConfiguration( + SystemPropertyIds.HardwareConfigSize, + UsbCommand.ReadHardwareConfig, + 'hardware configuration'); + + const response: ConfigurationReply = { + success: true, + userConfiguration, + hardwareConfiguration + }; + event.sender.send(IpcEvents.device.loadConfigurationReply, JSON.stringify(response)); + } catch (error) { + const response: ConfigurationReply = { + success: false, + error: error.message + }; + event.sender.send(IpcEvents.device.loadConfigurationReply, JSON.stringify(response)); + } finally { + this.device.close(); + } + } + + /** + * Return with the actual user / hardware fonfiguration from UHK Device + * @returns {Promise} + */ + public async loadConfiguration(property: SystemPropertyIds, config: UsbCommand, configName: string): Promise { let response = []; try { - this.logService.debug('[DeviceService] USB[T]: Read user configuration size from keyboard'); - const configSize = await this.getUserConfigSizeFromKeyboard(); + this.logService.debug(`[DeviceService] USB[T]: Read ${configName} size from keyboard`); + const configSize = await this.getConfigSizeFromKeyboard(property); const chunkSize = 63; let offset = 0; let configBuffer = new Buffer(0); - this.logService.debug('[DeviceService] USB[T]: Read user configuration from keyboard'); + this.logService.debug(`[DeviceService] USB[T]: Read ${configName} from keyboard`); while (offset < configSize) { const chunkSizeToRead = Math.min(chunkSize, configSize - offset); - const writeBuffer = Buffer.from([Command.ReadUserConfig, chunkSizeToRead, offset & 0xff, offset >> 8]); + const writeBuffer = Buffer.from([config, chunkSizeToRead, offset & 0xff, offset >> 8]); const readBuffer = await this.device.write(writeBuffer); configBuffer = Buffer.concat([configBuffer, new Buffer(readBuffer.slice(1, chunkSizeToRead + 1))]); offset += chunkSizeToRead; } - response = UhkHidDeviceService.convertBufferToIntArray(configBuffer); + response = UhkHidDevice.convertBufferToIntArray(configBuffer); + return Promise.resolve(JSON.stringify(response)); } catch (error) { - this.logService.error('[DeviceService] getUserConfigFromEeprom error', error); - } finally { - this.device.close(); + const errMsg = `[DeviceService] ${configName} from eeprom error`; + this.logService.error(errMsg, error); + throw new Error(errMsg); } - - event.sender.send(IpcEvents.device.loadUserConfigurationReply, JSON.stringify(response)); } /** @@ -127,11 +127,11 @@ export class DeviceService { } /** - * Return the UserConfiguration size from the UHK Device + * Return the user / hardware configuration size from the UHK Device * @returns {Promise} */ - private async getUserConfigSizeFromKeyboard(): Promise { - const buffer = await this.device.write(new Buffer([Command.GetProperty, SystemPropertyIds.UserConfigSize])); + private async getConfigSizeFromKeyboard(property: SystemPropertyIds): Promise { + const buffer = await this.device.write(new Buffer([UsbCommand.GetProperty, property])); const configSize = buffer[1] + (buffer[2] << 8); this.logService.debug('[DeviceService] User config size:', configSize); return configSize; @@ -144,7 +144,7 @@ export class DeviceService { this.logService.debug('[DeviceService] USB[T]: Write user configuration to keyboard'); await this.sendUserConfigToKeyboard(json); this.logService.debug('[DeviceService] USB[T]: Write user configuration to EEPROM'); - await this.writeUserConfigToEeprom(); + await this.device.writeConfigToEeprom(EepromTransfer.WriteUserConfig); response.success = true; } @@ -168,48 +168,12 @@ export class DeviceService { */ private async sendUserConfigToKeyboard(json: string): Promise { const buffer: Buffer = new Buffer(JSON.parse(json).data); - const fragments = this.getTransferBuffers(buffer); + const fragments = UhkHidDevice.getTransferBuffers(UsbCommand.UploadUserConfig, buffer); for (const fragment of fragments) { await this.device.write(fragment); } this.logService.debug('[DeviceService] USB[T]: Apply user configuration to keyboard'); - const applyBuffer = new Buffer([Command.ApplyConfig]); + const applyBuffer = new Buffer([UsbCommand.ApplyConfig]); await this.device.write(applyBuffer); } - - private async writeUserConfigToEeprom(): Promise { - await this.device.write(new Buffer([Command.LaunchEepromTransfer, EepromTransfer.WriteUserConfig])); - await this.waitUntilKeyboardBusy(); - } - - private async waitUntilKeyboardBusy(): Promise { - while (true) { - const buffer = await this.device.write(new Buffer([Command.GetKeyboardState])); - if (buffer[1] === 0) { - break; - } - this.logService.debug('Keyboard is busy, wait...'); - await snooze(200); - } - } - - /** - * Split the whole UserConfiguration package into 64 byte fragments - * @param {Buffer} configBuffer - * @returns {Buffer[]} - * @private - */ - private getTransferBuffers(configBuffer: Buffer): Buffer[] { - const fragments: Buffer[] = []; - const MAX_SENDING_PAYLOAD_SIZE = Constants.MAX_PAYLOAD_SIZE - 4; - for (let offset = 0; offset < configBuffer.length; offset += MAX_SENDING_PAYLOAD_SIZE) { - const length = offset + MAX_SENDING_PAYLOAD_SIZE < configBuffer.length - ? MAX_SENDING_PAYLOAD_SIZE - : configBuffer.length - offset; - const header = new Buffer([Command.UploadConfig, length, offset & 0xFF, offset >> 8]); - fragments.push(Buffer.concat([header, configBuffer.slice(offset, offset + length)])); - } - - return fragments; - } } diff --git a/packages/uhk-common/index.ts b/packages/uhk-common/index.ts index 73385809..b5850584 100644 --- a/packages/uhk-common/index.ts +++ b/packages/uhk-common/index.ts @@ -1,3 +1,4 @@ export * from './src/util'; export * from './src/models'; export * from './src/services'; +export * from './src/config-serializer'; diff --git a/packages/uhk-common/package-lock.json b/packages/uhk-common/package-lock.json index c74158ec..3ada805b 100644 --- a/packages/uhk-common/package-lock.json +++ b/packages/uhk-common/package-lock.json @@ -20,6 +20,11 @@ "resolved": "https://registry.npmjs.org/@ngrx/store/-/store-2.2.3.tgz", "integrity": "sha1-570RSfHEQgjxzEdENT8PmKDx9Xs=" }, + "@types/node": { + "version": "8.0.28", + "resolved": "https://registry.npmjs.org/@types/node/-/node-8.0.28.tgz", + "integrity": "sha512-HupkFXEv3O3KSzcr3Ylfajg0kaerBg1DyaZzRBBQfrU3NN1mTBRE7sCveqHwXLS5Yrjvww8qFzkzYQQakG9FuQ==" + }, "tslib": { "version": "1.7.1", "resolved": "https://registry.npmjs.org/tslib/-/tslib-1.7.1.tgz", diff --git a/packages/uhk-common/package.json b/packages/uhk-common/package.json index 5a856aa5..64422be5 100644 --- a/packages/uhk-common/package.json +++ b/packages/uhk-common/package.json @@ -3,15 +3,17 @@ "private": true, "version": "1.0.0", "description": "Common Library contains the common code for uhk-agent (electron-main) and web (electron-renderer) modules", - "main": "src/index.js", + "main": "dist/index.js", "scripts": { + "build": "tsc", "test": "echo \"Error: no test specified\" && exit 1" }, "author": "", "license": "ISC", "devDependencies": { - "@angular/core": "^4.3.3", + "@angular/core": "4.3.3", "@ngrx/core": "1.2.0", - "@ngrx/store": "^2.2.3" + "@ngrx/store": "2.2.3", + "@types/node": "8.0.28" } } diff --git a/packages/uhk-web/src/app/config-serializer/README.md b/packages/uhk-common/src/config-serializer/README.md similarity index 92% rename from packages/uhk-web/src/app/config-serializer/README.md rename to packages/uhk-common/src/config-serializer/README.md index 14a521e2..46620bdd 100644 --- a/packages/uhk-web/src/app/config-serializer/README.md +++ b/packages/uhk-common/src/config-serializer/README.md @@ -6,13 +6,13 @@ The configuration of the UHK is unusually complex for a keyboard, and is compose ## Setup -Given that the development dependencies are installed on your system you should be able to build the configuration serializer tester by executing `npm run build:test` in this directory, then start the test by running `node test-serializer.js`. +Given that the development dependencies are installed on your system you should be able to run the configuration serializer tester test by running `npm run test` in this directorx. ## Configuration representations There are 3 different representations of the configuration, each filling a specific purpose. -The **JavaScript representation** is optimally suited to be serialized as JSON, and saved to the file system, or transmitted over the network. As a plaintext format, it's human-readable and easily editable. See [user-config.json](user-config.json) for an example configuration. +The **JavaScript representation** is optimally suited to be serialized as JSON, and saved to the file system, or transmitted over the network. As a plaintext format, it's human-readable and easily editable. See [user-config.json](../../../uhk-web/src/app/services/user-config.json) for an example configuration. The **TypeScript representation** is structurally similar to the JavaScript representation, but it features strongly typed TypeScript objects instead of typeless JavaScript objects. This representation is meant to be used by Agent. Extensive, per-property [assertion](assert.ts) takes place upon initializing the TypeScript objects to ensure the integrity of the configuration. @@ -75,7 +75,7 @@ KeyActions.toJsObject: ## Testing the serializer -[test-serializer.ts](test-serializer.ts) is designed to test the serializer by taking [user-config.json](user-config.json), and transforming it to TypeScript representation, then to binary representation, then finally back to JavaScript representation. This should exercise every major code path. +[test-serializer.ts](test-serializer.ts) is designed to test the serializer by taking [user-config.json](../../../uhk-web/src/app/services/user-config.json), and transforming it to TypeScript representation, then to binary representation, then finally back to JavaScript representation. This should exercise every major code path. If the testing is successful the following should be displayed: diff --git a/packages/uhk-web/src/app/config-serializer/assert.ts b/packages/uhk-common/src/config-serializer/assert.ts similarity index 100% rename from packages/uhk-web/src/app/config-serializer/assert.ts rename to packages/uhk-common/src/config-serializer/assert.ts diff --git a/packages/uhk-web/src/app/config-serializer/config-items/hardware-configuration.ts b/packages/uhk-common/src/config-serializer/config-items/hardware-configuration.ts similarity index 100% rename from packages/uhk-web/src/app/config-serializer/config-items/hardware-configuration.ts rename to packages/uhk-common/src/config-serializer/config-items/hardware-configuration.ts diff --git a/packages/uhk-common/src/config-serializer/config-items/index.ts b/packages/uhk-common/src/config-serializer/config-items/index.ts new file mode 100644 index 00000000..0c0c1a77 --- /dev/null +++ b/packages/uhk-common/src/config-serializer/config-items/index.ts @@ -0,0 +1,11 @@ +export * from './key-action'; +export * from './macro-action'; +export * from './hardware-configuration'; +export * from './key-modifiers'; +export * from './keymap'; +export * from './layer'; +export * from './long-press-action'; +export * from './macro'; +export * from './module'; +export * from './module-configuration'; +export * from './user-configuration'; diff --git a/packages/uhk-web/src/app/config-serializer/config-items/key-action/helper.ts b/packages/uhk-common/src/config-serializer/config-items/key-action/helper.ts similarity index 100% rename from packages/uhk-web/src/app/config-serializer/config-items/key-action/helper.ts rename to packages/uhk-common/src/config-serializer/config-items/key-action/helper.ts diff --git a/packages/uhk-web/src/app/config-serializer/config-items/key-action/index.ts b/packages/uhk-common/src/config-serializer/config-items/key-action/index.ts similarity index 73% rename from packages/uhk-web/src/app/config-serializer/config-items/key-action/index.ts rename to packages/uhk-common/src/config-serializer/config-items/key-action/index.ts index e9bef9fa..7ee205c4 100644 --- a/packages/uhk-web/src/app/config-serializer/config-items/key-action/index.ts +++ b/packages/uhk-common/src/config-serializer/config-items/key-action/index.ts @@ -1,8 +1,9 @@ export * from './key-action'; export * from './keystroke-action'; +export * from './keystroke-type'; export * from './mouse-action'; export * from './none-action'; export * from './play-macro-action'; export * from './switch-keymap-action'; export * from './switch-layer-action'; -export * from './helper'; +export { Helper as KeyActionHelper } from './helper'; diff --git a/packages/uhk-web/src/app/config-serializer/config-items/key-action/key-action.ts b/packages/uhk-common/src/config-serializer/config-items/key-action/key-action.ts similarity index 100% rename from packages/uhk-web/src/app/config-serializer/config-items/key-action/key-action.ts rename to packages/uhk-common/src/config-serializer/config-items/key-action/key-action.ts diff --git a/packages/uhk-web/src/app/config-serializer/config-items/key-action/keystroke-action.ts b/packages/uhk-common/src/config-serializer/config-items/key-action/keystroke-action.ts similarity index 100% rename from packages/uhk-web/src/app/config-serializer/config-items/key-action/keystroke-action.ts rename to packages/uhk-common/src/config-serializer/config-items/key-action/keystroke-action.ts diff --git a/packages/uhk-web/src/app/config-serializer/config-items/key-action/keystroke-type.ts b/packages/uhk-common/src/config-serializer/config-items/key-action/keystroke-type.ts similarity index 100% rename from packages/uhk-web/src/app/config-serializer/config-items/key-action/keystroke-type.ts rename to packages/uhk-common/src/config-serializer/config-items/key-action/keystroke-type.ts diff --git a/packages/uhk-web/src/app/config-serializer/config-items/key-action/mouse-action.ts b/packages/uhk-common/src/config-serializer/config-items/key-action/mouse-action.ts similarity index 100% rename from packages/uhk-web/src/app/config-serializer/config-items/key-action/mouse-action.ts rename to packages/uhk-common/src/config-serializer/config-items/key-action/mouse-action.ts diff --git a/packages/uhk-web/src/app/config-serializer/config-items/key-action/none-action.ts b/packages/uhk-common/src/config-serializer/config-items/key-action/none-action.ts similarity index 100% rename from packages/uhk-web/src/app/config-serializer/config-items/key-action/none-action.ts rename to packages/uhk-common/src/config-serializer/config-items/key-action/none-action.ts diff --git a/packages/uhk-web/src/app/config-serializer/config-items/key-action/play-macro-action.ts b/packages/uhk-common/src/config-serializer/config-items/key-action/play-macro-action.ts similarity index 100% rename from packages/uhk-web/src/app/config-serializer/config-items/key-action/play-macro-action.ts rename to packages/uhk-common/src/config-serializer/config-items/key-action/play-macro-action.ts diff --git a/packages/uhk-web/src/app/config-serializer/config-items/key-action/switch-keymap-action.ts b/packages/uhk-common/src/config-serializer/config-items/key-action/switch-keymap-action.ts similarity index 100% rename from packages/uhk-web/src/app/config-serializer/config-items/key-action/switch-keymap-action.ts rename to packages/uhk-common/src/config-serializer/config-items/key-action/switch-keymap-action.ts diff --git a/packages/uhk-web/src/app/config-serializer/config-items/key-action/switch-layer-action.ts b/packages/uhk-common/src/config-serializer/config-items/key-action/switch-layer-action.ts similarity index 100% rename from packages/uhk-web/src/app/config-serializer/config-items/key-action/switch-layer-action.ts rename to packages/uhk-common/src/config-serializer/config-items/key-action/switch-layer-action.ts diff --git a/packages/uhk-web/src/app/config-serializer/config-items/key-modifiers.ts b/packages/uhk-common/src/config-serializer/config-items/key-modifiers.ts similarity index 100% rename from packages/uhk-web/src/app/config-serializer/config-items/key-modifiers.ts rename to packages/uhk-common/src/config-serializer/config-items/key-modifiers.ts diff --git a/packages/uhk-web/src/app/config-serializer/config-items/keymap.ts b/packages/uhk-common/src/config-serializer/config-items/keymap.ts similarity index 98% rename from packages/uhk-web/src/app/config-serializer/config-items/keymap.ts rename to packages/uhk-common/src/config-serializer/config-items/keymap.ts index 6f6b816d..3426b0a9 100644 --- a/packages/uhk-web/src/app/config-serializer/config-items/keymap.ts +++ b/packages/uhk-common/src/config-serializer/config-items/keymap.ts @@ -3,7 +3,6 @@ import { Layer } from './layer'; import { Macro } from './macro'; import { SwitchLayerAction } from './key-action/switch-layer-action'; import { KeyAction } from './key-action/key-action'; -import { ConfigSerializer } from '../config-serializer'; import { UserConfiguration } from './user-configuration'; export class Keymap { diff --git a/packages/uhk-web/src/app/config-serializer/config-items/layer.ts b/packages/uhk-common/src/config-serializer/config-items/layer.ts similarity index 97% rename from packages/uhk-web/src/app/config-serializer/config-items/layer.ts rename to packages/uhk-common/src/config-serializer/config-items/layer.ts index 33cf093f..7019adde 100644 --- a/packages/uhk-web/src/app/config-serializer/config-items/layer.ts +++ b/packages/uhk-common/src/config-serializer/config-items/layer.ts @@ -2,7 +2,6 @@ import { UhkBuffer } from '../uhk-buffer'; import { Macro } from './macro'; import { Module } from './module'; import { UserConfiguration } from './user-configuration'; -import { ConfigSerializer } from '../config-serializer'; export class Layer { diff --git a/packages/uhk-web/src/app/config-serializer/config-items/long-press-action.ts b/packages/uhk-common/src/config-serializer/config-items/long-press-action.ts similarity index 100% rename from packages/uhk-web/src/app/config-serializer/config-items/long-press-action.ts rename to packages/uhk-common/src/config-serializer/config-items/long-press-action.ts diff --git a/packages/uhk-web/src/app/config-serializer/config-items/macro-action/delay-macro-action.ts b/packages/uhk-common/src/config-serializer/config-items/macro-action/delay-macro-action.ts similarity index 100% rename from packages/uhk-web/src/app/config-serializer/config-items/macro-action/delay-macro-action.ts rename to packages/uhk-common/src/config-serializer/config-items/macro-action/delay-macro-action.ts diff --git a/packages/uhk-web/src/app/config-serializer/config-items/macro-action/helper.ts b/packages/uhk-common/src/config-serializer/config-items/macro-action/helper.ts similarity index 100% rename from packages/uhk-web/src/app/config-serializer/config-items/macro-action/helper.ts rename to packages/uhk-common/src/config-serializer/config-items/macro-action/helper.ts diff --git a/packages/uhk-web/src/app/config-serializer/config-items/macro-action/index.ts b/packages/uhk-common/src/config-serializer/config-items/macro-action/index.ts similarity index 83% rename from packages/uhk-web/src/app/config-serializer/config-items/macro-action/index.ts rename to packages/uhk-common/src/config-serializer/config-items/macro-action/index.ts index 63456b7a..dec73384 100644 --- a/packages/uhk-web/src/app/config-serializer/config-items/macro-action/index.ts +++ b/packages/uhk-common/src/config-serializer/config-items/macro-action/index.ts @@ -5,4 +5,4 @@ export * from './move-mouse-macro-action'; export * from './mouse-button-macro-action'; export * from './scroll-mouse-macro-action'; export * from './text-macro-action'; -export * from './helper'; +export { Helper as MacroActionHelper } from './helper'; diff --git a/packages/uhk-web/src/app/config-serializer/config-items/macro-action/key-macro-action.ts b/packages/uhk-common/src/config-serializer/config-items/macro-action/key-macro-action.ts similarity index 100% rename from packages/uhk-web/src/app/config-serializer/config-items/macro-action/key-macro-action.ts rename to packages/uhk-common/src/config-serializer/config-items/macro-action/key-macro-action.ts diff --git a/packages/uhk-web/src/app/config-serializer/config-items/macro-action/macro-action.ts b/packages/uhk-common/src/config-serializer/config-items/macro-action/macro-action.ts similarity index 100% rename from packages/uhk-web/src/app/config-serializer/config-items/macro-action/macro-action.ts rename to packages/uhk-common/src/config-serializer/config-items/macro-action/macro-action.ts diff --git a/packages/uhk-web/src/app/config-serializer/config-items/macro-action/mouse-button-macro-action.ts b/packages/uhk-common/src/config-serializer/config-items/macro-action/mouse-button-macro-action.ts similarity index 100% rename from packages/uhk-web/src/app/config-serializer/config-items/macro-action/mouse-button-macro-action.ts rename to packages/uhk-common/src/config-serializer/config-items/macro-action/mouse-button-macro-action.ts diff --git a/packages/uhk-web/src/app/config-serializer/config-items/macro-action/move-mouse-macro-action.ts b/packages/uhk-common/src/config-serializer/config-items/macro-action/move-mouse-macro-action.ts similarity index 100% rename from packages/uhk-web/src/app/config-serializer/config-items/macro-action/move-mouse-macro-action.ts rename to packages/uhk-common/src/config-serializer/config-items/macro-action/move-mouse-macro-action.ts diff --git a/packages/uhk-web/src/app/config-serializer/config-items/macro-action/scroll-mouse-macro-action.ts b/packages/uhk-common/src/config-serializer/config-items/macro-action/scroll-mouse-macro-action.ts similarity index 100% rename from packages/uhk-web/src/app/config-serializer/config-items/macro-action/scroll-mouse-macro-action.ts rename to packages/uhk-common/src/config-serializer/config-items/macro-action/scroll-mouse-macro-action.ts diff --git a/packages/uhk-web/src/app/config-serializer/config-items/macro-action/text-macro-action.ts b/packages/uhk-common/src/config-serializer/config-items/macro-action/text-macro-action.ts similarity index 100% rename from packages/uhk-web/src/app/config-serializer/config-items/macro-action/text-macro-action.ts rename to packages/uhk-common/src/config-serializer/config-items/macro-action/text-macro-action.ts diff --git a/packages/uhk-web/src/app/config-serializer/config-items/macro.ts b/packages/uhk-common/src/config-serializer/config-items/macro.ts similarity index 94% rename from packages/uhk-web/src/app/config-serializer/config-items/macro.ts rename to packages/uhk-common/src/config-serializer/config-items/macro.ts index 73f3641e..e4c0053c 100644 --- a/packages/uhk-web/src/app/config-serializer/config-items/macro.ts +++ b/packages/uhk-common/src/config-serializer/config-items/macro.ts @@ -1,6 +1,7 @@ import { assertUInt8 } from '../assert'; import { UhkBuffer } from '../uhk-buffer'; -import { Helper as MacroActionHelper, MacroAction } from './macro-action'; +import { MacroAction } from './macro-action'; +import { Helper as MacroActionHelper } from './macro-action/helper'; export class Macro { diff --git a/packages/uhk-web/src/app/config-serializer/config-items/module-configuration.ts b/packages/uhk-common/src/config-serializer/config-items/module-configuration.ts similarity index 100% rename from packages/uhk-web/src/app/config-serializer/config-items/module-configuration.ts rename to packages/uhk-common/src/config-serializer/config-items/module-configuration.ts diff --git a/packages/uhk-web/src/app/config-serializer/config-items/module.ts b/packages/uhk-common/src/config-serializer/config-items/module.ts similarity index 96% rename from packages/uhk-web/src/app/config-serializer/config-items/module.ts rename to packages/uhk-common/src/config-serializer/config-items/module.ts index a626c37b..8dbf7a4b 100644 --- a/packages/uhk-web/src/app/config-serializer/config-items/module.ts +++ b/packages/uhk-common/src/config-serializer/config-items/module.ts @@ -1,6 +1,6 @@ import { assertEnum, assertUInt8 } from '../assert'; import { UhkBuffer } from '../uhk-buffer'; -import { Helper as KeyActionHelper, KeyAction, NoneAction, PlayMacroAction, SwitchKeymapAction } from './key-action'; +import { KeyActionHelper, KeyAction, NoneAction, PlayMacroAction, SwitchKeymapAction } from './key-action'; import { Macro } from './macro'; import { UserConfiguration } from './user-configuration'; diff --git a/packages/uhk-web/src/app/config-serializer/config-items/user-configuration.ts b/packages/uhk-common/src/config-serializer/config-items/user-configuration.ts similarity index 100% rename from packages/uhk-web/src/app/config-serializer/config-items/user-configuration.ts rename to packages/uhk-common/src/config-serializer/config-items/user-configuration.ts diff --git a/packages/uhk-web/src/app/config-serializer/config-serializer.ts b/packages/uhk-common/src/config-serializer/config-serializer.ts similarity index 100% rename from packages/uhk-web/src/app/config-serializer/config-serializer.ts rename to packages/uhk-common/src/config-serializer/config-serializer.ts diff --git a/packages/uhk-common/src/config-serializer/index.ts b/packages/uhk-common/src/config-serializer/index.ts new file mode 100644 index 00000000..60713de9 --- /dev/null +++ b/packages/uhk-common/src/config-serializer/index.ts @@ -0,0 +1,4 @@ +export * from './config-items'; +export * from './assert'; +export * from './config-serializer'; +export * from './uhk-buffer'; diff --git a/packages/uhk-web/src/app/config-serializer/uhk-buffer.ts b/packages/uhk-common/src/config-serializer/uhk-buffer.ts similarity index 93% rename from packages/uhk-web/src/app/config-serializer/uhk-buffer.ts rename to packages/uhk-common/src/config-serializer/uhk-buffer.ts index fce2d36e..de76e803 100644 --- a/packages/uhk-web/src/app/config-serializer/uhk-buffer.ts +++ b/packages/uhk-common/src/config-serializer/uhk-buffer.ts @@ -4,6 +4,24 @@ export class UhkBuffer { (element).toBinary(buffer); // TODO: Remove any } + static fromArray(data: Array): UhkBuffer { + if (data.length < 1) { + return null; + } + + const uhkBuffer = new UhkBuffer(); + let hasNonZeroValue = false; + for (const num of data) { + if (num > 0) { + hasNonZeroValue = true; + } + uhkBuffer.writeUInt8(num); + } + uhkBuffer.offset = 0; + + return uhkBuffer; + } + private static eepromSize = 32 * 1024; private static maxCompactLength = 0xFFFF; private static longCompactLengthPrefix = 0xFF; diff --git a/packages/uhk-common/src/models/configuration-reply.ts b/packages/uhk-common/src/models/configuration-reply.ts new file mode 100644 index 00000000..0adb29e1 --- /dev/null +++ b/packages/uhk-common/src/models/configuration-reply.ts @@ -0,0 +1,6 @@ +export interface ConfigurationReply { + success: boolean; + userConfiguration?: string; + hardwareConfiguration?: string; + error?: string; +} diff --git a/packages/uhk-common/src/models/index.ts b/packages/uhk-common/src/models/index.ts index a41835fe..2da8b4cb 100644 --- a/packages/uhk-common/src/models/index.ts +++ b/packages/uhk-common/src/models/index.ts @@ -2,3 +2,4 @@ export * from './command-line-args'; export * from './notification'; export * from './ipc-response'; export * from './app-start-info'; +export * from './configuration-reply'; diff --git a/packages/uhk-common/src/services/logger.service.ts b/packages/uhk-common/src/services/logger.service.ts index d906c3a2..d3b16802 100644 --- a/packages/uhk-common/src/services/logger.service.ts +++ b/packages/uhk-common/src/services/logger.service.ts @@ -1,17 +1,14 @@ -import { Injectable } from '@angular/core'; - -@Injectable() export class LogService { error(...args: any[]): void { console.error(args); } debug(...args: any[]): void { - console.debug(args); + console.log(args); } silly(...args: any[]): void { - console.debug(args); + console.log(args); } info(...args: any[]): void { diff --git a/packages/uhk-common/src/util/index.ts b/packages/uhk-common/src/util/index.ts index 9ac63212..d8af9552 100644 --- a/packages/uhk-common/src/util/index.ts +++ b/packages/uhk-common/src/util/index.ts @@ -1,5 +1,5 @@ -export { Constants } from './constants'; export { IpcEvents } from './ipcEvents'; +export * from './log'; // Source: http://stackoverflow.com/questions/13720256/javascript-regex-camelcase-to-sentence export function camelCaseToSentence(camelCasedText: string): string { diff --git a/packages/uhk-common/src/util/ipcEvents.ts b/packages/uhk-common/src/util/ipcEvents.ts index 63ed2486..15821a75 100644 --- a/packages/uhk-common/src/util/ipcEvents.ts +++ b/packages/uhk-common/src/util/ipcEvents.ts @@ -22,8 +22,8 @@ class Device { public static readonly deviceConnectionStateChanged = 'device-connection-state-changed'; public static readonly saveUserConfiguration = 'device-save-user-configuration'; public static readonly saveUserConfigurationReply = 'device-save-user-configuration-reply'; - public static readonly loadUserConfiguration = 'device-load-user-configuration'; - public static readonly loadUserConfigurationReply = 'device-load-user-configuration-reply'; + public static readonly loadConfigurations = 'device-load-configuration'; + public static readonly loadConfigurationReply = 'device-load-configuration-reply'; } export class IpcEvents { diff --git a/packages/uhk-common/src/util/log.ts b/packages/uhk-common/src/util/log.ts new file mode 100644 index 00000000..434c6004 --- /dev/null +++ b/packages/uhk-common/src/util/log.ts @@ -0,0 +1,6 @@ +export namespace LogRegExps { + export const transferRegExp = /USB\[T]:/; + export const writeRegExp = /USB\[W]:/; + export const readRegExp = /USB\[R]: 00/; + export const errorRegExp = /(?:(USB\[R]: ([^0]|0[^0])))/; +} diff --git a/packages/uhk-common/tsconfig.json b/packages/uhk-common/tsconfig.json index ff9247cb..2ae15ec3 100644 --- a/packages/uhk-common/tsconfig.json +++ b/packages/uhk-common/tsconfig.json @@ -2,6 +2,7 @@ "compileOnSave": false, "compilerOptions": { "sourceMap": true, + "outDir": "./dist", "declaration": false, "module": "commonjs", "moduleResolution": "node", diff --git a/packages/uhk-usb/index.ts b/packages/uhk-usb/index.ts new file mode 100644 index 00000000..8420b109 --- /dev/null +++ b/packages/uhk-usb/index.ts @@ -0,0 +1 @@ +export * from './src'; diff --git a/packages/uhk-usb/package-lock.json b/packages/uhk-usb/package-lock.json new file mode 100644 index 00000000..8e4dcecc --- /dev/null +++ b/packages/uhk-usb/package-lock.json @@ -0,0 +1,781 @@ +{ + "requires": true, + "lockfileVersion": 1, + "dependencies": { + "@types/node": { + "version": "8.0.28", + "resolved": "https://registry.npmjs.org/@types/node/-/node-8.0.28.tgz", + "integrity": "sha512-HupkFXEv3O3KSzcr3Ylfajg0kaerBg1DyaZzRBBQfrU3NN1mTBRE7sCveqHwXLS5Yrjvww8qFzkzYQQakG9FuQ==" + }, + "nan": { + "version": "2.6.2", + "resolved": "https://registry.npmjs.org/nan/-/nan-2.6.2.tgz", + "integrity": "sha1-5P805slf37WuzAjeZZb0NgWn20U=" + }, + "node-hid": { + "version": "0.5.4", + "resolved": "https://registry.npmjs.org/node-hid/-/node-hid-0.5.4.tgz", + "integrity": "sha1-pyRt/AjVJ3QUf6JkNU1dpuq0AlM=", + "requires": { + "nan": "2.6.2", + "node-pre-gyp": "0.6.31" + }, + "dependencies": { + "abbrev": { + "version": "1.0.9", + "bundled": true + }, + "ansi-regex": { + "version": "2.1.1", + "bundled": true + }, + "ansi-styles": { + "version": "2.2.1", + "bundled": true + }, + "aproba": { + "version": "1.0.4", + "bundled": true + }, + "are-we-there-yet": { + "version": "1.1.2", + "bundled": true, + "requires": { + "delegates": "1.0.0", + "readable-stream": "2.2.2" + } + }, + "asn1": { + "version": "0.2.3", + "bundled": true + }, + "assert-plus": { + "version": "0.2.0", + "bundled": true + }, + "asynckit": { + "version": "0.4.0", + "bundled": true + }, + "aws-sign2": { + "version": "0.6.0", + "bundled": true + }, + "aws4": { + "version": "1.5.0", + "bundled": true + }, + "balanced-match": { + "version": "0.4.2", + "bundled": true + }, + "bcrypt-pbkdf": { + "version": "1.0.0", + "bundled": true, + "optional": true, + "requires": { + "tweetnacl": "0.14.5" + } + }, + "block-stream": { + "version": "0.0.9", + "bundled": true, + "requires": { + "inherits": "2.0.3" + } + }, + "boom": { + "version": "2.10.1", + "bundled": true, + "requires": { + "hoek": "2.16.3" + } + }, + "brace-expansion": { + "version": "1.1.6", + "bundled": true, + "requires": { + "balanced-match": "0.4.2", + "concat-map": "0.0.1" + } + }, + "buffer-shims": { + "version": "1.0.0", + "bundled": true + }, + "caseless": { + "version": "0.11.0", + "bundled": true + }, + "chalk": { + "version": "1.1.3", + "bundled": true, + "requires": { + "ansi-styles": "2.2.1", + "escape-string-regexp": "1.0.5", + "has-ansi": "2.0.0", + "strip-ansi": "3.0.1", + "supports-color": "2.0.0" + }, + "dependencies": { + "supports-color": { + "version": "2.0.0", + "bundled": true + } + } + }, + "code-point-at": { + "version": "1.1.0", + "bundled": true + }, + "combined-stream": { + "version": "1.0.5", + "bundled": true, + "requires": { + "delayed-stream": "1.0.0" + } + }, + "commander": { + "version": "2.9.0", + "bundled": true, + "requires": { + "graceful-readlink": "1.0.1" + } + }, + "concat-map": { + "version": "0.0.1", + "bundled": true + }, + "console-control-strings": { + "version": "1.1.0", + "bundled": true + }, + "core-util-is": { + "version": "1.0.2", + "bundled": true + }, + "cryptiles": { + "version": "2.0.5", + "bundled": true, + "requires": { + "boom": "2.10.1" + } + }, + "dashdash": { + "version": "1.14.1", + "bundled": true, + "requires": { + "assert-plus": "1.0.0" + }, + "dependencies": { + "assert-plus": { + "version": "1.0.0", + "bundled": true + } + } + }, + "debug": { + "version": "2.2.0", + "bundled": true, + "requires": { + "ms": "0.7.1" + } + }, + "deep-extend": { + "version": "0.4.1", + "bundled": true + }, + "delayed-stream": { + "version": "1.0.0", + "bundled": true + }, + "delegates": { + "version": "1.0.0", + "bundled": true + }, + "ecc-jsbn": { + "version": "0.1.1", + "bundled": true, + "optional": true, + "requires": { + "jsbn": "0.1.0" + } + }, + "escape-string-regexp": { + "version": "1.0.5", + "bundled": true + }, + "extend": { + "version": "3.0.0", + "bundled": true + }, + "extsprintf": { + "version": "1.0.2", + "bundled": true + }, + "forever-agent": { + "version": "0.6.1", + "bundled": true + }, + "form-data": { + "version": "2.1.2", + "bundled": true, + "requires": { + "asynckit": "0.4.0", + "combined-stream": "1.0.5", + "mime-types": "2.1.14" + } + }, + "fs.realpath": { + "version": "1.0.0", + "bundled": true + }, + "fstream": { + "version": "1.0.10", + "bundled": true, + "requires": { + "graceful-fs": "4.1.11", + "inherits": "2.0.3", + "mkdirp": "0.5.1", + "rimraf": "2.5.4" + } + }, + "fstream-ignore": { + "version": "1.0.5", + "bundled": true, + "requires": { + "fstream": "1.0.10", + "inherits": "2.0.3", + "minimatch": "3.0.3" + } + }, + "gauge": { + "version": "2.7.2", + "bundled": true, + "requires": { + "aproba": "1.0.4", + "console-control-strings": "1.1.0", + "has-unicode": "2.0.1", + "object-assign": "4.1.0", + "signal-exit": "3.0.2", + "string-width": "1.0.2", + "strip-ansi": "3.0.1", + "supports-color": "0.2.0", + "wide-align": "1.1.0" + } + }, + "generate-function": { + "version": "2.0.0", + "bundled": true + }, + "generate-object-property": { + "version": "1.2.0", + "bundled": true, + "requires": { + "is-property": "1.0.2" + } + }, + "getpass": { + "version": "0.1.6", + "bundled": true, + "requires": { + "assert-plus": "1.0.0" + }, + "dependencies": { + "assert-plus": { + "version": "1.0.0", + "bundled": true + } + } + }, + "glob": { + "version": "7.1.1", + "bundled": true, + "requires": { + "fs.realpath": "1.0.0", + "inflight": "1.0.6", + "inherits": "2.0.3", + "minimatch": "3.0.3", + "once": "1.4.0", + "path-is-absolute": "1.0.1" + } + }, + "graceful-fs": { + "version": "4.1.11", + "bundled": true + }, + "graceful-readlink": { + "version": "1.0.1", + "bundled": true + }, + "har-validator": { + "version": "2.0.6", + "bundled": true, + "requires": { + "chalk": "1.1.3", + "commander": "2.9.0", + "is-my-json-valid": "2.15.0", + "pinkie-promise": "2.0.1" + } + }, + "has-ansi": { + "version": "2.0.0", + "bundled": true, + "requires": { + "ansi-regex": "2.1.1" + } + }, + "has-unicode": { + "version": "2.0.1", + "bundled": true + }, + "hawk": { + "version": "3.1.3", + "bundled": true, + "requires": { + "boom": "2.10.1", + "cryptiles": "2.0.5", + "hoek": "2.16.3", + "sntp": "1.0.9" + } + }, + "hoek": { + "version": "2.16.3", + "bundled": true + }, + "http-signature": { + "version": "1.1.1", + "bundled": true, + "requires": { + "assert-plus": "0.2.0", + "jsprim": "1.3.1", + "sshpk": "1.10.2" + } + }, + "inflight": { + "version": "1.0.6", + "bundled": true, + "requires": { + "once": "1.4.0", + "wrappy": "1.0.2" + } + }, + "inherits": { + "version": "2.0.3", + "bundled": true + }, + "ini": { + "version": "1.3.4", + "bundled": true + }, + "is-fullwidth-code-point": { + "version": "1.0.0", + "bundled": true, + "requires": { + "number-is-nan": "1.0.1" + } + }, + "is-my-json-valid": { + "version": "2.15.0", + "bundled": true, + "requires": { + "generate-function": "2.0.0", + "generate-object-property": "1.2.0", + "jsonpointer": "4.0.1", + "xtend": "4.0.1" + } + }, + "is-property": { + "version": "1.0.2", + "bundled": true + }, + "is-typedarray": { + "version": "1.0.0", + "bundled": true + }, + "isarray": { + "version": "1.0.0", + "bundled": true + }, + "isstream": { + "version": "0.1.2", + "bundled": true + }, + "jodid25519": { + "version": "1.0.2", + "bundled": true, + "optional": true, + "requires": { + "jsbn": "0.1.0" + } + }, + "jsbn": { + "version": "0.1.0", + "bundled": true, + "optional": true + }, + "json-schema": { + "version": "0.2.3", + "bundled": true + }, + "json-stringify-safe": { + "version": "5.0.1", + "bundled": true + }, + "jsonpointer": { + "version": "4.0.1", + "bundled": true + }, + "jsprim": { + "version": "1.3.1", + "bundled": true, + "requires": { + "extsprintf": "1.0.2", + "json-schema": "0.2.3", + "verror": "1.3.6" + } + }, + "mime-db": { + "version": "1.26.0", + "bundled": true + }, + "mime-types": { + "version": "2.1.14", + "bundled": true, + "requires": { + "mime-db": "1.26.0" + } + }, + "minimatch": { + "version": "3.0.3", + "bundled": true, + "requires": { + "brace-expansion": "1.1.6" + } + }, + "minimist": { + "version": "0.0.8", + "bundled": true + }, + "mkdirp": { + "version": "0.5.1", + "bundled": true, + "requires": { + "minimist": "0.0.8" + } + }, + "ms": { + "version": "0.7.1", + "bundled": true + }, + "node-pre-gyp": { + "version": "0.6.31", + "bundled": true, + "requires": { + "mkdirp": "0.5.1", + "nopt": "3.0.6", + "npmlog": "4.0.2", + "rc": "1.1.6", + "request": "2.79.0", + "rimraf": "2.5.4", + "semver": "5.3.0", + "tar": "2.2.1", + "tar-pack": "3.3.0" + } + }, + "nopt": { + "version": "3.0.6", + "bundled": true, + "requires": { + "abbrev": "1.0.9" + } + }, + "npmlog": { + "version": "4.0.2", + "bundled": true, + "requires": { + "are-we-there-yet": "1.1.2", + "console-control-strings": "1.1.0", + "gauge": "2.7.2", + "set-blocking": "2.0.0" + } + }, + "number-is-nan": { + "version": "1.0.1", + "bundled": true + }, + "oauth-sign": { + "version": "0.8.2", + "bundled": true + }, + "object-assign": { + "version": "4.1.0", + "bundled": true + }, + "once": { + "version": "1.4.0", + "bundled": true, + "requires": { + "wrappy": "1.0.2" + } + }, + "path-is-absolute": { + "version": "1.0.1", + "bundled": true + }, + "pinkie": { + "version": "2.0.4", + "bundled": true + }, + "pinkie-promise": { + "version": "2.0.1", + "bundled": true, + "requires": { + "pinkie": "2.0.4" + } + }, + "process-nextick-args": { + "version": "1.0.7", + "bundled": true + }, + "punycode": { + "version": "1.4.1", + "bundled": true + }, + "qs": { + "version": "6.3.0", + "bundled": true + }, + "rc": { + "version": "1.1.6", + "bundled": true, + "requires": { + "deep-extend": "0.4.1", + "ini": "1.3.4", + "minimist": "1.2.0", + "strip-json-comments": "1.0.4" + }, + "dependencies": { + "minimist": { + "version": "1.2.0", + "bundled": true + } + } + }, + "readable-stream": { + "version": "2.2.2", + "bundled": true, + "requires": { + "buffer-shims": "1.0.0", + "core-util-is": "1.0.2", + "inherits": "2.0.3", + "isarray": "1.0.0", + "process-nextick-args": "1.0.7", + "string_decoder": "0.10.31", + "util-deprecate": "1.0.2" + } + }, + "request": { + "version": "2.79.0", + "bundled": true, + "requires": { + "aws-sign2": "0.6.0", + "aws4": "1.5.0", + "caseless": "0.11.0", + "combined-stream": "1.0.5", + "extend": "3.0.0", + "forever-agent": "0.6.1", + "form-data": "2.1.2", + "har-validator": "2.0.6", + "hawk": "3.1.3", + "http-signature": "1.1.1", + "is-typedarray": "1.0.0", + "isstream": "0.1.2", + "json-stringify-safe": "5.0.1", + "mime-types": "2.1.14", + "oauth-sign": "0.8.2", + "qs": "6.3.0", + "stringstream": "0.0.5", + "tough-cookie": "2.3.2", + "tunnel-agent": "0.4.3", + "uuid": "3.0.1" + } + }, + "rimraf": { + "version": "2.5.4", + "bundled": true, + "requires": { + "glob": "7.1.1" + } + }, + "semver": { + "version": "5.3.0", + "bundled": true + }, + "set-blocking": { + "version": "2.0.0", + "bundled": true + }, + "signal-exit": { + "version": "3.0.2", + "bundled": true + }, + "sntp": { + "version": "1.0.9", + "bundled": true, + "requires": { + "hoek": "2.16.3" + } + }, + "sshpk": { + "version": "1.10.2", + "bundled": true, + "requires": { + "asn1": "0.2.3", + "assert-plus": "1.0.0", + "bcrypt-pbkdf": "1.0.0", + "dashdash": "1.14.1", + "ecc-jsbn": "0.1.1", + "getpass": "0.1.6", + "jodid25519": "1.0.2", + "jsbn": "0.1.0", + "tweetnacl": "0.14.5" + }, + "dependencies": { + "assert-plus": { + "version": "1.0.0", + "bundled": true + } + } + }, + "string_decoder": { + "version": "0.10.31", + "bundled": true + }, + "string-width": { + "version": "1.0.2", + "bundled": true, + "requires": { + "code-point-at": "1.1.0", + "is-fullwidth-code-point": "1.0.0", + "strip-ansi": "3.0.1" + } + }, + "stringstream": { + "version": "0.0.5", + "bundled": true + }, + "strip-ansi": { + "version": "3.0.1", + "bundled": true, + "requires": { + "ansi-regex": "2.1.1" + } + }, + "strip-json-comments": { + "version": "1.0.4", + "bundled": true + }, + "supports-color": { + "version": "0.2.0", + "bundled": true + }, + "tar": { + "version": "2.2.1", + "bundled": true, + "requires": { + "block-stream": "0.0.9", + "fstream": "1.0.10", + "inherits": "2.0.3" + } + }, + "tar-pack": { + "version": "3.3.0", + "bundled": true, + "requires": { + "debug": "2.2.0", + "fstream": "1.0.10", + "fstream-ignore": "1.0.5", + "once": "1.3.3", + "readable-stream": "2.1.5", + "rimraf": "2.5.4", + "tar": "2.2.1", + "uid-number": "0.0.6" + }, + "dependencies": { + "once": { + "version": "1.3.3", + "bundled": true, + "requires": { + "wrappy": "1.0.2" + } + }, + "readable-stream": { + "version": "2.1.5", + "bundled": true, + "requires": { + "buffer-shims": "1.0.0", + "core-util-is": "1.0.2", + "inherits": "2.0.3", + "isarray": "1.0.0", + "process-nextick-args": "1.0.7", + "string_decoder": "0.10.31", + "util-deprecate": "1.0.2" + } + } + } + }, + "tough-cookie": { + "version": "2.3.2", + "bundled": true, + "requires": { + "punycode": "1.4.1" + } + }, + "tunnel-agent": { + "version": "0.4.3", + "bundled": true + }, + "tweetnacl": { + "version": "0.14.5", + "bundled": true, + "optional": true + }, + "uid-number": { + "version": "0.0.6", + "bundled": true + }, + "util-deprecate": { + "version": "1.0.2", + "bundled": true + }, + "uuid": { + "version": "3.0.1", + "bundled": true + }, + "verror": { + "version": "1.3.6", + "bundled": true, + "requires": { + "extsprintf": "1.0.2" + } + }, + "wide-align": { + "version": "1.1.0", + "bundled": true, + "requires": { + "string-width": "1.0.2" + } + }, + "wrappy": { + "version": "1.0.2", + "bundled": true + }, + "xtend": { + "version": "4.0.1", + "bundled": true + } + } + } + } +} diff --git a/packages/uhk-usb/package.json b/packages/uhk-usb/package.json new file mode 100644 index 00000000..4b299fc7 --- /dev/null +++ b/packages/uhk-usb/package.json @@ -0,0 +1,17 @@ +{ + "name": "uhk-usb", + "version": "1.0.0", + "description": "Agent preliminary USB code", + "main": "dist/index.js", + "license": "GPL-3.0", + "scripts": { + "build": "tsc" + }, + "devDependencies": { + "@types/node": "8.0.28" + }, + "dependencies": { + "node-hid": "0.5.4", + "uhk-common": "1.0.0" + } +} diff --git a/packages/uhk-usb/src/constants.ts b/packages/uhk-usb/src/constants.ts new file mode 100644 index 00000000..70f416f0 --- /dev/null +++ b/packages/uhk-usb/src/constants.ts @@ -0,0 +1,35 @@ +export namespace Constants { + export const VENDOR_ID = 0x1D50; + export const PRODUCT_ID = 0x6122; + export const MAX_PAYLOAD_SIZE = 64; +} + +/** + * UHK USB Communications command. All communication package should have start with a command code. + */ +export enum UsbCommand { + GetProperty = 0, + UploadUserConfig = 8, + ApplyConfig = 9, + LaunchEepromTransfer = 12, + ReadHardwareConfig = 13, + WriteHardwareConfig = 14, + ReadUserConfig = 15, + GetKeyboardState = 16 +} + +export enum EepromTransfer { + ReadHardwareConfig = 0, + WriteHardwareConfig = 1, + ReadUserConfig = 2, + WriteUserConfig = 3 +} + +export enum SystemPropertyIds { + UsbProtocolVersion = 0, + BridgeProtocolVersion = 1, + DataModelVersion = 2, + FirmwareVersion = 3, + HardwareConfigSize = 4, + UserConfigSize = 5 +} diff --git a/packages/uhk-usb/src/index.ts b/packages/uhk-usb/src/index.ts new file mode 100644 index 00000000..83af4e7f --- /dev/null +++ b/packages/uhk-usb/src/index.ts @@ -0,0 +1,2 @@ +export * from './constants'; +export * from './uhk-hid-device'; diff --git a/packages/uhk-agent/src/services/uhk-hid-device.service.ts b/packages/uhk-usb/src/uhk-hid-device.ts similarity index 72% rename from packages/uhk-agent/src/services/uhk-hid-device.service.ts rename to packages/uhk-usb/src/uhk-hid-device.ts index fc0222c7..3e7e4eb0 100644 --- a/packages/uhk-agent/src/services/uhk-hid-device.service.ts +++ b/packages/uhk-usb/src/uhk-hid-device.ts @@ -1,11 +1,14 @@ import { Device, devices, HID } from 'node-hid'; +import { LogService } from 'uhk-common'; -import { Constants, LogService } from 'uhk-common'; +import { Constants, EepromTransfer, UsbCommand } from './constants'; + +const snooze = ms => new Promise(resolve => setTimeout(resolve, ms)); /** * HID API wrapper to support unified logging and async write */ -export class UhkHidDeviceService { +export class UhkHidDevice { /** * Convert the Buffer to number[] * @param {Buffer} buffer @@ -17,6 +20,27 @@ export class UhkHidDeviceService { return Array.prototype.slice.call(buffer, 0); } + /** + * Split the communication package into 64 byte fragments + * @param {UsbCommand} usbCommand + * @param {Buffer} configBuffer + * @returns {Buffer[]} + * @private + */ + public static getTransferBuffers(usbCommand: UsbCommand, configBuffer: Buffer): Buffer[] { + const fragments: Buffer[] = []; + const MAX_SENDING_PAYLOAD_SIZE = Constants.MAX_PAYLOAD_SIZE - 4; + for (let offset = 0; offset < configBuffer.length; offset += MAX_SENDING_PAYLOAD_SIZE) { + const length = offset + MAX_SENDING_PAYLOAD_SIZE < configBuffer.length + ? MAX_SENDING_PAYLOAD_SIZE + : configBuffer.length - offset; + const header = new Buffer([usbCommand, length, offset & 0xFF, offset >> 8]); + fragments.push(Buffer.concat([header, configBuffer.slice(offset, offset + length)])); + } + + return fragments; + } + /** * Create the communication package that will send over USB and * - add usb report code as 1st byte @@ -27,7 +51,7 @@ export class UhkHidDeviceService { * @static */ private static getTransferData(buffer: Buffer): number[] { - const data = UhkHidDeviceService.convertBufferToIntArray(buffer); + const data = UhkHidDevice.convertBufferToIntArray(buffer); // if data start with 0 need to add additional leading zero because HID API remove it. // https://github.com/node-hid/node-hid/issues/187 if (data.length > 0 && data[0] === 0 && process.platform === 'win32') { @@ -108,7 +132,7 @@ export class UhkHidDeviceService { this.logService.error('[UhkHidDevice] Transfer error: ', err); return reject(err); } - const logString = UhkHidDeviceService.bufferToString(receivedData); + const logString = UhkHidDevice.bufferToString(receivedData); this.logService.debug('[UhkHidDevice] USB[R]:', logString); if (receivedData[0] !== 0) { @@ -118,12 +142,17 @@ export class UhkHidDeviceService { return resolve(Buffer.from(receivedData)); }); - const sendData = UhkHidDeviceService.getTransferData(buffer); - this.logService.debug('[UhkHidDevice] USB[W]:', UhkHidDeviceService.bufferToString(sendData)); + const sendData = UhkHidDevice.getTransferData(buffer); + this.logService.debug('[UhkHidDevice] USB[W]:', UhkHidDevice.bufferToString(sendData)); device.write(sendData); }); } + public async writeConfigToEeprom(transferType: EepromTransfer): Promise { + await this.write(new Buffer([UsbCommand.LaunchEepromTransfer, transferType])); + await this.waitUntilKeyboardBusy(); + } + /** * Close the communication chanel with UHK Device */ @@ -136,6 +165,17 @@ export class UhkHidDeviceService { this._device = null; } + private async waitUntilKeyboardBusy(): Promise { + while (true) { + const buffer = await this.write(new Buffer([UsbCommand.GetKeyboardState])); + if (buffer[1] === 0) { + break; + } + this.logService.debug('Keyboard is busy, wait...'); + await snooze(200); + } + } + /** * Return the stored version of HID device. If not exist try to initialize. * @returns {HID} diff --git a/packages/uhk-usb/tsconfig.json b/packages/uhk-usb/tsconfig.json new file mode 100644 index 00000000..69caa95f --- /dev/null +++ b/packages/uhk-usb/tsconfig.json @@ -0,0 +1,21 @@ +{ + "compileOnSave": false, + "compilerOptions": { + "sourceMap": true, + "outDir": "./dist", + "declaration": false, + "module": "commonjs", + "moduleResolution": "node", + "emitDecoratorMetadata": true, + "experimentalDecorators": true, + "target": "es2016", + "typeRoots": [ + "node_modules/@types" + ], + "lib": [ + "es2015.iterable", + "dom", + "es2016" + ] + } +} diff --git a/packages/uhk-web/src/app/app.component.ts b/packages/uhk-web/src/app/app.component.ts index 04fdeeff..0e0d28b1 100644 --- a/packages/uhk-web/src/app/app.component.ts +++ b/packages/uhk-web/src/app/app.component.ts @@ -2,6 +2,7 @@ import { Component, HostListener, ViewEncapsulation } from '@angular/core'; import { animate, style, transition, trigger } from '@angular/animations'; import { Observable } from 'rxjs/Observable'; import { Action, Store } from '@ngrx/store'; +import { UhkBuffer } from 'uhk-common'; import 'rxjs/add/operator/last'; @@ -14,7 +15,6 @@ import { saveToKeyboardState } from './store'; import { getUserConfiguration } from './store/reducers/user-configuration'; -import { UhkBuffer } from './config-serializer/uhk-buffer'; import { ProgressButtonState } from './store/reducers/progress-button-state'; @Component({ diff --git a/packages/uhk-web/src/app/components/keyboard/slider/keyboard-slider.component.html b/packages/uhk-web/src/app/components/keyboard/slider/keyboard-slider.component.html index c251f6aa..1817459f 100644 --- a/packages/uhk-web/src/app/components/keyboard/slider/keyboard-slider.component.html +++ b/packages/uhk-web/src/app/components/keyboard/slider/keyboard-slider.component.html @@ -1,13 +1,14 @@ diff --git a/packages/uhk-web/src/app/components/keyboard/slider/keyboard-slider.component.ts b/packages/uhk-web/src/app/components/keyboard/slider/keyboard-slider.component.ts index a2452385..49f46c37 100644 --- a/packages/uhk-web/src/app/components/keyboard/slider/keyboard-slider.component.ts +++ b/packages/uhk-web/src/app/components/keyboard/slider/keyboard-slider.component.ts @@ -1,7 +1,8 @@ import { Component, ChangeDetectionStrategy, Input, Output, EventEmitter, OnChanges, SimpleChanges } from '@angular/core'; import { animate, keyframes, state, style, transition, trigger } from '@angular/animations'; +import { Layer } from 'uhk-common'; -import { Layer } from '../../../config-serializer/config-items/layer'; +import { KeyboardLayout } from '../../../keyboard/keyboard-layout.enum'; type AnimationKeyboard = 'leftIn' | @@ -69,6 +70,7 @@ export class KeyboardSliderComponent implements OnChanges { @Input() capturingEnabled: boolean; @Input() halvesSplit: boolean; @Input() selectedKey: { layerId: number, moduleId: number, keyId: number }; + @Input() keyboardLayout = KeyboardLayout.ANSI; @Output() keyClick = new EventEmitter(); @Output() keyHover = new EventEmitter(); @Output() capture = new EventEmitter(); diff --git a/packages/uhk-web/src/app/components/keymap/add/keymap-add.component.ts b/packages/uhk-web/src/app/components/keymap/add/keymap-add.component.ts index 8ae307d9..35e2f4f1 100644 --- a/packages/uhk-web/src/app/components/keymap/add/keymap-add.component.ts +++ b/packages/uhk-web/src/app/components/keymap/add/keymap-add.component.ts @@ -1,12 +1,12 @@ import { Component } from '@angular/core'; import { Store } from '@ngrx/store'; +import { Keymap } from 'uhk-common'; import { BehaviorSubject } from 'rxjs/BehaviorSubject'; import { Observable } from 'rxjs/Observable'; import 'rxjs/add/operator/combineLatest'; import 'rxjs/add/operator/publishReplay'; -import { Keymap } from '../../../config-serializer/config-items/keymap'; import { AppState } from '../../../store'; import { KeymapActions } from '../../../store/actions'; diff --git a/packages/uhk-web/src/app/components/keymap/edit/keymap-edit-guard.service.ts b/packages/uhk-web/src/app/components/keymap/edit/keymap-edit-guard.service.ts index e5f59c9a..bbb549cc 100644 --- a/packages/uhk-web/src/app/components/keymap/edit/keymap-edit-guard.service.ts +++ b/packages/uhk-web/src/app/components/keymap/edit/keymap-edit-guard.service.ts @@ -1,5 +1,6 @@ import { Injectable } from '@angular/core'; import { CanActivate, Router } from '@angular/router'; +import { Keymap } from 'uhk-common'; import { Observable } from 'rxjs/Observable'; @@ -10,7 +11,6 @@ import 'rxjs/add/operator/switchMap'; import { Store } from '@ngrx/store'; -import { Keymap } from '../../../config-serializer/config-items/keymap'; import { AppState } from '../../../store/index'; import { getKeymaps } from '../../../store/reducers/user-configuration'; diff --git a/packages/uhk-web/src/app/components/keymap/edit/keymap-edit.component.html b/packages/uhk-web/src/app/components/keymap/edit/keymap-edit.component.html index 078429bb..2ca36ac2 100644 --- a/packages/uhk-web/src/app/components/keymap/edit/keymap-edit.component.html +++ b/packages/uhk-web/src/app/components/keymap/edit/keymap-edit.component.html @@ -1,6 +1,10 @@ - - + +
diff --git a/packages/uhk-web/src/app/components/keymap/edit/keymap-edit.component.ts b/packages/uhk-web/src/app/components/keymap/edit/keymap-edit.component.ts index 31c1aefa..3b2c4adc 100644 --- a/packages/uhk-web/src/app/components/keymap/edit/keymap-edit.component.ts +++ b/packages/uhk-web/src/app/components/keymap/edit/keymap-edit.component.ts @@ -1,8 +1,9 @@ import { Component, HostListener, ViewChild } from '@angular/core'; import { ActivatedRoute } from '@angular/router'; +import { Store } from '@ngrx/store'; +import { Keymap } from 'uhk-common'; import '@ngrx/core/add/operator/select'; -import { Store } from '@ngrx/store'; import { Observable } from 'rxjs/Observable'; import 'rxjs/add/operator/first'; @@ -15,11 +16,11 @@ import 'rxjs/add/operator/combineLatest'; import { saveAs } from 'file-saver'; -import { Keymap } from '../../../config-serializer/config-items/keymap'; -import { AppState } from '../../../store'; +import { AppState, getKeyboardLayout } from '../../../store'; import { getKeymap, getKeymaps, getUserConfiguration } from '../../../store/reducers/user-configuration'; import 'rxjs/add/operator/pluck'; import { SvgKeyboardWrapComponent } from '../../svg/wrap/svg-keyboard-wrap.component'; +import { KeyboardLayout } from '../../../keyboard/keyboard-layout.enum'; @Component({ selector: 'keymap-edit', @@ -37,6 +38,7 @@ export class KeymapEditComponent { deletable$: Observable; keymap$: Observable; + keyboardLayout$: Observable; constructor(protected store: Store, route: ActivatedRoute) { @@ -49,6 +51,8 @@ export class KeymapEditComponent { this.deletable$ = store.let(getKeymaps()) .map((keymaps: Keymap[]) => keymaps.length > 1); + + this.keyboardLayout$ = store.select(getKeyboardLayout); } downloadKeymap() { diff --git a/packages/uhk-web/src/app/components/keymap/header/keymap-header.component.ts b/packages/uhk-web/src/app/components/keymap/header/keymap-header.component.ts index 72d0f650..b3b0954b 100644 --- a/packages/uhk-web/src/app/components/keymap/header/keymap-header.component.ts +++ b/packages/uhk-web/src/app/components/keymap/header/keymap-header.component.ts @@ -10,11 +10,10 @@ import { SimpleChanges, ViewChild } from '@angular/core'; +import { Keymap } from 'uhk-common'; import { Store } from '@ngrx/store'; -import { Keymap } from '../../../config-serializer/config-items/keymap'; - import { AppState } from '../../../store'; import { KeymapActions } from '../../../store/actions'; diff --git a/packages/uhk-web/src/app/components/macro/action-editor/macro-action-editor.component.ts b/packages/uhk-web/src/app/components/macro/action-editor/macro-action-editor.component.ts index a49fe8d7..392e2125 100644 --- a/packages/uhk-web/src/app/components/macro/action-editor/macro-action-editor.component.ts +++ b/packages/uhk-web/src/app/components/macro/action-editor/macro-action-editor.component.ts @@ -8,8 +8,8 @@ import { MoveMouseMacroAction, MouseButtonMacroAction, TextMacroAction, - Helper as MacroActionHelper -} from '../../../config-serializer/config-items/macro-action'; + MacroActionHelper +} from 'uhk-common'; import { MacroDelayTabComponent, MacroMouseTabComponent, MacroKeyTabComponent, MacroTextTabComponent } from './tab'; enum TabName { diff --git a/packages/uhk-web/src/app/components/macro/action-editor/tab/delay/macro-delay.component.ts b/packages/uhk-web/src/app/components/macro/action-editor/tab/delay/macro-delay.component.ts index c342576c..560a39ec 100644 --- a/packages/uhk-web/src/app/components/macro/action-editor/tab/delay/macro-delay.component.ts +++ b/packages/uhk-web/src/app/components/macro/action-editor/tab/delay/macro-delay.component.ts @@ -6,8 +6,8 @@ import { OnInit, ViewChild } from '@angular/core'; +import { DelayMacroAction } from 'uhk-common'; -import { DelayMacroAction } from '../../../../../config-serializer/config-items/macro-action'; import { MacroBaseComponent } from '../macro-base.component'; const INITIAL_DELAY = 0.5; // In seconds diff --git a/packages/uhk-web/src/app/components/macro/action-editor/tab/key/macro-key.component.ts b/packages/uhk-web/src/app/components/macro/action-editor/tab/key/macro-key.component.ts index ec269f26..654e3bbd 100644 --- a/packages/uhk-web/src/app/components/macro/action-editor/tab/key/macro-key.component.ts +++ b/packages/uhk-web/src/app/components/macro/action-editor/tab/key/macro-key.component.ts @@ -1,7 +1,6 @@ import { Component, Input, OnInit, ViewChild } from '@angular/core'; -import { KeystrokeAction } from '../../../../../config-serializer/config-items/key-action'; -import { KeyMacroAction, MacroSubAction } from '../../../../../config-serializer/config-items/macro-action'; +import { KeyMacroAction, KeystrokeAction, MacroSubAction } from 'uhk-common'; import { KeypressTabComponent, Tab } from '../../../../popover/tab'; import { MacroBaseComponent } from '../macro-base.component'; diff --git a/packages/uhk-web/src/app/components/macro/action-editor/tab/mouse/macro-mouse.component.ts b/packages/uhk-web/src/app/components/macro/action-editor/tab/mouse/macro-mouse.component.ts index d1e8e90d..1a04c4e8 100644 --- a/packages/uhk-web/src/app/components/macro/action-editor/tab/mouse/macro-mouse.component.ts +++ b/packages/uhk-web/src/app/components/macro/action-editor/tab/mouse/macro-mouse.component.ts @@ -5,7 +5,7 @@ import { MoveMouseMacroAction, ScrollMouseMacroAction, MacroSubAction -} from '../../../../../config-serializer/config-items/macro-action'; +} from 'uhk-common'; import { Tab } from '../../../../popover/tab'; import { MacroBaseComponent } from '../macro-base.component'; diff --git a/packages/uhk-web/src/app/components/macro/action-editor/tab/text/macro-text.component.ts b/packages/uhk-web/src/app/components/macro/action-editor/tab/text/macro-text.component.ts index 3bf66e8e..c8e1d6e5 100644 --- a/packages/uhk-web/src/app/components/macro/action-editor/tab/text/macro-text.component.ts +++ b/packages/uhk-web/src/app/components/macro/action-editor/tab/text/macro-text.component.ts @@ -7,8 +7,8 @@ import { Renderer, ViewChild } from '@angular/core'; +import { TextMacroAction } from 'uhk-common'; -import { TextMacroAction } from '../../../../../config-serializer/config-items/macro-action'; import { MacroBaseComponent } from '../macro-base.component'; @Component({ diff --git a/packages/uhk-web/src/app/components/macro/edit/macro-edit.component.ts b/packages/uhk-web/src/app/components/macro/edit/macro-edit.component.ts index f756847e..3572ccb1 100644 --- a/packages/uhk-web/src/app/components/macro/edit/macro-edit.component.ts +++ b/packages/uhk-web/src/app/components/macro/edit/macro-edit.component.ts @@ -1,14 +1,11 @@ import { Component, OnDestroy } from '@angular/core'; import { ActivatedRoute } from '@angular/router'; - import { Store } from '@ngrx/store'; +import { Macro, MacroAction } from 'uhk-common'; import { Subscription } from 'rxjs/Subscription'; import 'rxjs/add/operator/pluck'; -import { Macro } from '../../../config-serializer/config-items/macro'; -import { MacroAction } from '../../../config-serializer/config-items/macro-action/macro-action'; - import { MacroActions } from '../../../store/actions'; import { AppState } from '../../../store/index'; import { getMacro } from '../../../store/reducers/user-configuration'; diff --git a/packages/uhk-web/src/app/components/macro/header/macro-header.component.ts b/packages/uhk-web/src/app/components/macro/header/macro-header.component.ts index c60f737a..9465ebdb 100644 --- a/packages/uhk-web/src/app/components/macro/header/macro-header.component.ts +++ b/packages/uhk-web/src/app/components/macro/header/macro-header.component.ts @@ -9,10 +9,8 @@ import { SimpleChanges, ViewChild } from '@angular/core'; - import { Store } from '@ngrx/store'; - -import { Macro } from '../../../config-serializer/config-items/macro'; +import { Macro } from 'uhk-common'; import { MacroActions } from '../../../store/actions'; import { AppState } from '../../../store/index'; diff --git a/packages/uhk-web/src/app/components/macro/item/macro-item.component.ts b/packages/uhk-web/src/app/components/macro/item/macro-item.component.ts index 86815f5a..0b572e5f 100644 --- a/packages/uhk-web/src/app/components/macro/item/macro-item.component.ts +++ b/packages/uhk-web/src/app/components/macro/item/macro-item.component.ts @@ -1,16 +1,15 @@ import { Component, Input, Output, EventEmitter, OnChanges, OnInit, SimpleChanges } from '@angular/core'; import { animate, state, style, transition, trigger } from '@angular/animations'; - -import { KeyModifiers } from '../../../config-serializer/config-items/key-modifiers'; import { DelayMacroAction, KeyMacroAction, + KeyModifiers, MacroAction, MouseButtonMacroAction, MoveMouseMacroAction, ScrollMouseMacroAction, TextMacroAction -} from '../../../config-serializer/config-items/macro-action'; +} from 'uhk-common'; import { MapperService } from '../../../services/mapper.service'; diff --git a/packages/uhk-web/src/app/components/macro/list/macro-list.component.ts b/packages/uhk-web/src/app/components/macro/list/macro-list.component.ts index 06f8360a..ae41d72d 100644 --- a/packages/uhk-web/src/app/components/macro/list/macro-list.component.ts +++ b/packages/uhk-web/src/app/components/macro/list/macro-list.component.ts @@ -1,10 +1,8 @@ import { Component, EventEmitter, Input, Output, QueryList, ViewChildren, forwardRef } from '@angular/core'; import { animate, state, style, transition, trigger } from '@angular/animations'; - import { DragulaService } from 'ng2-dragula/ng2-dragula'; +import { Macro, MacroAction } from 'uhk-common'; -import { Macro } from '../../../config-serializer/config-items/macro'; -import { MacroAction } from '../../../config-serializer/config-items/macro-action'; import { MacroItemComponent } from '../item'; @Component({ diff --git a/packages/uhk-web/src/app/components/macro/not-found/macro-not-found-guard.service.ts b/packages/uhk-web/src/app/components/macro/not-found/macro-not-found-guard.service.ts index 416e2b23..8869f253 100644 --- a/packages/uhk-web/src/app/components/macro/not-found/macro-not-found-guard.service.ts +++ b/packages/uhk-web/src/app/components/macro/not-found/macro-not-found-guard.service.ts @@ -1,5 +1,6 @@ import { Injectable } from '@angular/core'; import { CanActivate, Router } from '@angular/router'; +import { Macro } from 'uhk-common'; import { Observable } from 'rxjs/Observable'; @@ -10,7 +11,6 @@ import { Store } from '@ngrx/store'; import { AppState } from '../../../store/index'; import { getMacros } from '../../../store/reducers/user-configuration'; -import { Macro } from '../../../config-serializer/config-items/macro'; @Injectable() export class MacroNotFoundGuard implements CanActivate { diff --git a/packages/uhk-web/src/app/components/popover/popover.component.ts b/packages/uhk-web/src/app/components/popover/popover.component.ts index 043f007b..a20418f5 100644 --- a/packages/uhk-web/src/app/components/popover/popover.component.ts +++ b/packages/uhk-web/src/app/components/popover/popover.component.ts @@ -19,13 +19,13 @@ import 'rxjs/add/operator/map'; import { KeyAction, + Keymap, KeystrokeAction, MouseAction, PlayMacroAction, SwitchKeymapAction, SwitchLayerAction -} from '../../config-serializer/config-items/key-action'; -import { Keymap } from '../../config-serializer/config-items/keymap'; +} from 'uhk-common'; import { Tab } from './tab/tab'; diff --git a/packages/uhk-web/src/app/components/popover/tab/keymap/keymap-tab.component.ts b/packages/uhk-web/src/app/components/popover/tab/keymap/keymap-tab.component.ts index 317fbe14..ba8bbf53 100644 --- a/packages/uhk-web/src/app/components/popover/tab/keymap/keymap-tab.component.ts +++ b/packages/uhk-web/src/app/components/popover/tab/keymap/keymap-tab.component.ts @@ -1,9 +1,7 @@ import { ChangeDetectionStrategy, Component, Input, OnChanges, SimpleChanges } from '@angular/core'; - import { Select2OptionData } from 'ng2-select2/ng2-select2'; +import { Keymap, KeyAction, SwitchKeymapAction } from 'uhk-common'; -import { KeyAction, SwitchKeymapAction } from '../../../../config-serializer/config-items/key-action'; -import { Keymap } from '../../../../config-serializer/config-items/keymap'; import { Tab } from '../tab'; @Component({ diff --git a/packages/uhk-web/src/app/components/popover/tab/keypress/keypress-tab.component.ts b/packages/uhk-web/src/app/components/popover/tab/keypress/keypress-tab.component.ts index cc8a33b8..cc5e4043 100644 --- a/packages/uhk-web/src/app/components/popover/tab/keypress/keypress-tab.component.ts +++ b/packages/uhk-web/src/app/components/popover/tab/keypress/keypress-tab.component.ts @@ -1,12 +1,9 @@ import { Component, Input, OnChanges } from '@angular/core'; - import { Select2OptionData, Select2TemplateFunction } from 'ng2-select2'; - -import { KeyAction, KeystrokeAction } from '../../../../config-serializer/config-items/key-action'; +import { KeyAction, KeystrokeAction, KeystrokeType } from 'uhk-common'; import { Tab } from '../tab'; import { MapperService } from '../../../../services/mapper.service'; -import { KeystrokeType } from '../../../../config-serializer/config-items/key-action/keystroke-type'; @Component({ selector: 'keypress-tab', diff --git a/packages/uhk-web/src/app/components/popover/tab/layer/layer-tab.component.ts b/packages/uhk-web/src/app/components/popover/tab/layer/layer-tab.component.ts index 395b6b92..96e97b8a 100644 --- a/packages/uhk-web/src/app/components/popover/tab/layer/layer-tab.component.ts +++ b/packages/uhk-web/src/app/components/popover/tab/layer/layer-tab.component.ts @@ -1,6 +1,5 @@ import { Component, HostBinding, Input, OnChanges, SimpleChanges } from '@angular/core'; - -import { KeyAction, LayerName, SwitchLayerAction } from '../../../../config-serializer/config-items/key-action'; +import { KeyAction, LayerName, SwitchLayerAction } from 'uhk-common'; import { Tab } from '../tab'; diff --git a/packages/uhk-web/src/app/components/popover/tab/macro/macro-tab.component.ts b/packages/uhk-web/src/app/components/popover/tab/macro/macro-tab.component.ts index e88a34ab..d2343f6e 100644 --- a/packages/uhk-web/src/app/components/popover/tab/macro/macro-tab.component.ts +++ b/packages/uhk-web/src/app/components/popover/tab/macro/macro-tab.component.ts @@ -1,13 +1,8 @@ import { Component, Input, OnChanges, OnDestroy, OnInit } from '@angular/core'; - import { Store } from '@ngrx/store'; - import { Subscription } from 'rxjs/Subscription'; - import { Select2OptionData } from 'ng2-select2/ng2-select2'; - -import { KeyAction, PlayMacroAction } from '../../../../config-serializer/config-items/key-action'; -import { Macro } from '../../../../config-serializer/config-items/macro'; +import { KeyAction, Macro, PlayMacroAction } from 'uhk-common'; import { Tab } from '../tab'; diff --git a/packages/uhk-web/src/app/components/popover/tab/mouse/mouse-tab.component.ts b/packages/uhk-web/src/app/components/popover/tab/mouse/mouse-tab.component.ts index 267ae4c6..a3e76cba 100644 --- a/packages/uhk-web/src/app/components/popover/tab/mouse/mouse-tab.component.ts +++ b/packages/uhk-web/src/app/components/popover/tab/mouse/mouse-tab.component.ts @@ -1,6 +1,6 @@ import { Component, Input, OnChanges } from '@angular/core'; +import { KeyAction, MouseAction, MouseActionParam } from 'uhk-common'; -import { KeyAction, MouseAction, MouseActionParam } from '../../../../config-serializer/config-items/key-action'; import { Tab } from '../tab'; @Component({ diff --git a/packages/uhk-web/src/app/components/popover/tab/tab.ts b/packages/uhk-web/src/app/components/popover/tab/tab.ts index 9e75d544..504a543f 100644 --- a/packages/uhk-web/src/app/components/popover/tab/tab.ts +++ b/packages/uhk-web/src/app/components/popover/tab/tab.ts @@ -1,6 +1,5 @@ import { EventEmitter, Output } from '@angular/core'; - -import { KeyAction } from '../../../config-serializer/config-items/key-action'; +import { KeyAction } from 'uhk-common'; export abstract class Tab { @Output() validAction = new EventEmitter(); diff --git a/packages/uhk-web/src/app/components/side-menu/side-menu.component.ts b/packages/uhk-web/src/app/components/side-menu/side-menu.component.ts index efdf02de..eee8737c 100644 --- a/packages/uhk-web/src/app/components/side-menu/side-menu.component.ts +++ b/packages/uhk-web/src/app/components/side-menu/side-menu.component.ts @@ -1,5 +1,6 @@ import { Component, Renderer } from '@angular/core'; import { animate, state, style, transition, trigger } from '@angular/animations'; +import { Keymap, Macro } from 'uhk-common'; import { Store } from '@ngrx/store'; @@ -8,9 +9,6 @@ import 'rxjs/add/operator/do'; import 'rxjs/add/operator/map'; import 'rxjs/add/operator/let'; -import { Keymap } from '../../config-serializer/config-items/keymap'; -import { Macro } from '../../config-serializer/config-items/macro'; - import { AppState, showAddonMenu, runningInElectron } from '../../store'; import { MacroActions } from '../../store/actions'; import { getKeymaps, getMacros } from '../../store/reducers/user-configuration'; diff --git a/packages/uhk-web/src/app/components/svg/keyboard/svg-keyboard.component.ts b/packages/uhk-web/src/app/components/svg/keyboard/svg-keyboard.component.ts index db33039c..cace0d08 100644 --- a/packages/uhk-web/src/app/components/svg/keyboard/svg-keyboard.component.ts +++ b/packages/uhk-web/src/app/components/svg/keyboard/svg-keyboard.component.ts @@ -1,9 +1,10 @@ import { Component, EventEmitter, Input, OnInit, Output, SimpleChanges, ChangeDetectionStrategy } from '@angular/core'; import { animate, state, trigger, style, transition } from '@angular/animations'; +import { Module } from 'uhk-common'; -import { Module } from '../../../config-serializer/config-items/module'; import { SvgModule } from '../module'; import { SvgModuleProviderService } from '../../../services/svg-module-provider.service'; +import { KeyboardLayout } from '../../../keyboard/keyboard-layout.enum'; @Component({ selector: 'svg-keyboard', @@ -29,6 +30,7 @@ export class SvgKeyboardComponent implements OnInit { @Input() selectedKey: { layerId: number, moduleId: number, keyId: number }; @Input() selected: boolean; @Input() halvesSplit: boolean; + @Input() keyboardLayout = KeyboardLayout.ANSI; @Output() keyClick = new EventEmitter(); @Output() keyHover = new EventEmitter(); @Output() capture = new EventEmitter(); @@ -45,13 +47,17 @@ export class SvgKeyboardComponent implements OnInit { } ngOnInit() { - this.modules = this.svgModuleProvider.getSvgModules(); + this.setModules(); } ngOnChanges(changes: SimpleChanges) { if (changes.halvesSplit) { this.updateModuleAnimationStates(); } + + if (changes['keyboardLayout']) { + this.setModules(); + } } onKeyClick(moduleId: number, keyId: number, keyTarget: HTMLElement): void { @@ -87,4 +93,7 @@ export class SvgKeyboardComponent implements OnInit { } } + private setModules() { + this.modules = this.svgModuleProvider.getSvgModules(this.keyboardLayout); + } } diff --git a/packages/uhk-web/src/app/components/svg/keys/svg-keyboard-key/svg-keyboard-key.component.ts b/packages/uhk-web/src/app/components/svg/keys/svg-keyboard-key/svg-keyboard-key.component.ts index 219182c7..74d0aa4b 100644 --- a/packages/uhk-web/src/app/components/svg/keys/svg-keyboard-key/svg-keyboard-key.component.ts +++ b/packages/uhk-web/src/app/components/svg/keys/svg-keyboard-key/svg-keyboard-key.component.ts @@ -10,15 +10,15 @@ import { Subscription } from 'rxjs/Subscription'; import { KeyAction, + KeyModifiers, KeystrokeAction, LayerName, + Macro, MouseAction, PlayMacroAction, SwitchKeymapAction, SwitchLayerAction -} from '../../../../config-serializer/config-items/key-action'; -import { KeyModifiers } from '../../../../config-serializer/config-items/key-modifiers'; -import { Macro } from '../../../../config-serializer/config-items/macro'; +} from 'uhk-common'; import { CaptureService } from '../../../../services/capture.service'; import { MapperService } from '../../../../services/mapper.service'; diff --git a/packages/uhk-web/src/app/components/svg/keys/svg-keystroke-key/svg-keystroke-key.component.ts b/packages/uhk-web/src/app/components/svg/keys/svg-keystroke-key/svg-keystroke-key.component.ts index 32a7a247..a18ae43c 100644 --- a/packages/uhk-web/src/app/components/svg/keys/svg-keystroke-key/svg-keystroke-key.component.ts +++ b/packages/uhk-web/src/app/components/svg/keys/svg-keystroke-key/svg-keystroke-key.component.ts @@ -1,7 +1,6 @@ import { Component, Input, OnChanges, OnInit, ChangeDetectionStrategy } from '@angular/core'; +import { KeyModifiers, KeystrokeAction } from 'uhk-common'; -import { KeystrokeAction } from '../../../../config-serializer/config-items/key-action'; -import { KeyModifiers } from '../../../../config-serializer/config-items/key-modifiers'; import { MapperService } from '../../../../services/mapper.service'; class SvgAttributes { diff --git a/packages/uhk-web/src/app/components/svg/keys/svg-mouse-key/svg-mouse-key.ts b/packages/uhk-web/src/app/components/svg/keys/svg-mouse-key/svg-mouse-key.ts index 8429f9ef..875782d9 100644 --- a/packages/uhk-web/src/app/components/svg/keys/svg-mouse-key/svg-mouse-key.ts +++ b/packages/uhk-web/src/app/components/svg/keys/svg-mouse-key/svg-mouse-key.ts @@ -1,6 +1,6 @@ import { Component, Input, OnChanges, ChangeDetectionStrategy } from '@angular/core'; -import { MouseAction, MouseActionParam } from '../../../../config-serializer/config-items/key-action'; +import { MouseAction, MouseActionParam } from 'uhk-common'; @Component({ selector: 'g[svg-mouse-key]', diff --git a/packages/uhk-web/src/app/components/svg/module/svg-module.component.ts b/packages/uhk-web/src/app/components/svg/module/svg-module.component.ts index d6c80dc0..22ce34f7 100644 --- a/packages/uhk-web/src/app/components/svg/module/svg-module.component.ts +++ b/packages/uhk-web/src/app/components/svg/module/svg-module.component.ts @@ -1,6 +1,5 @@ import { Component, EventEmitter, Input, Output, ChangeDetectionStrategy } from '@angular/core'; - -import { KeyAction } from '../../../config-serializer/config-items/key-action'; +import { KeyAction } from 'uhk-common'; import { SvgKeyboardKey } from '../keys'; diff --git a/packages/uhk-web/src/app/components/svg/wrap/svg-keyboard-wrap.component.html b/packages/uhk-web/src/app/components/svg/wrap/svg-keyboard-wrap.component.html index ed20c5f3..e6289c7a 100644 --- a/packages/uhk-web/src/app/components/svg/wrap/svg-keyboard-wrap.component.html +++ b/packages/uhk-web/src/app/components/svg/wrap/svg-keyboard-wrap.component.html @@ -6,6 +6,7 @@ [capturingEnabled]="popoverEnabled" [selectedKey]="selectedKey" [halvesSplit]="halvesSplit" + [keyboardLayout]="keyboardLayout" (keyClick)="onKeyClick($event.moduleId, $event.keyId, $event.keyTarget)" (keyHover)="onKeyHover($event.moduleId, $event.event, $event.over, $event.keyId)" (capture)="onCapture($event.moduleId, $event.keyId, $event.captured)" diff --git a/packages/uhk-web/src/app/components/svg/wrap/svg-keyboard-wrap.component.ts b/packages/uhk-web/src/app/components/svg/wrap/svg-keyboard-wrap.component.ts index 11b00906..2da1e1be 100644 --- a/packages/uhk-web/src/app/components/svg/wrap/svg-keyboard-wrap.component.ts +++ b/packages/uhk-web/src/app/components/svg/wrap/svg-keyboard-wrap.component.ts @@ -17,26 +17,27 @@ import 'rxjs/add/observable/of'; import 'rxjs/add/operator/map'; import { Store } from '@ngrx/store'; -import { MapperService } from '../../../services/mapper.service'; - import { + camelCaseToSentence, + capitalizeFirstLetter, KeyAction, + Keymap, KeystrokeAction, + Layer, LayerName, + LongPressAction, MouseAction, MouseActionParam, PlayMacroAction, SwitchKeymapAction, SwitchLayerAction -} from '../../../config-serializer/config-items/key-action'; -import { Keymap } from '../../../config-serializer/config-items/keymap'; -import { Layer } from '../../../config-serializer/config-items/layer'; -import { LongPressAction } from '../../../config-serializer/config-items/long-press-action'; -import { camelCaseToSentence, capitalizeFirstLetter } from 'uhk-common'; +} from 'uhk-common'; +import { MapperService } from '../../../services/mapper.service'; import { AppState } from '../../../store'; import { KeymapActions } from '../../../store/actions'; import { PopoverComponent } from '../../popover'; +import { KeyboardLayout } from '../../../keyboard/keyboard-layout.enum'; interface NameValuePair { name: string; @@ -54,6 +55,7 @@ export class SvgKeyboardWrapComponent implements OnInit, OnChanges { @Input() popoverEnabled: boolean = true; @Input() tooltipEnabled: boolean = false; @Input() halvesSplit: boolean; + @Input() keyboardLayout: KeyboardLayout.ANSI; @ViewChild(PopoverComponent, { read: ElementRef }) popover: ElementRef; diff --git a/packages/uhk-web/src/app/services/datastorage-repository.service.ts b/packages/uhk-web/src/app/services/datastorage-repository.service.ts index ae228a72..5df41f1e 100644 --- a/packages/uhk-web/src/app/services/datastorage-repository.service.ts +++ b/packages/uhk-web/src/app/services/datastorage-repository.service.ts @@ -1,6 +1,6 @@ import { Injectable } from '@angular/core'; +import { UserConfiguration } from 'uhk-common'; -import { UserConfiguration } from '../config-serializer/config-items/user-configuration'; import { AutoUpdateSettings } from '../models/auto-update-settings'; @Injectable() diff --git a/packages/uhk-web/src/app/services/default-user-configuration.service.ts b/packages/uhk-web/src/app/services/default-user-configuration.service.ts index ad6bb4d1..e76302d5 100644 --- a/packages/uhk-web/src/app/services/default-user-configuration.service.ts +++ b/packages/uhk-web/src/app/services/default-user-configuration.service.ts @@ -1,5 +1,5 @@ import { Injectable } from '@angular/core'; -import { UserConfiguration } from '../config-serializer/config-items/user-configuration'; +import { UserConfiguration } from 'uhk-common'; @Injectable() export class DefaultUserConfigurationService { @@ -7,7 +7,7 @@ export class DefaultUserConfigurationService { constructor() { this._defaultConfig = new UserConfiguration() - .fromJsonObject(require('../config-serializer/user-config.json')); + .fromJsonObject(require('./user-config.json')); } getDefault(): UserConfiguration { diff --git a/packages/uhk-web/src/app/services/device-renderer.service.ts b/packages/uhk-web/src/app/services/device-renderer.service.ts index 70411d78..5d6df3c5 100644 --- a/packages/uhk-web/src/app/services/device-renderer.service.ts +++ b/packages/uhk-web/src/app/services/device-renderer.service.ts @@ -9,7 +9,7 @@ import { SaveConfigurationReplyAction, SetPrivilegeOnLinuxReplyAction } from '../store/actions/device'; -import { LoadUserConfigFromDeviceReplyAction } from '../store/actions/user-config'; +import { LoadConfigFromDeviceReplyAction } from '../store/actions/user-config'; @Injectable() export class DeviceRendererService { @@ -29,8 +29,8 @@ export class DeviceRendererService { this.ipcRenderer.send(IpcEvents.device.saveUserConfiguration, JSON.stringify(buffer)); } - loadUserConfiguration(): void { - this.ipcRenderer.send(IpcEvents.device.loadUserConfiguration); + loadConfigurationFromKeyboard(): void { + this.ipcRenderer.send(IpcEvents.device.loadConfigurations); } private registerEvents(): void { @@ -46,8 +46,8 @@ export class DeviceRendererService { this.dispachStoreAction(new SaveConfigurationReplyAction(response)); }); - this.ipcRenderer.on(IpcEvents.device.loadUserConfigurationReply, (event: string, response: string) => { - this.dispachStoreAction(new LoadUserConfigFromDeviceReplyAction(JSON.parse(response))); + this.ipcRenderer.on(IpcEvents.device.loadConfigurationReply, (event: string, response: string) => { + this.dispachStoreAction(new LoadConfigFromDeviceReplyAction(JSON.parse(response))); }); } diff --git a/packages/uhk-web/src/app/config-serializer/hardware-config.json b/packages/uhk-web/src/app/services/hardware-config.json similarity index 100% rename from packages/uhk-web/src/app/config-serializer/hardware-config.json rename to packages/uhk-web/src/app/services/hardware-config.json diff --git a/packages/uhk-web/src/app/services/mapper.service.ts b/packages/uhk-web/src/app/services/mapper.service.ts index 3686025c..5e48c1bb 100644 --- a/packages/uhk-web/src/app/services/mapper.service.ts +++ b/packages/uhk-web/src/app/services/mapper.service.ts @@ -1,5 +1,5 @@ import { Injectable } from '@angular/core'; -import { KeystrokeType } from '../config-serializer/config-items/key-action/keystroke-type'; +import { KeystrokeType } from 'uhk-common'; @Injectable() export class MapperService { diff --git a/packages/uhk-web/src/app/config-serializer/user-config.json b/packages/uhk-web/src/app/services/user-config.json similarity index 97% rename from packages/uhk-web/src/app/config-serializer/user-config.json rename to packages/uhk-web/src/app/services/user-config.json index d45d3a56..74ab868d 100644 --- a/packages/uhk-web/src/app/config-serializer/user-config.json +++ b/packages/uhk-web/src/app/services/user-config.json @@ -1080,10 +1080,12 @@ }, { "keyActionType": "keystroke", + "type": "basic", "scancode": 47 }, { "keyActionType": "keystroke", + "type": "basic", "scancode": 48 }, { @@ -1093,54 +1095,67 @@ }, { "keyActionType": "keystroke", + "type": "basic", "scancode": 10 }, { "keyActionType": "keystroke", + "type": "basic", "scancode": 6 }, { "keyActionType": "keystroke", + "type": "basic", "scancode": 21 }, { "keyActionType": "keystroke", + "type": "basic", "scancode": 15 }, { "keyActionType": "keystroke", + "type": "basic", "scancode": 56 }, { "keyActionType": "keystroke", + "type": "basic", "scancode": 46 }, { "keyActionType": "keystroke", + "type": "basic", "scancode": 49 }, { "keyActionType": "keystroke", + "type": "basic", "scancode": 9 }, { "keyActionType": "keystroke", + "type": "basic", "scancode": 11 }, { "keyActionType": "keystroke", + "type": "basic", "scancode": 23 }, { "keyActionType": "keystroke", + "type": "basic", "scancode": 17 }, { "keyActionType": "keystroke", + "type": "basic", "scancode": 22 }, { "keyActionType": "keystroke", + "type": "basic", "scancode": 45 }, { @@ -1150,26 +1165,32 @@ }, { "keyActionType": "keystroke", + "type": "basic", "scancode": 7 }, { "keyActionType": "keystroke", + "type": "basic", "scancode": 5 }, { "keyActionType": "keystroke", + "type": "basic", "scancode": 16 }, { "keyActionType": "keystroke", + "type": "basic", "scancode": 26 }, { "keyActionType": "keystroke", + "type": "basic", "scancode": 25 }, { "keyActionType": "keystroke", + "type": "basic", "scancode": 29 }, { @@ -1256,23 +1277,28 @@ }, { "keyActionType": "keystroke", + "type": "basic", "scancode": 52 }, { "keyActionType": "keystroke", + "type": "basic", "scancode": 54 }, { "keyActionType": "keystroke", + "type": "basic", "scancode": 55 }, { "keyActionType": "keystroke", + "type": "basic", "scancode": 19 }, null, { "keyActionType": "keystroke", + "type": "basic", "scancode": 28 }, { @@ -1287,19 +1313,23 @@ }, { "keyActionType": "keystroke", + "type": "basic", "scancode": 18 }, { "keyActionType": "keystroke", + "type": "basic", "scancode": 8 }, { "keyActionType": "keystroke", + "type": "basic", "scancode": 24 }, null, { "keyActionType": "keystroke", + "type": "basic", "scancode": 12 }, { @@ -1310,22 +1340,27 @@ null, { "keyActionType": "keystroke", + "type": "basic", "scancode": 51 }, { "keyActionType": "keystroke", + "type": "basic", "scancode": 20 }, { "keyActionType": "keystroke", + "type": "basic", "scancode": 13 }, { "keyActionType": "keystroke", + "type": "basic", "scancode": 14 }, { "keyActionType": "keystroke", + "type": "basic", "scancode": 27 }, { @@ -2105,18 +2140,22 @@ }, { "keyActionType": "keystroke", + "type": "basic", "scancode": 15 }, { "keyActionType": "keystroke", + "type": "basic", "scancode": 24 }, { "keyActionType": "keystroke", + "type": "basic", "scancode": 28 }, { "keyActionType": "keystroke", + "type": "basic", "scancode": 51 }, { @@ -2136,22 +2175,27 @@ }, { "keyActionType": "keystroke", + "type": "basic", "scancode": 13 }, { "keyActionType": "keystroke", + "type": "basic", "scancode": 17 }, { "keyActionType": "keystroke", + "type": "basic", "scancode": 8 }, { "keyActionType": "keystroke", + "type": "basic", "scancode": 12 }, { "keyActionType": "keystroke", + "type": "basic", "scancode": 18 }, { @@ -2171,10 +2215,12 @@ }, { "keyActionType": "keystroke", + "type": "basic", "scancode": 14 }, { "keyActionType": "keystroke", + "type": "basic", "scancode": 16 }, { @@ -2286,15 +2332,18 @@ }, { "keyActionType": "keystroke", + "type": "basic", "scancode": 9 }, { "keyActionType": "keystroke", + "type": "basic", "scancode": 19 }, null, { "keyActionType": "keystroke", + "type": "basic", "scancode": 10 }, { @@ -2309,19 +2358,23 @@ }, { "keyActionType": "keystroke", + "type": "basic", "scancode": 21 }, { "keyActionType": "keystroke", + "type": "basic", "scancode": 22 }, { "keyActionType": "keystroke", + "type": "basic", "scancode": 23 }, null, { "keyActionType": "keystroke", + "type": "basic", "scancode": 7 }, { @@ -3132,18 +3185,22 @@ }, { "keyActionType": "keystroke", + "type": "basic", "scancode": 9 }, { "keyActionType": "keystroke", + "type": "basic", "scancode": 24 }, { "keyActionType": "keystroke", + "type": "basic", "scancode": 19 }, { "keyActionType": "keystroke", + "type": "basic", "scancode": 51 }, { @@ -3163,22 +3220,27 @@ }, { "keyActionType": "keystroke", + "type": "basic", "scancode": 13 }, { "keyActionType": "keystroke", + "type": "basic", "scancode": 17 }, { "keyActionType": "keystroke", + "type": "basic", "scancode": 8 }, { "keyActionType": "keystroke", + "type": "basic", "scancode": 18 }, { "keyActionType": "keystroke", + "type": "basic", "scancode": 12 }, { @@ -3193,14 +3255,17 @@ }, { "keyActionType": "keystroke", + "type": "basic", "scancode": 28 }, { "keyActionType": "keystroke", + "type": "basic", "scancode": 14 }, { "keyActionType": "keystroke", + "type": "basic", "scancode": 15 }, { @@ -3307,19 +3372,23 @@ }, { "keyActionType": "keystroke", + "type": "basic", "scancode": 7 }, { "keyActionType": "keystroke", + "type": "basic", "scancode": 21 }, { "keyActionType": "keystroke", + "type": "basic", "scancode": 26 }, null, { "keyActionType": "keystroke", + "type": "basic", "scancode": 5 }, { @@ -3334,19 +3403,23 @@ }, { "keyActionType": "keystroke", + "type": "basic", "scancode": 22 }, { "keyActionType": "keystroke", + "type": "basic", "scancode": 11 }, { "keyActionType": "keystroke", + "type": "basic", "scancode": 23 }, null, { "keyActionType": "keystroke", + "type": "basic", "scancode": 10 }, { @@ -3367,14 +3440,17 @@ }, { "keyActionType": "keystroke", + "type": "basic", "scancode": 16 }, { "keyActionType": "keystroke", + "type": "basic", "scancode": 6 }, { "keyActionType": "keystroke", + "type": "basic", "scancode": 25 }, { @@ -4462,72 +4538,89 @@ "keyActions": [ { "keyActionType": "keystroke", + "type": "basic", "scancode": 35 }, { "keyActionType": "keystroke", + "type": "basic", "scancode": 34 }, { "keyActionType": "keystroke", + "type": "basic", "scancode": 33 }, { "keyActionType": "keystroke", + "type": "basic", "scancode": 32 }, { "keyActionType": "keystroke", + "type": "basic", "scancode": 31 }, { "keyActionType": "keystroke", + "type": "basic", "scancode": 30 }, { "keyActionType": "keystroke", + "type": "basic", "scancode": 53 }, { "keyActionType": "keystroke", + "type": "basic", "scancode": 21 }, { "keyActionType": "keystroke", + "type": "basic", "scancode": 8 }, { "keyActionType": "keystroke", + "type": "basic", "scancode": 26 }, { "keyActionType": "keystroke", + "type": "basic", "scancode": 20 }, { "keyActionType": "keystroke", + "type": "basic", "scancode": 43 }, null, null, { "keyActionType": "keystroke", + "type": "basic", "scancode": 23 }, { "keyActionType": "keystroke", + "type": "basic", "scancode": 9 }, { "keyActionType": "keystroke", + "type": "basic", "scancode": 7 }, { "keyActionType": "keystroke", + "type": "basic", "scancode": 22 }, { "keyActionType": "keystroke", + "type": "basic", "scancode": 4 }, { @@ -4538,26 +4631,32 @@ null, { "keyActionType": "keystroke", + "type": "basic", "scancode": 10 }, { "keyActionType": "keystroke", + "type": "basic", "scancode": 5 }, { "keyActionType": "keystroke", + "type": "basic", "scancode": 25 }, { "keyActionType": "keystroke", + "type": "basic", "scancode": 6 }, { "keyActionType": "keystroke", + "type": "basic", "scancode": 27 }, { "keyActionType": "keystroke", + "type": "basic", "scancode": 29 }, { @@ -4600,30 +4699,37 @@ "keyActions": [ { "keyActionType": "keystroke", + "type": "basic", "scancode": 42 }, { "keyActionType": "keystroke", + "type": "basic", "scancode": 46 }, { "keyActionType": "keystroke", + "type": "basic", "scancode": 45 }, { "keyActionType": "keystroke", + "type": "basic", "scancode": 39 }, { "keyActionType": "keystroke", + "type": "basic", "scancode": 38 }, { "keyActionType": "keystroke", + "type": "basic", "scancode": 37 }, { "keyActionType": "keystroke", + "type": "basic", "scancode": 36 }, { @@ -4633,23 +4739,28 @@ }, { "keyActionType": "keystroke", + "type": "basic", "scancode": 19 }, { "keyActionType": "keystroke", + "type": "basic", "scancode": 18 }, { "keyActionType": "keystroke", + "type": "basic", "scancode": 12 }, { "keyActionType": "keystroke", + "type": "basic", "scancode": 24 }, null, { "keyActionType": "keystroke", + "type": "basic", "scancode": 28 }, { @@ -4659,23 +4770,28 @@ }, { "keyActionType": "keystroke", + "type": "basic", "scancode": 51 }, { "keyActionType": "keystroke", + "type": "basic", "scancode": 15 }, { "keyActionType": "keystroke", + "type": "basic", "scancode": 14 }, { "keyActionType": "keystroke", + "type": "basic", "scancode": 13 }, null, { "keyActionType": "keystroke", + "type": "basic", "scancode": 11 }, { @@ -4686,22 +4802,27 @@ null, { "keyActionType": "keystroke", + "type": "basic", "scancode": 56 }, { "keyActionType": "keystroke", + "type": "basic", "scancode": 55 }, { "keyActionType": "keystroke", + "type": "basic", "scancode": 54 }, { "keyActionType": "keystroke", + "type": "basic", "scancode": 16 }, { "keyActionType": "keystroke", + "type": "basic", "scancode": 17 }, { @@ -5489,72 +5610,89 @@ "keyActions": [ { "keyActionType": "keystroke", + "type": "basic", "scancode": 35 }, { "keyActionType": "keystroke", + "type": "basic", "scancode": 34 }, { "keyActionType": "keystroke", + "type": "basic", "scancode": 33 }, { "keyActionType": "keystroke", + "type": "basic", "scancode": 32 }, { "keyActionType": "keystroke", + "type": "basic", "scancode": 31 }, { "keyActionType": "keystroke", + "type": "basic", "scancode": 30 }, { "keyActionType": "keystroke", + "type": "basic", "scancode": 53 }, { "keyActionType": "keystroke", + "type": "basic", "scancode": 21 }, { "keyActionType": "keystroke", + "type": "basic", "scancode": 8 }, { "keyActionType": "keystroke", + "type": "basic", "scancode": 26 }, { "keyActionType": "keystroke", + "type": "basic", "scancode": 20 }, { "keyActionType": "keystroke", + "type": "basic", "scancode": 43 }, null, null, { "keyActionType": "keystroke", + "type": "basic", "scancode": 23 }, { "keyActionType": "keystroke", + "type": "basic", "scancode": 9 }, { "keyActionType": "keystroke", + "type": "basic", "scancode": 7 }, { "keyActionType": "keystroke", + "type": "basic", "scancode": 22 }, { "keyActionType": "keystroke", + "type": "basic", "scancode": 4 }, { @@ -5565,26 +5703,32 @@ null, { "keyActionType": "keystroke", + "type": "basic", "scancode": 10 }, { "keyActionType": "keystroke", + "type": "basic", "scancode": 5 }, { "keyActionType": "keystroke", + "type": "basic", "scancode": 25 }, { "keyActionType": "keystroke", + "type": "basic", "scancode": 6 }, { "keyActionType": "keystroke", + "type": "basic", "scancode": 27 }, { "keyActionType": "keystroke", + "type": "basic", "scancode": 29 }, { @@ -5627,30 +5771,37 @@ "keyActions": [ { "keyActionType": "keystroke", + "type": "basic", "scancode": 42 }, { "keyActionType": "keystroke", + "type": "basic", "scancode": 46 }, { "keyActionType": "keystroke", + "type": "basic", "scancode": 45 }, { "keyActionType": "keystroke", + "type": "basic", "scancode": 39 }, { "keyActionType": "keystroke", + "type": "basic", "scancode": 38 }, { "keyActionType": "keystroke", + "type": "basic", "scancode": 37 }, { "keyActionType": "keystroke", + "type": "basic", "scancode": 36 }, { @@ -5660,23 +5811,28 @@ }, { "keyActionType": "keystroke", + "type": "basic", "scancode": 19 }, { "keyActionType": "keystroke", + "type": "basic", "scancode": 18 }, { "keyActionType": "keystroke", + "type": "basic", "scancode": 12 }, { "keyActionType": "keystroke", + "type": "basic", "scancode": 24 }, null, { "keyActionType": "keystroke", + "type": "basic", "scancode": 28 }, { @@ -5686,23 +5842,28 @@ }, { "keyActionType": "keystroke", + "type": "basic", "scancode": 51 }, { "keyActionType": "keystroke", + "type": "basic", "scancode": 15 }, { "keyActionType": "keystroke", + "type": "basic", "scancode": 14 }, { "keyActionType": "keystroke", + "type": "basic", "scancode": 13 }, null, { "keyActionType": "keystroke", + "type": "basic", "scancode": 11 }, { @@ -5713,22 +5874,27 @@ null, { "keyActionType": "keystroke", + "type": "basic", "scancode": 56 }, { "keyActionType": "keystroke", + "type": "basic", "scancode": 55 }, { "keyActionType": "keystroke", + "type": "basic", "scancode": 54 }, { "keyActionType": "keystroke", + "type": "basic", "scancode": 16 }, { "keyActionType": "keystroke", + "type": "basic", "scancode": 17 }, { diff --git a/packages/uhk-web/src/app/store/actions/app.ts b/packages/uhk-web/src/app/store/actions/app.ts index 87547481..2560a2a7 100644 --- a/packages/uhk-web/src/app/store/actions/app.ts +++ b/packages/uhk-web/src/app/store/actions/app.ts @@ -1,8 +1,7 @@ import { Action } from '@ngrx/store'; import { type } from 'uhk-common'; -import { Notification, CommandLineArgs } from 'uhk-common'; -import { AppStartInfo } from '../../../../../uhk-common/src/models/app-start-info'; +import { AppStartInfo, HardwareConfiguration, Notification } from 'uhk-common'; const PREFIX = '[app] '; @@ -15,7 +14,8 @@ export const ActionTypes = { APP_PROCESS_START_INFO: type(PREFIX + 'process start info'), UNDO_LAST: type(PREFIX + 'undo last action'), UNDO_LAST_SUCCESS: type(PREFIX + 'undo last action success'), - DISMISS_UNDO_NOTIFICATION: type(PREFIX + 'dismiss notification action') + DISMISS_UNDO_NOTIFICATION: type(PREFIX + 'dismiss notification action'), + LOAD_HARDWARE_CONFIGURATION_SUCCESS: type(PREFIX + 'load hardware configuration success') }; export class AppBootsrappedAction implements Action { @@ -58,6 +58,12 @@ export class DismissUndoNotificationAction implements Action { type = ActionTypes.DISMISS_UNDO_NOTIFICATION; } +export class LoadHardwareConfigurationSuccessAction implements Action { + type = ActionTypes.LOAD_HARDWARE_CONFIGURATION_SUCCESS; + + constructor(public payload: HardwareConfiguration) {} +} + export type Actions = AppStartedAction | AppBootsrappedAction @@ -66,4 +72,6 @@ export type Actions | ProcessAppStartInfoAction | UndoLastAction | UndoLastSuccessAction - | DismissUndoNotificationAction; + | DismissUndoNotificationAction + | LoadHardwareConfigurationSuccessAction + ; diff --git a/packages/uhk-web/src/app/store/actions/keymap.ts b/packages/uhk-web/src/app/store/actions/keymap.ts index 91944a0d..04061422 100644 --- a/packages/uhk-web/src/app/store/actions/keymap.ts +++ b/packages/uhk-web/src/app/store/actions/keymap.ts @@ -1,8 +1,5 @@ import { Action } from '@ngrx/store'; - -import { KeyAction } from '../../config-serializer/config-items/key-action'; -import { Keymap } from '../../config-serializer/config-items/keymap'; -import { Macro } from '../../config-serializer/config-items/macro'; +import { KeyAction, Keymap, Macro } from 'uhk-common'; export namespace KeymapActions { export const PREFIX = '[Keymap] '; diff --git a/packages/uhk-web/src/app/store/actions/macro.ts b/packages/uhk-web/src/app/store/actions/macro.ts index abe7d35f..5aea9c5a 100644 --- a/packages/uhk-web/src/app/store/actions/macro.ts +++ b/packages/uhk-web/src/app/store/actions/macro.ts @@ -1,7 +1,5 @@ import { Action } from '@ngrx/store'; - -import { Macro } from '../../config-serializer/config-items/macro'; -import { MacroAction } from '../../config-serializer/config-items/macro-action'; +import { Macro, MacroAction } from 'uhk-common'; export namespace MacroActions { export const PREFIX = '[Macro] '; diff --git a/packages/uhk-web/src/app/store/actions/user-config.ts b/packages/uhk-web/src/app/store/actions/user-config.ts index 90c67214..be1cc899 100644 --- a/packages/uhk-web/src/app/store/actions/user-config.ts +++ b/packages/uhk-web/src/app/store/actions/user-config.ts @@ -1,15 +1,13 @@ import { Action } from '@ngrx/store'; - -import { type } from 'uhk-common'; -import { UserConfiguration } from '../../config-serializer/config-items/user-configuration'; +import { type, UserConfiguration, ConfigurationReply } from 'uhk-common'; const PREFIX = '[user-config] '; // tslint:disable-next-line:variable-name export const ActionTypes = { LOAD_USER_CONFIG: type(PREFIX + 'Load User Config'), - LOAD_USER_CONFIG_FROM_DEVICE: type(PREFIX + 'Load User Config from Device'), - LOAD_USER_CONFIG_FROM_DEVICE_REPLY: type(PREFIX + 'Load User Config from Device reply'), + LOAD_CONFIG_FROM_DEVICE: type(PREFIX + 'Load User Config from Device'), + LOAD_CONFIG_FROM_DEVICE_REPLY: type(PREFIX + 'Load User Config from Device reply'), LOAD_USER_CONFIG_SUCCESS: type(PREFIX + 'Load User Config Success'), SAVE_USER_CONFIG_SUCCESS: type(PREFIX + 'Save User Config Success') }; @@ -18,14 +16,14 @@ export class LoadUserConfigAction implements Action { type = ActionTypes.LOAD_USER_CONFIG; } -export class LoadUserConfigFromDeviceAction implements Action { - type = ActionTypes.LOAD_USER_CONFIG_FROM_DEVICE; +export class LoadConfigFromDeviceAction implements Action { + type = ActionTypes.LOAD_CONFIG_FROM_DEVICE; } -export class LoadUserConfigFromDeviceReplyAction implements Action { - type = ActionTypes.LOAD_USER_CONFIG_FROM_DEVICE_REPLY; +export class LoadConfigFromDeviceReplyAction implements Action { + type = ActionTypes.LOAD_CONFIG_FROM_DEVICE_REPLY; - constructor(public payload: Array) { } + constructor(public payload: ConfigurationReply) { } } export class LoadUserConfigSuccessAction implements Action { @@ -43,4 +41,7 @@ export class SaveUserConfigSuccessAction implements Action { export type Actions = LoadUserConfigAction | LoadUserConfigSuccessAction - | SaveUserConfigSuccessAction; + | SaveUserConfigSuccessAction + | LoadConfigFromDeviceAction + | LoadConfigFromDeviceReplyAction + ; diff --git a/packages/uhk-web/src/app/store/effects/device.ts b/packages/uhk-web/src/app/store/effects/device.ts index 18affe60..fb1e0e96 100644 --- a/packages/uhk-web/src/app/store/effects/device.ts +++ b/packages/uhk-web/src/app/store/effects/device.ts @@ -12,7 +12,7 @@ import 'rxjs/add/operator/map'; import 'rxjs/add/operator/mergeMap'; import 'rxjs/add/operator/withLatestFrom'; -import { NotificationType, IpcResponse } from 'uhk-common'; +import { NotificationType, IpcResponse, UhkBuffer, UserConfiguration } from 'uhk-common'; import { ActionTypes, ConnectionStateChangedAction, @@ -24,9 +24,7 @@ import { import { DeviceRendererService } from '../../services/device-renderer.service'; import { ShowNotificationAction } from '../actions/app'; import { AppState } from '../index'; -import { UserConfiguration } from '../../config-serializer/config-items/user-configuration'; -import { UhkBuffer } from '../../config-serializer/uhk-buffer'; -import { LoadUserConfigFromDeviceAction } from '../actions/user-config'; +import { LoadConfigFromDeviceAction } from '../actions/user-config'; @Injectable() export class DeviceEffects { @@ -44,7 +42,7 @@ export class DeviceEffects { }) .switchMap((connected: boolean) => { if (connected) { - return Observable.of(new LoadUserConfigFromDeviceAction()); + return Observable.of(new LoadConfigFromDeviceAction()); } return Observable.empty(); diff --git a/packages/uhk-web/src/app/store/effects/keymap.ts b/packages/uhk-web/src/app/store/effects/keymap.ts index 03df04ff..0a11337e 100644 --- a/packages/uhk-web/src/app/store/effects/keymap.ts +++ b/packages/uhk-web/src/app/store/effects/keymap.ts @@ -12,11 +12,10 @@ import 'rxjs/add/operator/switchMap'; import 'rxjs/add/operator/withLatestFrom'; import 'rxjs/add/observable/of'; +import { Keymap } from 'uhk-common'; import { KeymapActions } from '../actions'; import { AppState } from '../index'; -import { Keymap } from '../../config-serializer/config-items/keymap'; - @Injectable() export class KeymapEffects { diff --git a/packages/uhk-web/src/app/store/effects/user-config.ts b/packages/uhk-web/src/app/store/effects/user-config.ts index 1d9170d5..28802db4 100644 --- a/packages/uhk-web/src/app/store/effects/user-config.ts +++ b/packages/uhk-web/src/app/store/effects/user-config.ts @@ -11,7 +11,14 @@ import 'rxjs/add/operator/withLatestFrom'; import 'rxjs/add/operator/mergeMap'; import 'rxjs/add/observable/of'; -import { LogService, NotificationType } from 'uhk-common'; +import { + ConfigurationReply, + HardwareConfiguration, + LogService, + NotificationType, + UhkBuffer, + UserConfiguration +} from 'uhk-common'; import { ActionTypes, @@ -20,21 +27,42 @@ import { SaveUserConfigSuccessAction } from '../actions/user-config'; -import { UserConfiguration } from '../../config-serializer/config-items/user-configuration'; import { DataStorageRepositoryService } from '../../services/datastorage-repository.service'; import { DefaultUserConfigurationService } from '../../services/default-user-configuration.service'; import { AppState, getPrevUserConfiguration, getUserConfiguration } from '../index'; import { KeymapActions } from '../actions/keymap'; import { MacroActions } from '../actions/macro'; import { UndoUserConfigData } from '../../models/undo-user-config-data'; -import { ShowNotificationAction, DismissUndoNotificationAction } from '../actions/app'; +import { ShowNotificationAction, DismissUndoNotificationAction, LoadHardwareConfigurationSuccessAction } from '../actions/app'; import { ShowSaveToKeyboardButtonAction } from '../actions/device'; import { DeviceRendererService } from '../../services/device-renderer.service'; -import { UhkBuffer } from '../../config-serializer/uhk-buffer'; @Injectable() export class UserConfigEffects { + private static getUserConfigFromDeviceResponse(json: string): UserConfiguration { + const data = JSON.parse(json); + const userConfig = new UserConfiguration(); + userConfig.fromBinary(UhkBuffer.fromArray(data)); + + if (userConfig.dataModelVersion > 0) { + return userConfig; + } + + return null; + } + + private static getHardwareConfigFromDeviceResponse(json: string): HardwareConfiguration { + const data = JSON.parse(json); + const hardwareConfig = new HardwareConfiguration(); + hardwareConfig.fromBinary(UhkBuffer.fromArray(data)); + + if (hardwareConfig.uuid > 0) { + return hardwareConfig; + } + return null; + } + @Effect() loadUserConfig$: Observable = this.actions$ .ofType(ActionTypes.LOAD_USER_CONFIG) .startWith(new LoadUserConfigAction()) @@ -88,38 +116,36 @@ export class UserConfigEffects { return [new LoadUserConfigSuccessAction(config), go(payload.path)]; }); - @Effect({dispatch: false}) loadUserConfigFromDevice$ = this.actions$ - .ofType(ActionTypes.LOAD_USER_CONFIG_FROM_DEVICE) - .do(() => this.deviceRendererService.loadUserConfiguration()); + @Effect({dispatch: false}) loadConfigFromDevice$ = this.actions$ + .ofType(ActionTypes.LOAD_CONFIG_FROM_DEVICE) + .do(() => this.deviceRendererService.loadConfigurationFromKeyboard()); - @Effect() loadUserConfigFromDeviceReply$ = this.actions$ - .ofType(ActionTypes.LOAD_USER_CONFIG_FROM_DEVICE_REPLY) - .map(action => action.payload) - .switchMap((data: Array) => { - try { - let userConfig; - if (data.length > 0) { - const uhkBuffer = new UhkBuffer(); - let hasNonZeroValue = false; - for (const num of data) { - if (num > 0) { - hasNonZeroValue = true; - } - uhkBuffer.writeUInt8(num); - } - uhkBuffer.offset = 0; - userConfig = new UserConfiguration(); - userConfig.fromBinary(uhkBuffer); - - if (hasNonZeroValue) { - return Observable.of(new LoadUserConfigSuccessAction(userConfig)); - } - } - } catch (err) { - this.logService.error('Eeprom parse error:', err); + @Effect() loadConfigFromDeviceReply$ = this.actions$ + .ofType(ActionTypes.LOAD_CONFIG_FROM_DEVICE_REPLY) + .map(toPayload) + .mergeMap((data: ConfigurationReply): any => { + if (!data.success) { + return [new ShowNotificationAction({ + type: NotificationType.Error, + message: data.error + })]; } - return Observable.empty(); + try { + const userConfig = UserConfigEffects.getUserConfigFromDeviceResponse(data.userConfiguration); + const hardwareConfig = UserConfigEffects.getHardwareConfigFromDeviceResponse(data.hardwareConfiguration); + + return [ + new LoadUserConfigSuccessAction(userConfig), + new LoadHardwareConfigurationSuccessAction(hardwareConfig) + ]; + } catch (err) { + this.logService.error('Eeprom parse error:', err); + return [new ShowNotificationAction({ + type: NotificationType.Error, + message: err.message + })]; + } }); constructor(private actions$: Actions, @@ -147,4 +173,5 @@ export class UserConfigEffects { return config; } + } diff --git a/packages/uhk-web/src/app/store/index.ts b/packages/uhk-web/src/app/store/index.ts index cbcc77a4..a078c3e4 100644 --- a/packages/uhk-web/src/app/store/index.ts +++ b/packages/uhk-web/src/app/store/index.ts @@ -3,11 +3,10 @@ import { compose } from '@ngrx/core/compose'; import { ActionReducer, combineReducers } from '@ngrx/store'; import { RouterState, routerReducer } from '@ngrx/router-store'; import { storeFreeze } from 'ngrx-store-freeze'; +import { Keymap, UserConfiguration } from 'uhk-common'; import userConfigurationReducer from './reducers/user-configuration'; import presetReducer from './reducers/preset'; -import { Keymap } from '../config-serializer/config-items/keymap'; -import { UserConfiguration } from '../config-serializer/config-items/user-configuration'; import * as fromAppUpdate from './reducers/app-update.reducer'; import * as autoUpdateSettings from './reducers/auto-update-settings'; import * as fromApp from './reducers/app.reducer'; @@ -53,6 +52,8 @@ export const showAddonMenu = createSelector(appState, fromApp.showAddonMenu); export const getUndoableNotification = createSelector(appState, fromApp.getUndoableNotification); export const getPrevUserConfiguration = createSelector(appState, fromApp.getPrevUserConfiguration); export const runningInElectron = createSelector(appState, fromApp.runningInElectron); +export const getHardwareConfiguration = createSelector(appState, fromApp.getHardwareConfiguration); +export const getKeyboardLayout = createSelector(appState, fromApp.getKeyboardLayout); export const appUpdateState = (state: AppState) => state.appUpdate; export const getShowAppUpdateAvailable = createSelector(appUpdateState, fromAppUpdate.getShowAppUpdateAvailable); diff --git a/packages/uhk-web/src/app/store/reducers/app.reducer.ts b/packages/uhk-web/src/app/store/reducers/app.reducer.ts index bf148559..5bf22933 100644 --- a/packages/uhk-web/src/app/store/reducers/app.reducer.ts +++ b/packages/uhk-web/src/app/store/reducers/app.reducer.ts @@ -1,10 +1,10 @@ import { routerActions } from '@ngrx/router-store'; import { Action } from '@ngrx/store'; -import { runInElectron, Notification, NotificationType } from 'uhk-common'; +import { HardwareConfiguration, runInElectron, Notification, NotificationType, UserConfiguration } from 'uhk-common'; import { ActionTypes, ShowNotificationAction } from '../actions/app'; import { ActionTypes as UserConfigActionTypes } from '../actions/user-config'; -import { UserConfiguration } from '../../config-serializer/config-items/user-configuration'; +import { KeyboardLayout } from '../../keyboard/keyboard-layout.enum'; export interface State { started: boolean; @@ -13,7 +13,8 @@ export interface State { navigationCountAfterNotification: number; prevUserConfig?: UserConfiguration; runningInElectron: boolean; - userConfigLoading: boolean; + configLoading: boolean; + hardwareConfig?: HardwareConfiguration; } const initialState: State = { @@ -21,7 +22,7 @@ const initialState: State = { showAddonMenu: false, navigationCountAfterNotification: 0, runningInElectron: runInElectron(), - userConfigLoading: true + configLoading: true }; export function reducer(state = initialState, action: Action) { @@ -56,7 +57,7 @@ export function reducer(state = initialState, action: Action) { // When deleted a keymap or macro the app automaticaly navigate to other keymap, or macro, so // so we have to count the navigations and when reach the 2nd then remove the dialog. case routerActions.UPDATE_LOCATION: { - const newState = { ...state }; + const newState = {...state}; newState.navigationCountAfterNotification++; if (newState.navigationCountAfterNotification > 1) { @@ -79,18 +80,24 @@ export function reducer(state = initialState, action: Action) { return { ...state, prevUserConfig: action.payload, - userConfigLoading: false + configLoading: false }; } - case UserConfigActionTypes.LOAD_USER_CONFIG_FROM_DEVICE: + case UserConfigActionTypes.LOAD_CONFIG_FROM_DEVICE: case UserConfigActionTypes.LOAD_USER_CONFIG: { return { ...state, - userConfigLoading: true + configLoading: true }; } + case ActionTypes.LOAD_HARDWARE_CONFIGURATION_SUCCESS: + return { + ...state, + hardwareConfig: action.payload + }; + default: return state; } @@ -100,3 +107,11 @@ export const showAddonMenu = (state: State) => state.showAddonMenu; export const getUndoableNotification = (state: State) => state.undoableNotification; export const getPrevUserConfiguration = (state: State) => state.prevUserConfig; export const runningInElectron = (state: State) => state.runningInElectron; +export const getHardwareConfiguration = (state: State) => state.hardwareConfig; +export const getKeyboardLayout = (state: State): KeyboardLayout => { + if (state.hardwareConfig && state.hardwareConfig.isIso) { + return KeyboardLayout.ISO; + } + + return KeyboardLayout.ANSI; +}; diff --git a/packages/uhk-web/src/app/store/reducers/preset.ts b/packages/uhk-web/src/app/store/reducers/preset.ts index fdbc95dd..f9ab7f7a 100644 --- a/packages/uhk-web/src/app/store/reducers/preset.ts +++ b/packages/uhk-web/src/app/store/reducers/preset.ts @@ -1,6 +1,6 @@ import { Action } from '@ngrx/store'; +import { Keymap } from 'uhk-common'; -import { Keymap } from '../../config-serializer/config-items/keymap'; import { KeymapActions } from '../actions/keymap'; const initialState: Keymap[] = []; diff --git a/packages/uhk-web/src/app/store/reducers/user-configuration.ts b/packages/uhk-web/src/app/store/reducers/user-configuration.ts index 1ab3c121..2249f773 100644 --- a/packages/uhk-web/src/app/store/reducers/user-configuration.ts +++ b/packages/uhk-web/src/app/store/reducers/user-configuration.ts @@ -5,12 +5,7 @@ import { Observable } from 'rxjs/Observable'; import 'rxjs/add/observable/of'; import 'rxjs/add/operator/map'; -import { Helper as KeyActionHelper } from '../../config-serializer/config-items/key-action'; -import { Keymap } from '../../config-serializer/config-items/keymap'; -import { Macro } from '../../config-serializer/config-items/macro'; -import { UserConfiguration } from '../../config-serializer/config-items/user-configuration'; -import { Layer } from '../../config-serializer/config-items/layer'; -import { Module } from '../../config-serializer/config-items/module'; +import { Keymap, KeyActionHelper, Layer, Macro, Module, UserConfiguration } from 'uhk-common'; import { KeymapActions, MacroActions } from '../actions'; import { AppState } from '../index'; import { ActionTypes } from '../actions/user-config'; diff --git a/packages/uhk-web/src/renderer/services/electron-datastorage-repository.service.ts b/packages/uhk-web/src/renderer/services/electron-datastorage-repository.service.ts index 96043dff..f2b5a440 100644 --- a/packages/uhk-web/src/renderer/services/electron-datastorage-repository.service.ts +++ b/packages/uhk-web/src/renderer/services/electron-datastorage-repository.service.ts @@ -1,6 +1,6 @@ import * as storage from 'electron-settings'; -import { UserConfiguration } from '../../app/config-serializer/config-items/user-configuration'; +import { UserConfiguration } from 'uhk-common'; import { DataStorageRepositoryService } from '../../app/services/datastorage-repository.service'; import { AutoUpdateSettings } from '../../app/models/auto-update-settings'; diff --git a/packages/uhk-web/src/renderer/services/electron-log.service.ts b/packages/uhk-web/src/renderer/services/electron-log.service.ts index bd2411f0..85f78215 100644 --- a/packages/uhk-web/src/renderer/services/electron-log.service.ts +++ b/packages/uhk-web/src/renderer/services/electron-log.service.ts @@ -1,25 +1,19 @@ import { Injectable } from '@angular/core'; import * as log from 'electron-log'; import * as util from 'util'; - -import { LogService } from 'uhk-common'; - -const transferRegExp = /USB\[T]:/; -const writeRegExp = /USB\[W]:/; -const readRegExp = /USB\[R]: 00/; -const errorRegExp = /(?:(USB\[R]: ([^0]|0[^0])))/; +import { LogService, LogRegExps } from 'uhk-common'; // https://github.com/megahertz/electron-log/issues/44 // console.debug starting with Chromium 58 this method is a no-op on Chromium browsers. if (console.debug) { console.debug = (...args: any[]): void => { - if (writeRegExp.test(args[0])) { + if (LogRegExps.writeRegExp.test(args[0])) { console.log('%c' + args[0], 'color:blue'); - } else if (readRegExp.test(args[0])) { + } else if (LogRegExps.readRegExp.test(args[0])) { console.log('%c' + args[0], 'color:green'); - } else if (errorRegExp.test(args[0])) { + } else if (LogRegExps.errorRegExp.test(args[0])) { console.log('%c' + args[0], 'color:red'); - }else if (transferRegExp.test(args[0])) { + }else if (LogRegExps.transferRegExp.test(args[0])) { console.log('%c' + args[0], 'color:orange'); } else { console.log(...args); diff --git a/packages/uhk-web/src/renderer/services/uhk-device-provider.ts b/packages/uhk-web/src/renderer/services/uhk-device-provider.ts deleted file mode 100644 index a3aa93e5..00000000 --- a/packages/uhk-web/src/renderer/services/uhk-device-provider.ts +++ /dev/null @@ -1,17 +0,0 @@ -import { LogService } from 'uhk-common'; -import { UhkDeviceService } from './uhk-device.service'; -import { UhkHidApiService } from './uhk-hid-api.service'; - -export function uhkDeviceFactory(logService: LogService): UhkDeviceService { - // HID API officially support MAC, WIN and linux x64 platform - // https://github.com/node-hid/node-hid#platform-support - if (process.platform === 'darwin' || - process.platform === 'win32' || - (process.platform === 'linux' && process.arch === 'x64')) { - return new UhkHidApiService(logService); - } - - // On other platform use libUsb, but we try to test on all platform - // return new UhkLibUsbApiService(logService); - return new UhkHidApiService(logService); -} diff --git a/packages/uhk-web/src/renderer/services/uhk-device.service.ts b/packages/uhk-web/src/renderer/services/uhk-device.service.ts deleted file mode 100644 index 2fd501ab..00000000 --- a/packages/uhk-web/src/renderer/services/uhk-device.service.ts +++ /dev/null @@ -1,106 +0,0 @@ -import { OnDestroy } from '@angular/core'; -import { Observable } from 'rxjs/Observable'; -import { Subject } from 'rxjs/Subject'; -import { Observer } from 'rxjs/Observer'; -import { Subscriber } from 'rxjs/Subscriber'; -import { BehaviorSubject } from 'rxjs/BehaviorSubject'; -import { Subscription } from 'rxjs/Subscription'; - -import { Constants, LogService } from 'uhk-common'; -import { SenderMessage } from '../models/sender-message'; - -enum Command { - UploadConfig = 8, - ApplyConfig = 9 -} - -export abstract class UhkDeviceService implements OnDestroy { - protected connected$: BehaviorSubject; - protected initialized$: BehaviorSubject; - protected deviceOpened$: BehaviorSubject; - protected outSubscription: Subscription; - - protected messageIn$: Observable; - protected messageOut$: Subject; - - constructor(protected logService: LogService) { - this.messageOut$ = new Subject(); - this.initialized$ = new BehaviorSubject(false); - this.connected$ = new BehaviorSubject(false); - this.deviceOpened$ = new BehaviorSubject(false); - this.outSubscription = Subscription.EMPTY; - } - - ngOnDestroy() { - this.disconnect(); - this.initialized$.unsubscribe(); - this.connected$.unsubscribe(); - this.deviceOpened$.unsubscribe(); - } - - sendConfig(configBuffer: Buffer): Observable { - return Observable.create((subscriber: Subscriber) => { - this.logService.info('Sending...', configBuffer); - const fragments: Buffer[] = []; - const MAX_SENDING_PAYLOAD_SIZE = Constants.MAX_PAYLOAD_SIZE - 4; - for (let offset = 0; offset < configBuffer.length; offset += MAX_SENDING_PAYLOAD_SIZE) { - const length = offset + MAX_SENDING_PAYLOAD_SIZE < configBuffer.length - ? MAX_SENDING_PAYLOAD_SIZE - : configBuffer.length - offset; - const header = new Buffer([Command.UploadConfig, length, offset & 0xFF, offset >> 8]); - fragments.push(Buffer.concat([header, configBuffer.slice(offset, offset + length)])); - } - - const buffers: Buffer[] = []; - const observer: Observer = { - next: (buffer: Buffer) => buffers.push(buffer), - error: error => subscriber.error(error), - complete: () => { - if (buffers.length === fragments.length) { - subscriber.next(Buffer.concat(buffers)); - subscriber.complete(); - this.logService.info('Sending finished'); - } - } - }; - - fragments - .map(fragment => ({ buffer: fragment, observer })) - .forEach(senderPackage => this.messageOut$.next(senderPackage)); - }); - } - - applyConfig(): Observable { - return Observable.create((subscriber: Subscriber) => { - this.logService.info('Applying configuration'); - this.messageOut$.next({ - buffer: new Buffer([Command.ApplyConfig]), - observer: subscriber - }); - }); - } - - isInitialized(): Observable { - return this.initialized$.asObservable(); - } - - isConnected(): Observable { - return this.connected$.asObservable(); - } - - isOpened(): Observable { - return this.deviceOpened$.asObservable(); - } - - disconnect() { - this.outSubscription.unsubscribe(); - this.messageIn$ = undefined; - this.initialized$.next(false); - this.deviceOpened$.next(false); - this.connected$.next(false); - } - - abstract initialize(): void; - - abstract hasPermissions(): Observable; -} diff --git a/packages/uhk-web/src/renderer/services/uhk-hid-api.service.ts b/packages/uhk-web/src/renderer/services/uhk-hid-api.service.ts deleted file mode 100644 index 734ee508..00000000 --- a/packages/uhk-web/src/renderer/services/uhk-hid-api.service.ts +++ /dev/null @@ -1,136 +0,0 @@ -import { Injectable, OnDestroy } from '@angular/core'; - -import { Observable } from 'rxjs/Observable'; -import { Subscriber } from 'rxjs/Subscriber'; -import { Device, devices, HID } from 'node-hid'; - -import 'rxjs/add/observable/empty'; -import 'rxjs/add/observable/interval'; -import 'rxjs/add/operator/catch'; -import 'rxjs/add/operator/concat'; -import 'rxjs/add/operator/combineLatest'; -import 'rxjs/add/operator/concatMap'; -import 'rxjs/add/operator/publish'; -import 'rxjs/add/operator/do'; -import 'rxjs/add/operator/startWith'; -import 'rxjs/add/operator/map'; - -import { Constants, LogService } from 'uhk-common'; -import { UhkDeviceService } from './uhk-device.service'; - -@Injectable() -export class UhkHidApiService extends UhkDeviceService implements OnDestroy { - private device: HID; - - constructor(protected logService: LogService) { - super(logService); - } - - ngOnDestroy() { - super.ngOnDestroy(); - } - - initialize(): void { - if (this.initialized$.getValue()) { - return; - } - - this.device = this.getDevice(); - if (!this.device) { - return; - } - - this.deviceOpened$.next(true); - - this.messageIn$ = Observable.create((subscriber: Subscriber) => { - this.logService.info('Try to read'); - this.device.read((error: any, data: any = []) => { - if (error) { - this.logService.error('reading error', error); - subscriber.error(error); - } else { - this.logService.info('read data', data); - subscriber.next(data); - subscriber.complete(); - } - }); - }); - - const outSending = this.messageOut$.concatMap(senderPackage => { - return (>Observable.create((subscriber: Subscriber) => { - this.logService.info('transfering', senderPackage.buffer); - const data = Array.prototype.slice.call(senderPackage.buffer, 0); - // if data start with 0 need to add additional leading zero because HID API remove it. - // https://github.com/node-hid/node-hid/issues/187 - if (data.length > 0 && data[0] === 0) { - data.unshift(0); - } - - // From HID API documentation: - // http://www.signal11.us/oss/hidapi/hidapi/doxygen/html/group__API.html#gad14ea48e440cf5066df87cc6488493af - // The first byte of data[] must contain the Report ID. - // For devices which only support a single report, this must be set to 0x0. - data.unshift(0); - - try { - this.device.write(data); - this.logService.info('transfering finished'); - subscriber.complete(); - } - catch (error) { - this.logService.error('transfering errored', error); - subscriber.error(error); - } - })).concat(this.messageIn$) - .do(buffer => senderPackage.observer.next(buffer) && senderPackage.observer.complete()) - .catch((error: string) => { - senderPackage.observer.error(error); - return Observable.empty(); - }); - }).publish(); - this.outSubscription = outSending.connect(); - - this.initialized$.next(true); - } - - hasPermissions(): Observable { - return this.isConnected() - .combineLatest(this.deviceOpened$) - .map((latest: boolean[]) => { - const connected = latest[0]; - const opened = latest[1]; - if (!connected) { - return false; - } else if (opened) { - return true; - } - return true; - }); - } - - /** - * Return the 0 interface of the keyboard. - * @returns {HID} - */ - getDevice(): HID { - try { - const devs = devices(); - this.logService.info('Available devices:', devs); - - const dev = devs.find((x: Device) => - x.vendorId === Constants.VENDOR_ID && - x.productId === Constants.PRODUCT_ID && - ((x.usagePage === 128 && x.usage === 129) || x.interface === 0)); - - const device = new HID(dev.path); - this.logService.info('Used device:', dev); - return device; - } - catch (err) { - this.logService.error('Can not create device:', err); - } - - return null; - } - -} diff --git a/packages/uhk-web/tsconfig.json b/packages/uhk-web/tsconfig.json index fb799a55..3a05947d 100644 --- a/packages/uhk-web/tsconfig.json +++ b/packages/uhk-web/tsconfig.json @@ -17,7 +17,8 @@ "es2016" ], "paths": { - "@angular/*": ["../node_modules/@angular/*"] + "@angular/*": ["../node_modules/@angular/*"], + "rxjs/*": ["../node_modules/rxjs/*"] } } } diff --git a/packages/usb/logger.js b/packages/usb/logger.js new file mode 100644 index 00000000..548ef8e5 --- /dev/null +++ b/packages/usb/logger.js @@ -0,0 +1,34 @@ +const {LogService, LogRegExps} = require('uhk-common'); +const chalk = require('chalk'); + +class Logger extends LogService { + error(...args) { + console.error(args); + } + + debug(...args) { + const msg = args.join(' '); + + if (LogRegExps.writeRegExp.test(msg)) { + console.log(chalk.blue(msg)); + } else if (LogRegExps.readRegExp.test(msg)) { + console.log(chalk.green(msg)); + } else if (LogRegExps.errorRegExp.test(msg)) { + console.log(chalk.red(msg)); + }else if (LogRegExps.transferRegExp.test(msg)) { + console.log(chalk.yellow(msg)); + } else { + console.log(...args); + } + } + + silly(...args) { + console.log(args); + } + + info(...args) { + console.info(args); + } +} + +module.exports = Logger; diff --git a/packages/usb/package-lock.json b/packages/usb/package-lock.json index 21f64ad5..5ba5b031 100644 --- a/packages/usb/package-lock.json +++ b/packages/usb/package-lock.json @@ -1,468 +1,55 @@ { - "requires": true, + "name": "agent-usb", + "version": "1.0.0", "lockfileVersion": 1, + "requires": true, "dependencies": { - "abbrev": { - "version": "1.1.0", - "resolved": "https://registry.npmjs.org/abbrev/-/abbrev-1.1.0.tgz", - "integrity": "sha1-0FVMIlZjbi9W58LlrRg/hZQo2B8=" + "@types/node": { + "version": "8.0.28", + "resolved": "https://registry.npmjs.org/@types/node/-/node-8.0.28.tgz", + "integrity": "sha512-HupkFXEv3O3KSzcr3Ylfajg0kaerBg1DyaZzRBBQfrU3NN1mTBRE7sCveqHwXLS5Yrjvww8qFzkzYQQakG9FuQ==", + "dev": true }, - "ajv": { - "version": "4.11.8", - "resolved": "https://registry.npmjs.org/ajv/-/ajv-4.11.8.tgz", - "integrity": "sha1-gv+wKynmYq5TvcIK8VlHcGc5xTY=", + "ansi-styles": { + "version": "3.2.0", + "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-3.2.0.tgz", + "integrity": "sha512-NnSOmMEYtVR2JVMIGTzynRkkaxtiq1xnFBcdQD/DnNCYPoEPsVJhM98BDyaoNOQIi7p4okdi3E27eN7GQbsUug==", "requires": { - "co": "4.6.0", - "json-stable-stringify": "1.0.1" + "color-convert": "1.9.0" } }, - "ansi-regex": { - "version": "2.1.1", - "resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-2.1.1.tgz", - "integrity": "sha1-w7M6te42DYbg5ijwRorn7yfWVN8=" - }, - "aproba": { - "version": "1.1.2", - "resolved": "https://registry.npmjs.org/aproba/-/aproba-1.1.2.tgz", - "integrity": "sha512-ZpYajIfO0j2cOFTO955KUMIKNmj6zhX8kVztMAxFsDaMwz+9Z9SV0uou2pC9HJqcfpffOsjnbrDMvkNy+9RXPw==" - }, - "are-we-there-yet": { - "version": "1.1.4", - "resolved": "https://registry.npmjs.org/are-we-there-yet/-/are-we-there-yet-1.1.4.tgz", - "integrity": "sha1-u13KOCu5TwXhUZQ3PRb9O6HKEQ0=", + "chalk": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/chalk/-/chalk-2.1.0.tgz", + "integrity": "sha512-LUHGS/dge4ujbXMJrnihYMcL4AoOweGnw9Tp3kQuqy1Kx5c1qKjqvMJZ6nVJPMWJtKCTN72ZogH3oeSO9g9rXQ==", "requires": { - "delegates": "1.0.0", - "readable-stream": "2.3.3" + "ansi-styles": "3.2.0", + "escape-string-regexp": "1.0.5", + "supports-color": "4.4.0" } }, - "asn1": { - "version": "0.2.3", - "resolved": "https://registry.npmjs.org/asn1/-/asn1-0.2.3.tgz", - "integrity": "sha1-2sh4dxPJlmhJ/IGAd36+nB3fO4Y=" - }, - "assert-plus": { - "version": "0.2.0", - "resolved": "https://registry.npmjs.org/assert-plus/-/assert-plus-0.2.0.tgz", - "integrity": "sha1-104bh+ev/A24qttwIfP+SBAasjQ=" - }, - "asynckit": { - "version": "0.4.0", - "resolved": "https://registry.npmjs.org/asynckit/-/asynckit-0.4.0.tgz", - "integrity": "sha1-x57Zf380y48robyXkLzDZkdLS3k=" - }, - "aws-sign2": { - "version": "0.6.0", - "resolved": "https://registry.npmjs.org/aws-sign2/-/aws-sign2-0.6.0.tgz", - "integrity": "sha1-FDQt0428yU0OW4fXY81jYSwOeU8=" - }, - "aws4": { - "version": "1.6.0", - "resolved": "https://registry.npmjs.org/aws4/-/aws4-1.6.0.tgz", - "integrity": "sha1-g+9cqGCysy5KDe7e6MdxudtXRx4=" - }, - "balanced-match": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/balanced-match/-/balanced-match-1.0.0.tgz", - "integrity": "sha1-ibTRmasr7kneFk6gK4nORi1xt2c=" - }, - "bcrypt-pbkdf": { - "version": "1.0.1", - "resolved": "https://registry.npmjs.org/bcrypt-pbkdf/-/bcrypt-pbkdf-1.0.1.tgz", - "integrity": "sha1-Y7xdy2EzG5K8Bf1SiVPDNGKgb40=", - "optional": true, + "color-convert": { + "version": "1.9.0", + "resolved": "https://registry.npmjs.org/color-convert/-/color-convert-1.9.0.tgz", + "integrity": "sha1-Gsz5fdc5uYO/mU1W/sj5WFNkG3o=", "requires": { - "tweetnacl": "0.14.5" + "color-name": "1.1.3" } }, - "block-stream": { - "version": "0.0.9", - "resolved": "https://registry.npmjs.org/block-stream/-/block-stream-0.0.9.tgz", - "integrity": "sha1-E+v+d4oDIFz+A3UUgeu0szAMEmo=", - "requires": { - "inherits": "2.0.3" - } + "color-name": { + "version": "1.1.3", + "resolved": "https://registry.npmjs.org/color-name/-/color-name-1.1.3.tgz", + "integrity": "sha1-p9BVi9icQveV3UIyj3QIMcpTvCU=" }, - "boom": { - "version": "2.10.1", - "resolved": "https://registry.npmjs.org/boom/-/boom-2.10.1.tgz", - "integrity": "sha1-OciRjO/1eZ+D+UkqhI9iWt0Mdm8=", - "requires": { - "hoek": "2.16.3" - } - }, - "brace-expansion": { - "version": "1.1.8", - "resolved": "https://registry.npmjs.org/brace-expansion/-/brace-expansion-1.1.8.tgz", - "integrity": "sha1-wHshHHyVLsH479Uad+8NHTmQopI=", - "requires": { - "balanced-match": "1.0.0", - "concat-map": "0.0.1" - } - }, - "caseless": { - "version": "0.12.0", - "resolved": "https://registry.npmjs.org/caseless/-/caseless-0.12.0.tgz", - "integrity": "sha1-G2gcIf+EAzyCZUMJBolCDRhxUdw=" - }, - "co": { - "version": "4.6.0", - "resolved": "https://registry.npmjs.org/co/-/co-4.6.0.tgz", - "integrity": "sha1-bqa989hTrlTMuOR7+gvz+QMfsYQ=" - }, - "code-point-at": { - "version": "1.1.0", - "resolved": "https://registry.npmjs.org/code-point-at/-/code-point-at-1.1.0.tgz", - "integrity": "sha1-DQcLTQQ6W+ozovGkDi7bPZpMz3c=" - }, - "combined-stream": { + "escape-string-regexp": { "version": "1.0.5", - "resolved": "https://registry.npmjs.org/combined-stream/-/combined-stream-1.0.5.tgz", - "integrity": "sha1-k4NwpXtKUd6ix3wV1cX9+JUWQAk=", - "requires": { - "delayed-stream": "1.0.0" - } + "resolved": "https://registry.npmjs.org/escape-string-regexp/-/escape-string-regexp-1.0.5.tgz", + "integrity": "sha1-G2HAViGQqN/2rjuyzwIAyhMLhtQ=" }, - "concat-map": { - "version": "0.0.1", - "resolved": "https://registry.npmjs.org/concat-map/-/concat-map-0.0.1.tgz", - "integrity": "sha1-2Klr13/Wjfd5OnMDajug1UBdR3s=" - }, - "console-control-strings": { - "version": "1.1.0", - "resolved": "https://registry.npmjs.org/console-control-strings/-/console-control-strings-1.1.0.tgz", - "integrity": "sha1-PXz0Rk22RG6mRL9LOVB/mFEAjo4=" - }, - "core-util-is": { - "version": "1.0.2", - "resolved": "https://registry.npmjs.org/core-util-is/-/core-util-is-1.0.2.tgz", - "integrity": "sha1-tf1UIgqivFq1eqtxQMlAdUUDwac=" - }, - "cryptiles": { - "version": "2.0.5", - "resolved": "https://registry.npmjs.org/cryptiles/-/cryptiles-2.0.5.tgz", - "integrity": "sha1-O9/s3GCBR8HGcgL6KR59ylnqo7g=", - "requires": { - "boom": "2.10.1" - } - }, - "dashdash": { - "version": "1.14.1", - "resolved": "https://registry.npmjs.org/dashdash/-/dashdash-1.14.1.tgz", - "integrity": "sha1-hTz6D3y+L+1d4gMmuN1YEDX24vA=", - "requires": { - "assert-plus": "1.0.0" - }, - "dependencies": { - "assert-plus": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/assert-plus/-/assert-plus-1.0.0.tgz", - "integrity": "sha1-8S4PPF13sLHN2RRpQuTpbB5N1SU=" - } - } - }, - "debug": { - "version": "2.6.8", - "resolved": "https://registry.npmjs.org/debug/-/debug-2.6.8.tgz", - "integrity": "sha1-5zFTHKLt4n0YgiJCfaF4IdaP9Pw=", - "requires": { - "ms": "2.0.0" - } - }, - "deep-extend": { - "version": "0.4.2", - "resolved": "https://registry.npmjs.org/deep-extend/-/deep-extend-0.4.2.tgz", - "integrity": "sha1-SLaZwn4zS/ifEIkr5DL25MfTSn8=" - }, - "delayed-stream": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/delayed-stream/-/delayed-stream-1.0.0.tgz", - "integrity": "sha1-3zrhmayt+31ECqrgsp4icrJOxhk=" - }, - "delegates": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/delegates/-/delegates-1.0.0.tgz", - "integrity": "sha1-hMbhWbgZBP3KWaDvRM2HDTElD5o=" - }, - "ecc-jsbn": { - "version": "0.1.1", - "resolved": "https://registry.npmjs.org/ecc-jsbn/-/ecc-jsbn-0.1.1.tgz", - "integrity": "sha1-D8c6ntXw1Tw4GTOYUj735UN3dQU=", - "optional": true, - "requires": { - "jsbn": "0.1.1" - } - }, - "extend": { - "version": "3.0.1", - "resolved": "https://registry.npmjs.org/extend/-/extend-3.0.1.tgz", - "integrity": "sha1-p1Xqe8Gt/MWjHOfnYtuq3F5jZEQ=" - }, - "extsprintf": { - "version": "1.3.0", - "resolved": "https://registry.npmjs.org/extsprintf/-/extsprintf-1.3.0.tgz", - "integrity": "sha1-lpGEQOMEGnpBT4xS48V06zw+HgU=" - }, - "forever-agent": { - "version": "0.6.1", - "resolved": "https://registry.npmjs.org/forever-agent/-/forever-agent-0.6.1.tgz", - "integrity": "sha1-+8cfDEGt6zf5bFd60e1C2P2sypE=" - }, - "form-data": { - "version": "2.1.4", - "resolved": "https://registry.npmjs.org/form-data/-/form-data-2.1.4.tgz", - "integrity": "sha1-M8GDrPGTJ27KqYFDpp6Uv+4XUNE=", - "requires": { - "asynckit": "0.4.0", - "combined-stream": "1.0.5", - "mime-types": "2.1.16" - } - }, - "fs.realpath": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/fs.realpath/-/fs.realpath-1.0.0.tgz", - "integrity": "sha1-FQStJSMVjKpA20onh8sBQRmU6k8=" - }, - "fstream": { - "version": "1.0.11", - "resolved": "https://registry.npmjs.org/fstream/-/fstream-1.0.11.tgz", - "integrity": "sha1-XB+x8RdHcRTwYyoOtLcbPLD9MXE=", - "requires": { - "graceful-fs": "4.1.11", - "inherits": "2.0.3", - "mkdirp": "0.5.1", - "rimraf": "2.6.1" - } - }, - "fstream-ignore": { - "version": "1.0.5", - "resolved": "https://registry.npmjs.org/fstream-ignore/-/fstream-ignore-1.0.5.tgz", - "integrity": "sha1-nDHa40dnAY/h0kmyTa2mfQktoQU=", - "requires": { - "fstream": "1.0.11", - "inherits": "2.0.3", - "minimatch": "3.0.4" - } - }, - "gauge": { - "version": "2.7.4", - "resolved": "https://registry.npmjs.org/gauge/-/gauge-2.7.4.tgz", - "integrity": "sha1-LANAXHU4w51+s3sxcCLjJfsBi/c=", - "requires": { - "aproba": "1.1.2", - "console-control-strings": "1.1.0", - "has-unicode": "2.0.1", - "object-assign": "4.1.1", - "signal-exit": "3.0.2", - "string-width": "1.0.2", - "strip-ansi": "3.0.1", - "wide-align": "1.1.2" - } - }, - "getpass": { - "version": "0.1.7", - "resolved": "https://registry.npmjs.org/getpass/-/getpass-0.1.7.tgz", - "integrity": "sha1-Xv+OPmhNVprkyysSgmBOi6YhSfo=", - "requires": { - "assert-plus": "1.0.0" - }, - "dependencies": { - "assert-plus": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/assert-plus/-/assert-plus-1.0.0.tgz", - "integrity": "sha1-8S4PPF13sLHN2RRpQuTpbB5N1SU=" - } - } - }, - "glob": { - "version": "7.1.2", - "resolved": "https://registry.npmjs.org/glob/-/glob-7.1.2.tgz", - "integrity": "sha512-MJTUg1kjuLeQCJ+ccE4Vpa6kKVXkPYJ2mOCQyUuKLcLQsdrMCpBPUi8qVE6+YuaJkozeA9NusTAw3hLr8Xe5EQ==", - "requires": { - "fs.realpath": "1.0.0", - "inflight": "1.0.6", - "inherits": "2.0.3", - "minimatch": "3.0.4", - "once": "1.4.0", - "path-is-absolute": "1.0.1" - } - }, - "graceful-fs": { - "version": "4.1.11", - "resolved": "https://registry.npmjs.org/graceful-fs/-/graceful-fs-4.1.11.tgz", - "integrity": "sha1-Dovf5NHduIVNZOBOp8AOKgJuVlg=" - }, - "har-schema": { - "version": "1.0.5", - "resolved": "https://registry.npmjs.org/har-schema/-/har-schema-1.0.5.tgz", - "integrity": "sha1-0mMTX0MwfALGAq/I/pWXDAFRNp4=" - }, - "har-validator": { - "version": "4.2.1", - "resolved": "https://registry.npmjs.org/har-validator/-/har-validator-4.2.1.tgz", - "integrity": "sha1-M0gdDxu/9gDdID11gSpqX7oALio=", - "requires": { - "ajv": "4.11.8", - "har-schema": "1.0.5" - } - }, - "has-unicode": { - "version": "2.0.1", - "resolved": "https://registry.npmjs.org/has-unicode/-/has-unicode-2.0.1.tgz", - "integrity": "sha1-4Ob+aijPUROIVeCG0Wkedx3iqLk=" - }, - "hawk": { - "version": "3.1.3", - "resolved": "https://registry.npmjs.org/hawk/-/hawk-3.1.3.tgz", - "integrity": "sha1-B4REvXwWQLD+VA0sm3PVlnjo4cQ=", - "requires": { - "boom": "2.10.1", - "cryptiles": "2.0.5", - "hoek": "2.16.3", - "sntp": "1.0.9" - } - }, - "hoek": { - "version": "2.16.3", - "resolved": "https://registry.npmjs.org/hoek/-/hoek-2.16.3.tgz", - "integrity": "sha1-ILt0A9POo5jpHcRxCo/xuCdKJe0=" - }, - "http-signature": { - "version": "1.1.1", - "resolved": "https://registry.npmjs.org/http-signature/-/http-signature-1.1.1.tgz", - "integrity": "sha1-33LiZwZs0Kxn+3at+OE0qPvPkb8=", - "requires": { - "assert-plus": "0.2.0", - "jsprim": "1.4.1", - "sshpk": "1.13.1" - } - }, - "inflight": { - "version": "1.0.6", - "resolved": "https://registry.npmjs.org/inflight/-/inflight-1.0.6.tgz", - "integrity": "sha1-Sb1jMdfQLQwJvJEKEHW6gWW1bfk=", - "requires": { - "once": "1.4.0", - "wrappy": "1.0.2" - } - }, - "inherits": { - "version": "2.0.3", - "resolved": "https://registry.npmjs.org/inherits/-/inherits-2.0.3.tgz", - "integrity": "sha1-Yzwsg+PaQqUC9SRmAiSA9CCCYd4=" - }, - "ini": { - "version": "1.3.4", - "resolved": "https://registry.npmjs.org/ini/-/ini-1.3.4.tgz", - "integrity": "sha1-BTfLedr1m1mhpRff9wbIbsA5Fi4=" - }, - "is-fullwidth-code-point": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/is-fullwidth-code-point/-/is-fullwidth-code-point-1.0.0.tgz", - "integrity": "sha1-754xOG8DGn8NZDr4L95QxFfvAMs=", - "requires": { - "number-is-nan": "1.0.1" - } - }, - "is-typedarray": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/is-typedarray/-/is-typedarray-1.0.0.tgz", - "integrity": "sha1-5HnICFjfDBsR3dppQPlgEfzaSpo=" - }, - "isarray": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/isarray/-/isarray-1.0.0.tgz", - "integrity": "sha1-u5NdSFgsuhaMBoNJV6VKPgcSTxE=" - }, - "isstream": { - "version": "0.1.2", - "resolved": "https://registry.npmjs.org/isstream/-/isstream-0.1.2.tgz", - "integrity": "sha1-R+Y/evVa+m+S4VAOaQ64uFKcCZo=" - }, - "jsbn": { - "version": "0.1.1", - "resolved": "https://registry.npmjs.org/jsbn/-/jsbn-0.1.1.tgz", - "integrity": "sha1-peZUwuWi3rXyAdls77yoDA7y9RM=", - "optional": true - }, - "json-schema": { - "version": "0.2.3", - "resolved": "https://registry.npmjs.org/json-schema/-/json-schema-0.2.3.tgz", - "integrity": "sha1-tIDIkuWaLwWVTOcnvT8qTogvnhM=" - }, - "json-stable-stringify": { - "version": "1.0.1", - "resolved": "https://registry.npmjs.org/json-stable-stringify/-/json-stable-stringify-1.0.1.tgz", - "integrity": "sha1-mnWdOcXy/1A/1TAGRu1EX4jE+a8=", - "requires": { - "jsonify": "0.0.0" - } - }, - "json-stringify-safe": { - "version": "5.0.1", - "resolved": "https://registry.npmjs.org/json-stringify-safe/-/json-stringify-safe-5.0.1.tgz", - "integrity": "sha1-Epai1Y/UXxmg9s4B1lcB4sc1tus=" - }, - "jsonify": { - "version": "0.0.0", - "resolved": "https://registry.npmjs.org/jsonify/-/jsonify-0.0.0.tgz", - "integrity": "sha1-LHS27kHZPKUbe1qu6PUDYx0lKnM=" - }, - "jsprim": { - "version": "1.4.1", - "resolved": "https://registry.npmjs.org/jsprim/-/jsprim-1.4.1.tgz", - "integrity": "sha1-MT5mvB5cwG5Di8G3SZwuXFastqI=", - "requires": { - "assert-plus": "1.0.0", - "extsprintf": "1.3.0", - "json-schema": "0.2.3", - "verror": "1.10.0" - }, - "dependencies": { - "assert-plus": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/assert-plus/-/assert-plus-1.0.0.tgz", - "integrity": "sha1-8S4PPF13sLHN2RRpQuTpbB5N1SU=" - } - } - }, - "mime-db": { - "version": "1.29.0", - "resolved": "https://registry.npmjs.org/mime-db/-/mime-db-1.29.0.tgz", - "integrity": "sha1-SNJtI1WJZRcErFkWygYAGRQmaHg=" - }, - "mime-types": { - "version": "2.1.16", - "resolved": "https://registry.npmjs.org/mime-types/-/mime-types-2.1.16.tgz", - "integrity": "sha1-K4WKUuXs1RbbiXrCvodIeDBpjiM=", - "requires": { - "mime-db": "1.29.0" - } - }, - "minimatch": { - "version": "3.0.4", - "resolved": "https://registry.npmjs.org/minimatch/-/minimatch-3.0.4.tgz", - "integrity": "sha512-yJHVQEhyqPLUTgt9B83PXu6W3rx4MvvHvSUvToogpwoGDOUQ+yDrR0HRot+yOCdCO7u4hX3pWft6kWBBcqh0UA==", - "requires": { - "brace-expansion": "1.1.8" - } - }, - "minimist": { - "version": "0.0.8", - "resolved": "https://registry.npmjs.org/minimist/-/minimist-0.0.8.tgz", - "integrity": "sha1-hX/Kv8M5fSYluCKCYuhqp6ARsF0=" - }, - "mkdirp": { - "version": "0.5.1", - "resolved": "https://registry.npmjs.org/mkdirp/-/mkdirp-0.5.1.tgz", - "integrity": "sha1-MAV0OOrGz3+MR2fzhkjWaX11yQM=", - "requires": { - "minimist": "0.0.8" - } - }, - "ms": { + "has-flag": { "version": "2.0.0", - "resolved": "https://registry.npmjs.org/ms/-/ms-2.0.0.tgz", - "integrity": "sha1-VgiurfwAvmwpAd9fmGF4jeDVl8g=" + "resolved": "https://registry.npmjs.org/has-flag/-/has-flag-2.0.0.tgz", + "integrity": "sha1-6CB68cx7MNRGzHC3NLXovhj4jVE=" }, "nan": { "version": "2.6.2", @@ -1234,381 +821,13 @@ } } }, - "node-pre-gyp": { - "version": "0.6.36", - "resolved": "https://registry.npmjs.org/node-pre-gyp/-/node-pre-gyp-0.6.36.tgz", - "integrity": "sha1-22BBEst04NR3VU6bUFsXq936t4Y=", + "supports-color": { + "version": "4.4.0", + "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-4.4.0.tgz", + "integrity": "sha512-rKC3+DyXWgK0ZLKwmRsrkyHVZAjNkfzeehuFWdGGcqGDTZFH73+RH6S/RDAAxl9GusSjZSUWYLmT9N5pzXFOXQ==", "requires": { - "mkdirp": "0.5.1", - "nopt": "4.0.1", - "npmlog": "4.1.2", - "rc": "1.2.1", - "request": "2.81.0", - "rimraf": "2.6.1", - "semver": "5.4.1", - "tar": "2.2.1", - "tar-pack": "3.4.0" + "has-flag": "2.0.0" } - }, - "nopt": { - "version": "4.0.1", - "resolved": "https://registry.npmjs.org/nopt/-/nopt-4.0.1.tgz", - "integrity": "sha1-0NRoWv1UFRk8jHUFYC0NF81kR00=", - "requires": { - "abbrev": "1.1.0", - "osenv": "0.1.4" - } - }, - "npmlog": { - "version": "4.1.2", - "resolved": "https://registry.npmjs.org/npmlog/-/npmlog-4.1.2.tgz", - "integrity": "sha512-2uUqazuKlTaSI/dC8AzicUck7+IrEaOnN/e0jd3Xtt1KcGpwx30v50mL7oPyr/h9bL3E4aZccVwpwP+5W9Vjkg==", - "requires": { - "are-we-there-yet": "1.1.4", - "console-control-strings": "1.1.0", - "gauge": "2.7.4", - "set-blocking": "2.0.0" - } - }, - "number-is-nan": { - "version": "1.0.1", - "resolved": "https://registry.npmjs.org/number-is-nan/-/number-is-nan-1.0.1.tgz", - "integrity": "sha1-CXtgK1NCKlIsGvuHkDGDNpQaAR0=" - }, - "oauth-sign": { - "version": "0.8.2", - "resolved": "https://registry.npmjs.org/oauth-sign/-/oauth-sign-0.8.2.tgz", - "integrity": "sha1-Rqarfwrq2N6unsBWV4C31O/rnUM=" - }, - "object-assign": { - "version": "4.1.1", - "resolved": "https://registry.npmjs.org/object-assign/-/object-assign-4.1.1.tgz", - "integrity": "sha1-IQmtx5ZYh8/AXLvUQsrIv7s2CGM=" - }, - "once": { - "version": "1.4.0", - "resolved": "https://registry.npmjs.org/once/-/once-1.4.0.tgz", - "integrity": "sha1-WDsap3WWHUsROsF9nFC6753Xa9E=", - "requires": { - "wrappy": "1.0.2" - } - }, - "os-homedir": { - "version": "1.0.2", - "resolved": "https://registry.npmjs.org/os-homedir/-/os-homedir-1.0.2.tgz", - "integrity": "sha1-/7xJiDNuDoM94MFox+8VISGqf7M=" - }, - "os-tmpdir": { - "version": "1.0.2", - "resolved": "https://registry.npmjs.org/os-tmpdir/-/os-tmpdir-1.0.2.tgz", - "integrity": "sha1-u+Z0BseaqFxc/sdm/lc0VV36EnQ=" - }, - "osenv": { - "version": "0.1.4", - "resolved": "https://registry.npmjs.org/osenv/-/osenv-0.1.4.tgz", - "integrity": "sha1-Qv5tWVPfBsgGS+bxdsPQWqqjRkQ=", - "requires": { - "os-homedir": "1.0.2", - "os-tmpdir": "1.0.2" - } - }, - "path-is-absolute": { - "version": "1.0.1", - "resolved": "https://registry.npmjs.org/path-is-absolute/-/path-is-absolute-1.0.1.tgz", - "integrity": "sha1-F0uSaHNVNP+8es5r9TpanhtcX18=" - }, - "performance-now": { - "version": "0.2.0", - "resolved": "https://registry.npmjs.org/performance-now/-/performance-now-0.2.0.tgz", - "integrity": "sha1-M+8wxcd9TqIcWlOGnZG1bY8lVeU=" - }, - "process-nextick-args": { - "version": "1.0.7", - "resolved": "https://registry.npmjs.org/process-nextick-args/-/process-nextick-args-1.0.7.tgz", - "integrity": "sha1-FQ4gt1ZZCtP5EJPyWk8q2L/zC6M=" - }, - "punycode": { - "version": "1.4.1", - "resolved": "https://registry.npmjs.org/punycode/-/punycode-1.4.1.tgz", - "integrity": "sha1-wNWmOycYgArY4esPpSachN1BhF4=" - }, - "qs": { - "version": "6.4.0", - "resolved": "https://registry.npmjs.org/qs/-/qs-6.4.0.tgz", - "integrity": "sha1-E+JtKK1rD/qpExLNO/cI7TUecjM=" - }, - "ramda": { - "version": "0.22.1", - "resolved": "https://registry.npmjs.org/ramda/-/ramda-0.22.1.tgz", - "integrity": "sha1-Ax2gw99BfFszyWI0dX6zcDPzag4=" - }, - "rc": { - "version": "1.2.1", - "resolved": "https://registry.npmjs.org/rc/-/rc-1.2.1.tgz", - "integrity": "sha1-LgPo5C7kULjLPc5lvhv4l04d/ZU=", - "requires": { - "deep-extend": "0.4.2", - "ini": "1.3.4", - "minimist": "1.2.0", - "strip-json-comments": "2.0.1" - }, - "dependencies": { - "minimist": { - "version": "1.2.0", - "resolved": "https://registry.npmjs.org/minimist/-/minimist-1.2.0.tgz", - "integrity": "sha1-o1AIsg9BOD7sH7kU9M1d95omQoQ=" - } - } - }, - "readable-stream": { - "version": "2.3.3", - "resolved": "https://registry.npmjs.org/readable-stream/-/readable-stream-2.3.3.tgz", - "integrity": "sha512-m+qzzcn7KUxEmd1gMbchF+Y2eIUbieUaxkWtptyHywrX0rE8QEYqPC07Vuy4Wm32/xE16NcdBctb8S0Xe/5IeQ==", - "requires": { - "core-util-is": "1.0.2", - "inherits": "2.0.3", - "isarray": "1.0.0", - "process-nextick-args": "1.0.7", - "safe-buffer": "5.1.1", - "string_decoder": "1.0.3", - "util-deprecate": "1.0.2" - } - }, - "request": { - "version": "2.81.0", - "resolved": "https://registry.npmjs.org/request/-/request-2.81.0.tgz", - "integrity": "sha1-xpKJRqDgbF+Nb4qTM0af/aRimKA=", - "requires": { - "aws-sign2": "0.6.0", - "aws4": "1.6.0", - "caseless": "0.12.0", - "combined-stream": "1.0.5", - "extend": "3.0.1", - "forever-agent": "0.6.1", - "form-data": "2.1.4", - "har-validator": "4.2.1", - "hawk": "3.1.3", - "http-signature": "1.1.1", - "is-typedarray": "1.0.0", - "isstream": "0.1.2", - "json-stringify-safe": "5.0.1", - "mime-types": "2.1.16", - "oauth-sign": "0.8.2", - "performance-now": "0.2.0", - "qs": "6.4.0", - "safe-buffer": "5.1.1", - "stringstream": "0.0.5", - "tough-cookie": "2.3.2", - "tunnel-agent": "0.6.0", - "uuid": "3.1.0" - } - }, - "rimraf": { - "version": "2.6.1", - "resolved": "https://registry.npmjs.org/rimraf/-/rimraf-2.6.1.tgz", - "integrity": "sha1-wjOOxkPfeht/5cVPqG9XQopV8z0=", - "requires": { - "glob": "7.1.2" - } - }, - "safe-buffer": { - "version": "5.1.1", - "resolved": "https://registry.npmjs.org/safe-buffer/-/safe-buffer-5.1.1.tgz", - "integrity": "sha512-kKvNJn6Mm93gAczWVJg7wH+wGYWNrDHdWvpUmHyEsgCtIwwo3bqPtV4tR5tuPaUhTOo/kvhVwd8XwwOllGYkbg==" - }, - "semver": { - "version": "5.4.1", - "resolved": "https://registry.npmjs.org/semver/-/semver-5.4.1.tgz", - "integrity": "sha512-WfG/X9+oATh81XtllIo/I8gOiY9EXRdv1cQdyykeXK17YcUW3EXUAi2To4pcH6nZtJPr7ZOpM5OMyWJZm+8Rsg==" - }, - "set-blocking": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/set-blocking/-/set-blocking-2.0.0.tgz", - "integrity": "sha1-BF+XgtARrppoA93TgrJDkrPYkPc=" - }, - "signal-exit": { - "version": "3.0.2", - "resolved": "https://registry.npmjs.org/signal-exit/-/signal-exit-3.0.2.tgz", - "integrity": "sha1-tf3AjxKH6hF4Yo5BXiUTK3NkbG0=" - }, - "sntp": { - "version": "1.0.9", - "resolved": "https://registry.npmjs.org/sntp/-/sntp-1.0.9.tgz", - "integrity": "sha1-ZUEYTMkK7qbG57NeJlkIJEPGYZg=", - "requires": { - "hoek": "2.16.3" - } - }, - "sprintf-js": { - "version": "1.1.1", - "resolved": "https://registry.npmjs.org/sprintf-js/-/sprintf-js-1.1.1.tgz", - "integrity": "sha1-Nr54Mgr+WAH2zqPueLblqrlA6gw=" - }, - "sshpk": { - "version": "1.13.1", - "resolved": "https://registry.npmjs.org/sshpk/-/sshpk-1.13.1.tgz", - "integrity": "sha1-US322mKHFEMW3EwY/hzx2UBzm+M=", - "requires": { - "asn1": "0.2.3", - "assert-plus": "1.0.0", - "bcrypt-pbkdf": "1.0.1", - "dashdash": "1.14.1", - "ecc-jsbn": "0.1.1", - "getpass": "0.1.7", - "jsbn": "0.1.1", - "tweetnacl": "0.14.5" - }, - "dependencies": { - "assert-plus": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/assert-plus/-/assert-plus-1.0.0.tgz", - "integrity": "sha1-8S4PPF13sLHN2RRpQuTpbB5N1SU=" - } - } - }, - "string_decoder": { - "version": "1.0.3", - "resolved": "https://registry.npmjs.org/string_decoder/-/string_decoder-1.0.3.tgz", - "integrity": "sha512-4AH6Z5fzNNBcH+6XDMfA/BTt87skxqJlO0lAh3Dker5zThcAxG6mKz+iGu308UKoPPQ8Dcqx/4JhujzltRa+hQ==", - "requires": { - "safe-buffer": "5.1.1" - } - }, - "string-width": { - "version": "1.0.2", - "resolved": "https://registry.npmjs.org/string-width/-/string-width-1.0.2.tgz", - "integrity": "sha1-EYvfW4zcUaKn5w0hHgfisLmxB9M=", - "requires": { - "code-point-at": "1.1.0", - "is-fullwidth-code-point": "1.0.0", - "strip-ansi": "3.0.1" - } - }, - "stringstream": { - "version": "0.0.5", - "resolved": "https://registry.npmjs.org/stringstream/-/stringstream-0.0.5.tgz", - "integrity": "sha1-TkhM1N5aC7vuGORjB3EKioFiGHg=" - }, - "strip-ansi": { - "version": "3.0.1", - "resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-3.0.1.tgz", - "integrity": "sha1-ajhfuIU9lS1f8F0Oiq+UJ43GPc8=", - "requires": { - "ansi-regex": "2.1.1" - } - }, - "strip-json-comments": { - "version": "2.0.1", - "resolved": "https://registry.npmjs.org/strip-json-comments/-/strip-json-comments-2.0.1.tgz", - "integrity": "sha1-PFMZQukIwml8DsNEhYwobHygpgo=" - }, - "tar": { - "version": "2.2.1", - "resolved": "https://registry.npmjs.org/tar/-/tar-2.2.1.tgz", - "integrity": "sha1-jk0qJWwOIYXGsYrWlK7JaLg8sdE=", - "requires": { - "block-stream": "0.0.9", - "fstream": "1.0.11", - "inherits": "2.0.3" - } - }, - "tar-pack": { - "version": "3.4.0", - "resolved": "https://registry.npmjs.org/tar-pack/-/tar-pack-3.4.0.tgz", - "integrity": "sha1-I74tf2cagzk3bL2wuP4/3r8xeYQ=", - "requires": { - "debug": "2.6.8", - "fstream": "1.0.11", - "fstream-ignore": "1.0.5", - "once": "1.4.0", - "readable-stream": "2.3.3", - "rimraf": "2.6.1", - "tar": "2.2.1", - "uid-number": "0.0.6" - } - }, - "tough-cookie": { - "version": "2.3.2", - "resolved": "https://registry.npmjs.org/tough-cookie/-/tough-cookie-2.3.2.tgz", - "integrity": "sha1-8IH3bkyFcg5sN6X6ztc3FQ2EByo=", - "requires": { - "punycode": "1.4.1" - } - }, - "tunnel-agent": { - "version": "0.6.0", - "resolved": "https://registry.npmjs.org/tunnel-agent/-/tunnel-agent-0.6.0.tgz", - "integrity": "sha1-J6XeoGs2sEoKmWZ3SykIaPD8QP0=", - "requires": { - "safe-buffer": "5.1.1" - } - }, - "tweetnacl": { - "version": "0.14.5", - "resolved": "https://registry.npmjs.org/tweetnacl/-/tweetnacl-0.14.5.tgz", - "integrity": "sha1-WuaBd/GS1EViadEIr6k/+HQ/T2Q=", - "optional": true - }, - "uid-number": { - "version": "0.0.6", - "resolved": "https://registry.npmjs.org/uid-number/-/uid-number-0.0.6.tgz", - "integrity": "sha1-DqEOgDXo61uOREnwbaHHMGY7qoE=" - }, - "underscore.string": { - "version": "3.3.4", - "resolved": "https://registry.npmjs.org/underscore.string/-/underscore.string-3.3.4.tgz", - "integrity": "sha1-LCo/n4PmR2L9xF5s6sZRQoZCE9s=", - "requires": { - "sprintf-js": "1.1.1", - "util-deprecate": "1.0.2" - } - }, - "usb": { - "version": "git+https://github.com/tessel/node-usb.git#38cc9cc75759e74f3d3ee8c79ca852395c3529b0", - "requires": { - "nan": "2.6.2", - "node-pre-gyp": "0.6.36" - } - }, - "util-deprecate": { - "version": "1.0.2", - "resolved": "https://registry.npmjs.org/util-deprecate/-/util-deprecate-1.0.2.tgz", - "integrity": "sha1-RQ1Nyfpw3nMnYvvS1KKJgUGaDM8=" - }, - "uuid": { - "version": "3.1.0", - "resolved": "https://registry.npmjs.org/uuid/-/uuid-3.1.0.tgz", - "integrity": "sha512-DIWtzUkw04M4k3bf1IcpS2tngXEL26YUD2M0tMDUpnUrz2hgzUBlD55a4FjdLGPvfHxS6uluGWvaVEqgBcVa+g==" - }, - "verror": { - "version": "1.10.0", - "resolved": "https://registry.npmjs.org/verror/-/verror-1.10.0.tgz", - "integrity": "sha1-OhBcoXBTr1XW4nDB+CiGguGNpAA=", - "requires": { - "assert-plus": "1.0.0", - "core-util-is": "1.0.2", - "extsprintf": "1.3.0" - }, - "dependencies": { - "assert-plus": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/assert-plus/-/assert-plus-1.0.0.tgz", - "integrity": "sha1-8S4PPF13sLHN2RRpQuTpbB5N1SU=" - } - } - }, - "wide-align": { - "version": "1.1.2", - "resolved": "https://registry.npmjs.org/wide-align/-/wide-align-1.1.2.tgz", - "integrity": "sha512-ijDLlyQ7s6x1JgCLur53osjm/UXUYD9+0PbYKrBsYisYXzCxN+HC3mYDNy/dWdmf3AwqwU3CXwDCvsNgGK1S0w==", - "requires": { - "string-width": "1.0.2" - } - }, - "wrappy": { - "version": "1.0.2", - "resolved": "https://registry.npmjs.org/wrappy/-/wrappy-1.0.2.tgz", - "integrity": "sha1-tSQ9jz7BqjXxNkYFvA0QNuMKtp8=" } } } diff --git a/packages/usb/package.json b/packages/usb/package.json index 0670f06b..2dfb6122 100644 --- a/packages/usb/package.json +++ b/packages/usb/package.json @@ -4,7 +4,16 @@ "description": "Agent preliminary USB code", "main": "UhkConnection.js", "license": "GPL-3.0", + "scripts": { + "build": "tsc" + }, + "devDependencies": { + "@types/node": "8.0.28" + }, "dependencies": { - "node-hid": "0.5.4" + "chalk": "^2.1.0", + "node-hid": "0.5.4", + "uhk-common": "1.0.0", + "uhk-usb": "1.0.0" } } diff --git a/packages/usb/uhk.js b/packages/usb/uhk.js index 549a8329..2ed6caff 100755 --- a/packages/usb/uhk.js +++ b/packages/usb/uhk.js @@ -1,4 +1,6 @@ const HID = require('node-hid'); +// const debug = process.env.DEBUG; +const debug = true; function bufferToString(buffer) { let str = ''; @@ -78,8 +80,10 @@ exports = module.exports = moduleExports = { writeUserConfig: 3, }, leftLedDriverAddress: 0b1110100, - rightLedDriverAddress: 0b1110111 -} + rightLedDriverAddress: 0b1110111, + sendLog: sendLog, + readLog: readLog +}; function convertBufferToIntArray(buffer) { return Array.prototype.slice.call(buffer, 0) @@ -101,3 +105,18 @@ function getTransferData(buffer) { return data } + +function readLog(buffer) { + writeLog('USB[R]: ', buffer) +} + +function sendLog(buffer) { + writeLog('USB[W]: ', buffer) +} + +function writeLog(prefix, buffer) { + if (!debug) { + return; + } + console.log(prefix + bufferToString(buffer)) +} diff --git a/packages/usb/write-hca.js b/packages/usb/write-hca.js new file mode 100755 index 00000000..57e184f5 --- /dev/null +++ b/packages/usb/write-hca.js @@ -0,0 +1,57 @@ +#!/usr/bin/env node +const {HardwareConfiguration, UhkBuffer} = require('uhk-common'); +const {EepromTransfer, UhkHidDevice, UsbCommand} = require('uhk-usb'); +const Logger = require('./logger'); + +if (process.argv.length < 3) { + console.log(`use: write-hca + +- layout: iso or ansi +- manufactureId: max 32 bit integer +`); + process.exit(1); +} + +const layout = process.argv[2]; +if (layout !== 'iso' && layout !== 'ansi') { + console.log('Invalid layout. Layout should be on of: iso, ansi'); + process.exit(1); +} + +const uuid = Number.parseInt(process.argv[3]); + +if (isNaN(uuid)) { + console.log('Manufacture Id is not a integer'); + process.exit(1); +} +const hardwareConfig = new HardwareConfiguration(); + +hardwareConfig.signature = 'UHK'; +hardwareConfig.dataModelVersion = 0; +hardwareConfig.hardwareId = 0; +hardwareConfig.uuid = uuid; +hardwareConfig.brandId = 0; +hardwareConfig.isIso = layout === 'iso'; +hardwareConfig.hasBacklighting = false; + +const logger = new Logger(); + +async function writeHca() { + const device = new UhkHidDevice(logger); + const hardwareBuffer = new UhkBuffer(); + hardwareConfig.toBinary(hardwareBuffer); + const buffer = hardwareBuffer.buffer.slice(0, 60); + const fragments = UhkHidDevice.getTransferBuffers(UsbCommand.WriteHardwareConfig, buffer); + logger.debug('USB[T]: Write hardware configuration to keyboard'); + for (const fragment of fragments) { + await device.write(fragment); + } + + logger.debug('USB[T]: Write hardware configuration to EEPROM'); + await device.writeConfigToEeprom(EepromTransfer.WriteHardwareConfig); +} + +writeHca() + .catch((err)=>{ + console.error(err); + });