diff --git a/.github/workflows/BuildPSI.yml b/.github/workflows/BuildPSI.yml deleted file mode 100644 index e16b6a1..0000000 --- a/.github/workflows/BuildPSI.yml +++ /dev/null @@ -1,59 +0,0 @@ -name: Build PSIs -on: - release: - types: [published] -jobs: - - build: - runs-on: ${{ matrix.os }} - strategy: - matrix: - node-version: [16] - os: [windows-latest, macos-latest, ubuntu-latest, self-hosted] - include: - # Define the binary names to use for uploads - - os: ubuntu-latest - file: server - asset_name: server-ubuntu.psi - asset_body: "Ubuntu Server Binary" - - os: self-hosted - file: server - asset_name: server-debian-arm.psi - asset_body: "Debian ARM Server Binary" - - os: windows-latest - file: server.exe - asset_name: server-win.psi - asset_body: "Windows Server Binary" - - os: macos-latest - file: server - asset_name: server-macos.psi - asset_body: "macOS Server Binary" - - steps: - - name: Checkout code - uses: actions/checkout@v2 - - - name: Use Node.js ${{ matrix.node-version }} - uses: actions/setup-node@v2 - with: - node-version: ${{ matrix.node-version }} - cache-dependency-path: ./PSI/yarn.lock - cache: 'yarn' - - - name: Install dependencies - working-directory: ./PSI - run: yarn install --immutable - - - name: Build PSI Image - working-directory: ./PSI - run: yarn run build - - - name: Upload binaries to release - uses: svenstaro/upload-release-action@v2 - with: - repo_token: ${{ secrets.GITHUB_TOKEN }} - file: "PSI/dist/${{ matrix.file }}" - asset_name: ${{ matrix.asset_name }} - tag: ${{ github.ref }} - overwrite: true - body: ${{ matrix.asset_body }} diff --git a/.gitignore b/.gitignore index a6d5608..5c5cb5c 100644 --- a/.gitignore +++ b/.gitignore @@ -19,3 +19,5 @@ !**/.yarn/versions **/.pnp.* +PSI/server.js +PSI/package-lock.json diff --git a/CHANGELOG.md b/CHANGELOG.md index 9be6a0d..5f13ec4 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,65 @@ +- v4.0.0 + + - Versions + - ZWave JS Driver Version: 12.2.1 + - ZWave JS Server Version: 1.33.0 (Schema Version 33) + + - Breaking Changes + - Removed support for **NET45** + The supported frameworks are as follows: **NET 48**, **NET 5.0**, **NET 6.0**, **NET 7.0**, **NETSTANDARD 2.0**, **NETSTANDARD 2.1** + - The **NodeStatistics** arg on the ZWaveNode class event **StatisticsUpdated** has been renamed to **NodeStatisticsUpdatedArgs** + - The **ControllerStatistics** arg on the Controller class event **StatisticsUpdated** has been renamed to **ControllerStatisticsUpdatedArgs** + - The **InclusionResult** argument has been renamed to **InclusionResultArgs** + - The **ValueUpdated** event now uses a dedicated class for the args parameter + - The **ValueNotification** event now uses a dedicated class for the args parameter + - The **NodeRemoved** event now contains a reason Enum as to why it was removed. + - The **NetworkHealDone** and **NetworkHealProgress** events now use dedicated classes for the args parameter + - The **BeginExclusion** method now requires an Exclusion Options instance + - The Node **BeginFirmwareUpdate** method has been renamed to **UpdateFrimware**, and requires a class instance. + - The Node **FirmwareUpdateProgress** event now passes an args parameter + - The Node **FirmwareUpdateFinished** event now passes an args parameter + - Setting the Node **name**, **location** and **keepAwake** values is now only possible with methods for each. + This is to address some unintentional communication between the Driver runtime and the lib. + - The method **GetAllEndpoints** has been removed, and is replaced with an **endpoints** property + - The Controller property **isHealNetworkActive** has been renamed to **isRebuildingRoutes** + - The Controller methods of **HealNode**, **BeginHealingNetwork**, **StopHealingNetwork** have been renamed to: + **RebuildNodeRoutes**, **RebuildNodeRoutes**, **StopRebuildingRoutes** + This inccludes the associated events + + - New Features + - Added **SetRawConfigParameterValue** method to the ZWaveNode class. + - Added **RefreshValues** method to the ZWaveNode class. + - Added **RefreshCCValues** method to the ZWaveNode class. + - Added **WaitForWakeUp** method to the ZWaveNode class. + - Added **Ping**, method to the ZwaveNode class. + - Added **StartListeningLogs**, **StopListeningLogs** methods and the associated events to the Driver class. + - Added **ValueAdded**, **ValueRemoved** events. **ValueRemoved** was never added until now, **ValueAdded**, previously used the **ValueUpdated** event + - Added **endpointLabel** to the Endpoint class + - Added **Interview** method, to the ZWaveNode class - this should only be used if "disableOnNodeAdded" is set to true + - Allow specifying Refresh Info options, when re-interviewing a node. + - Added **FirmwareUpdateOTW** method (and supporting events) to update the Controller Firmware + - Added **SetRFRegion**, **GetRFRegion** methods to the Controller class + - Added **SetPowerlevel**, **GetPowerlevel** methods to the Controller class + - Added **GetAvailableFirmwareUpdates** methods to the Controller class + - Added **FirmwareUpdateOTA** method to the Controller class, to update a node with the fetched Updates via **GetAvailableFirmwareUpdates** + - Added **HardReset** method to the Driver class + **Warning!!!** This will Reset your controller, and will result in a clean network with no included nodes. + - Added **SoftReset** method to the Driver class + - Added the **ccSpecific** property to the **ValueMetadata** class + - Added the ability to add new server methods to the library during runtime. + This is helpful if you want to use a method that is not yet implemented, or to support an older version of an exetrnal server + + + + - Internal changes + - Switched to an alternative websocket client package + - Massive structural / performance improvements + - Better (hopefully) recovery/connection error handling + - Redeveloped the Demo Application / Debug App + - Updated some of the defaults in the Zwave Options to mirror the Driver defaults + - Internal logic to ensure the server satifies the specified expected schema requested by the library + + - v3.1.0 - Versions @@ -9,7 +71,7 @@ - The child classes of **ZWaveOptions** are now instanciated with default values when calling their constructors. - The **DownloadPSI** method now pulls down version locked binaries, to remove the potential for incompatible Binary/library combinations - - New Fearures + - New Features - Added ARM prebuilt binary (Debian, RPi) - The **DownloadPSI** method - now has an optional override, allwowing the PSI to be focibly downloaded, i.e to ensure you have the correct version. diff --git a/Debug Notes/Debug Notes.txt b/Debug Notes/Debug Notes.txt new file mode 100644 index 0000000..eaf0a89 --- /dev/null +++ b/Debug Notes/Debug Notes.txt @@ -0,0 +1,38 @@ +.env file (FWUS) +------------------------------------- +API_REQUIRE_KEY=false +ADMIN_SECRET=1234567890 + + +Wrangler +------------------------------------- +cache_persist = false + + +Build / Run +------------------------------------- +yarn +yarn build +yarn dev + + +Upload Firmware Test +------------------------------------- +set ADMIN_SECRET=1234567890 +set BASE_URL=http://localhost:8787 +yarn build:index +yarn upload + + +S2 Keys (DO NOT USE IN PRODUCTION) +------------------------------------- +0d0003d7bda539f90b5553297d043fdd +c7a2a891f6c786a679453608eb04ade5 +b959a89faedab01ce55fdf23d36e6361 +9142ddbbce0dc0cef42939acaac24f6e + + + + + + diff --git a/Debug Notes/SomeDevice/SomeDevice.json b/Debug Notes/SomeDevice/SomeDevice.json new file mode 100644 index 0000000..9e107d1 --- /dev/null +++ b/Debug Notes/SomeDevice/SomeDevice.json @@ -0,0 +1,37 @@ +{ + "devices": [ + { + "brand": "Some MFG", + "model": "Some Device", + "manufacturerId": "0x0346", + "productType": "0x0101", + "productId": "0x0202" + } + ], + "upgrades": [ + { + "version": "9.0", + "channel": "stable", + "changelog": "Bug Fixes:\n* Bug Fixes\n* More bug fixes", + "files": [ + { + "target": 0, + "url": "https://z-wave.freshdesk.com/helpdesk/attachments/80257130806", + "integrity": "sha256:f653271acaf3ed44563dd3bfb6d98cf8bdfe34d5d68d350cf099e95af1e9724b" + } + ] + }, + { + "version": "9.5", + "channel": "stable", + "changelog": "Bug Fixes:\n* More More Bug Fixes\n* More More More bug fixes", + "files": [ + { + "target": 0, + "url": "https://z-wave.freshdesk.com/helpdesk/attachments/80257130806", + "integrity": "sha256:f653271acaf3ed44563dd3bfb6d98cf8bdfe34d5d68d350cf099e95af1e9724b" + } + ] + } + ] +} diff --git a/PSI/package.json b/PSI/package.json index fac6f89..385000b 100644 --- a/PSI/package.json +++ b/PSI/package.json @@ -1,20 +1,22 @@ { - "version": "3.1.0", + "version": "4.0.0", "name": "server", "bin": "./server.js", "dependencies": { - "@zwave-js/server": "1.17.0", - "zwave-js": "9.4.0" + "@zwave-js/server": "1.35.0", + "zwave-js": "12.5.6" }, "devDependencies": { - "pkg": "^5.7.0" + "@yao-pkg/pkg": "^5.11.5", + "esbuild": "^0.20.2" }, "scripts": { - "build": "pkg . --compress GZip -t host" + "build": "npm run do_esbuild && npm run do_pkgbuild", + "do_esbuild": "esbuild server_source.js --bundle --outfile=server.js --platform=node --target=node18 --external:@serialport/* --external:@zwave-js/config --external:zwave-js/package.json", + "do_pkgbuild": "pkg . --compress gzip -t host --targets node18" }, "pkg": { "assets": "./node_modules/@serialport/bindings-cpp/prebuilds/**/*", "outputPath": "dist" - }, - "packageManager": "yarn@3.2.1" + } } diff --git a/PSI/server.js b/PSI/server_source.js similarity index 79% rename from PSI/server.js rename to PSI/server_source.js index ba2e7fa..7f88d7c 100755 --- a/PSI/server.js +++ b/PSI/server_source.js @@ -1,16 +1,12 @@ const { Driver } = require("zwave-js"); const { ZwavejsServer } = require("@zwave-js/server"); -console.log("ZWaveJS.NET: Preparing server..."); - const serialPort = process.env.SERIAL_PORT; const wsPort = parseInt(process.env.WS_PORT); const driverOptions = JSON.parse(process.env.CONFIG); let ServerStarted = false; let DriverStarted = false; -console.log(`ZWaveJS.NET: Serial Port: ${serialPort}, WSPort: ${wsPort}`); - if (driverOptions.securityKeys) { for (const key of Object.keys(driverOptions.securityKeys)) { driverOptions.securityKeys[key] = Buffer.from( @@ -20,7 +16,15 @@ if (driverOptions.securityKeys) { } } -console.log("ZWaveJS.NET: Instantiating driver..."); +if (driverOptions.securityKeysLongRange) { + for (const key of Object.keys(driverOptions.securityKeysLongRange)) { + driverOptions.securityKeysLongRange[key] = Buffer.from( + driverOptions.securityKeysLongRange[key], + "hex" + ); + } +} + const driver = new Driver(serialPort, driverOptions); const server = new ZwavejsServer(driver, { port: wsPort, host: "localhost" }); server.on("listening",() =>{ @@ -30,10 +34,8 @@ driver.on("error", (e) => {}); driver.on("driver ready", () => { server.start(); - ServerStarted = true; }); -console.log("ZWaveJS.NET: Starting driver..."); driver.start() .then(() =>{ DriverStarted = true; @@ -45,7 +47,6 @@ driver.start() const HandleInput = async (Data) =>{ if(Data.toString().trim() === "KILL"){ - console.log("ZWaveJS.NET: Cleaning up..."); if(ServerStarted) await server.destroy(); if(DriverStarted) await driver.destroy(); process.exit(0); diff --git a/PSI/yarn.lock b/PSI/yarn.lock deleted file mode 100644 index d82a9c6..0000000 --- a/PSI/yarn.lock +++ /dev/null @@ -1,1801 +0,0 @@ -# THIS IS AN AUTOGENERATED FILE. DO NOT EDIT THIS FILE DIRECTLY. -# yarn lockfile v1 - - -"@alcalzone/jsonl-db@^2.5.2": - version "2.5.2" - resolved "https://registry.yarnpkg.com/@alcalzone/jsonl-db/-/jsonl-db-2.5.2.tgz#9c1de6b1c1b58e98e717d5f270012b5d053a6b63" - integrity sha512-4yS5hUXpOOYa24vZ6rxDT5oUwvvTzO2paYUKApOYDdPyrjlZzHwQ1HwaLD7UHXbi9qKDnBbOryGfUPtD+4DddA== - dependencies: - alcalzone-shared "^4.0.1" - fs-extra "^10.1.0" - proper-lockfile "^4.1.2" - -"@alcalzone/pak@^0.8.1": - version "0.8.1" - resolved "https://registry.yarnpkg.com/@alcalzone/pak/-/pak-0.8.1.tgz#69b837c3ba6df6a10d8bb1e159b738eb4ae580c3" - integrity sha512-sPdxNxdXLH96kbyWLdIljVSIY2N6/qnPqkq5AlWvuizjGQUwHIUtWZHLss9XNDV/hY7YkgdIb9ILHbMTnRBxVQ== - dependencies: - axios "^0.26.0" - execa "^5.0.0" - fs-extra "^10.0.1" - -"@babel/helper-validator-identifier@^7.16.7": - version "7.16.7" - resolved "https://registry.yarnpkg.com/@babel/helper-validator-identifier/-/helper-validator-identifier-7.16.7.tgz#e8c602438c4a8195751243da9031d1607d247cad" - integrity sha512-hsEnFemeiW4D08A5gUAZxLBTXpZ39P+a+DGDsHw1yxqyQ/jzFEnxf5uTEGp+3bzAbNOxU1paTgYS4ECU/IgfDw== - -"@babel/parser@7.17.10": - version "7.17.10" - resolved "https://registry.yarnpkg.com/@babel/parser/-/parser-7.17.10.tgz#873b16db82a8909e0fbd7f115772f4b739f6ce78" - integrity sha512-n2Q6i+fnJqzOaq2VkdXxy2TCPCWQZHiCo0XqmrCvDWcZQKRyZzYi4Z0yxlBuN0w+r2ZHmre+Q087DSrw3pbJDQ== - -"@babel/types@7.17.10": - version "7.17.10" - resolved "https://registry.yarnpkg.com/@babel/types/-/types-7.17.10.tgz#d35d7b4467e439fcf06d195f8100e0fea7fc82c4" - integrity sha512-9O26jG0mBYfGkUYCYZRnBwbVLd1UZOICEr2Em6InB6jVfsAv1GKgwXHmrSg+WFWDmeKTA6vyTZiN8tCSM5Oo3A== - dependencies: - "@babel/helper-validator-identifier" "^7.16.7" - to-fast-properties "^2.0.0" - -"@colors/colors@1.5.0": - version "1.5.0" - resolved "https://registry.yarnpkg.com/@colors/colors/-/colors-1.5.0.tgz#bb504579c1cae923e6576a4f5da43d25f97bdbd9" - integrity sha512-ooWCrlZP11i8GImSjTHYHLkvFDP48nS4+204nGb1RiX/WXYHmJA2III9/e2DWVabCESdW7hBAEzHRqUn9OUVvQ== - -"@dabh/diagnostics@^2.0.2": - version "2.0.3" - resolved "https://registry.yarnpkg.com/@dabh/diagnostics/-/diagnostics-2.0.3.tgz#7f7e97ee9a725dffc7808d93668cc984e1dc477a" - integrity sha512-hrlQOIi7hAfzsMqlGSFyVucrx38O+j6wiGOf//H2ecvIEqYN4ADBSS2iLMh5UFyDunCNniUIPk/q3riFv45xRA== - dependencies: - colorspace "1.1.x" - enabled "2.0.x" - kuler "^2.0.0" - -"@homebridge/ciao@^1.1.3": - version "1.1.5" - resolved "https://registry.yarnpkg.com/@homebridge/ciao/-/ciao-1.1.5.tgz#8d850cfd85e6ade9e525a0f2bdb577dcb2af1242" - integrity sha512-ZI9tcbPfX2d8oP1PNeLzrZLXISAIDUtJQWk4JVVJKCxktC6tQ3JyWXT9t1FbB5xtl82M1jdCgyAbWbjhUtRWcA== - dependencies: - debug "^4.3.4" - fast-deep-equal "^3.1.3" - source-map-support "^0.5.21" - tslib "^2.4.0" - -"@nodelib/fs.scandir@2.1.5": - version "2.1.5" - resolved "https://registry.yarnpkg.com/@nodelib/fs.scandir/-/fs.scandir-2.1.5.tgz#7619c2eb21b25483f6d167548b4cfd5a7488c3d5" - integrity sha512-vq24Bq3ym5HEQm2NKCr3yXDwjc7vTsEThRDnkp2DK9p1uqLR+DHurm/NOTo0KG7HYHU7eppKZj3MyqYuMBf62g== - dependencies: - "@nodelib/fs.stat" "2.0.5" - run-parallel "^1.1.9" - -"@nodelib/fs.stat@2.0.5", "@nodelib/fs.stat@^2.0.2": - version "2.0.5" - resolved "https://registry.yarnpkg.com/@nodelib/fs.stat/-/fs.stat-2.0.5.tgz#5bd262af94e9d25bd1e71b05deed44876a222e8b" - integrity sha512-RkhPPp2zrqDAQA/2jNhnztcPAlv64XdhIp7a7454A5ovI7Bukxgt7MX7udwAu3zg1DcpPU0rz3VV1SeaqvY4+A== - -"@nodelib/fs.walk@^1.2.3": - version "1.2.8" - resolved "https://registry.yarnpkg.com/@nodelib/fs.walk/-/fs.walk-1.2.8.tgz#e95737e8bb6746ddedf69c556953494f196fe69a" - integrity sha512-oGB+UxlgWcgQkgwo8GcEGwemoTFt3FIO9ababBmaGwXIoBKZ+GTy0pP185beGg7Llih/NSHSV2XAs1lnznocSg== - dependencies: - "@nodelib/fs.scandir" "2.1.5" - fastq "^1.6.0" - -"@sentry/core@6.19.7": - version "6.19.7" - resolved "https://registry.yarnpkg.com/@sentry/core/-/core-6.19.7.tgz#156aaa56dd7fad8c89c145be6ad7a4f7209f9785" - integrity sha512-tOfZ/umqB2AcHPGbIrsFLcvApdTm9ggpi/kQZFkej7kMphjT+SGBiQfYtjyg9jcRW+ilAR4JXC9BGKsdEQ+8Vw== - dependencies: - "@sentry/hub" "6.19.7" - "@sentry/minimal" "6.19.7" - "@sentry/types" "6.19.7" - "@sentry/utils" "6.19.7" - tslib "^1.9.3" - -"@sentry/hub@6.19.7": - version "6.19.7" - resolved "https://registry.yarnpkg.com/@sentry/hub/-/hub-6.19.7.tgz#58ad7776bbd31e9596a8ec46365b45cd8b9cfd11" - integrity sha512-y3OtbYFAqKHCWezF0EGGr5lcyI2KbaXW2Ik7Xp8Mu9TxbSTuwTe4rTntwg8ngPjUQU3SUHzgjqVB8qjiGqFXCA== - dependencies: - "@sentry/types" "6.19.7" - "@sentry/utils" "6.19.7" - tslib "^1.9.3" - -"@sentry/integrations@^6.19.7": - version "6.19.7" - resolved "https://registry.yarnpkg.com/@sentry/integrations/-/integrations-6.19.7.tgz#e6e126b692077c8731644224c754012bed65b425" - integrity sha512-yNeeFyuygJaV7Mdc5qWuDa13xVj5mVdECaaw2Xs4pfeHaXmRfRzZY17N8ypWFegKWxKBHynyQRMD10W5pBwJvA== - dependencies: - "@sentry/types" "6.19.7" - "@sentry/utils" "6.19.7" - localforage "^1.8.1" - tslib "^1.9.3" - -"@sentry/minimal@6.19.7": - version "6.19.7" - resolved "https://registry.yarnpkg.com/@sentry/minimal/-/minimal-6.19.7.tgz#b3ee46d6abef9ef3dd4837ebcb6bdfd01b9aa7b4" - integrity sha512-wcYmSJOdvk6VAPx8IcmZgN08XTXRwRtB1aOLZm+MVHjIZIhHoBGZJYTVQS/BWjldsamj2cX3YGbGXNunaCfYJQ== - dependencies: - "@sentry/hub" "6.19.7" - "@sentry/types" "6.19.7" - tslib "^1.9.3" - -"@sentry/node@^6.19.7": - version "6.19.7" - resolved "https://registry.yarnpkg.com/@sentry/node/-/node-6.19.7.tgz#32963b36b48daebbd559e6f13b1deb2415448592" - integrity sha512-gtmRC4dAXKODMpHXKfrkfvyBL3cI8y64vEi3fDD046uqYcrWdgoQsffuBbxMAizc6Ez1ia+f0Flue6p15Qaltg== - dependencies: - "@sentry/core" "6.19.7" - "@sentry/hub" "6.19.7" - "@sentry/types" "6.19.7" - "@sentry/utils" "6.19.7" - cookie "^0.4.1" - https-proxy-agent "^5.0.0" - lru_map "^0.3.3" - tslib "^1.9.3" - -"@sentry/types@6.19.7": - version "6.19.7" - resolved "https://registry.yarnpkg.com/@sentry/types/-/types-6.19.7.tgz#c6b337912e588083fc2896eb012526cf7cfec7c7" - integrity sha512-jH84pDYE+hHIbVnab3Hr+ZXr1v8QABfhx39KknxqKWr2l0oEItzepV0URvbEhB446lk/S/59230dlUUIBGsXbg== - -"@sentry/utils@6.19.7": - version "6.19.7" - resolved "https://registry.yarnpkg.com/@sentry/utils/-/utils-6.19.7.tgz#6edd739f8185fd71afe49cbe351c1bbf5e7b7c79" - integrity sha512-z95ECmE3i9pbWoXQrD/7PgkBAzJYR+iXtPuTkpBjDKs86O3mT+PXOT3BAn79w2wkn7/i3vOGD2xVr1uiMl26dA== - dependencies: - "@sentry/types" "6.19.7" - tslib "^1.9.3" - -"@serialport/binding-mock@10.2.2": - version "10.2.2" - resolved "https://registry.yarnpkg.com/@serialport/binding-mock/-/binding-mock-10.2.2.tgz#d322a8116a97806addda13c62f50e73d16125874" - integrity sha512-HAFzGhk9OuFMpuor7aT5G1ChPgn5qSsklTFOTUX72Rl6p0xwcSVsRtG/xaGp6bxpN7fI9D/S8THLBWbBgS6ldw== - dependencies: - "@serialport/bindings-interface" "^1.2.1" - debug "^4.3.3" - -"@serialport/bindings-cpp@10.7.0": - version "10.7.0" - resolved "https://registry.yarnpkg.com/@serialport/bindings-cpp/-/bindings-cpp-10.7.0.tgz#9cf7dda78d914ba597933089abe2a8511e875851" - integrity sha512-Xx1wA2UCG2loS32hxNvWJI4smCzGKhWqE85//fLRzHoGgE1lSLe3Nk7W40/ebrlGFHWRbQZmeaIF4chb2XLliA== - dependencies: - "@serialport/bindings-interface" "1.2.1" - "@serialport/parser-readline" "^10.2.1" - debug "^4.3.2" - node-addon-api "^4.3.0" - node-gyp-build "^4.3.0" - -"@serialport/bindings-interface@1.2.1": - version "1.2.1" - resolved "https://registry.yarnpkg.com/@serialport/bindings-interface/-/bindings-interface-1.2.1.tgz#1ee80b0951ef4e4fd8a5a186621feff046aa2faf" - integrity sha512-63Dyqz2gtryRDDckFusOYqLYhR3Hq/M4sEdbF9i/VsvDb6T+tNVgoAKUZ+FMrXXKnCSu+hYbk+MTc0XQANszxw== - -"@serialport/bindings-interface@^1.2.1": - version "1.2.2" - resolved "https://registry.yarnpkg.com/@serialport/bindings-interface/-/bindings-interface-1.2.2.tgz#c4ae9c1c85e26b02293f62f37435478d90baa460" - integrity sha512-CJaUd5bLvtM9c5dmO9rPBHPXTa9R2UwpkJ0wdh9JCYcbrPWsKz+ErvR0hBLeo7NPeiFdjFO4sonRljiw4d2XiA== - -"@serialport/parser-byte-length@10.3.0": - version "10.3.0" - resolved "https://registry.yarnpkg.com/@serialport/parser-byte-length/-/parser-byte-length-10.3.0.tgz#c650b8883f716af77196e8466e86861b55290201" - integrity sha512-pJ/VoFemzKRRNDHLhFfPThwP40QrGaEnm9TtwL7o2GihEPwzBg3T0bN13ew5TpbbUYZdMpUtpm3CGfl6av9rUQ== - -"@serialport/parser-cctalk@10.3.0": - version "10.3.0" - resolved "https://registry.yarnpkg.com/@serialport/parser-cctalk/-/parser-cctalk-10.3.0.tgz#d8fc7ab480910b28362b1ff154c01c170ac201a3" - integrity sha512-8ujmk8EvVbDPrNF4mM33bWvUYJOZ0wXbY3WCRazHRWvyCdL0VO0DQvW81ZqgoTpiDQZm5r8wQu9rmuemahF6vQ== - -"@serialport/parser-delimiter@10.3.0": - version "10.3.0" - resolved "https://registry.yarnpkg.com/@serialport/parser-delimiter/-/parser-delimiter-10.3.0.tgz#4bcbbeed7e3c6fed2c116535f0754bbf8a33f015" - integrity sha512-9E4Vj6s0UbbcCCTclwegHGPYjJhdm9qLCS0lowXQDEQC5naZnbsELemMHs93nD9jHPcyx1B4oXkMnVZLxX5TYw== - -"@serialport/parser-inter-byte-timeout@10.3.0": - version "10.3.0" - resolved "https://registry.yarnpkg.com/@serialport/parser-inter-byte-timeout/-/parser-inter-byte-timeout-10.3.0.tgz#57e4fceeeeb13415dcded3ef1ba5d28a9fa0c611" - integrity sha512-wKP0QK85NHgvT6BBB1qBfKBBU4pf8kespNXAZBUYmFT+P4n8r8IZE2mqigCD+AiZcfWNQoAizwOsT/Jx/qeVig== - -"@serialport/parser-packet-length@10.3.0": - version "10.3.0" - resolved "https://registry.yarnpkg.com/@serialport/parser-packet-length/-/parser-packet-length-10.3.0.tgz#9faefc91841c011925a6d4fa4fad6ed44bf11ed6" - integrity sha512-bj0cWzt8YSQj/E5fRQVYdi4TsfTlZQrXlXrUwjyTsCONv8IPOHzsz+yY0fw5SEMiJtaLyqvPkCHLsttOd/zFsg== - -"@serialport/parser-readline@10.3.0", "@serialport/parser-readline@^10.2.1": - version "10.3.0" - resolved "https://registry.yarnpkg.com/@serialport/parser-readline/-/parser-readline-10.3.0.tgz#7db9143ce9a2537a4086b3824a70fe53ae2107b3" - integrity sha512-ki3ATZ3/RAqnqGROBKE7k+OeZ0DZXZ53GTca4q71OU5RazbbNhTOBQLKLXD3v9QZXCMJdg4hGW/2Y0DuMUqMQg== - dependencies: - "@serialport/parser-delimiter" "10.3.0" - -"@serialport/parser-ready@10.3.0": - version "10.3.0" - resolved "https://registry.yarnpkg.com/@serialport/parser-ready/-/parser-ready-10.3.0.tgz#6a93d8970dc827e57829a9ee54802469be71f185" - integrity sha512-1owywJ4p592dJyVrEJZPIh6pUZ3/y/LN6kGTDH2wxdewRUITo/sGvDy0er5i2+dJD3yuowiAz0dOHSdz8tevJA== - -"@serialport/parser-regex@10.3.0": - version "10.3.0" - resolved "https://registry.yarnpkg.com/@serialport/parser-regex/-/parser-regex-10.3.0.tgz#7c7314036535414bb7ada3520598d233f5ea09d0" - integrity sha512-tIogTs7CvTH+UUFnsvE7i33MSISyTPTGPWlglWYH2/5coipXY503jlaYS1YGe818wWNcSx6YAjMZRdhTWwM39w== - -"@serialport/parser-slip-encoder@10.3.0": - version "10.3.0" - resolved "https://registry.yarnpkg.com/@serialport/parser-slip-encoder/-/parser-slip-encoder-10.3.0.tgz#ff01cd7cda2258ad2ca3ebb113145a0aa7272c78" - integrity sha512-JI0ILF5sylWn8f0MuMzHFBix/iMUTa79/Z95KaPZYnVaEdA7h7hh/o21Jmon/26P3RJwL1SNJCjZ81zfan+LtQ== - -"@serialport/parser-spacepacket@10.3.0": - version "10.3.0" - resolved "https://registry.yarnpkg.com/@serialport/parser-spacepacket/-/parser-spacepacket-10.3.0.tgz#447d49b0690527ea770410ffe0a2ade2079ae7b2" - integrity sha512-PDF73ClEPsClD1FEJZHNuBevDKsJCkqy/XD5+S5eA6+tY5D4HLrVgSWsg+3qqB6+dlpwf2CzHe+uO8D3teuKHA== - -"@serialport/stream@10.3.0": - version "10.3.0" - resolved "https://registry.yarnpkg.com/@serialport/stream/-/stream-10.3.0.tgz#fdb13ed4487379615819203217060b114548c0a6" - integrity sha512-7sooi5fHogYNVEJwxVdg872xO6TuMgQd2E9iRmv+o8pk/1dbBnPkmH6Ka3st1mVE+0KnIJqVlgei+ncSsqXIGw== - dependencies: - "@serialport/bindings-interface" "1.2.1" - debug "^4.3.2" - -"@zwave-js/config@9.4.0": - version "9.4.0" - resolved "https://registry.yarnpkg.com/@zwave-js/config/-/config-9.4.0.tgz#41f0355b405048bb45929d464de6be7cf41242d8" - integrity sha512-c2vSTO/tCBnqfe3ivcffEX4v8OX1oOo+/oGQ3pCzsbSEgcfbx9x2NMpO/9GHCiKIbKGPj4rubZqHaLn7z6ScLQ== - dependencies: - "@zwave-js/core" "9.4.0" - "@zwave-js/shared" "9.4.0" - alcalzone-shared "^4.0.1" - ansi-colors "^4.1.3" - fs-extra "^10.1.0" - json-logic-js "^2.0.2" - json5 "^2.2.1" - semver "^7.3.7" - winston "^3.7.2" - -"@zwave-js/core@9.4.0": - version "9.4.0" - resolved "https://registry.yarnpkg.com/@zwave-js/core/-/core-9.4.0.tgz#3406c0d14d237e82e2fbf09ffccf6070eb0a292c" - integrity sha512-AplNBIwraO1ko99gUqkObAlsI/VXngnJlYhtG+FGlAF18Aok2bJQ+ZJhp+an0Yo0zM5s8CpOeuWhw6cTd71ycQ== - dependencies: - "@alcalzone/jsonl-db" "^2.5.2" - "@zwave-js/shared" "9.4.0" - alcalzone-shared "^4.0.1" - ansi-colors "^4.1.3" - dayjs "^1.11.2" - logform "^2.4.0" - nrf-intel-hex "^1.3.0" - triple-beam "*" - winston "^3.7.2" - winston-daily-rotate-file "^4.7.1" - winston-transport "^4.5.0" - -"@zwave-js/host@9.4.0": - version "9.4.0" - resolved "https://registry.yarnpkg.com/@zwave-js/host/-/host-9.4.0.tgz#7142cb28ec1d9f12c0e2044bbc8a7068fae12efd" - integrity sha512-Otk8zo86uPKYgbrze9l3BKMg2O5hv8wf1jwiTKR38TfBXfBo5sJg7LUvy9Cww2kgXqbiiqPrauhQlFerBrM13w== - dependencies: - "@zwave-js/core" "9.4.0" - "@zwave-js/shared" "9.4.0" - alcalzone-shared "^4.0.1" - -"@zwave-js/nvmedit@9.4.0": - version "9.4.0" - resolved "https://registry.yarnpkg.com/@zwave-js/nvmedit/-/nvmedit-9.4.0.tgz#be6e1e091317561294124f4c17a0e14d78872bcd" - integrity sha512-jFBxq+ROgDGXKhLrIUHn+lir0lKmYZ0H/A0xRnRVsAPYkMWRkMlNEHvwup99DF4HxR2+4FAF8ycsGwE8dISbdw== - dependencies: - "@zwave-js/core" "9.4.0" - "@zwave-js/shared" "9.4.0" - alcalzone-shared "^4.0.1" - fs-extra "^10.1.0" - reflect-metadata "^0.1.13" - semver "^7.3.7" - yargs "^17.5.1" - -"@zwave-js/serial@9.4.0": - version "9.4.0" - resolved "https://registry.yarnpkg.com/@zwave-js/serial/-/serial-9.4.0.tgz#132c2fb949ef6c4058fd630aadc9fd1d9c0e213c" - integrity sha512-4AYwkfyjwUBjLU02zppTHIhjweNzHdR9+uRVPq+7JldB1cGYBZ8aVShIFoV73SIXQMxIcO7l9EswjgR2Uo1dgA== - dependencies: - "@sentry/node" "^6.19.7" - "@zwave-js/core" "9.4.0" - "@zwave-js/host" "9.4.0" - "@zwave-js/shared" "9.4.0" - alcalzone-shared "^4.0.1" - serialport "^10.4.0" - winston "^3.7.2" - -"@zwave-js/server@1.17.0": - version "1.17.0" - resolved "https://registry.yarnpkg.com/@zwave-js/server/-/server-1.17.0.tgz#6056e88d8e3e1c153f0d792cc142e8f6b5819a2f" - integrity sha512-UhEJbTVrNiwOQB4pH4mtyblktKinZQwLIDcs0T2ZMzOZLqtBuzduuESPdSZs4bCHhdeCfe9rR/Dg5j71J5qY3g== - dependencies: - "@homebridge/ciao" "^1.1.3" - minimist "^1.2.5" - ws "^8.0.0" - -"@zwave-js/shared@9.4.0": - version "9.4.0" - resolved "https://registry.yarnpkg.com/@zwave-js/shared/-/shared-9.4.0.tgz#e5264ffac44d9ec2abd7ade8017ab6f6baa25d88" - integrity sha512-eZ4j6ERIzwT8Izp4W4Nj5Bk57/Sjcn7e7ItAioPkgh/a97xO/rXii6EuOZQK8AiyKhRubA7u2YvG1fmu3PLjqg== - dependencies: - alcalzone-shared "^4.0.1" - fs-extra "^10.1.0" - -agent-base@6: - version "6.0.2" - resolved "https://registry.yarnpkg.com/agent-base/-/agent-base-6.0.2.tgz#49fff58577cfee3f37176feab4c22e00f86d7f77" - integrity sha512-RZNwNclF7+MS/8bDg70amg32dyeZGZxiDuQmZxKLAlQjr3jGyLx+4Kkk58UO7D2QdgFIQCovuSuZESne6RG6XQ== - dependencies: - debug "4" - -alcalzone-shared@^4.0.1: - version "4.0.1" - resolved "https://registry.yarnpkg.com/alcalzone-shared/-/alcalzone-shared-4.0.1.tgz#1fcfb042f104a29cc8e67b0b07cb9e459ac2f9bc" - integrity sha512-6t0LFCIGvBG24grbV93Y1+MJjoyqgUpPOp/PkOcal1ZXXUUMEaZKPu6NfN6e3x5k2P2mnNaY2eXn/VmpWDLzYA== - dependencies: - debug "^4.3.2" - -ansi-colors@^4.1.3: - version "4.1.3" - resolved "https://registry.yarnpkg.com/ansi-colors/-/ansi-colors-4.1.3.tgz#37611340eb2243e70cc604cad35d63270d48781b" - integrity sha512-/6w/C21Pm1A7aZitlI5Ni/2J6FFQN8i1Cvz3kHABAAbw93v/NlvKdVOqz7CCWz/3iv/JplRSEEZ83XION15ovw== - -ansi-regex@^2.0.0: - version "2.1.1" - resolved "https://registry.yarnpkg.com/ansi-regex/-/ansi-regex-2.1.1.tgz#c3b33ab5ee360d86e0e628f0468ae7ef27d654df" - integrity sha512-TIGnTpdo+E3+pCyAluZvtED5p5wCqLdezCyhPZzKPcxvFplEt4i+W7OONCKgeZFT3+y5NZZfOOS/Bdcanm1MYA== - -ansi-regex@^5.0.1: - version "5.0.1" - resolved "https://registry.yarnpkg.com/ansi-regex/-/ansi-regex-5.0.1.tgz#082cb2c89c9fe8659a311a53bd6a4dc5301db304" - integrity sha512-quJQXlTSUGL2LH9SUXo8VwsY4soanhgo6LNSm84E1LBcE8s3O0wpdiRzyR9z/ZZJMlMWv37qOOb9pdJlMUEKFQ== - -ansi-styles@^4.0.0, ansi-styles@^4.1.0: - version "4.3.0" - resolved "https://registry.yarnpkg.com/ansi-styles/-/ansi-styles-4.3.0.tgz#edd803628ae71c04c85ae7a0906edad34b648937" - integrity sha512-zbB9rCJAT1rbjiVDb2hqKFHNYLxgtk8NURxZ3IZwD3F6NtxbXZQCnnSi1Lkx+IDohdPlFp222wVALIheZJQSEg== - dependencies: - color-convert "^2.0.1" - -aproba@^1.0.3: - version "1.2.0" - resolved "https://registry.yarnpkg.com/aproba/-/aproba-1.2.0.tgz#6802e6264efd18c790a1b0d517f0f2627bf2c94a" - integrity sha512-Y9J6ZjXtoYh8RnXVCMOU/ttDmk1aBjunq9vO0ta5x85WDQiQfUF9sIPBITdbiiIVcBo03Hi3jMxigBtsddlXRw== - -are-we-there-yet@~1.1.2: - version "1.1.7" - resolved "https://registry.yarnpkg.com/are-we-there-yet/-/are-we-there-yet-1.1.7.tgz#b15474a932adab4ff8a50d9adfa7e4e926f21146" - integrity sha512-nxwy40TuMiUGqMyRHgCSWZ9FM4VAoRP4xUYSTv5ImRog+h9yISPbVH7H8fASCIzYn9wlEv4zvFL7uKDMCFQm3g== - dependencies: - delegates "^1.0.0" - readable-stream "^2.0.6" - -array-union@^2.1.0: - version "2.1.0" - resolved "https://registry.yarnpkg.com/array-union/-/array-union-2.1.0.tgz#b798420adbeb1de828d84acd8a2e23d3efe85e8d" - integrity sha512-HGyxoOTYUyCM6stUe6EJgnd4EoewAI7zMdfqO+kGjnlZmBDz/cR5pf8r/cR4Wq60sL/p0IkcjUEEPwS3GFrIyw== - -async@^3.2.3: - version "3.2.4" - resolved "https://registry.yarnpkg.com/async/-/async-3.2.4.tgz#2d22e00f8cddeb5fde5dd33522b56d1cf569a81c" - integrity sha512-iAB+JbDEGXhyIUavoDl9WP/Jj106Kz9DEn1DPgYw5ruDn0e3Wgi3sKFm55sASdGBNOQB8F59d9qQ7deqrHA8wQ== - -asynckit@^0.4.0: - version "0.4.0" - resolved "https://registry.yarnpkg.com/asynckit/-/asynckit-0.4.0.tgz#c79ed97f7f34cb8f2ba1bc9790bcc366474b4b79" - integrity sha512-Oei9OH4tRh0YqU3GxhX79dM/mwVgvbZJaSNaRk+bshkj0S5cfHcgYakreBjrHwatXKbz+IoIdYLxrKim2MjW0Q== - -at-least-node@^1.0.0: - version "1.0.0" - resolved "https://registry.yarnpkg.com/at-least-node/-/at-least-node-1.0.0.tgz#602cd4b46e844ad4effc92a8011a3c46e0238dc2" - integrity sha512-+q/t7Ekv1EDY2l6Gda6LLiX14rU9TV20Wa3ofeQmwPFZbOMo9DXrLbOjFaaclkXKWidIaopwAObQDqwWtGUjqg== - -axios@^0.26.0: - version "0.26.1" - resolved "https://registry.yarnpkg.com/axios/-/axios-0.26.1.tgz#1ede41c51fcf51bbbd6fd43669caaa4f0495aaa9" - integrity sha512-fPwcX4EvnSHuInCMItEhAGnaSEXRBjtzh9fOtsE6E1G6p7vl7edEeZe11QHf18+6+9gR5PbKV/sGKNaD8YaMeA== - dependencies: - follow-redirects "^1.14.8" - -axios@^0.27.2: - version "0.27.2" - resolved "https://registry.yarnpkg.com/axios/-/axios-0.27.2.tgz#207658cc8621606e586c85db4b41a750e756d972" - integrity sha512-t+yRIyySRTp/wua5xEr+z1q60QmLq8ABsS5O9Me1AsE5dfKqgnCFzwiCZZ/cGNd1lq4/7akDWMxdhVlucjmnOQ== - dependencies: - follow-redirects "^1.14.9" - form-data "^4.0.0" - -base64-js@^1.3.1: - version "1.5.1" - resolved "https://registry.yarnpkg.com/base64-js/-/base64-js-1.5.1.tgz#1b1b440160a5bf7ad40b650f095963481903930a" - integrity sha512-AKpaYlHn8t4SVbOHCy+b5+KKgvR4vrsD8vbvrbiQJps7fKDTkjkDry6ji0rUJjC0kzbNePLwzxq8iypo41qeWA== - -bl@^4.0.3: - version "4.1.0" - resolved "https://registry.yarnpkg.com/bl/-/bl-4.1.0.tgz#451535264182bec2fbbc83a62ab98cf11d9f7b3a" - integrity sha512-1W07cM9gS6DcLperZfFSj+bWLtaPGSOHWhPiGzXmvVJbRLdG82sH/Kn8EtW1VqWVA54AKf2h5k5BbnIbwF3h6w== - dependencies: - buffer "^5.5.0" - inherits "^2.0.4" - readable-stream "^3.4.0" - -braces@^3.0.2: - version "3.0.2" - resolved "https://registry.yarnpkg.com/braces/-/braces-3.0.2.tgz#3454e1a462ee8d599e236df336cd9ea4f8afe107" - integrity sha512-b8um+L1RzM3WDSzvhm6gIz1yfTbBt6YTlcEKAvsmqCZZFw46z626lVj9j1yEPW33H5H+lBQpZMP1k8l+78Ha0A== - dependencies: - fill-range "^7.0.1" - -buffer-from@^1.0.0: - version "1.1.2" - resolved "https://registry.yarnpkg.com/buffer-from/-/buffer-from-1.1.2.tgz#2b146a6fd72e80b4f55d255f35ed59a3a9a41bd5" - integrity sha512-E+XQCRwSbaaiChtv6k6Dwgc+bx+Bs6vuKJHHl5kox/BaKbhiXzqQOwK4cO22yElGp2OCmjwVhT3HmxgyPGnJfQ== - -buffer@^5.5.0: - version "5.7.1" - resolved "https://registry.yarnpkg.com/buffer/-/buffer-5.7.1.tgz#ba62e7c13133053582197160851a8f648e99eed0" - integrity sha512-EHcyIPBQ4BSGlvjB16k5KgAJ27CIsHY/2JBmCRReo48y9rQ3MaUzWX3KVlBa4U7MyX02HdVj0K7C3WaB3ju7FQ== - dependencies: - base64-js "^1.3.1" - ieee754 "^1.1.13" - -chalk@^4.1.2: - version "4.1.2" - resolved "https://registry.yarnpkg.com/chalk/-/chalk-4.1.2.tgz#aac4e2b7734a740867aeb16bf02aad556a1e7a01" - integrity sha512-oKnbhFyRIXpUuez8iBMmyEa4nbj4IOQyuhc/wy9kY7/WVPcwIO9VA668Pu8RkO7+0G76SLROeyw9CpQ061i4mA== - dependencies: - ansi-styles "^4.1.0" - supports-color "^7.1.0" - -chownr@^1.1.1: - version "1.1.4" - resolved "https://registry.yarnpkg.com/chownr/-/chownr-1.1.4.tgz#6fc9d7b42d32a583596337666e7d08084da2cc6b" - integrity sha512-jJ0bqzaylmJtVnNgzTeSOs8DPavpbYgEr/b0YL8/2GO3xJEhInFmhKMUnEJQjZumK7KXGFhUy89PrsJWlakBVg== - -cliui@^7.0.2: - version "7.0.4" - resolved "https://registry.yarnpkg.com/cliui/-/cliui-7.0.4.tgz#a0265ee655476fc807aea9df3df8df7783808b4f" - integrity sha512-OcRE68cOsVMXp1Yvonl/fzkQOyjLSu/8bhPDfQt0e0/Eb283TKP20Fs2MqoPsr9SwA595rRCA+QMzYc9nBP+JQ== - dependencies: - string-width "^4.2.0" - strip-ansi "^6.0.0" - wrap-ansi "^7.0.0" - -code-point-at@^1.0.0: - version "1.1.0" - resolved "https://registry.yarnpkg.com/code-point-at/-/code-point-at-1.1.0.tgz#0d070b4d043a5bea33a2f1a40e2edb3d9a4ccf77" - integrity sha512-RpAVKQA5T63xEj6/giIbUEtZwJ4UFIc3ZtvEkiaUERylqe8xb5IvqcgOurZLahv93CLKfxcw5YI+DZcUBRyLXA== - -color-convert@^1.9.3: - version "1.9.3" - resolved "https://registry.yarnpkg.com/color-convert/-/color-convert-1.9.3.tgz#bb71850690e1f136567de629d2d5471deda4c1e8" - integrity sha512-QfAUtd+vFdAtFQcC8CCyYt1fYWxSqAiK2cSD6zDB8N3cpsEBAvRxp9zOGg6G/SHHJYAT88/az/IuDGALsNVbGg== - dependencies: - color-name "1.1.3" - -color-convert@^2.0.1: - version "2.0.1" - resolved "https://registry.yarnpkg.com/color-convert/-/color-convert-2.0.1.tgz#72d3a68d598c9bdb3af2ad1e84f21d896abd4de3" - integrity sha512-RRECPsj7iu/xb5oKYcsFHSppFNnsj/52OVTRKb4zP5onXwVF3zVmmToNcOfGC+CRDpfK/U584fMg38ZHCaElKQ== - dependencies: - color-name "~1.1.4" - -color-name@1.1.3: - version "1.1.3" - resolved "https://registry.yarnpkg.com/color-name/-/color-name-1.1.3.tgz#a7d0558bd89c42f795dd42328f740831ca53bc25" - integrity sha512-72fSenhMw2HZMTVHeCA9KCmpEIbzWiQsjN+BHcBbS9vr1mtt+vJjPdksIBNUmKAW8TFUDPJK5SUU3QhE9NEXDw== - -color-name@^1.0.0, color-name@~1.1.4: - version "1.1.4" - resolved "https://registry.yarnpkg.com/color-name/-/color-name-1.1.4.tgz#c2a09a87acbde69543de6f63fa3995c826c536a2" - integrity sha512-dOy+3AuW3a2wNbZHIuMZpTcgjGuLU/uBL/ubcZF9OXbDo8ff4O8yVp5Bf0efS8uEoYo5q4Fx7dY9OgQGXgAsQA== - -color-string@^1.6.0: - version "1.9.1" - resolved "https://registry.yarnpkg.com/color-string/-/color-string-1.9.1.tgz#4467f9146f036f855b764dfb5bf8582bf342c7a4" - integrity sha512-shrVawQFojnZv6xM40anx4CkoDP+fZsw/ZerEMsW/pyzsRbElpsL/DBVW7q3ExxwusdNXI3lXpuhEZkzs8p5Eg== - dependencies: - color-name "^1.0.0" - simple-swizzle "^0.2.2" - -color@^3.1.3: - version "3.2.1" - resolved "https://registry.yarnpkg.com/color/-/color-3.2.1.tgz#3544dc198caf4490c3ecc9a790b54fe9ff45e164" - integrity sha512-aBl7dZI9ENN6fUGC7mWpMTPNHmWUSNan9tuWN6ahh5ZLNk9baLJOnSMlrQkHcrfFgz2/RigjUVAjdx36VcemKA== - dependencies: - color-convert "^1.9.3" - color-string "^1.6.0" - -colorspace@1.1.x: - version "1.1.4" - resolved "https://registry.yarnpkg.com/colorspace/-/colorspace-1.1.4.tgz#8d442d1186152f60453bf8070cd66eb364e59243" - integrity sha512-BgvKJiuVu1igBUF2kEjRCZXol6wiiGbY5ipL/oVPwm0BL9sIpMIzM8IK7vwuxIIzOXMV3Ey5w+vxhm0rR/TN8w== - dependencies: - color "^3.1.3" - text-hex "1.0.x" - -combined-stream@^1.0.8: - version "1.0.8" - resolved "https://registry.yarnpkg.com/combined-stream/-/combined-stream-1.0.8.tgz#c3d45a8b34fd730631a110a8a2520682b31d5a7f" - integrity sha512-FQN4MRfuJeHf7cBbBMJFXhKSDq+2kAArBlmRBvcvFE5BB1HZKXtSFASDhdlz9zOYwxh8lDdnvmMOe/+5cdoEdg== - dependencies: - delayed-stream "~1.0.0" - -console-control-strings@^1.0.0, console-control-strings@~1.1.0: - version "1.1.0" - resolved "https://registry.yarnpkg.com/console-control-strings/-/console-control-strings-1.1.0.tgz#3d7cf4464db6446ea644bf4b39507f9851008e8e" - integrity sha512-ty/fTekppD2fIwRvnZAVdeOiGd1c7YXEixbgJTNzqcxJWKQnjJ/V1bNEEE6hygpM3WjwHFUVK6HTjWSzV4a8sQ== - -cookie@^0.4.1: - version "0.4.2" - resolved "https://registry.yarnpkg.com/cookie/-/cookie-0.4.2.tgz#0e41f24de5ecf317947c82fc789e06a884824432" - integrity sha512-aSWTXFzaKWkvHO1Ny/s+ePFpvKsPnjc551iI41v3ny/ow6tBG5Vd+FuqGNhh1LxOmVzOlGUriIlOaokOvhaStA== - -core-util-is@~1.0.0: - version "1.0.3" - resolved "https://registry.yarnpkg.com/core-util-is/-/core-util-is-1.0.3.tgz#a6042d3634c2b27e9328f837b965fac83808db85" - integrity sha512-ZQBvi1DcpJ4GDqanjucZ2Hj3wEO5pZDS89BWbkcrvdxksJorwUDDZamX9ldFkp9aw2lmBDLgkObEA4DWNJ9FYQ== - -cross-spawn@^7.0.3: - version "7.0.3" - resolved "https://registry.yarnpkg.com/cross-spawn/-/cross-spawn-7.0.3.tgz#f73a85b9d5d41d045551c177e2882d4ac85728a6" - integrity sha512-iRDPJKUPVEND7dHPO8rkbOnPpyDygcDFtWjpeWNCgy8WP2rXcxXL8TskReQl6OrB2G7+UJrags1q15Fudc7G6w== - dependencies: - path-key "^3.1.0" - shebang-command "^2.0.0" - which "^2.0.1" - -dayjs@^1.11.2: - version "1.11.3" - resolved "https://registry.yarnpkg.com/dayjs/-/dayjs-1.11.3.tgz#4754eb694a624057b9ad2224b67b15d552589258" - integrity sha512-xxwlswWOlGhzgQ4TKzASQkUhqERI3egRNqgV4ScR8wlANA/A9tZ7miXa44vTTKEq5l7vWoL5G57bG3zA+Kow0A== - -debug@4, debug@^4.3.2, debug@^4.3.3, debug@^4.3.4: - version "4.3.4" - resolved "https://registry.yarnpkg.com/debug/-/debug-4.3.4.tgz#1319f6579357f2338d3337d2cdd4914bb5dcc865" - integrity sha512-PRWFHuSU3eDtQJPvnNY7Jcket1j0t5OuOsFzPPzsekD52Zl8qUfFIPEiswXqIvHWGVHOgX+7G/vCNNhehwxfkQ== - dependencies: - ms "2.1.2" - -decompress-response@^4.2.0: - version "4.2.1" - resolved "https://registry.yarnpkg.com/decompress-response/-/decompress-response-4.2.1.tgz#414023cc7a302da25ce2ec82d0d5238ccafd8986" - integrity sha512-jOSne2qbyE+/r8G1VU+G/82LBs2Fs4LAsTiLSHOCOMZQl2OKZ6i8i4IyHemTe+/yIXOtTcRQMzPcgyhoFlqPkw== - dependencies: - mimic-response "^2.0.0" - -deep-extend@^0.6.0: - version "0.6.0" - resolved "https://registry.yarnpkg.com/deep-extend/-/deep-extend-0.6.0.tgz#c4fa7c95404a17a9c3e8ca7e1537312b736330ac" - integrity sha512-LOHxIOaPYdHlJRtCQfDIVZtfw/ufM8+rVj649RIHzcm/vGwQRXFt6OPqIFWsm2XEMrNIEtWR64sY1LEKD2vAOA== - -deep-is@~0.1.3: - version "0.1.4" - resolved "https://registry.yarnpkg.com/deep-is/-/deep-is-0.1.4.tgz#a6f2dce612fadd2ef1f519b73551f17e85199831" - integrity sha512-oIPzksmTg4/MriiaYGO+okXDT7ztn/w3Eptv/+gSIdMdKsJo0u4CfYNFJPy+4SKMuCqGw2wxnA+URMg3t8a/bQ== - -delayed-stream@~1.0.0: - version "1.0.0" - resolved "https://registry.yarnpkg.com/delayed-stream/-/delayed-stream-1.0.0.tgz#df3ae199acadfb7d440aaae0b29e2272b24ec619" - integrity sha512-ZySD7Nf91aLB0RxL4KGrKHBXl7Eds1DAmEdcoVawXnLD7SDhpNgtuII2aAkg7a7QS41jxPSZ17p4VdGnMHk3MQ== - -delegates@^1.0.0: - version "1.0.0" - resolved "https://registry.yarnpkg.com/delegates/-/delegates-1.0.0.tgz#84c6e159b81904fdca59a0ef44cd870d31250f9a" - integrity sha512-bd2L678uiWATM6m5Z1VzNCErI3jiGzt6HGY8OVICs40JQq/HALfbyNJmp0UDakEY4pMMaN0Ly5om/B1VI/+xfQ== - -detect-libc@^1.0.3: - version "1.0.3" - resolved "https://registry.yarnpkg.com/detect-libc/-/detect-libc-1.0.3.tgz#fa137c4bd698edf55cd5cd02ac559f91a4c4ba9b" - integrity sha512-pGjwhsmsp4kL2RTz08wcOlGN83otlqHeD/Z5T8GXZB+/YcpQ/dgo+lbU8ZsGxV0HIvqqxo9l7mqYwyYMD9bKDg== - -dir-glob@^3.0.1: - version "3.0.1" - resolved "https://registry.yarnpkg.com/dir-glob/-/dir-glob-3.0.1.tgz#56dbf73d992a4a93ba1584f4534063fd2e41717f" - integrity sha512-WkrWp9GR4KXfKGYzOLmTuGVi1UWFfws377n9cc55/tb6DuqyF6pcQ5AbiHEshaDpY9v6oaSr2XCDidGmMwdzIA== - dependencies: - path-type "^4.0.0" - -emoji-regex@^8.0.0: - version "8.0.0" - resolved "https://registry.yarnpkg.com/emoji-regex/-/emoji-regex-8.0.0.tgz#e818fd69ce5ccfcb404594f842963bf53164cc37" - integrity sha512-MSjYzcWNOA0ewAHpz0MxpYFvwg6yjy1NG3xteoqz644VCo/RPgnr1/GGt+ic3iJTzQ8Eu3TdM14SawnVUmGE6A== - -enabled@2.0.x: - version "2.0.0" - resolved "https://registry.yarnpkg.com/enabled/-/enabled-2.0.0.tgz#f9dd92ec2d6f4bbc0d5d1e64e21d61cd4665e7c2" - integrity sha512-AKrN98kuwOzMIdAizXGI86UFBoo26CL21UM763y1h/GMSJ4/OHU9k2YlsmBpyScFo/wbLzWQJBMCW4+IO3/+OQ== - -end-of-stream@^1.1.0, end-of-stream@^1.4.1: - version "1.4.4" - resolved "https://registry.yarnpkg.com/end-of-stream/-/end-of-stream-1.4.4.tgz#5ae64a5f45057baf3626ec14da0ca5e4b2431eb0" - integrity sha512-+uw1inIHVPQoaVuHzRyXd21icM+cnt4CzD5rW+NC1wjOUSTOs+Te7FOv7AhN7vS9x/oIyhLP5PR1H+phQAHu5Q== - dependencies: - once "^1.4.0" - -escalade@^3.1.1: - version "3.1.1" - resolved "https://registry.yarnpkg.com/escalade/-/escalade-3.1.1.tgz#d8cfdc7000965c5a0174b4a82eaa5c0552742e40" - integrity sha512-k0er2gUkLf8O0zKJiAhmkTnJlTvINGv7ygDNPbeIsX/TJjGJZHuh9B2UxbsaEkmlEo9MfhrSzmhIlhRlI2GXnw== - -escodegen@^2.0.0: - version "2.0.0" - resolved "https://registry.yarnpkg.com/escodegen/-/escodegen-2.0.0.tgz#5e32b12833e8aa8fa35e1bf0befa89380484c7dd" - integrity sha512-mmHKys/C8BFUGI+MAWNcSYoORYLMdPzjrknd2Vc+bUsjN5bXcr8EhrNB+UTqfL1y3I9c4fw2ihgtMPQLBRiQxw== - dependencies: - esprima "^4.0.1" - estraverse "^5.2.0" - esutils "^2.0.2" - optionator "^0.8.1" - optionalDependencies: - source-map "~0.6.1" - -esprima@^4.0.1: - version "4.0.1" - resolved "https://registry.yarnpkg.com/esprima/-/esprima-4.0.1.tgz#13b04cdb3e6c5d19df91ab6987a8695619b0aa71" - integrity sha512-eGuFFw7Upda+g4p+QHvnW0RyTX/SVeJBDM/gCtMARO0cLuT2HcEKnTPvhjV6aGeqrCB/sbNop0Kszm0jsaWU4A== - -estraverse@^5.2.0: - version "5.3.0" - resolved "https://registry.yarnpkg.com/estraverse/-/estraverse-5.3.0.tgz#2eea5290702f26ab8fe5370370ff86c965d21123" - integrity sha512-MMdARuVEQziNTeJD8DgMqmhwR11BRQ/cBP+pLtYdSTnf3MIO8fFeiINEbX36ZdNlfU/7A9f3gUw49B3oQsvwBA== - -esutils@^2.0.2: - version "2.0.3" - resolved "https://registry.yarnpkg.com/esutils/-/esutils-2.0.3.tgz#74d2eb4de0b8da1293711910d50775b9b710ef64" - integrity sha512-kVscqXk4OCp68SZ0dkgEKVi6/8ij300KBWTJq32P/dYeWTSwK41WyTxalN1eRmA5Z9UU/LX9D7FWSmV9SAYx6g== - -execa@^5.0.0, execa@^5.1.1: - version "5.1.1" - resolved "https://registry.yarnpkg.com/execa/-/execa-5.1.1.tgz#f80ad9cbf4298f7bd1d4c9555c21e93741c411dd" - integrity sha512-8uSpZZocAZRBAPIEINJj3Lo9HyGitllczc27Eh5YYojjMFMn8yHMDMaUHE2Jqfq05D/wucwI4JGURyXt1vchyg== - dependencies: - cross-spawn "^7.0.3" - get-stream "^6.0.0" - human-signals "^2.1.0" - is-stream "^2.0.0" - merge-stream "^2.0.0" - npm-run-path "^4.0.1" - onetime "^5.1.2" - signal-exit "^3.0.3" - strip-final-newline "^2.0.0" - -expand-template@^2.0.3: - version "2.0.3" - resolved "https://registry.yarnpkg.com/expand-template/-/expand-template-2.0.3.tgz#6e14b3fcee0f3a6340ecb57d2e8918692052a47c" - integrity sha512-XYfuKMvj4O35f/pOXLObndIRvyQ+/+6AhODh+OKWj9S9498pHHn/IMszH+gt0fBCRWMNfk1ZSp5x3AifmnI2vg== - -fast-deep-equal@^3.1.3: - version "3.1.3" - resolved "https://registry.yarnpkg.com/fast-deep-equal/-/fast-deep-equal-3.1.3.tgz#3a7d56b559d6cbc3eb512325244e619a65c6c525" - integrity sha512-f3qQ9oQy9j2AhBe/H9VC91wLmKBCCU/gDOnKNAYG5hswO7BLKj09Hc5HYNz9cGI++xlpDCIgDaitVs03ATR84Q== - -fast-glob@^3.2.9: - version "3.2.11" - resolved "https://registry.yarnpkg.com/fast-glob/-/fast-glob-3.2.11.tgz#a1172ad95ceb8a16e20caa5c5e56480e5129c1d9" - integrity sha512-xrO3+1bxSo3ZVHAnqzyuewYT6aMFHRAd4Kcs92MAonjwQZLsK9d0SF1IyQ3k5PoirxTW0Oe/RqFgMQ6TcNE5Ew== - dependencies: - "@nodelib/fs.stat" "^2.0.2" - "@nodelib/fs.walk" "^1.2.3" - glob-parent "^5.1.2" - merge2 "^1.3.0" - micromatch "^4.0.4" - -fast-levenshtein@~2.0.6: - version "2.0.6" - resolved "https://registry.yarnpkg.com/fast-levenshtein/-/fast-levenshtein-2.0.6.tgz#3d8a5c66883a16a30ca8643e851f19baa7797917" - integrity sha512-DCXu6Ifhqcks7TZKY3Hxp3y6qphY5SJZmrWMDrKcERSOXWQdMhU9Ig/PYrzyw/ul9jOIyh0N4M0tbC5hodg8dw== - -fastq@^1.6.0: - version "1.13.0" - resolved "https://registry.yarnpkg.com/fastq/-/fastq-1.13.0.tgz#616760f88a7526bdfc596b7cab8c18938c36b98c" - integrity sha512-YpkpUnK8od0o1hmeSc7UUs/eB/vIPWJYjKck2QKIzAf71Vm1AAQ3EbuZB3g2JIy+pg+ERD0vqI79KyZiB2e2Nw== - dependencies: - reusify "^1.0.4" - -fecha@^4.2.0: - version "4.2.3" - resolved "https://registry.yarnpkg.com/fecha/-/fecha-4.2.3.tgz#4d9ccdbc61e8629b259fdca67e65891448d569fd" - integrity sha512-OP2IUU6HeYKJi3i0z4A19kHMQoLVs4Hc+DPqqxI2h/DPZHTm/vjsfC6P0b4jCMy14XizLBqvndQ+UilD7707Jw== - -file-stream-rotator@^0.6.1: - version "0.6.1" - resolved "https://registry.yarnpkg.com/file-stream-rotator/-/file-stream-rotator-0.6.1.tgz#007019e735b262bb6c6f0197e58e5c87cb96cec3" - integrity sha512-u+dBid4PvZw17PmDeRcNOtCP9CCK/9lRN2w+r1xIS7yOL9JFrIBKTvrYsxT4P0pGtThYTn++QS5ChHaUov3+zQ== - dependencies: - moment "^2.29.1" - -fill-range@^7.0.1: - version "7.0.1" - resolved "https://registry.yarnpkg.com/fill-range/-/fill-range-7.0.1.tgz#1919a6a7c75fe38b2c7c77e5198535da9acdda40" - integrity sha512-qOo9F+dMUmC2Lcb4BbVvnKJxTPjCm+RRpe4gDuGrzkL7mEVl/djYSu2OdQ2Pa302N4oqkSg9ir6jaLWJ2USVpQ== - dependencies: - to-regex-range "^5.0.1" - -fn.name@1.x.x: - version "1.1.0" - resolved "https://registry.yarnpkg.com/fn.name/-/fn.name-1.1.0.tgz#26cad8017967aea8731bc42961d04a3d5988accc" - integrity sha512-GRnmB5gPyJpAhTQdSZTSp9uaPSvl09KoYcMQtsB9rQoOmzs9dH6ffeccH+Z+cv6P68Hu5bC6JjRh4Ah/mHSNRw== - -follow-redirects@^1.14.8, follow-redirects@^1.14.9: - version "1.15.1" - resolved "https://registry.yarnpkg.com/follow-redirects/-/follow-redirects-1.15.1.tgz#0ca6a452306c9b276e4d3127483e29575e207ad5" - integrity sha512-yLAMQs+k0b2m7cVxpS1VKJVvoz7SS9Td1zss3XRwXj+ZDH00RJgnuLx7E44wx02kQLrdM3aOOy+FpzS7+8OizA== - -form-data@^4.0.0: - version "4.0.0" - resolved "https://registry.yarnpkg.com/form-data/-/form-data-4.0.0.tgz#93919daeaf361ee529584b9b31664dc12c9fa452" - integrity sha512-ETEklSGi5t0QMZuiXoA/Q6vcnxcLQP5vdugSpuAyi6SVGi2clPPp+xgEhuMaHC+zGgn31Kd235W35f7Hykkaww== - dependencies: - asynckit "^0.4.0" - combined-stream "^1.0.8" - mime-types "^2.1.12" - -from2@^2.3.0: - version "2.3.0" - resolved "https://registry.yarnpkg.com/from2/-/from2-2.3.0.tgz#8bfb5502bde4a4d36cfdeea007fcca21d7e382af" - integrity sha512-OMcX/4IC/uqEPVgGeyfN22LJk6AZrMkRZHxcHBMBvHScDGgwTm2GT2Wkgtocyd3JfZffjj2kYUDXXII0Fk9W0g== - dependencies: - inherits "^2.0.1" - readable-stream "^2.0.0" - -fs-constants@^1.0.0: - version "1.0.0" - resolved "https://registry.yarnpkg.com/fs-constants/-/fs-constants-1.0.0.tgz#6be0de9be998ce16af8afc24497b9ee9b7ccd9ad" - integrity sha512-y6OAwoSIf7FyjMIv94u+b5rdheZEjzR63GTyZJm5qh4Bi+2YgwLCcI/fPFZkL5PSixOt6ZNKm+w+Hfp/Bciwow== - -fs-extra@^10.0.1, fs-extra@^10.1.0: - version "10.1.0" - resolved "https://registry.yarnpkg.com/fs-extra/-/fs-extra-10.1.0.tgz#02873cfbc4084dde127eaa5f9905eef2325d1abf" - integrity sha512-oRXApq54ETRj4eMiFzGnHWGy+zo5raudjuxN0b8H7s/RU2oW0Wvsx9O0ACRN/kRq9E8Vu/ReskGB5o3ji+FzHQ== - dependencies: - graceful-fs "^4.2.0" - jsonfile "^6.0.1" - universalify "^2.0.0" - -fs-extra@^9.1.0: - version "9.1.0" - resolved "https://registry.yarnpkg.com/fs-extra/-/fs-extra-9.1.0.tgz#5954460c764a8da2094ba3554bf839e6b9a7c86d" - integrity sha512-hcg3ZmepS30/7BSFqRvoo3DOMQu7IjqxO5nCDt+zM9XWjb33Wg7ziNT+Qvqbuc3+gWpzO02JubVyk2G4Zvo1OQ== - dependencies: - at-least-node "^1.0.0" - graceful-fs "^4.2.0" - jsonfile "^6.0.1" - universalify "^2.0.0" - -function-bind@^1.1.1: - version "1.1.1" - resolved "https://registry.yarnpkg.com/function-bind/-/function-bind-1.1.1.tgz#a56899d3ea3c9bab874bb9773b7c5ede92f4895d" - integrity sha512-yIovAzMX49sF8Yl58fSCWJ5svSLuaibPxXQJFLmBObTuCr0Mf1KiPopGM9NiFjiYBCbfaa2Fh6breQ6ANVTI0A== - -gauge@~2.7.3: - version "2.7.4" - resolved "https://registry.yarnpkg.com/gauge/-/gauge-2.7.4.tgz#2c03405c7538c39d7eb37b317022e325fb018bf7" - integrity sha512-14x4kjc6lkD3ltw589k0NrPD6cCNTD6CWoVUNpB85+DrtONoZn+Rug6xZU5RvSC4+TZPxA5AnBibQYAvZn41Hg== - dependencies: - aproba "^1.0.3" - console-control-strings "^1.0.0" - has-unicode "^2.0.0" - object-assign "^4.1.0" - signal-exit "^3.0.0" - string-width "^1.0.1" - strip-ansi "^3.0.1" - wide-align "^1.1.0" - -get-caller-file@^2.0.5: - version "2.0.5" - resolved "https://registry.yarnpkg.com/get-caller-file/-/get-caller-file-2.0.5.tgz#4f94412a82db32f36e3b0b9741f8a97feb031f7e" - integrity sha512-DyFP3BM/3YHTQOCUL/w0OZHR0lpKeGrxotcHWcqNEdnltqFwXVfhEBQ94eIo34AfQpo0rGki4cyIiftY06h2Fg== - -get-stream@^6.0.0: - version "6.0.1" - resolved "https://registry.yarnpkg.com/get-stream/-/get-stream-6.0.1.tgz#a262d8eef67aced57c2852ad6167526a43cbf7b7" - integrity sha512-ts6Wi+2j3jQjqi70w5AlN8DFnkSwC+MqmxEzdEALB2qXZYV3X/b1CTfgPLGJNMeAWxdPfU8FO1ms3NUfaHCPYg== - -github-from-package@0.0.0: - version "0.0.0" - resolved "https://registry.yarnpkg.com/github-from-package/-/github-from-package-0.0.0.tgz#97fb5d96bfde8973313f20e8288ef9a167fa64ce" - integrity sha512-SyHy3T1v2NUXn29OsWdxmK6RwHD+vkj3v8en8AOBZ1wBQ/hCAQ5bAQTD02kW4W9tUp/3Qh6J8r9EvntiyCmOOw== - -glob-parent@^5.1.2: - version "5.1.2" - resolved "https://registry.yarnpkg.com/glob-parent/-/glob-parent-5.1.2.tgz#869832c58034fe68a4093c17dc15e8340d8401c4" - integrity sha512-AOIgSQCepiJYwP3ARnGx+5VnTu2HBYdzbGP45eLw1vr3zB3vZLeyed1sC9hnbcOc9/SrMyM5RPQrkGz4aS9Zow== - dependencies: - is-glob "^4.0.1" - -globby@^11.1.0: - version "11.1.0" - resolved "https://registry.yarnpkg.com/globby/-/globby-11.1.0.tgz#bd4be98bb042f83d796f7e3811991fbe82a0d34b" - integrity sha512-jhIXaOzy1sb8IyocaruWSn1TjmnBVs8Ayhcy83rmxNJ8q2uWKCAj3CnJY+KpGSXCueAPc0i05kVvVKtP1t9S3g== - dependencies: - array-union "^2.1.0" - dir-glob "^3.0.1" - fast-glob "^3.2.9" - ignore "^5.2.0" - merge2 "^1.4.1" - slash "^3.0.0" - -graceful-fs@^4.1.6, graceful-fs@^4.2.0, graceful-fs@^4.2.4: - version "4.2.10" - resolved "https://registry.yarnpkg.com/graceful-fs/-/graceful-fs-4.2.10.tgz#147d3a006da4ca3ce14728c7aefc287c367d7a6c" - integrity sha512-9ByhssR2fPVsNZj478qUUbKfmL0+t5BDVyjShtyZZLiK7ZDAArFFfopyOTj0M05wE2tJPisA4iTnnXl2YoPvOA== - -has-flag@^4.0.0: - version "4.0.0" - resolved "https://registry.yarnpkg.com/has-flag/-/has-flag-4.0.0.tgz#944771fd9c81c81265c4d6941860da06bb59479b" - integrity sha512-EykJT/Q1KjTWctppgIAgfSO0tKVuZUjhgMr17kqTumMl6Afv3EISleU7qZUzoXDFTAHTDC4NOoG/ZxU3EvlMPQ== - -has-unicode@^2.0.0: - version "2.0.1" - resolved "https://registry.yarnpkg.com/has-unicode/-/has-unicode-2.0.1.tgz#e0e6fe6a28cf51138855e086d1691e771de2a8b9" - integrity sha512-8Rf9Y83NBReMnx0gFzA8JImQACstCYWUplepDa9xprwwtmgEZUF0h/i5xSA625zB/I37EtrswSST6OXxwaaIJQ== - -has@^1.0.3: - version "1.0.3" - resolved "https://registry.yarnpkg.com/has/-/has-1.0.3.tgz#722d7cbfc1f6aa8241f16dd814e011e1f41e8796" - integrity sha512-f2dvO0VU6Oej7RkWJGrehjbzMAjFp5/VKPp5tTpWIV4JHHZK1/BxbFRtf/siA2SWTe09caDmVtYYzWEIbBS4zw== - dependencies: - function-bind "^1.1.1" - -https-proxy-agent@^5.0.0: - version "5.0.1" - resolved "https://registry.yarnpkg.com/https-proxy-agent/-/https-proxy-agent-5.0.1.tgz#c59ef224a04fe8b754f3db0063a25ea30d0005d6" - integrity sha512-dFcAjpTQFgoLMzC2VwU+C/CbS7uRL0lWmxDITmqm7C+7F0Odmj6s9l6alZc6AELXhrnggM2CeWSXHGOdX2YtwA== - dependencies: - agent-base "6" - debug "4" - -human-signals@^2.1.0: - version "2.1.0" - resolved "https://registry.yarnpkg.com/human-signals/-/human-signals-2.1.0.tgz#dc91fcba42e4d06e4abaed33b3e7a3c02f514ea0" - integrity sha512-B4FFZ6q/T2jhhksgkbEW3HBvWIfDW85snkQgawt07S7J5QXTk6BkNV+0yAeZrM5QpMAdYlocGoljn0sJ/WQkFw== - -ieee754@^1.1.13: - version "1.2.1" - resolved "https://registry.yarnpkg.com/ieee754/-/ieee754-1.2.1.tgz#8eb7a10a63fff25d15a57b001586d177d1b0d352" - integrity sha512-dcyqhDvX1C46lXZcVqCpK+FtMRQVdIMN6/Df5js2zouUsqG7I6sFxitIC+7KYK29KdXOLHdu9zL4sFnoVQnqaA== - -ignore@^5.2.0: - version "5.2.0" - resolved "https://registry.yarnpkg.com/ignore/-/ignore-5.2.0.tgz#6d3bac8fa7fe0d45d9f9be7bac2fc279577e345a" - integrity sha512-CmxgYGiEPCLhfLnpPp1MoRmifwEIOgjcHXxOBjv7mY96c+eWScsOP9c112ZyLdWHi0FxHjI+4uVhKYp/gcdRmQ== - -immediate@~3.0.5: - version "3.0.6" - resolved "https://registry.yarnpkg.com/immediate/-/immediate-3.0.6.tgz#9db1dbd0faf8de6fbe0f5dd5e56bb606280de69b" - integrity sha512-XXOFtyqDjNDAQxVfYxuF7g9Il/IbWmmlQg2MYKOH8ExIT1qg6xc4zyS3HaEEATgs1btfzxq15ciUiY7gjSXRGQ== - -inherits@^2.0.1, inherits@^2.0.3, inherits@^2.0.4, inherits@~2.0.3: - version "2.0.4" - resolved "https://registry.yarnpkg.com/inherits/-/inherits-2.0.4.tgz#0fa2c64f932917c3433a0ded55363aae37416b7c" - integrity sha512-k/vGaX4/Yla3WzyMCvTQOXYeIHvqOKtnqBduzTHpzpQZzAskKMhZ2K+EnBiSM9zGSoIFeMpXKxa4dYeZIQqewQ== - -ini@~1.3.0: - version "1.3.8" - resolved "https://registry.yarnpkg.com/ini/-/ini-1.3.8.tgz#a29da425b48806f34767a4efce397269af28432c" - integrity sha512-JV/yugV2uzW5iMRSiZAyDtQd+nxtUnjeLt0acNdw98kKLrvuRVyB80tsREOE7yvGVgalhZ6RNXCmEHkUKBKxew== - -into-stream@^6.0.0: - version "6.0.0" - resolved "https://registry.yarnpkg.com/into-stream/-/into-stream-6.0.0.tgz#4bfc1244c0128224e18b8870e85b2de8e66c6702" - integrity sha512-XHbaOAvP+uFKUFsOgoNPRjLkwB+I22JFPFe5OjTkQ0nwgj6+pSjb4NmB6VMxaPshLiOf+zcpOCBQuLwC1KHhZA== - dependencies: - from2 "^2.3.0" - p-is-promise "^3.0.0" - -is-arrayish@^0.3.1: - version "0.3.2" - resolved "https://registry.yarnpkg.com/is-arrayish/-/is-arrayish-0.3.2.tgz#4574a2ae56f7ab206896fb431eaeed066fdf8f03" - integrity sha512-eVRqCvVlZbuw3GrM63ovNSNAeA1K16kaR/LRY/92w0zxQ5/1YzwblUX652i4Xs9RwAGjW9d9y6X88t8OaAJfWQ== - -is-core-module@2.9.0, is-core-module@^2.8.1: - version "2.9.0" - resolved "https://registry.yarnpkg.com/is-core-module/-/is-core-module-2.9.0.tgz#e1c34429cd51c6dd9e09e0799e396e27b19a9c69" - integrity sha512-+5FPy5PnwmO3lvfMb0AsoPaBG+5KHUI0wYFXOtYPnVVVspTFUuMZNfNaNVRt3FZadstu2c8x23vykRW/NBoU6A== - dependencies: - has "^1.0.3" - -is-extglob@^2.1.1: - version "2.1.1" - resolved "https://registry.yarnpkg.com/is-extglob/-/is-extglob-2.1.1.tgz#a88c02535791f02ed37c76a1b9ea9773c833f8c2" - integrity sha512-SbKbANkN603Vi4jEZv49LeVJMn4yGwsbzZworEoyEiutsN3nJYdbO36zfhGJ6QEDpOZIFkDtnq5JRxmvl3jsoQ== - -is-fullwidth-code-point@^1.0.0: - version "1.0.0" - resolved "https://registry.yarnpkg.com/is-fullwidth-code-point/-/is-fullwidth-code-point-1.0.0.tgz#ef9e31386f031a7f0d643af82fde50c457ef00cb" - integrity sha512-1pqUqRjkhPJ9miNq9SwMfdvi6lBJcd6eFxvfaivQhaH3SgisfiuudvFntdKOmxuee/77l+FPjKrQjWvmPjWrRw== - dependencies: - number-is-nan "^1.0.0" - -is-fullwidth-code-point@^3.0.0: - version "3.0.0" - resolved "https://registry.yarnpkg.com/is-fullwidth-code-point/-/is-fullwidth-code-point-3.0.0.tgz#f116f8064fe90b3f7844a38997c0b75051269f1d" - integrity sha512-zymm5+u+sCsSWyD9qNaejV3DFvhCKclKdizYaJUuHA83RLjb7nSuGnddCHGv0hk+KY7BMAlsWeK4Ueg6EV6XQg== - -is-glob@^4.0.1: - version "4.0.3" - resolved "https://registry.yarnpkg.com/is-glob/-/is-glob-4.0.3.tgz#64f61e42cbbb2eec2071a9dac0b28ba1e65d5084" - integrity sha512-xelSayHH36ZgE7ZWhli7pW34hNbNl8Ojv5KVmkJD4hBdD3th8Tfk9vYasLM+mXWOZhFkgZfxhLSnrwRr4elSSg== - dependencies: - is-extglob "^2.1.1" - -is-number@^7.0.0: - version "7.0.0" - resolved "https://registry.yarnpkg.com/is-number/-/is-number-7.0.0.tgz#7535345b896734d5f80c4d06c50955527a14f12b" - integrity sha512-41Cifkg6e8TylSpdtTpeLVMqvSBEVzTttHvERD741+pnZ8ANv0004MRL43QKPDlK9cGvNp6NZWZUBlbGXYxxng== - -is-stream@^2.0.0: - version "2.0.1" - resolved "https://registry.yarnpkg.com/is-stream/-/is-stream-2.0.1.tgz#fac1e3d53b97ad5a9d0ae9cef2389f5810a5c077" - integrity sha512-hFoiJiTl63nn+kstHGBtewWSKnQLpyb155KHheA1l39uvtO9nWIop1p3udqPcUd/xbF1VLMO4n7OI6p7RbngDg== - -isarray@~1.0.0: - version "1.0.0" - resolved "https://registry.yarnpkg.com/isarray/-/isarray-1.0.0.tgz#bb935d48582cba168c06834957a54a3e07124f11" - integrity sha512-VLghIWNM6ELQzo7zwmcg0NmTVyWKYjvIeM83yjp0wRDTmUnrM678fQbcKBo6n2CJEF0szoG//ytg+TKla89ALQ== - -isexe@^2.0.0: - version "2.0.0" - resolved "https://registry.yarnpkg.com/isexe/-/isexe-2.0.0.tgz#e8fbf374dc556ff8947a10dcb0572d633f2cfa10" - integrity sha512-RHxMLp9lnKHGHRng9QFhRCMbYAcVpn69smSGcq3f36xjgVVWThj4qqLbTLlq7Ssj8B+fIQ1EuCEGI2lKsyQeIw== - -json-logic-js@^2.0.2: - version "2.0.2" - resolved "https://registry.yarnpkg.com/json-logic-js/-/json-logic-js-2.0.2.tgz#b613e095f5e598cb78f7b9a2bbf638e74cf98158" - integrity sha512-ZBtBdMJieqQcH7IX/LaBsr5pX+Y5JIW+EhejtM3Ffg2jdN9Iwf+Ht6TbHnvAZ/YtwyuhPaCBlnvzrwVeWdvGDQ== - -json5@^2.2.1: - version "2.2.3" - resolved "https://registry.yarnpkg.com/json5/-/json5-2.2.3.tgz#78cd6f1a19bdc12b73db5ad0c61efd66c1e29283" - integrity sha512-XmOWe7eyHYH14cLdVPoyg+GOH3rYX++KpzrylJwSW98t3Nk+U8XOl8FWKOgwtzdb8lXGf6zYwDUzeHMWfxasyg== - -jsonfile@^6.0.1: - version "6.1.0" - resolved "https://registry.yarnpkg.com/jsonfile/-/jsonfile-6.1.0.tgz#bc55b2634793c679ec6403094eb13698a6ec0aae" - integrity sha512-5dgndWOriYSm5cnYaJNhalLNDKOqFwyDB/rr1E9ZsGciGvKPs8R2xYGCacuf3z6K1YKDz182fd+fY3cn3pMqXQ== - dependencies: - universalify "^2.0.0" - optionalDependencies: - graceful-fs "^4.1.6" - -kuler@^2.0.0: - version "2.0.0" - resolved "https://registry.yarnpkg.com/kuler/-/kuler-2.0.0.tgz#e2c570a3800388fb44407e851531c1d670b061b3" - integrity sha512-Xq9nH7KlWZmXAtodXDDRE7vs6DU1gTU8zYDHDiWLSip45Egwq3plLHzPn27NgvzL2r1LMPC1vdqh98sQxtqj4A== - -levn@~0.3.0: - version "0.3.0" - resolved "https://registry.yarnpkg.com/levn/-/levn-0.3.0.tgz#3b09924edf9f083c0490fdd4c0bc4421e04764ee" - integrity sha512-0OO4y2iOHix2W6ujICbKIaEQXvFQHue65vUG3pb5EUomzPI90z9hsA1VsO/dbIIpC53J8gxM9Q4Oho0jrCM/yA== - dependencies: - prelude-ls "~1.1.2" - type-check "~0.3.2" - -lie@3.1.1: - version "3.1.1" - resolved "https://registry.yarnpkg.com/lie/-/lie-3.1.1.tgz#9a436b2cc7746ca59de7a41fa469b3efb76bd87e" - integrity sha512-RiNhHysUjhrDQntfYSfY4MU24coXXdEOgw9WGcKHNeEwffDYbF//u87M1EWaMGzuFoSbqW0C9C6lEEhDOAswfw== - dependencies: - immediate "~3.0.5" - -localforage@^1.8.1: - version "1.10.0" - resolved "https://registry.yarnpkg.com/localforage/-/localforage-1.10.0.tgz#5c465dc5f62b2807c3a84c0c6a1b1b3212781dd4" - integrity sha512-14/H1aX7hzBBmmh7sGPd+AOMkkIrHM3Z1PAyGgZigA1H1p5O5ANnMyWzvpAETtG68/dC4pC0ncy3+PPGzXZHPg== - dependencies: - lie "3.1.1" - -logform@^2.3.2, logform@^2.4.0: - version "2.4.0" - resolved "https://registry.yarnpkg.com/logform/-/logform-2.4.0.tgz#131651715a17d50f09c2a2c1a524ff1a4164bcfe" - integrity sha512-CPSJw4ftjf517EhXZGGvTHHkYobo7ZCc0kvwUoOYcjfR2UVrI66RHj8MCrfAdEitdmFqbu2BYdYs8FHHZSb6iw== - dependencies: - "@colors/colors" "1.5.0" - fecha "^4.2.0" - ms "^2.1.1" - safe-stable-stringify "^2.3.1" - triple-beam "^1.3.0" - -lru-cache@^6.0.0: - version "6.0.0" - resolved "https://registry.yarnpkg.com/lru-cache/-/lru-cache-6.0.0.tgz#6d6fe6570ebd96aaf90fcad1dafa3b2566db3a94" - integrity sha512-Jo6dJ04CmSjuznwJSS3pUeWmd/H0ffTlkXXgwZi+eq1UCmqQwCh+eLsYOYCwY991i2Fah4h1BEMCx4qThGbsiA== - dependencies: - yallist "^4.0.0" - -lru_map@^0.3.3: - version "0.3.3" - resolved "https://registry.yarnpkg.com/lru_map/-/lru_map-0.3.3.tgz#b5c8351b9464cbd750335a79650a0ec0e56118dd" - integrity sha512-Pn9cox5CsMYngeDbmChANltQl+5pi6XmTrraMSzhPmMBbmgcxmqWry0U3PGapCU1yB4/LqCcom7qhHZiF/jGfQ== - -merge-stream@^2.0.0: - version "2.0.0" - resolved "https://registry.yarnpkg.com/merge-stream/-/merge-stream-2.0.0.tgz#52823629a14dd00c9770fb6ad47dc6310f2c1f60" - integrity sha512-abv/qOcuPfk3URPfDzmZU1LKmuw8kT+0nIHvKrKgFrwifol/doWcdA4ZqsWQ8ENrFKkd67Mfpo/LovbIUsbt3w== - -merge2@^1.3.0, merge2@^1.4.1: - version "1.4.1" - resolved "https://registry.yarnpkg.com/merge2/-/merge2-1.4.1.tgz#4368892f885e907455a6fd7dc55c0c9d404990ae" - integrity sha512-8q7VEgMJW4J8tcfVPy8g09NcQwZdbwFEqhe/WZkoIzjn/3TGDwtOCYtXGxA3O8tPzpczCCDgv+P2P5y00ZJOOg== - -micromatch@^4.0.4: - version "4.0.5" - resolved "https://registry.yarnpkg.com/micromatch/-/micromatch-4.0.5.tgz#bc8999a7cbbf77cdc89f132f6e467051b49090c6" - integrity sha512-DMy+ERcEW2q8Z2Po+WNXuw3c5YaUSFjAO5GsJqfEl7UjvtIuFKO6ZrKvcItdy98dwFI2N1tg3zNIdKaQT+aNdA== - dependencies: - braces "^3.0.2" - picomatch "^2.3.1" - -mime-db@1.52.0: - version "1.52.0" - resolved "https://registry.yarnpkg.com/mime-db/-/mime-db-1.52.0.tgz#bbabcdc02859f4987301c856e3387ce5ec43bf70" - integrity sha512-sPU4uV7dYlvtWJxwwxHD0PuihVNiE7TyAbQ5SWxDCB9mUYvOgroQOwYQQOKPJ8CIbE+1ETVlOoK1UC2nU3gYvg== - -mime-types@^2.1.12: - version "2.1.35" - resolved "https://registry.yarnpkg.com/mime-types/-/mime-types-2.1.35.tgz#381a871b62a734450660ae3deee44813f70d959a" - integrity sha512-ZDY+bPm5zTTF+YpCrAU9nK0UgICYPT0QtT1NZWFv4s++TNkcgVaT0g6+4R2uI4MjQjzysHB1zxuWL50hzaeXiw== - dependencies: - mime-db "1.52.0" - -mimic-fn@^2.1.0: - version "2.1.0" - resolved "https://registry.yarnpkg.com/mimic-fn/-/mimic-fn-2.1.0.tgz#7ed2c2ccccaf84d3ffcb7a69b57711fc2083401b" - integrity sha512-OqbOk5oEQeAZ8WXWydlu9HJjz9WVdEIvamMCcXmuqUYjTknH/sqsWvhQ3vgwKFRR1HpjvNBKQ37nbJgYzGqGcg== - -mimic-response@^2.0.0: - version "2.1.0" - resolved "https://registry.yarnpkg.com/mimic-response/-/mimic-response-2.1.0.tgz#d13763d35f613d09ec37ebb30bac0469c0ee8f43" - integrity sha512-wXqjST+SLt7R009ySCglWBCFpjUygmCIfD790/kVbiGmUgfYGuB14PiTd5DwVxSV4NcYHjzMkoj5LjQZwTQLEA== - -minimist@^1.2.0, minimist@^1.2.3, minimist@^1.2.5, minimist@^1.2.6: - version "1.2.6" - resolved "https://registry.yarnpkg.com/minimist/-/minimist-1.2.6.tgz#8637a5b759ea0d6e98702cfb3a9283323c93af44" - integrity sha512-Jsjnk4bw3YJqYzbdyBiNsPWHPfO++UGG749Cxs6peCu5Xg4nrena6OVxOYxrQTqww0Jmwt+Ref8rggumkTLz9Q== - -mkdirp-classic@^0.5.2, mkdirp-classic@^0.5.3: - version "0.5.3" - resolved "https://registry.yarnpkg.com/mkdirp-classic/-/mkdirp-classic-0.5.3.tgz#fa10c9115cc6d8865be221ba47ee9bed78601113" - integrity sha512-gKLcREMhtuZRwRAfqP3RFW+TK4JqApVBtOIftVgjuABpAtpxhPGaDcfvbhNvD0B8iD1oUr/txX35NjcaY6Ns/A== - -moment@^2.29.1: - version "2.29.4" - resolved "https://registry.yarnpkg.com/moment/-/moment-2.29.4.tgz#3dbe052889fe7c1b2ed966fcb3a77328964ef108" - integrity sha512-5LC9SOxjSc2HF6vO2CyuTDNivEdoz2IvyJJGj6X8DJ0eFyfszE0QiEd+iXmBvUP3WHxSjFH/vIsA0EN00cgr8w== - -ms@2.1.2: - version "2.1.2" - resolved "https://registry.yarnpkg.com/ms/-/ms-2.1.2.tgz#d09d1f357b443f493382a8eb3ccd183872ae6009" - integrity sha512-sGkPx+VjMtmA6MX27oA4FBFELFCZZ4S4XqeGOXCv68tT+jb3vk/RyaKWP0PTKyWtmLSM0b+adUTEvbs1PEaH2w== - -ms@^2.1.1: - version "2.1.3" - resolved "https://registry.yarnpkg.com/ms/-/ms-2.1.3.tgz#574c8138ce1d2b5861f0b44579dbadd60c6615b2" - integrity sha512-6FlzubTLZG3J2a/NVCAleEhjzq5oxgHyaCU9yYXvcLsvoVaHJq/s5xXI6/XXP6tz7R9xAOtHnSO/tXtF3WRTlA== - -multistream@^4.1.0: - version "4.1.0" - resolved "https://registry.yarnpkg.com/multistream/-/multistream-4.1.0.tgz#7bf00dfd119556fbc153cff3de4c6d477909f5a8" - integrity sha512-J1XDiAmmNpRCBfIWJv+n0ymC4ABcf/Pl+5YvC5B/D2f/2+8PtHvCNxMPKiQcZyi922Hq69J2YOpb1pTywfifyw== - dependencies: - once "^1.4.0" - readable-stream "^3.6.0" - -napi-build-utils@^1.0.1: - version "1.0.2" - resolved "https://registry.yarnpkg.com/napi-build-utils/-/napi-build-utils-1.0.2.tgz#b1fddc0b2c46e380a0b7a76f984dd47c41a13806" - integrity sha512-ONmRUqK7zj7DWX0D9ADe03wbwOBZxNAfF20PlGfCWQcD3+/MakShIHrMqx9YwPTfxDdF1zLeL+RGZiR9kGMLdg== - -node-abi@^2.21.0: - version "2.30.1" - resolved "https://registry.yarnpkg.com/node-abi/-/node-abi-2.30.1.tgz#c437d4b1fe0e285aaf290d45b45d4d7afedac4cf" - integrity sha512-/2D0wOQPgaUWzVSVgRMx+trKJRC2UG4SUc4oCJoXx9Uxjtp0Vy3/kt7zcbxHF8+Z/pK3UloLWzBISg72brfy1w== - dependencies: - semver "^5.4.1" - -node-addon-api@^4.3.0: - version "4.3.0" - resolved "https://registry.yarnpkg.com/node-addon-api/-/node-addon-api-4.3.0.tgz#52a1a0b475193e0928e98e0426a0d1254782b77f" - integrity sha512-73sE9+3UaLYYFmDsFZnqCInzPyh3MqIwZO9cw58yIqAZhONrrabrYyYe3TuIqtIiOuTXVhsGau8hcrhhwSsDIQ== - -node-fetch@^2.6.6: - version "2.6.7" - resolved "https://registry.yarnpkg.com/node-fetch/-/node-fetch-2.6.7.tgz#24de9fba827e3b4ae44dc8b20256a379160052ad" - integrity sha512-ZjMPFEfVx5j+y2yF35Kzx5sF7kDzxuDj6ziH4FFbOp87zKDZNx8yExJIb05OGF4Nlt9IHFIMBkRl41VdvcNdbQ== - dependencies: - whatwg-url "^5.0.0" - -node-gyp-build@^4.3.0: - version "4.4.0" - resolved "https://registry.yarnpkg.com/node-gyp-build/-/node-gyp-build-4.4.0.tgz#42e99687ce87ddeaf3a10b99dc06abc11021f3f4" - integrity sha512-amJnQCcgtRVw9SvoebO3BKGESClrfXGCUTX9hSn1OuGQTQBOZmVd0Z0OlecpuRksKvbsUqALE8jls/ErClAPuQ== - -npm-run-path@^4.0.1: - version "4.0.1" - resolved "https://registry.yarnpkg.com/npm-run-path/-/npm-run-path-4.0.1.tgz#b7ecd1e5ed53da8e37a55e1c2269e0b97ed748ea" - integrity sha512-S48WzZW777zhNIrn7gxOlISNAqi9ZC/uQFnRdbeIHhZhCA6UqpkOT8T1G7BvfdgP4Er8gF4sUbaS0i7QvIfCWw== - dependencies: - path-key "^3.0.0" - -npmlog@^4.0.1: - version "4.1.2" - resolved "https://registry.yarnpkg.com/npmlog/-/npmlog-4.1.2.tgz#08a7f2a8bf734604779a9efa4ad5cc717abb954b" - integrity sha512-2uUqazuKlTaSI/dC8AzicUck7+IrEaOnN/e0jd3Xtt1KcGpwx30v50mL7oPyr/h9bL3E4aZccVwpwP+5W9Vjkg== - dependencies: - are-we-there-yet "~1.1.2" - console-control-strings "~1.1.0" - gauge "~2.7.3" - set-blocking "~2.0.0" - -nrf-intel-hex@^1.3.0: - version "1.3.0" - resolved "https://registry.yarnpkg.com/nrf-intel-hex/-/nrf-intel-hex-1.3.0.tgz#d29079ed5cde4ff3674e1865e384c2c89f31b610" - integrity sha512-oXwBJxX/0Jc4fe2Jxjv3Mw9/qw9JdToDLvJuozfVx+twpkc2oSUm8W/OODX6W4kmWOaYA11ORpGLfQ8BP7mndw== - -number-is-nan@^1.0.0: - version "1.0.1" - resolved "https://registry.yarnpkg.com/number-is-nan/-/number-is-nan-1.0.1.tgz#097b602b53422a522c1afb8790318336941a011d" - integrity sha512-4jbtZXNAsfZbAHiiqjLPBiCl16dES1zI4Hpzzxw61Tk+loF+sBDBKx1ICKKKwIqQ7M0mFn1TmkN7euSncWgHiQ== - -object-assign@^4.1.0: - version "4.1.1" - resolved "https://registry.yarnpkg.com/object-assign/-/object-assign-4.1.1.tgz#2109adc7965887cfc05cbbd442cac8bfbb360863" - integrity sha512-rJgTQnkUnH1sFw8yT6VSU3zD3sWmu6sZhIseY8VX+GRu3P6F7Fu+JNDoXfklElbLJSnc3FUQHVe4cU5hj+BcUg== - -object-hash@^2.0.1: - version "2.2.0" - resolved "https://registry.yarnpkg.com/object-hash/-/object-hash-2.2.0.tgz#5ad518581eefc443bd763472b8ff2e9c2c0d54a5" - integrity sha512-gScRMn0bS5fH+IuwyIFgnh9zBdo4DV+6GhygmWM9HyNJSgS0hScp1f5vjtm7oIIOiT9trXrShAkLFSc2IqKNgw== - -once@^1.3.1, once@^1.4.0: - version "1.4.0" - resolved "https://registry.yarnpkg.com/once/-/once-1.4.0.tgz#583b1aa775961d4b113ac17d9c50baef9dd76bd1" - integrity sha512-lNaJgI+2Q5URQBkccEKHTQOPaXdUxnZZElQTZY0MFUAuaEqe1E+Nyvgdz/aIyNi6Z9MzO5dv1H8n58/GELp3+w== - dependencies: - wrappy "1" - -one-time@^1.0.0: - version "1.0.0" - resolved "https://registry.yarnpkg.com/one-time/-/one-time-1.0.0.tgz#e06bc174aed214ed58edede573b433bbf827cb45" - integrity sha512-5DXOiRKwuSEcQ/l0kGCF6Q3jcADFv5tSmRaJck/OqkVFcOzutB134KRSfF0xDrL39MNnqxbHBbUUcjZIhTgb2g== - dependencies: - fn.name "1.x.x" - -onetime@^5.1.2: - version "5.1.2" - resolved "https://registry.yarnpkg.com/onetime/-/onetime-5.1.2.tgz#d0e96ebb56b07476df1dd9c4806e5237985ca45e" - integrity sha512-kbpaSSGJTWdAY5KPVeMOKXSrPtr8C8C7wodJbcsd51jRnmD+GZu8Y0VoU6Dm5Z4vWr0Ig/1NKuWRKf7j5aaYSg== - dependencies: - mimic-fn "^2.1.0" - -optionator@^0.8.1: - version "0.8.3" - resolved "https://registry.yarnpkg.com/optionator/-/optionator-0.8.3.tgz#84fa1d036fe9d3c7e21d99884b601167ec8fb495" - integrity sha512-+IW9pACdk3XWmmTXG8m3upGUJst5XRGzxMRjXzAuJ1XnIFNvfhjjIuYkDvysnPQ7qzqVzLt78BCruntqRhWQbA== - dependencies: - deep-is "~0.1.3" - fast-levenshtein "~2.0.6" - levn "~0.3.0" - prelude-ls "~1.1.2" - type-check "~0.3.2" - word-wrap "~1.2.3" - -p-is-promise@^3.0.0: - version "3.0.0" - resolved "https://registry.yarnpkg.com/p-is-promise/-/p-is-promise-3.0.0.tgz#58e78c7dfe2e163cf2a04ff869e7c1dba64a5971" - integrity sha512-Wo8VsW4IRQSKVXsJCn7TomUaVtyfjVDn3nUP7kE967BQk0CwFpdbZs0X0uk5sW9mkBa9eNM7hCMaG93WUAwxYQ== - -path-key@^3.0.0, path-key@^3.1.0: - version "3.1.1" - resolved "https://registry.yarnpkg.com/path-key/-/path-key-3.1.1.tgz#581f6ade658cbba65a0d3380de7753295054f375" - integrity sha512-ojmeN0qd+y0jszEtoY48r0Peq5dwMEkIlCOu6Q5f41lfkswXuKtYrhgoTpLnyIcHm24Uhqx+5Tqm2InSwLhE6Q== - -path-parse@^1.0.7: - version "1.0.7" - resolved "https://registry.yarnpkg.com/path-parse/-/path-parse-1.0.7.tgz#fbc114b60ca42b30d9daf5858e4bd68bbedb6735" - integrity sha512-LDJzPVEEEPR+y48z93A0Ed0yXb8pAByGWo/k5YYdYgpY2/2EsOsksJrq7lOHxryrVOn1ejG6oAp8ahvOIQD8sw== - -path-type@^4.0.0: - version "4.0.0" - resolved "https://registry.yarnpkg.com/path-type/-/path-type-4.0.0.tgz#84ed01c0a7ba380afe09d90a8c180dcd9d03043b" - integrity sha512-gDKb8aZMDeD/tZWs9P6+q0J9Mwkdl6xMV8TjnGP3qJVJ06bdMgkbBlLU8IdfOsIsFz2BW1rNVT3XuNEl8zPAvw== - -picomatch@^2.3.1: - version "2.3.1" - resolved "https://registry.yarnpkg.com/picomatch/-/picomatch-2.3.1.tgz#3ba3833733646d9d3e4995946c1365a67fb07a42" - integrity sha512-JU3teHTNjmE2VCGFzuY8EXzCDVwEqB2a8fsIvwaStHhAWJEeVd1o1QD80CU6+ZdEXXSLbSsuLwJjkCBWqRQUVA== - -pkg-fetch@3.4.1: - version "3.4.1" - resolved "https://registry.yarnpkg.com/pkg-fetch/-/pkg-fetch-3.4.1.tgz#be68bb9f7fdb0f6ed995abc518ab2e35aa64d2fd" - integrity sha512-fS4cdayCa1r4jHkOKGPJKnS9PEs6OWZst+s+m0+CmhmPZObMnxoRnf9T9yUWl+lzM2b5aJF7cnQIySCT7Hq8Dg== - dependencies: - chalk "^4.1.2" - fs-extra "^9.1.0" - https-proxy-agent "^5.0.0" - node-fetch "^2.6.6" - progress "^2.0.3" - semver "^7.3.5" - tar-fs "^2.1.1" - yargs "^16.2.0" - -pkg@^5.7.0: - version "5.7.0" - resolved "https://registry.yarnpkg.com/pkg/-/pkg-5.7.0.tgz#6422df05e8aa147764be6ef912921d0fa719ea95" - integrity sha512-PTiAjNq/CGAtK5qUBR6pjheqnipTFjeecgSgIKEcAOJA4GpmZeOZC8pMOoT0rfes5vHsmcFo7wbSRTAmXQurrg== - dependencies: - "@babel/parser" "7.17.10" - "@babel/types" "7.17.10" - chalk "^4.1.2" - escodegen "^2.0.0" - fs-extra "^9.1.0" - globby "^11.1.0" - into-stream "^6.0.0" - is-core-module "2.9.0" - minimist "^1.2.6" - multistream "^4.1.0" - pkg-fetch "3.4.1" - prebuild-install "6.1.4" - resolve "^1.22.0" - stream-meter "^1.0.4" - -prebuild-install@6.1.4: - version "6.1.4" - resolved "https://registry.yarnpkg.com/prebuild-install/-/prebuild-install-6.1.4.tgz#ae3c0142ad611d58570b89af4986088a4937e00f" - integrity sha512-Z4vpywnK1lBg+zdPCVCsKq0xO66eEV9rWo2zrROGGiRS4JtueBOdlB1FnY8lcy7JsUud/Q3ijUxyWN26Ika0vQ== - dependencies: - detect-libc "^1.0.3" - expand-template "^2.0.3" - github-from-package "0.0.0" - minimist "^1.2.3" - mkdirp-classic "^0.5.3" - napi-build-utils "^1.0.1" - node-abi "^2.21.0" - npmlog "^4.0.1" - pump "^3.0.0" - rc "^1.2.7" - simple-get "^3.0.3" - tar-fs "^2.0.0" - tunnel-agent "^0.6.0" - -prelude-ls@~1.1.2: - version "1.1.2" - resolved "https://registry.yarnpkg.com/prelude-ls/-/prelude-ls-1.1.2.tgz#21932a549f5e52ffd9a827f570e04be62a97da54" - integrity sha512-ESF23V4SKG6lVSGZgYNpbsiaAkdab6ZgOxe52p7+Kid3W3u3bxR4Vfd/o21dmN7jSt0IwgZ4v5MUd26FEtXE9w== - -process-nextick-args@~2.0.0: - version "2.0.1" - resolved "https://registry.yarnpkg.com/process-nextick-args/-/process-nextick-args-2.0.1.tgz#7820d9b16120cc55ca9ae7792680ae7dba6d7fe2" - integrity sha512-3ouUOpQhtgrbOa17J7+uxOTpITYWaGP7/AhoR3+A+/1e9skrzelGi/dXzEYyvbxubEF6Wn2ypscTKiKJFFn1ag== - -progress@^2.0.3: - version "2.0.3" - resolved "https://registry.yarnpkg.com/progress/-/progress-2.0.3.tgz#7e8cf8d8f5b8f239c1bc68beb4eb78567d572ef8" - integrity sha512-7PiHtLll5LdnKIMw100I+8xJXR5gW2QwWYkT6iJva0bXitZKa/XMrSbdmg3r2Xnaidz9Qumd0VPaMrZlF9V9sA== - -proper-lockfile@^4.1.2: - version "4.1.2" - resolved "https://registry.yarnpkg.com/proper-lockfile/-/proper-lockfile-4.1.2.tgz#c8b9de2af6b2f1601067f98e01ac66baa223141f" - integrity sha512-TjNPblN4BwAWMXU8s9AEz4JmQxnD1NNL7bNOY/AKUzyamc379FWASUhc/K1pL2noVb+XmZKLL68cjzLsiOAMaA== - dependencies: - graceful-fs "^4.2.4" - retry "^0.12.0" - signal-exit "^3.0.2" - -pump@^3.0.0: - version "3.0.0" - resolved "https://registry.yarnpkg.com/pump/-/pump-3.0.0.tgz#b4a2116815bde2f4e1ea602354e8c75565107a64" - integrity sha512-LwZy+p3SFs1Pytd/jYct4wpv49HiYCqd9Rlc5ZVdk0V+8Yzv6jR5Blk3TRmPL1ft69TxP0IMZGJ+WPFU2BFhww== - dependencies: - end-of-stream "^1.1.0" - once "^1.3.1" - -queue-microtask@^1.2.2: - version "1.2.3" - resolved "https://registry.yarnpkg.com/queue-microtask/-/queue-microtask-1.2.3.tgz#4929228bbc724dfac43e0efb058caf7b6cfb6243" - integrity sha512-NuaNSa6flKT5JaSYQzJok04JzTL1CA6aGhv5rfLW3PgqA+M2ChpZQnAC8h8i4ZFkBS8X5RqkDBHA7r4hej3K9A== - -rc@^1.2.7: - version "1.2.8" - resolved "https://registry.yarnpkg.com/rc/-/rc-1.2.8.tgz#cd924bf5200a075b83c188cd6b9e211b7fc0d3ed" - integrity sha512-y3bGgqKj3QBdxLbLkomlohkvsA8gdAiUQlSBJnBhfn+BPxg4bc62d8TcBW15wavDfgexCgccckhcZvywyQYPOw== - dependencies: - deep-extend "^0.6.0" - ini "~1.3.0" - minimist "^1.2.0" - strip-json-comments "~2.0.1" - -readable-stream@^2.0.0, readable-stream@^2.0.6, readable-stream@^2.1.4: - version "2.3.7" - resolved "https://registry.yarnpkg.com/readable-stream/-/readable-stream-2.3.7.tgz#1eca1cf711aef814c04f62252a36a62f6cb23b57" - integrity sha512-Ebho8K4jIbHAxnuxi7o42OrZgF/ZTNcsZj6nRKyUmkhLFq8CHItp/fy6hQZuZmP/n3yZ9VBUbp4zz/mX8hmYPw== - dependencies: - core-util-is "~1.0.0" - inherits "~2.0.3" - isarray "~1.0.0" - process-nextick-args "~2.0.0" - safe-buffer "~5.1.1" - string_decoder "~1.1.1" - util-deprecate "~1.0.1" - -readable-stream@^3.1.1, readable-stream@^3.4.0, readable-stream@^3.6.0: - version "3.6.0" - resolved "https://registry.yarnpkg.com/readable-stream/-/readable-stream-3.6.0.tgz#337bbda3adc0706bd3e024426a286d4b4b2c9198" - integrity sha512-BViHy7LKeTz4oNnkcLJ+lVSL6vpiFeX6/d3oSH8zCW7UxP2onchk+vTGB143xuFjHS3deTgkKoXXymXqymiIdA== - dependencies: - inherits "^2.0.3" - string_decoder "^1.1.1" - util-deprecate "^1.0.1" - -reflect-metadata@^0.1.13: - version "0.1.13" - resolved "https://registry.yarnpkg.com/reflect-metadata/-/reflect-metadata-0.1.13.tgz#67ae3ca57c972a2aa1642b10fe363fe32d49dc08" - integrity sha512-Ts1Y/anZELhSsjMcU605fU9RE4Oi3p5ORujwbIKXfWa+0Zxs510Qrmrce5/Jowq3cHSZSJqBjypxmHarc+vEWg== - -require-directory@^2.1.1: - version "2.1.1" - resolved "https://registry.yarnpkg.com/require-directory/-/require-directory-2.1.1.tgz#8c64ad5fd30dab1c976e2344ffe7f792a6a6df42" - integrity sha512-fGxEI7+wsG9xrvdjsrlmL22OMTTiHRwAMroiEeMgq8gzoLC/PQr7RsRDSTLUg/bZAZtF+TVIkHc6/4RIKrui+Q== - -resolve@^1.22.0: - version "1.22.0" - resolved "https://registry.yarnpkg.com/resolve/-/resolve-1.22.0.tgz#5e0b8c67c15df57a89bdbabe603a002f21731198" - integrity sha512-Hhtrw0nLeSrFQ7phPp4OOcVjLPIeMnRlr5mcnVuMe7M/7eBn98A3hmFRLoFo3DLZkivSYwhRUJTyPyWAk56WLw== - dependencies: - is-core-module "^2.8.1" - path-parse "^1.0.7" - supports-preserve-symlinks-flag "^1.0.0" - -retry@^0.12.0: - version "0.12.0" - resolved "https://registry.yarnpkg.com/retry/-/retry-0.12.0.tgz#1b42a6266a21f07421d1b0b54b7dc167b01c013b" - integrity sha512-9LkiTwjUh6rT555DtE9rTX+BKByPfrMzEAtnlEtdEwr3Nkffwiihqe2bWADg+OQRjt9gl6ICdmB/ZFDCGAtSow== - -reusify@^1.0.4: - version "1.0.4" - resolved "https://registry.yarnpkg.com/reusify/-/reusify-1.0.4.tgz#90da382b1e126efc02146e90845a88db12925d76" - integrity sha512-U9nH88a3fc/ekCF1l0/UP1IosiuIjyTh7hBvXVMHYgVcfGvt897Xguj2UOLDeI5BG2m7/uwyaLVT6fbtCwTyzw== - -run-parallel@^1.1.9: - version "1.2.0" - resolved "https://registry.yarnpkg.com/run-parallel/-/run-parallel-1.2.0.tgz#66d1368da7bdf921eb9d95bd1a9229e7f21a43ee" - integrity sha512-5l4VyZR86LZ/lDxZTR6jqL8AFE2S0IFLMP26AbjsLVADxHdhB/c0GUsH+y39UfCi3dzz8OlQuPmnaJOMoDHQBA== - dependencies: - queue-microtask "^1.2.2" - -safe-buffer@^5.0.1, safe-buffer@~5.2.0: - version "5.2.1" - resolved "https://registry.yarnpkg.com/safe-buffer/-/safe-buffer-5.2.1.tgz#1eaf9fa9bdb1fdd4ec75f58f9cdb4e6b7827eec6" - integrity sha512-rp3So07KcdmmKbGvgaNxQSJr7bGVSVk5S9Eq1F+ppbRo70+YeaDxkw5Dd8NPN+GD6bjnYm2VuPuCXmpuYvmCXQ== - -safe-buffer@~5.1.0, safe-buffer@~5.1.1: - version "5.1.2" - resolved "https://registry.yarnpkg.com/safe-buffer/-/safe-buffer-5.1.2.tgz#991ec69d296e0313747d59bdfd2b745c35f8828d" - integrity sha512-Gd2UZBJDkXlY7GbJxfsE8/nvKkUEU1G38c1siN6QP6a9PT9MmHB8GnpscSmMJSoF8LOIrt8ud/wPtojys4G6+g== - -safe-stable-stringify@^2.3.1: - version "2.3.1" - resolved "https://registry.yarnpkg.com/safe-stable-stringify/-/safe-stable-stringify-2.3.1.tgz#ab67cbe1fe7d40603ca641c5e765cb942d04fc73" - integrity sha512-kYBSfT+troD9cDA85VDnHZ1rpHC50O0g1e6WlGHVCz/g+JS+9WKLj+XwFYyR8UbrZN8ll9HUpDAAddY58MGisg== - -semver@^5.4.1: - version "5.7.2" - resolved "https://registry.yarnpkg.com/semver/-/semver-5.7.2.tgz#48d55db737c3287cd4835e17fa13feace1c41ef8" - integrity sha512-cBznnQ9KjJqU67B52RMC65CMarK2600WFnbkcaiwWq3xy/5haFJlshgnpjovMVJ+Hff49d8GEn0b87C5pDQ10g== - -semver@^7.3.5, semver@^7.3.7: - version "7.5.4" - resolved "https://registry.yarnpkg.com/semver/-/semver-7.5.4.tgz#483986ec4ed38e1c6c48c34894a9182dbff68a6e" - integrity sha512-1bCSESV6Pv+i21Hvpxp3Dx+pSD8lIPt8uVjRrxAUt/nbswYc+tK6Y2btiULjd4+fnq15PX+nqQDC7Oft7WkwcA== - dependencies: - lru-cache "^6.0.0" - -serialport@^10.4.0: - version "10.4.0" - resolved "https://registry.yarnpkg.com/serialport/-/serialport-10.4.0.tgz#93c95ecccc0e314d5bbee3f06cde2c70be70e671" - integrity sha512-PszPM5SnFMgSXom60PkKS2A9nMlNbHkuoyRBlzdSWw9rmgOn258+V0dYbWMrETJMM+TJV32vqBzjg5MmmUMwMw== - dependencies: - "@serialport/binding-mock" "10.2.2" - "@serialport/bindings-cpp" "10.7.0" - "@serialport/parser-byte-length" "10.3.0" - "@serialport/parser-cctalk" "10.3.0" - "@serialport/parser-delimiter" "10.3.0" - "@serialport/parser-inter-byte-timeout" "10.3.0" - "@serialport/parser-packet-length" "10.3.0" - "@serialport/parser-readline" "10.3.0" - "@serialport/parser-ready" "10.3.0" - "@serialport/parser-regex" "10.3.0" - "@serialport/parser-slip-encoder" "10.3.0" - "@serialport/parser-spacepacket" "10.3.0" - "@serialport/stream" "10.3.0" - debug "^4.3.3" - -set-blocking@~2.0.0: - version "2.0.0" - resolved "https://registry.yarnpkg.com/set-blocking/-/set-blocking-2.0.0.tgz#045f9782d011ae9a6803ddd382b24392b3d890f7" - integrity sha512-KiKBS8AnWGEyLzofFfmvKwpdPzqiy16LvQfK3yv/fVH7Bj13/wl3JSR1J+rfgRE9q7xUJK4qvgS8raSOeLUehw== - -shebang-command@^2.0.0: - version "2.0.0" - resolved "https://registry.yarnpkg.com/shebang-command/-/shebang-command-2.0.0.tgz#ccd0af4f8835fbdc265b82461aaf0c36663f34ea" - integrity sha512-kHxr2zZpYtdmrN1qDjrrX/Z1rR1kG8Dx+gkpK1G4eXmvXswmcE1hTWBWYUzlraYw1/yZp6YuDY77YtvbN0dmDA== - dependencies: - shebang-regex "^3.0.0" - -shebang-regex@^3.0.0: - version "3.0.0" - resolved "https://registry.yarnpkg.com/shebang-regex/-/shebang-regex-3.0.0.tgz#ae16f1644d873ecad843b0307b143362d4c42172" - integrity sha512-7++dFhtcx3353uBaq8DDR4NuxBetBzC7ZQOhmTQInHEd6bSrXdiEyzCvG07Z44UYdLShWUyXt5M/yhz8ekcb1A== - -signal-exit@^3.0.0, signal-exit@^3.0.2, signal-exit@^3.0.3: - version "3.0.7" - resolved "https://registry.yarnpkg.com/signal-exit/-/signal-exit-3.0.7.tgz#a9a1767f8af84155114eaabd73f99273c8f59ad9" - integrity sha512-wnD2ZE+l+SPC/uoS0vXeE9L1+0wuaMqKlfz9AMUo38JsyLSBWSFcHR1Rri62LZc12vLr1gb3jl7iwQhgwpAbGQ== - -simple-concat@^1.0.0: - version "1.0.1" - resolved "https://registry.yarnpkg.com/simple-concat/-/simple-concat-1.0.1.tgz#f46976082ba35c2263f1c8ab5edfe26c41c9552f" - integrity sha512-cSFtAPtRhljv69IK0hTVZQ+OfE9nePi/rtJmw5UjHeVyVroEqJXP1sFztKUy1qU+xvz3u/sfYJLa947b7nAN2Q== - -simple-get@^3.0.3: - version "3.1.1" - resolved "https://registry.yarnpkg.com/simple-get/-/simple-get-3.1.1.tgz#cc7ba77cfbe761036fbfce3d021af25fc5584d55" - integrity sha512-CQ5LTKGfCpvE1K0n2us+kuMPbk/q0EKl82s4aheV9oXjFEz6W/Y7oQFVJuU6QG77hRT4Ghb5RURteF5vnWjupA== - dependencies: - decompress-response "^4.2.0" - once "^1.3.1" - simple-concat "^1.0.0" - -simple-swizzle@^0.2.2: - version "0.2.2" - resolved "https://registry.yarnpkg.com/simple-swizzle/-/simple-swizzle-0.2.2.tgz#a4da6b635ffcccca33f70d17cb92592de95e557a" - integrity sha512-JA//kQgZtbuY83m+xT+tXJkmJncGMTFT+C+g2h2R9uxkYIrE2yy9sgmcLhCnw57/WSD+Eh3J97FPEDFnbXnDUg== - dependencies: - is-arrayish "^0.3.1" - -slash@^3.0.0: - version "3.0.0" - resolved "https://registry.yarnpkg.com/slash/-/slash-3.0.0.tgz#6539be870c165adbd5240220dbe361f1bc4d4634" - integrity sha512-g9Q1haeby36OSStwb4ntCGGGaKsaVSjQ68fBxoQcutl5fS1vuY18H3wSt3jFyFtrkx+Kz0V1G85A4MyAdDMi2Q== - -source-map-support@^0.5.21: - version "0.5.21" - resolved "https://registry.yarnpkg.com/source-map-support/-/source-map-support-0.5.21.tgz#04fe7c7f9e1ed2d662233c28cb2b35b9f63f6e4f" - integrity sha512-uBHU3L3czsIyYXKX88fdrGovxdSCoTGDRZ6SYXtSRxLZUzHg5P/66Ht6uoUlHu9EZod+inXhKo3qQgwXUT/y1w== - dependencies: - buffer-from "^1.0.0" - source-map "^0.6.0" - -source-map@^0.6.0, source-map@~0.6.1: - version "0.6.1" - resolved "https://registry.yarnpkg.com/source-map/-/source-map-0.6.1.tgz#74722af32e9614e9c287a8d0bbde48b5e2f1a263" - integrity sha512-UjgapumWlbMhkBgzT7Ykc5YXUT46F0iKu8SGXq0bcwP5dz/h0Plj6enJqjz1Zbq2l5WaqYnrVbwWOWMyF3F47g== - -stack-trace@0.0.x: - version "0.0.10" - resolved "https://registry.yarnpkg.com/stack-trace/-/stack-trace-0.0.10.tgz#547c70b347e8d32b4e108ea1a2a159e5fdde19c0" - integrity sha512-KGzahc7puUKkzyMt+IqAep+TVNbKP+k2Lmwhub39m1AsTSkaDutx56aDCo+HLDzf/D26BIHTJWNiTG1KAJiQCg== - -stream-meter@^1.0.4: - version "1.0.4" - resolved "https://registry.yarnpkg.com/stream-meter/-/stream-meter-1.0.4.tgz#52af95aa5ea760a2491716704dbff90f73afdd1d" - integrity sha512-4sOEtrbgFotXwnEuzzsQBYEV1elAeFSO8rSGeTwabuX1RRn/kEq9JVH7I0MRBhKVRR0sJkr0M0QCH7yOLf9fhQ== - dependencies: - readable-stream "^2.1.4" - -string-width@^1.0.1: - version "1.0.2" - resolved "https://registry.yarnpkg.com/string-width/-/string-width-1.0.2.tgz#118bdf5b8cdc51a2a7e70d211e07e2b0b9b107d3" - integrity sha512-0XsVpQLnVCXHJfyEs8tC0zpTVIr5PKKsQtkT29IwupnPTjtPmQ3xT/4yCREF9hYkV/3M3kzcUTSAZT6a6h81tw== - dependencies: - code-point-at "^1.0.0" - is-fullwidth-code-point "^1.0.0" - strip-ansi "^3.0.0" - -"string-width@^1.0.2 || 2 || 3 || 4", string-width@^4.1.0, string-width@^4.2.0, string-width@^4.2.3: - version "4.2.3" - resolved "https://registry.yarnpkg.com/string-width/-/string-width-4.2.3.tgz#269c7117d27b05ad2e536830a8ec895ef9c6d010" - integrity sha512-wKyQRQpjJ0sIp62ErSZdGsjMJWsap5oRNihHhu6G7JVO/9jIB6UyevL+tXuOqrng8j/cxKTWyWUwvSTriiZz/g== - dependencies: - emoji-regex "^8.0.0" - is-fullwidth-code-point "^3.0.0" - strip-ansi "^6.0.1" - -string_decoder@^1.1.1: - version "1.3.0" - resolved "https://registry.yarnpkg.com/string_decoder/-/string_decoder-1.3.0.tgz#42f114594a46cf1a8e30b0a84f56c78c3edac21e" - integrity sha512-hkRX8U1WjJFd8LsDJ2yQ/wWWxaopEsABU1XfkM8A+j0+85JAGppt16cr1Whg6KIbb4okU6Mql6BOj+uup/wKeA== - dependencies: - safe-buffer "~5.2.0" - -string_decoder@~1.1.1: - version "1.1.1" - resolved "https://registry.yarnpkg.com/string_decoder/-/string_decoder-1.1.1.tgz#9cf1611ba62685d7030ae9e4ba34149c3af03fc8" - integrity sha512-n/ShnvDi6FHbbVfviro+WojiFzv+s8MPMHBczVePfUpDJLwoLT0ht1l4YwBCbi8pJAveEEdnkHyPyTP/mzRfwg== - dependencies: - safe-buffer "~5.1.0" - -strip-ansi@^3.0.0, strip-ansi@^3.0.1: - version "3.0.1" - resolved "https://registry.yarnpkg.com/strip-ansi/-/strip-ansi-3.0.1.tgz#6a385fb8853d952d5ff05d0e8aaf94278dc63dcf" - integrity sha512-VhumSSbBqDTP8p2ZLKj40UjBCV4+v8bUSEpUb4KjRgWk9pbqGF4REFj6KEagidb2f/M6AzC0EmFyDNGaw9OCzg== - dependencies: - ansi-regex "^2.0.0" - -strip-ansi@^6.0.0, strip-ansi@^6.0.1: - version "6.0.1" - resolved "https://registry.yarnpkg.com/strip-ansi/-/strip-ansi-6.0.1.tgz#9e26c63d30f53443e9489495b2105d37b67a85d9" - integrity sha512-Y38VPSHcqkFrCpFnQ9vuSXmquuv5oXOKpGeT6aGrr3o3Gc9AlVa6JBfUSOCnbxGGZF+/0ooI7KrPuUSztUdU5A== - dependencies: - ansi-regex "^5.0.1" - -strip-final-newline@^2.0.0: - version "2.0.0" - resolved "https://registry.yarnpkg.com/strip-final-newline/-/strip-final-newline-2.0.0.tgz#89b852fb2fcbe936f6f4b3187afb0a12c1ab58ad" - integrity sha512-BrpvfNAE3dcvq7ll3xVumzjKjZQ5tI1sEUIKr3Uoks0XUl45St3FlatVqef9prk4jRDzhW6WZg+3bk93y6pLjA== - -strip-json-comments@~2.0.1: - version "2.0.1" - resolved "https://registry.yarnpkg.com/strip-json-comments/-/strip-json-comments-2.0.1.tgz#3c531942e908c2697c0ec344858c286c7ca0a60a" - integrity sha512-4gB8na07fecVVkOI6Rs4e7T6NOTki5EmL7TUduTs6bu3EdnSycntVJ4re8kgZA+wx9IueI2Y11bfbgwtzuE0KQ== - -supports-color@^7.1.0: - version "7.2.0" - resolved "https://registry.yarnpkg.com/supports-color/-/supports-color-7.2.0.tgz#1b7dcdcb32b8138801b3e478ba6a51caa89648da" - integrity sha512-qpCAvRl9stuOHveKsn7HncJRvv501qIacKzQlO/+Lwxc9+0q2wLyv4Dfvt80/DPn2pqOBsJdDiogXGR9+OvwRw== - dependencies: - has-flag "^4.0.0" - -supports-preserve-symlinks-flag@^1.0.0: - version "1.0.0" - resolved "https://registry.yarnpkg.com/supports-preserve-symlinks-flag/-/supports-preserve-symlinks-flag-1.0.0.tgz#6eda4bd344a3c94aea376d4cc31bc77311039e09" - integrity sha512-ot0WnXS9fgdkgIcePe6RHNk1WA8+muPa6cSjeR3V8K27q9BB1rTE3R1p7Hv0z1ZyAc8s6Vvv8DIyWf681MAt0w== - -tar-fs@^2.0.0, tar-fs@^2.1.1: - version "2.1.1" - resolved "https://registry.yarnpkg.com/tar-fs/-/tar-fs-2.1.1.tgz#489a15ab85f1f0befabb370b7de4f9eb5cbe8784" - integrity sha512-V0r2Y9scmbDRLCNex/+hYzvp/zyYjvFbHPNgVTKfQvVrb6guiE/fxP+XblDNR011utopbkex2nM4dHNV6GDsng== - dependencies: - chownr "^1.1.1" - mkdirp-classic "^0.5.2" - pump "^3.0.0" - tar-stream "^2.1.4" - -tar-stream@^2.1.4: - version "2.2.0" - resolved "https://registry.yarnpkg.com/tar-stream/-/tar-stream-2.2.0.tgz#acad84c284136b060dc3faa64474aa9aebd77287" - integrity sha512-ujeqbceABgwMZxEJnk2HDY2DlnUZ+9oEcb1KzTVfYHio0UE6dG71n60d8D2I4qNvleWrrXpmjpt7vZeF1LnMZQ== - dependencies: - bl "^4.0.3" - end-of-stream "^1.4.1" - fs-constants "^1.0.0" - inherits "^2.0.3" - readable-stream "^3.1.1" - -text-hex@1.0.x: - version "1.0.0" - resolved "https://registry.yarnpkg.com/text-hex/-/text-hex-1.0.0.tgz#69dc9c1b17446ee79a92bf5b884bb4b9127506f5" - integrity sha512-uuVGNWzgJ4yhRaNSiubPY7OjISw4sw4E5Uv0wbjp+OzcbmVU/rsT8ujgcXJhn9ypzsgr5vlzpPqP+MBBKcGvbg== - -to-fast-properties@^2.0.0: - version "2.0.0" - resolved "https://registry.yarnpkg.com/to-fast-properties/-/to-fast-properties-2.0.0.tgz#dc5e698cbd079265bc73e0377681a4e4e83f616e" - integrity sha512-/OaKK0xYrs3DmxRYqL/yDc+FxFUVYhDlXMhRmv3z915w2HF1tnN1omB354j8VUGO/hbRzyD6Y3sA7v7GS/ceog== - -to-regex-range@^5.0.1: - version "5.0.1" - resolved "https://registry.yarnpkg.com/to-regex-range/-/to-regex-range-5.0.1.tgz#1648c44aae7c8d988a326018ed72f5b4dd0392e4" - integrity sha512-65P7iz6X5yEr1cwcgvQxbbIw7Uk3gOy5dIdtZ4rDveLqhrdJP+Li/Hx6tyK0NEb+2GCyneCMJiGqrADCSNk8sQ== - dependencies: - is-number "^7.0.0" - -tr46@~0.0.3: - version "0.0.3" - resolved "https://registry.yarnpkg.com/tr46/-/tr46-0.0.3.tgz#8184fd347dac9cdc185992f3a6622e14b9d9ab6a" - integrity sha512-N3WMsuqV66lT30CrXNbEjx4GEwlow3v6rr4mCcv6prnfwhS01rkgyFdjPNBYd9br7LpXV1+Emh01fHnq2Gdgrw== - -triple-beam@*, triple-beam@^1.3.0: - version "1.3.0" - resolved "https://registry.yarnpkg.com/triple-beam/-/triple-beam-1.3.0.tgz#a595214c7298db8339eeeee083e4d10bd8cb8dd9" - integrity sha512-XrHUvV5HpdLmIj4uVMxHggLbFSZYIn7HEWsqePZcI50pco+MPqJ50wMGY794X7AOOhxOBAjbkqfAbEe/QMp2Lw== - -tslib@^1.9.3: - version "1.14.1" - resolved "https://registry.yarnpkg.com/tslib/-/tslib-1.14.1.tgz#cf2d38bdc34a134bcaf1091c41f6619e2f672d00" - integrity sha512-Xni35NKzjgMrwevysHTCArtLDpPvye8zV/0E4EyYn43P7/7qvQwPh9BGkHewbMulVntbigmcT7rdX3BNo9wRJg== - -tslib@^2.4.0: - version "2.4.0" - resolved "https://registry.yarnpkg.com/tslib/-/tslib-2.4.0.tgz#7cecaa7f073ce680a05847aa77be941098f36dc3" - integrity sha512-d6xOpEDfsi2CZVlPQzGeux8XMwLT9hssAsaPYExaQMuYskwb+x1x7J371tWlbBdWHroy99KnVB6qIkUbs5X3UQ== - -tunnel-agent@^0.6.0: - version "0.6.0" - resolved "https://registry.yarnpkg.com/tunnel-agent/-/tunnel-agent-0.6.0.tgz#27a5dea06b36b04a0a9966774b290868f0fc40fd" - integrity sha512-McnNiV1l8RYeY8tBgEpuodCC1mLUdbSN+CYBL7kJsJNInOP8UjDDEwdk6Mw60vdLLrr5NHKZhMAOSrR2NZuQ+w== - dependencies: - safe-buffer "^5.0.1" - -type-check@~0.3.2: - version "0.3.2" - resolved "https://registry.yarnpkg.com/type-check/-/type-check-0.3.2.tgz#5884cab512cf1d355e3fb784f30804b2b520db72" - integrity sha512-ZCmOJdvOWDBYJlzAoFkC+Q0+bUyEOS1ltgp1MGU03fqHG+dbi9tBFU2Rd9QKiDZFAYrhPh2JUf7rZRIuHRKtOg== - dependencies: - prelude-ls "~1.1.2" - -universalify@^2.0.0: - version "2.0.0" - resolved "https://registry.yarnpkg.com/universalify/-/universalify-2.0.0.tgz#75a4984efedc4b08975c5aeb73f530d02df25717" - integrity sha512-hAZsKq7Yy11Zu1DE0OzWjw7nnLZmJZYTDZZyEFHZdUhV8FkH5MCfoU1XMaxXovpyW5nq5scPqq0ZDP9Zyl04oQ== - -util-deprecate@^1.0.1, util-deprecate@~1.0.1: - version "1.0.2" - resolved "https://registry.yarnpkg.com/util-deprecate/-/util-deprecate-1.0.2.tgz#450d4dc9fa70de732762fbd2d4a28981419a0ccf" - integrity sha512-EPD5q1uXyFxJpCrLnCc1nHnq3gOa6DZBocAIiI2TaSCA7VCJ1UJDMagCzIkXNsUYfD1daK//LTEQ8xiIbrHtcw== - -webidl-conversions@^3.0.0: - version "3.0.1" - resolved "https://registry.yarnpkg.com/webidl-conversions/-/webidl-conversions-3.0.1.tgz#24534275e2a7bc6be7bc86611cc16ae0a5654871" - integrity sha512-2JAn3z8AR6rjK8Sm8orRC0h/bcl/DqL7tRPdGZ4I1CjdF+EaMLmYxBHyXuKL849eucPFhvBoxMsflfOb8kxaeQ== - -whatwg-url@^5.0.0: - version "5.0.0" - resolved "https://registry.yarnpkg.com/whatwg-url/-/whatwg-url-5.0.0.tgz#966454e8765462e37644d3626f6742ce8b70965d" - integrity sha512-saE57nupxk6v3HY35+jzBwYa0rKSy0XR8JSxZPwgLr7ys0IBzhGviA1/TUGJLmSVqs8pb9AnvICXEuOHLprYTw== - dependencies: - tr46 "~0.0.3" - webidl-conversions "^3.0.0" - -which@^2.0.1: - version "2.0.2" - resolved "https://registry.yarnpkg.com/which/-/which-2.0.2.tgz#7c6a8dd0a636a0327e10b59c9286eee93f3f51b1" - integrity sha512-BLI3Tl1TW3Pvl70l3yq3Y64i+awpwXqsGBYWkkqMtnbXgrMD+yj7rhW0kuEDxzJaYXGjEW5ogapKNMEKNMjibA== - dependencies: - isexe "^2.0.0" - -wide-align@^1.1.0: - version "1.1.5" - resolved "https://registry.yarnpkg.com/wide-align/-/wide-align-1.1.5.tgz#df1d4c206854369ecf3c9a4898f1b23fbd9d15d3" - integrity sha512-eDMORYaPNZ4sQIuuYPDHdQvf4gyCF9rEEV/yPxGfwPkRodwEgiMUUXTx/dex+Me0wxx53S+NgUHaP7y3MGlDmg== - dependencies: - string-width "^1.0.2 || 2 || 3 || 4" - -winston-daily-rotate-file@^4.7.1: - version "4.7.1" - resolved "https://registry.yarnpkg.com/winston-daily-rotate-file/-/winston-daily-rotate-file-4.7.1.tgz#f60a643af87f8867f23170d8cd87dbe3603a625f" - integrity sha512-7LGPiYGBPNyGHLn9z33i96zx/bd71pjBn9tqQzO3I4Tayv94WPmBNwKC7CO1wPHdP9uvu+Md/1nr6VSH9h0iaA== - dependencies: - file-stream-rotator "^0.6.1" - object-hash "^2.0.1" - triple-beam "^1.3.0" - winston-transport "^4.4.0" - -winston-transport@^4.4.0, winston-transport@^4.5.0: - version "4.5.0" - resolved "https://registry.yarnpkg.com/winston-transport/-/winston-transport-4.5.0.tgz#6e7b0dd04d393171ed5e4e4905db265f7ab384fa" - integrity sha512-YpZzcUzBedhlTAfJg6vJDlyEai/IFMIVcaEZZyl3UXIl4gmqRpU7AE89AHLkbzLUsv0NVmw7ts+iztqKxxPW1Q== - dependencies: - logform "^2.3.2" - readable-stream "^3.6.0" - triple-beam "^1.3.0" - -winston@^3.7.2: - version "3.7.2" - resolved "https://registry.yarnpkg.com/winston/-/winston-3.7.2.tgz#95b4eeddbec902b3db1424932ac634f887c400b1" - integrity sha512-QziIqtojHBoyzUOdQvQiar1DH0Xp9nF1A1y7NVy2DGEsz82SBDtOalS0ulTRGVT14xPX3WRWkCsdcJKqNflKng== - dependencies: - "@dabh/diagnostics" "^2.0.2" - async "^3.2.3" - is-stream "^2.0.0" - logform "^2.4.0" - one-time "^1.0.0" - readable-stream "^3.4.0" - safe-stable-stringify "^2.3.1" - stack-trace "0.0.x" - triple-beam "^1.3.0" - winston-transport "^4.5.0" - -word-wrap@~1.2.3: - version "1.2.4" - resolved "https://registry.yarnpkg.com/word-wrap/-/word-wrap-1.2.4.tgz#cb4b50ec9aca570abd1f52f33cd45b6c61739a9f" - integrity sha512-2V81OA4ugVo5pRo46hAoD2ivUJx8jXmWXfUkY4KFNw0hEptvN0QfH3K4nHiwzGeKl5rFKedV48QVoqYavy4YpA== - -wrap-ansi@^7.0.0: - version "7.0.0" - resolved "https://registry.yarnpkg.com/wrap-ansi/-/wrap-ansi-7.0.0.tgz#67e145cff510a6a6984bdf1152911d69d2eb9e43" - integrity sha512-YVGIj2kamLSTxw6NsZjoBxfSwsn0ycdesmc4p+Q21c5zPuZ1pl+NfxVdxPtdHvmNVOQ6XSYG4AUtyt/Fi7D16Q== - dependencies: - ansi-styles "^4.0.0" - string-width "^4.1.0" - strip-ansi "^6.0.0" - -wrappy@1: - version "1.0.2" - resolved "https://registry.yarnpkg.com/wrappy/-/wrappy-1.0.2.tgz#b5243d8f3ec1aa35f1364605bc0d1036e30ab69f" - integrity sha512-l4Sp/DRseor9wL6EvV2+TuQn63dMkPjZ/sp9XkghTEbV9KlPS1xUsZ3u7/IQO4wxtcFB4bgpQPRcR3QCvezPcQ== - -ws@^8.0.0: - version "8.8.0" - resolved "https://registry.yarnpkg.com/ws/-/ws-8.8.0.tgz#8e71c75e2f6348dbf8d78005107297056cb77769" - integrity sha512-JDAgSYQ1ksuwqfChJusw1LSJ8BizJ2e/vVu5Lxjq3YvNJNlROv1ui4i+c/kUUrPheBvQl4c5UbERhTwKa6QBJQ== - -xstate@^4.29.0: - version "4.32.1" - resolved "https://registry.yarnpkg.com/xstate/-/xstate-4.32.1.tgz#1a09c808a66072938861a3b4acc5b38460244b70" - integrity sha512-QYUd+3GkXZ8i6qdixnOn28bL3EvA++LONYL/EMWwKlFSh/hiLndJ8YTnz77FDs+JUXcwU7NZJg7qoezoRHc4GQ== - -y18n@^5.0.5: - version "5.0.8" - resolved "https://registry.yarnpkg.com/y18n/-/y18n-5.0.8.tgz#7f4934d0f7ca8c56f95314939ddcd2dd91ce1d55" - integrity sha512-0pfFzegeDWJHJIAmTLRP2DwHjdF5s7jo9tuztdQxAhINCdvS+3nGINqPd00AphqJR/0LhANUS6/+7SCb98YOfA== - -yallist@^4.0.0: - version "4.0.0" - resolved "https://registry.yarnpkg.com/yallist/-/yallist-4.0.0.tgz#9bb92790d9c0effec63be73519e11a35019a3a72" - integrity sha512-3wdGidZyq5PB084XLES5TpOSRA3wjXAlIWMhum2kRcv/41Sn2emQ0dycQW4uZXLejwKvg6EsvbdlVL+FYEct7A== - -yargs-parser@^20.2.2: - version "20.2.9" - resolved "https://registry.yarnpkg.com/yargs-parser/-/yargs-parser-20.2.9.tgz#2eb7dc3b0289718fc295f362753845c41a0c94ee" - integrity sha512-y11nGElTIV+CT3Zv9t7VKl+Q3hTQoT9a1Qzezhhl6Rp21gJ/IVTW7Z3y9EWXhuUBC2Shnf+DX0antecpAwSP8w== - -yargs-parser@^21.0.0: - version "21.0.1" - resolved "https://registry.yarnpkg.com/yargs-parser/-/yargs-parser-21.0.1.tgz#0267f286c877a4f0f728fceb6f8a3e4cb95c6e35" - integrity sha512-9BK1jFpLzJROCI5TzwZL/TU4gqjK5xiHV/RfWLOahrjAko/e4DJkRDZQXfvqAsiZzzYhgAzbgz6lg48jcm4GLg== - -yargs@^16.2.0: - version "16.2.0" - resolved "https://registry.yarnpkg.com/yargs/-/yargs-16.2.0.tgz#1c82bf0f6b6a66eafce7ef30e376f49a12477f66" - integrity sha512-D1mvvtDG0L5ft/jGWkLpG1+m0eQxOfaBvTNELraWj22wSVUMWxZUvYgJYcKh6jGGIkJFhH4IZPQhR4TKpc8mBw== - dependencies: - cliui "^7.0.2" - escalade "^3.1.1" - get-caller-file "^2.0.5" - require-directory "^2.1.1" - string-width "^4.2.0" - y18n "^5.0.5" - yargs-parser "^20.2.2" - -yargs@^17.5.1: - version "17.5.1" - resolved "https://registry.yarnpkg.com/yargs/-/yargs-17.5.1.tgz#e109900cab6fcb7fd44b1d8249166feb0b36e58e" - integrity sha512-t6YAJcxDkNX7NFYiVtKvWUz8l+PaKTLiL63mJYWR2GnHq2gjEWISzsLp9wg3aY36dY1j+gfIEL3pIF+XlJJfbA== - dependencies: - cliui "^7.0.2" - escalade "^3.1.1" - get-caller-file "^2.0.5" - require-directory "^2.1.1" - string-width "^4.2.3" - y18n "^5.0.5" - yargs-parser "^21.0.0" - -zwave-js@9.4.0: - version "9.4.0" - resolved "https://registry.yarnpkg.com/zwave-js/-/zwave-js-9.4.0.tgz#196ffe4edd34cb9cb9b6081f57eb5c90175b280e" - integrity sha512-w/n6+tAkms0gURTll5CRt0HDvZxct5Z6sAIT+6L6OiZY54GhjOxxFgDkoWbKlH5oQmyXl5t/EA2AF3jIYyl/QQ== - dependencies: - "@alcalzone/jsonl-db" "^2.5.2" - "@alcalzone/pak" "^0.8.1" - "@sentry/integrations" "^6.19.7" - "@sentry/node" "^6.19.7" - "@zwave-js/config" "9.4.0" - "@zwave-js/core" "9.4.0" - "@zwave-js/host" "9.4.0" - "@zwave-js/nvmedit" "9.4.0" - "@zwave-js/serial" "9.4.0" - "@zwave-js/shared" "9.4.0" - alcalzone-shared "^4.0.1" - ansi-colors "^4.1.3" - axios "^0.27.2" - execa "^5.1.1" - fs-extra "^10.1.0" - proper-lockfile "^4.1.2" - reflect-metadata "^0.1.13" - semver "^7.3.7" - serialport "^10.4.0" - source-map-support "^0.5.21" - winston "^3.7.2" - xstate "^4.29.0" diff --git a/README.md b/README.md index 8a2c450..fcc430d 100644 --- a/README.md +++ b/README.md @@ -9,22 +9,22 @@ ![GitHub closed issues](https://img.shields.io/github/issues-closed-raw/zwave-js/zwavejs.net) -ZWaveJS.NET is a class library developed for the .NET framework family, that opens up the zwave-js Driver in .NET, allowing its runtime to be used directly in .NET applications. +ZWaveJS.NET is a class library developed for the .NET framework family, that opens up the zwave-js Driver in .NET, allowing its full runtime to be used directly in .NET applications. ## Supported Targets - - NET 4.5 - NET 4.8 - - NET 5.0 + - NET 6.0 + - NET 7.0 + - NET 8.0 - NET Standard 2.0 - NET Standard 2.1 - - NET Core 3.1 The library strictly follows the structure of the zwave-js API. Examples: ```c# -Driver.Controller.BeginHealingNetwork() +Driver.Controller.BeginRebuildingRoutes() Driver.Controller.Nodes.Get(4).GetDefinedValueIDs() Driver.Controller.Nodes.Get(4).SetValue(ValueID ValueID, object Value, SetValueAPIOptions Options = null) Driver.Controller.Nodes.Get(4).GetEndpoint(2).InvokeCCAPI(int CommandClass, string Method, params object[] Params) @@ -32,38 +32,7 @@ Driver.Controller.Nodes.Get(4).GetEndpoint(2).InvokeCCAPI(int CommandClass, stri ## Features - - [x] Controller - - [x] Controller Info - - [x] NVM Restore/Backup - - [x] Network Statistics - - [x] Node Inclusion (Unsecured, S0 & S2 Security) - - [x] Smart Start - - [x] Smart Start Provisioning entry management - - [x] Node Exclusion - - [x] Network Healing - - [x] Remove Failed Node - - [x] Replace Failed Node - - [x] Multicast support - - [x] Node added/removed events - - [x] Inclusion/Exclusion started/stopped events - - [x] Network Heal progress/completed events - - [x] Network statistics updated events - - - [x] Node - - [x] Node Info - - [x] Network Health Checks - - [x] Network Statistics - - [x] Updating, Polling & Fetching Values - - [x] CCAPI Invoke (and its endpoints) - - [x] Obtain Value IDs - - [x] Obtain Value Metadata - - [x] Interview Node - - [x] Association Management - - [x] Firmware Updates - - [x] Node Ready, Asleep, Awake & Dead events - - [x] Value Updated, Notification & Value Notification events - - [x] Interview Started, Completed & Failed events - - [x] Node Network Statistics updated events +The library contains most of the ZWave JS API whilst the code base is structured in such a way, enabling access to new methods, can be achieved within minutes. ## Getting Started. @@ -83,29 +52,16 @@ and it contains everything necessary for .NET to work with zwave-js. **server.psi** files are platform specific, but the assembly isn't - it will run on windows, OSX and Linux, and the platform specifics i.e **node** are contained in **server.psi**. -## Prebuilt PSI's - - Windows x64 - - MacOS x64 (Should support Apple Silicon via Rosetta 2) - - Ubuntu Linux x64 - - Debian ARM64 +## Building a platform specific binary. -## Building yor own platform specific binary. - -To build an image for your platform: +To build an image for your platform (Note this will require Node & NPM on the machine building the image): - Clone the repo - cd to **./PSI** - - run `yarn install --immutable` - - and finally `yarn run build` - - rename **dist/server** to **server.psi**, and distrubute with your application/dll. - -Every release will include a set of PSI images, so download the one for your platform, and rename it to **server.psi**, and ensure its in the same location as the dll. - -There is also a Helper method that pulls down the correct image if one is needed **ZWaveJS.NET.Helpers.DownloadPSI()** + - run `npm install && npm run buld` + - rename **./dist/server** to **./dist/server.psi**, and distrubute the image with the library. **server.psi** is not needed, if using the library in Client Mode. -The class library contains most of the methods you will need, from including a secure device, to removing it. - ## Installing. All releases will be published to nuget, so search for **ZWaveJS.NET** and install it, the **nupkg** file will also be attached to the release here, on Github, along with the platform PSI files. @@ -115,7 +71,7 @@ All releases will be published to nuget, so search for **ZWaveJS.NET** and insta static ZWaveJS.NET.Driver _Driver; static void Main(string[] args) { - // Set encryption keys, enable logging, adjust network timeouts so on and so forth. + // Set S0, S2 encryption keys, enable logging, adjust network timeouts so on and so forth. ZWaveJS.NET.ZWaveOptions Options = new ZWaveJS.NET.ZWaveOptions(); // Create Driver Instance @@ -140,47 +96,53 @@ private static void _Driver_DriverReady() SVO.transitionDuration = "2s"; SVO.volume = 30; - // All methods returns a task, as to not block the UI + // All methods return a task, as to not block the UI _Driver.Controller.Nodes.Get(4).SetValue(VID, 200, SVO).ContinueWith((res) => { - if (res.Result.Success) { + if (res.Result.Success) + { Console.WriteLine("Value Updated"); } }); - // Listen for Value Updates on a node + // Subscribe to value updates on a node _Driver.Controller.Nodes.Get(3).ValueUpdated += Program_ValueUpdated; - _Driver.Controller.Nodes.Get(3).Notification += Program_Notification; // Or All of them ZWaveJS.NET.ZWaveNode[] Nodes = _Driver.Controller.Nodes.AsArray(); foreach(ZWaveJS.NET.ZWaveNode Node in Nodes) { Node.ValueUpdated += Program_ValueUpdated; - Node.Notification += Program_Notification; } - - // Other Node methods + + // Other Node methods _Driver.Controller.Nodes.Get(4).GetDefinedValueIDs().ContinueWith((res) => { - // Do something with Value ID's (res.Result) + if(res.Result.Success) + { + // Do something with Value ID's (res.Result.ResultPayload) + } + else + { + // See res.Result.Message and res.Result.ErrorCode + } }); + + // Subscribe to new nodes being added to the network + _Driver.Controller.NodeAdded += Controller_NodeAdded; + + } -private static void Program_ValueUpdated(ZWaveNode Node, JObject Args) +private static void Program_ValueUpdated(ZWaveNode Node, ValueUpdatedArgs Args) { // Do something with Args } -private static void Program_Notification(ZWaveNode Node, int ccId, JObject Args) +private void Controller_NodeAdded(ZWaveNode Node, InclusionResultArgs Args) { - // Do something with Args + // Add the new node to the UI } ``` -## Network Toolkit Demo Application. -The Network Toolkit Application (NET 4.5) serves as a reference, in how the library can be used, but at the same time, can be used as a tool to manage your network. You can download the toolkit demo from the Release pages here, on Github - The source code is also available. - -![Image](./Toolkit.PNG) - ## License MIT License diff --git a/Toolkit.PNG b/Toolkit.PNG deleted file mode 100644 index 9516e09..0000000 Binary files a/Toolkit.PNG and /dev/null differ diff --git a/Visual Studio Projects/Network Toolkit/Icon.ico b/Visual Studio Projects/Network Toolkit/Icon.ico deleted file mode 100644 index a2f917b..0000000 Binary files a/Visual Studio Projects/Network Toolkit/Icon.ico and /dev/null differ diff --git a/Visual Studio Projects/Network Toolkit/Network Toolkit.sln b/Visual Studio Projects/Network Toolkit/Network Toolkit.sln deleted file mode 100644 index 378bf49..0000000 --- a/Visual Studio Projects/Network Toolkit/Network Toolkit.sln +++ /dev/null @@ -1,25 +0,0 @@ - -Microsoft Visual Studio Solution File, Format Version 12.00 -# Visual Studio Version 16 -VisualStudioVersion = 16.0.32407.337 -MinimumVisualStudioVersion = 10.0.40219.1 -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Network Toolkit", "Network Toolkit\Network Toolkit.csproj", "{F2787359-F6F4-41B4-853F-36D7C90DB62B}" -EndProject -Global - GlobalSection(SolutionConfigurationPlatforms) = preSolution - Debug|Any CPU = Debug|Any CPU - Release|Any CPU = Release|Any CPU - EndGlobalSection - GlobalSection(ProjectConfigurationPlatforms) = postSolution - {F2787359-F6F4-41B4-853F-36D7C90DB62B}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {F2787359-F6F4-41B4-853F-36D7C90DB62B}.Debug|Any CPU.Build.0 = Debug|Any CPU - {F2787359-F6F4-41B4-853F-36D7C90DB62B}.Release|Any CPU.ActiveCfg = Release|Any CPU - {F2787359-F6F4-41B4-853F-36D7C90DB62B}.Release|Any CPU.Build.0 = Release|Any CPU - EndGlobalSection - GlobalSection(SolutionProperties) = preSolution - HideSolutionNode = FALSE - EndGlobalSection - GlobalSection(ExtensibilityGlobals) = postSolution - SolutionGuid = {FA9050B8-D139-49C9-AE35-27620F8BD289} - EndGlobalSection -EndGlobal diff --git a/Visual Studio Projects/Network Toolkit/Network Toolkit/App.config b/Visual Studio Projects/Network Toolkit/Network Toolkit/App.config deleted file mode 100644 index e7d3d8b..0000000 --- a/Visual Studio Projects/Network Toolkit/Network Toolkit/App.config +++ /dev/null @@ -1,14 +0,0 @@ - - - - - - - - - - - - - - diff --git a/Visual Studio Projects/Network Toolkit/Network Toolkit/Associations.Designer.cs b/Visual Studio Projects/Network Toolkit/Network Toolkit/Associations.Designer.cs deleted file mode 100644 index 2c9d957..0000000 --- a/Visual Studio Projects/Network Toolkit/Network Toolkit/Associations.Designer.cs +++ /dev/null @@ -1,231 +0,0 @@ - -namespace Network_Toolkit -{ - partial class Associations - { - /// - /// Required designer variable. - /// - private System.ComponentModel.IContainer components = null; - - /// - /// Clean up any resources being used. - /// - /// true if managed resources should be disposed; otherwise, false. - protected override void Dispose(bool disposing) - { - if (disposing && (components != null)) - { - components.Dispose(); - } - base.Dispose(disposing); - } - - #region Windows Form Designer generated code - - /// - /// Required method for Designer support - do not modify - /// the contents of this method with the code editor. - /// - private void InitializeComponent() - { - this.panel1 = new System.Windows.Forms.Panel(); - this.label2 = new System.Windows.Forms.Label(); - this.NUM_EP = new System.Windows.Forms.NumericUpDown(); - this.label1 = new System.Windows.Forms.Label(); - this.COM_Group = new System.Windows.Forms.ComboBox(); - this.label3 = new System.Windows.Forms.Label(); - this.LST_Associations = new System.Windows.Forms.ListView(); - this.columnHeader1 = ((System.Windows.Forms.ColumnHeader)(new System.Windows.Forms.ColumnHeader())); - this.columnHeader2 = ((System.Windows.Forms.ColumnHeader)(new System.Windows.Forms.ColumnHeader())); - this.label4 = new System.Windows.Forms.Label(); - this.button1 = new System.Windows.Forms.Button(); - this.button2 = new System.Windows.Forms.Button(); - this.button3 = new System.Windows.Forms.Button(); - this.panel1.SuspendLayout(); - ((System.ComponentModel.ISupportInitialize)(this.NUM_EP)).BeginInit(); - this.SuspendLayout(); - // - // panel1 - // - this.panel1.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left) - | System.Windows.Forms.AnchorStyles.Right))); - this.panel1.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(16)))), ((int)(((byte)(115)))), ((int)(((byte)(185))))); - this.panel1.Controls.Add(this.label2); - this.panel1.Location = new System.Drawing.Point(-5, -12); - this.panel1.Margin = new System.Windows.Forms.Padding(4); - this.panel1.Name = "panel1"; - this.panel1.Size = new System.Drawing.Size(570, 94); - this.panel1.TabIndex = 7; - // - // label2 - // - this.label2.AutoSize = true; - this.label2.Font = new System.Drawing.Font("Microsoft Sans Serif", 16.75F); - this.label2.ForeColor = System.Drawing.Color.White; - this.label2.Location = new System.Drawing.Point(21, 34); - this.label2.Margin = new System.Windows.Forms.Padding(4, 0, 4, 0); - this.label2.Name = "label2"; - this.label2.Size = new System.Drawing.Size(282, 29); - this.label2.TabIndex = 22; - this.label2.Text = "Association Management"; - // - // NUM_EP - // - this.NUM_EP.Location = new System.Drawing.Point(47, 125); - this.NUM_EP.Name = "NUM_EP"; - this.NUM_EP.Size = new System.Drawing.Size(182, 20); - this.NUM_EP.TabIndex = 8; - this.NUM_EP.ValueChanged += new System.EventHandler(this.NUM_EP_ValueChanged); - // - // label1 - // - this.label1.AutoSize = true; - this.label1.Location = new System.Drawing.Point(44, 109); - this.label1.Name = "label1"; - this.label1.Size = new System.Drawing.Size(49, 13); - this.label1.TabIndex = 9; - this.label1.Text = "Endpoint"; - // - // COM_Group - // - this.COM_Group.FormattingEnabled = true; - this.COM_Group.Location = new System.Drawing.Point(47, 174); - this.COM_Group.Name = "COM_Group"; - this.COM_Group.Size = new System.Drawing.Size(182, 21); - this.COM_Group.TabIndex = 10; - this.COM_Group.Text = "Select Group"; - this.COM_Group.SelectedValueChanged += new System.EventHandler(this.COM_Group_SelectedValueChanged); - // - // label3 - // - this.label3.AutoSize = true; - this.label3.Location = new System.Drawing.Point(44, 158); - this.label3.Name = "label3"; - this.label3.Size = new System.Drawing.Size(93, 13); - this.label3.TabIndex = 11; - this.label3.Text = "Association Group"; - // - // LST_Associations - // - this.LST_Associations.Columns.AddRange(new System.Windows.Forms.ColumnHeader[] { - this.columnHeader1, - this.columnHeader2}); - this.LST_Associations.FullRowSelect = true; - this.LST_Associations.HideSelection = false; - this.LST_Associations.Location = new System.Drawing.Point(47, 230); - this.LST_Associations.MultiSelect = false; - this.LST_Associations.Name = "LST_Associations"; - this.LST_Associations.Size = new System.Drawing.Size(418, 142); - this.LST_Associations.TabIndex = 12; - this.LST_Associations.UseCompatibleStateImageBehavior = false; - this.LST_Associations.View = System.Windows.Forms.View.Details; - // - // columnHeader1 - // - this.columnHeader1.Text = "Target Node"; - this.columnHeader1.Width = 156; - // - // columnHeader2 - // - this.columnHeader2.Text = "Target Endpoint"; - this.columnHeader2.Width = 200; - // - // label4 - // - this.label4.AutoSize = true; - this.label4.Location = new System.Drawing.Point(44, 214); - this.label4.Name = "label4"; - this.label4.Size = new System.Drawing.Size(66, 13); - this.label4.TabIndex = 13; - this.label4.Text = "Associations"; - // - // button1 - // - this.button1.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(16)))), ((int)(((byte)(115)))), ((int)(((byte)(185))))); - this.button1.FlatStyle = System.Windows.Forms.FlatStyle.Flat; - this.button1.ForeColor = System.Drawing.Color.White; - this.button1.Location = new System.Drawing.Point(382, 398); - this.button1.Margin = new System.Windows.Forms.Padding(4); - this.button1.Name = "button1"; - this.button1.Size = new System.Drawing.Size(127, 42); - this.button1.TabIndex = 24; - this.button1.Text = "CLOSE"; - this.button1.UseVisualStyleBackColor = false; - this.button1.Click += new System.EventHandler(this.button1_Click); - // - // button2 - // - this.button2.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(16)))), ((int)(((byte)(115)))), ((int)(((byte)(185))))); - this.button2.FlatStyle = System.Windows.Forms.FlatStyle.Flat; - this.button2.Font = new System.Drawing.Font("Microsoft Sans Serif", 12.25F); - this.button2.ForeColor = System.Drawing.Color.White; - this.button2.Location = new System.Drawing.Point(47, 379); - this.button2.Margin = new System.Windows.Forms.Padding(4); - this.button2.Name = "button2"; - this.button2.Size = new System.Drawing.Size(40, 34); - this.button2.TabIndex = 25; - this.button2.Text = "-"; - this.button2.UseVisualStyleBackColor = false; - this.button2.Click += new System.EventHandler(this.button2_Click); - // - // button3 - // - this.button3.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(16)))), ((int)(((byte)(115)))), ((int)(((byte)(185))))); - this.button3.FlatStyle = System.Windows.Forms.FlatStyle.Flat; - this.button3.Font = new System.Drawing.Font("Microsoft Sans Serif", 12.25F); - this.button3.ForeColor = System.Drawing.Color.White; - this.button3.Location = new System.Drawing.Point(95, 379); - this.button3.Margin = new System.Windows.Forms.Padding(4); - this.button3.Name = "button3"; - this.button3.Size = new System.Drawing.Size(40, 34); - this.button3.TabIndex = 26; - this.button3.Text = "+"; - this.button3.UseVisualStyleBackColor = false; - this.button3.Click += new System.EventHandler(this.button3_Click); - // - // Associations - // - this.AutoScaleDimensions = new System.Drawing.SizeF(96F, 96F); - this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Dpi; - this.ClientSize = new System.Drawing.Size(522, 453); - this.Controls.Add(this.button3); - this.Controls.Add(this.button2); - this.Controls.Add(this.button1); - this.Controls.Add(this.label4); - this.Controls.Add(this.LST_Associations); - this.Controls.Add(this.label3); - this.Controls.Add(this.COM_Group); - this.Controls.Add(this.label1); - this.Controls.Add(this.NUM_EP); - this.Controls.Add(this.panel1); - this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedToolWindow; - this.Name = "Associations"; - this.StartPosition = System.Windows.Forms.FormStartPosition.CenterParent; - this.Text = "Association Management"; - this.Load += new System.EventHandler(this.Associations_Load); - this.panel1.ResumeLayout(false); - this.panel1.PerformLayout(); - ((System.ComponentModel.ISupportInitialize)(this.NUM_EP)).EndInit(); - this.ResumeLayout(false); - this.PerformLayout(); - - } - - #endregion - - private System.Windows.Forms.Panel panel1; - private System.Windows.Forms.Label label2; - private System.Windows.Forms.NumericUpDown NUM_EP; - private System.Windows.Forms.Label label1; - private System.Windows.Forms.ComboBox COM_Group; - private System.Windows.Forms.Label label3; - private System.Windows.Forms.ListView LST_Associations; - private System.Windows.Forms.Label label4; - private System.Windows.Forms.ColumnHeader columnHeader1; - private System.Windows.Forms.ColumnHeader columnHeader2; - private System.Windows.Forms.Button button1; - private System.Windows.Forms.Button button2; - private System.Windows.Forms.Button button3; - } -} \ No newline at end of file diff --git a/Visual Studio Projects/Network Toolkit/Network Toolkit/Associations.cs b/Visual Studio Projects/Network Toolkit/Network Toolkit/Associations.cs deleted file mode 100644 index 846f993..0000000 --- a/Visual Studio Projects/Network Toolkit/Network Toolkit/Associations.cs +++ /dev/null @@ -1,208 +0,0 @@ -using System; -using System.Collections.Generic; -using System.ComponentModel; -using System.Data; -using System.Drawing; -using System.Linq; -using System.Text; -using System.Threading.Tasks; -using System.Windows.Forms; -using ZWaveJS.NET; - -namespace Network_Toolkit -{ - public partial class Associations : Form - { - ZWaveNode _Node; - Driver _Driver; - public Associations(ZWaveNode Node, Driver Driver) - { - InitializeComponent(); - _Node = Node; - _Driver = Driver; - - } - - private void button1_Click(object sender, EventArgs e) - { - this.Close(); - } - - private void Associations_Load(object sender, EventArgs e) - { - ListGroups(); - } - - private void ListGroups() - { - LST_Associations.Items.Clear(); - - COM_Group.Items.Clear(); - COM_Group.Items.Add(new ComboObject("Select Group", null)); - COM_Group.Text = "Select Group"; - - _Driver.Controller.GetAssociationGroups(_Node.id, Convert.ToInt32(NUM_EP.Value)).ContinueWith((R) => - { - - if (R.Result.Success) - { - this.Invoke((MethodInvoker)delegate () - { - - - Dictionary Groups = R.Result.ResultPayload as Dictionary; - foreach (int AGID in Groups.Keys) - { - - ComboObject CO = new ComboObject(Groups[AGID].label, AGID); - COM_Group.Items.Add(CO); - } - }); - - } - else - { - this.Invoke((MethodInvoker)delegate () - { - MessageBox.Show(R.Result.Message, "Failed To Get Association Groups", MessageBoxButtons.OK, MessageBoxIcon.Error); - }); - } - - }); - - } - - private void NUM_EP_ValueChanged(object sender, EventArgs e) - { - ListGroups(); - } - - private void COM_Group_SelectedValueChanged(object sender, EventArgs e) - { - LST_Associations.Items.Clear(); - ComboObject CO = COM_Group.SelectedItem as ComboObject; - - if (CO.Value == null) - { - return; - - } - - - _Driver.Controller.GetAssociations(_Node.id, Convert.ToInt32(NUM_EP.Value)).ContinueWith((R) => - { - - if (R.Result.Success) - { - this.Invoke((MethodInvoker)delegate () - { - Dictionary Associations = R.Result.ResultPayload as Dictionary; - - foreach (AssociationAddress ASS in Associations[(int)CO.Value]) - { - ListViewItem LVI = new ListViewItem(ASS.nodeId.ToString()); - LVI.Tag = ASS; - if (ASS.endpoint == null) - { - LVI.SubItems.Add("0 (root)"); - } - else - { - LVI.SubItems.Add(ASS.endpoint.ToString()); - } - LST_Associations.Items.Add(LVI); - - } - }); - - } - else - { - this.Invoke((MethodInvoker)delegate () - { - MessageBox.Show(R.Result.Message, "Failed To Get Associations", MessageBoxButtons.OK, MessageBoxIcon.Error); - }); - } - - }); - } - - private void button2_Click(object sender, EventArgs e) - { - if (LST_Associations.SelectedItems.Count > 0) - { - AssociationAddress Target = LST_Associations.SelectedItems[0].Tag as AssociationAddress; - - AssociationAddress Source = new AssociationAddress(); - Source.nodeId = _Node.id; - Source.endpoint = Convert.ToInt32(NUM_EP.Value); - - ComboObject CO = COM_Group.SelectedItem as ComboObject; - - _Driver.Controller.RemoveAssociations(Source, (int)CO.Value, new AssociationAddress[] { Target }).ContinueWith((R) => - { - - if (R.Result.Success) - { - this.Invoke((MethodInvoker)delegate () - { - LST_Associations.Items.Remove(LST_Associations.SelectedItems[0]); - }); - } - else - { - this.Invoke((MethodInvoker)delegate () - { - MessageBox.Show(R.Result.Message, "Failed To Remove Association", MessageBoxButtons.OK, MessageBoxIcon.Error); - }); - } - - }); - } - } - - private void button3_Click(object sender, EventArgs e) - { - NewAssociation NA = new NewAssociation(); - if (NA.ShowDialog() == DialogResult.OK) - { - AssociationAddress AA = new AssociationAddress(); - AA.nodeId = Convert.ToInt32(NA.NUM_Node.Value); - if (NA.NUM_EP.Value > 0) - { - AA.endpoint = Convert.ToInt32(NA.NUM_EP.Value); - } - - AssociationAddress Source = new AssociationAddress(); - Source.nodeId = _Node.id; - Source.endpoint = Convert.ToInt32(NUM_EP.Value); - - ComboObject CO = COM_Group.SelectedItem as ComboObject; - - List Targets = new List(); - Targets.Add(AA); - - _Driver.Controller.AddAssociations(Source, (int)CO.Value, Targets.ToArray()).ContinueWith((R) => - { - - if (R.Result.Success) - { - this.Invoke((MethodInvoker)delegate () - { - COM_Group_SelectedValueChanged(this, null); - - }); - } - else - { - MessageBox.Show(R.Result.Message, "Failed To Add Association", MessageBoxButtons.OK, MessageBoxIcon.Error); - } - - - }); - } - - - } - } -} diff --git a/Visual Studio Projects/Network Toolkit/Network Toolkit/Associations.resx b/Visual Studio Projects/Network Toolkit/Network Toolkit/Associations.resx deleted file mode 100644 index 1af7de1..0000000 --- a/Visual Studio Projects/Network Toolkit/Network Toolkit/Associations.resx +++ /dev/null @@ -1,120 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - text/microsoft-resx - - - 2.0 - - - System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - - - System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - - \ No newline at end of file diff --git a/Visual Studio Projects/Network Toolkit/Network Toolkit/CustomControls/Node.Designer.cs b/Visual Studio Projects/Network Toolkit/Network Toolkit/CustomControls/Node.Designer.cs deleted file mode 100644 index 91b5ece..0000000 --- a/Visual Studio Projects/Network Toolkit/Network Toolkit/CustomControls/Node.Designer.cs +++ /dev/null @@ -1,206 +0,0 @@ - -namespace Network_Toolkit.CustomControls -{ - partial class Node - { - /// - /// Required designer variable. - /// - private System.ComponentModel.IContainer components = null; - - /// - /// Clean up any resources being used. - /// - /// true if managed resources should be disposed; otherwise, false. - protected override void Dispose(bool disposing) - { - if (disposing && (components != null)) - { - components.Dispose(); - } - base.Dispose(disposing); - } - - #region Component Designer generated code - - /// - /// Required method for Designer support - do not modify - /// the contents of this method with the code editor. - /// - private void InitializeComponent() - { - this.LBL_NodeID = new System.Windows.Forms.Label(); - this.LBL_Label = new System.Windows.Forms.Label(); - this.LBL_Description = new System.Windows.Forms.Label(); - this.pan1 = new System.Windows.Forms.Panel(); - this.PAN_Ready = new System.Windows.Forms.Panel(); - this.label1 = new System.Windows.Forms.Label(); - this.label2 = new System.Windows.Forms.Label(); - this.PAN_Interviewed = new System.Windows.Forms.Panel(); - this.label3 = new System.Windows.Forms.Label(); - this.PAN_Wake = new System.Windows.Forms.Panel(); - this.PAN_Dead = new System.Windows.Forms.Panel(); - this.label4 = new System.Windows.Forms.Label(); - this.pan1.SuspendLayout(); - this.SuspendLayout(); - // - // LBL_NodeID - // - this.LBL_NodeID.Font = new System.Drawing.Font("Microsoft Sans Serif", 12.75F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(0))); - this.LBL_NodeID.ForeColor = System.Drawing.Color.White; - this.LBL_NodeID.Location = new System.Drawing.Point(13, 68); - this.LBL_NodeID.Name = "LBL_NodeID"; - this.LBL_NodeID.Size = new System.Drawing.Size(39, 23); - this.LBL_NodeID.TabIndex = 0; - this.LBL_NodeID.Text = "888"; - this.LBL_NodeID.TextAlign = System.Drawing.ContentAlignment.TopCenter; - // - // LBL_Label - // - this.LBL_Label.AutoSize = true; - this.LBL_Label.Font = new System.Drawing.Font("Microsoft Sans Serif", 12.75F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(0))); - this.LBL_Label.ForeColor = System.Drawing.Color.White; - this.LBL_Label.Location = new System.Drawing.Point(53, 7); - this.LBL_Label.Name = "LBL_Label"; - this.LBL_Label.Size = new System.Drawing.Size(55, 20); - this.LBL_Label.TabIndex = 1; - this.LBL_Label.Text = "Label"; - // - // LBL_Description - // - this.LBL_Description.AutoSize = true; - this.LBL_Description.Font = new System.Drawing.Font("Microsoft Sans Serif", 8.75F); - this.LBL_Description.ForeColor = System.Drawing.Color.White; - this.LBL_Description.Location = new System.Drawing.Point(54, 27); - this.LBL_Description.Name = "LBL_Description"; - this.LBL_Description.Size = new System.Drawing.Size(69, 15); - this.LBL_Description.TabIndex = 2; - this.LBL_Description.Text = "Description"; - // - // pan1 - // - this.pan1.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(26)))), ((int)(((byte)(125)))), ((int)(((byte)(195))))); - this.pan1.Controls.Add(this.LBL_NodeID); - this.pan1.Location = new System.Drawing.Point(-9, -5); - this.pan1.Name = "pan1"; - this.pan1.Size = new System.Drawing.Size(56, 165); - this.pan1.TabIndex = 3; - // - // PAN_Ready - // - this.PAN_Ready.BackColor = System.Drawing.Color.Black; - this.PAN_Ready.Location = new System.Drawing.Point(57, 54); - this.PAN_Ready.Name = "PAN_Ready"; - this.PAN_Ready.Size = new System.Drawing.Size(16, 16); - this.PAN_Ready.TabIndex = 4; - // - // label1 - // - this.label1.AutoSize = true; - this.label1.Font = new System.Drawing.Font("Microsoft Sans Serif", 8.75F); - this.label1.ForeColor = System.Drawing.Color.White; - this.label1.Location = new System.Drawing.Point(81, 54); - this.label1.Name = "label1"; - this.label1.Size = new System.Drawing.Size(42, 15); - this.label1.TabIndex = 5; - this.label1.Text = "Ready"; - // - // label2 - // - this.label2.AutoSize = true; - this.label2.Font = new System.Drawing.Font("Microsoft Sans Serif", 8.75F); - this.label2.ForeColor = System.Drawing.Color.White; - this.label2.Location = new System.Drawing.Point(81, 72); - this.label2.Name = "label2"; - this.label2.Size = new System.Drawing.Size(69, 15); - this.label2.TabIndex = 7; - this.label2.Text = "Interviewed"; - // - // PAN_Interviewed - // - this.PAN_Interviewed.BackColor = System.Drawing.Color.Black; - this.PAN_Interviewed.Location = new System.Drawing.Point(57, 72); - this.PAN_Interviewed.Name = "PAN_Interviewed"; - this.PAN_Interviewed.Size = new System.Drawing.Size(16, 16); - this.PAN_Interviewed.TabIndex = 6; - // - // label3 - // - this.label3.AutoSize = true; - this.label3.Font = new System.Drawing.Font("Microsoft Sans Serif", 8.75F); - this.label3.ForeColor = System.Drawing.Color.White; - this.label3.Location = new System.Drawing.Point(81, 90); - this.label3.Name = "label3"; - this.label3.Size = new System.Drawing.Size(72, 15); - this.label3.TabIndex = 9; - this.label3.Text = "Alive / Wake"; - // - // PAN_Wake - // - this.PAN_Wake.BackColor = System.Drawing.Color.Black; - this.PAN_Wake.Location = new System.Drawing.Point(57, 90); - this.PAN_Wake.Name = "PAN_Wake"; - this.PAN_Wake.Size = new System.Drawing.Size(16, 16); - this.PAN_Wake.TabIndex = 8; - // - // PAN_Dead - // - this.PAN_Dead.BackColor = System.Drawing.Color.Black; - this.PAN_Dead.Location = new System.Drawing.Point(57, 108); - this.PAN_Dead.Name = "PAN_Dead"; - this.PAN_Dead.Size = new System.Drawing.Size(16, 16); - this.PAN_Dead.TabIndex = 10; - // - // label4 - // - this.label4.AutoSize = true; - this.label4.Font = new System.Drawing.Font("Microsoft Sans Serif", 8.75F); - this.label4.ForeColor = System.Drawing.Color.White; - this.label4.Location = new System.Drawing.Point(81, 108); - this.label4.Name = "label4"; - this.label4.Size = new System.Drawing.Size(37, 15); - this.label4.TabIndex = 11; - this.label4.Text = "Dead"; - // - // Node - // - this.AutoScaleDimensions = new System.Drawing.SizeF(96F, 96F); - this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Dpi; - this.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(16)))), ((int)(((byte)(115)))), ((int)(((byte)(185))))); - this.Controls.Add(this.label4); - this.Controls.Add(this.PAN_Dead); - this.Controls.Add(this.label3); - this.Controls.Add(this.PAN_Wake); - this.Controls.Add(this.label2); - this.Controls.Add(this.PAN_Interviewed); - this.Controls.Add(this.label1); - this.Controls.Add(this.PAN_Ready); - this.Controls.Add(this.pan1); - this.Controls.Add(this.LBL_Description); - this.Controls.Add(this.LBL_Label); - this.Cursor = System.Windows.Forms.Cursors.Hand; - this.Name = "Node"; - this.Size = new System.Drawing.Size(242, 148); - this.Click += new System.EventHandler(this.Node_Click); - this.pan1.ResumeLayout(false); - this.ResumeLayout(false); - this.PerformLayout(); - - } - - #endregion - - private System.Windows.Forms.Label LBL_NodeID; - private System.Windows.Forms.Label LBL_Label; - private System.Windows.Forms.Label LBL_Description; - private System.Windows.Forms.Panel pan1; - private System.Windows.Forms.Panel PAN_Ready; - private System.Windows.Forms.Label label1; - private System.Windows.Forms.Label label2; - private System.Windows.Forms.Panel PAN_Interviewed; - private System.Windows.Forms.Label label3; - private System.Windows.Forms.Panel PAN_Wake; - private System.Windows.Forms.Panel PAN_Dead; - private System.Windows.Forms.Label label4; - } -} diff --git a/Visual Studio Projects/Network Toolkit/Network Toolkit/CustomControls/Node.cs b/Visual Studio Projects/Network Toolkit/Network Toolkit/CustomControls/Node.cs deleted file mode 100644 index fb317de..0000000 --- a/Visual Studio Projects/Network Toolkit/Network Toolkit/CustomControls/Node.cs +++ /dev/null @@ -1,155 +0,0 @@ -using System; -using System.Collections.Generic; -using System.ComponentModel; -using System.Data; -using System.Drawing; -using System.Linq; -using System.Text; -using System.Threading.Tasks; -using System.Windows.Forms; -using ZWaveJS.NET; - -namespace Network_Toolkit.CustomControls -{ - public partial class Node : UserControl - { - public ZWaveNode ZwaveNode; - public delegate void NodeSelected(ZWaveNode ZwaveNode); - public event NodeSelected NodeSelectedEvent; - public Node(ZWaveNode Node) - { - InitializeComponent(); - - this.ZwaveNode = Node; - - Node.NodeInterviewCompleted += Node_NodeInterviewCompleted; - Node.NodeInterviewStarted += Node_NodeInterviewStarted; - Node.NodeInterviewFailed += Node_NodeInterviewFailed; - Node.NodeReady += Node_NodeReady; - Node.NodeAwake += Node_NodeAwake; - Node.NodeAsleep += Node_NodeAsleep; - Node.NodeDead += Node_NodeDead; - - LBL_NodeID.Text = Node.id.ToString(); - LBL_Label.Text = Node.deviceConfig?.label ?? "Unknown"; - LBL_Description.Text = Node.deviceConfig?.description; - SetStatus(Node.status); - - if (Node.ready) - { - MarkReady(); - } - - if(Node.interviewStage == "Complete") - { - PAN_Interviewed.BackColor = Color.White; - } - - } - - - - private void Node_NodeDead(ZWaveNode Node) - { - this.Invoke((MethodInvoker)delegate() { - SetStatus(Node.status); - }); - } - - private void Node_NodeAsleep(ZWaveNode Node) - { - this.Invoke((MethodInvoker)delegate () { - SetStatus(Node.status); - }); - } - - private void Node_NodeAwake(ZWaveNode Node) - { - this.Invoke((MethodInvoker)delegate () { - SetStatus(Node.status); - }); - } - - private void Node_NodeReady(ZWaveNode Node) - { - this.Invoke((MethodInvoker)delegate () { - MarkReady(); - }); - - } - - private void Node_NodeInterviewFailed(ZWaveNode Node, NodeInterviewFailedEventArgs Args) - { - if (Args.isFinal) - { - this.Invoke((MethodInvoker)delegate () - { - PAN_Ready.BackColor = Color.Black; - PAN_Interviewed.BackColor = Color.Red; - - }); - } - - } - - private void Node_NodeInterviewStarted(ZWaveNode Node) - { - this.Invoke((MethodInvoker)delegate () - { - PAN_Ready.BackColor = Color.Black; - PAN_Interviewed.BackColor = Color.Black; - - }); - } - - private void Node_NodeInterviewCompleted(ZWaveNode Node) - { - this.Invoke((MethodInvoker)delegate () - { - PAN_Interviewed.BackColor = Color.White; - PAN_Wake.BackColor = Color.White; - PAN_Ready.BackColor = Color.White; - - LBL_Label.Text = Node.deviceConfig?.label; - LBL_Description.Text = Node.deviceConfig?.description; - }); - - - } - - public void MarkReady() - { - PAN_Ready.BackColor = Color.White; - } - - public void SetStatus(Enums.NodeStatus Status) - { - switch (Status) - { - // Alive - case Enums.NodeStatus.Alive: - case Enums.NodeStatus.Awake: - PAN_Wake.BackColor = Color.White; - PAN_Dead.BackColor = Color.Black; - break; - - // A sleep - case Enums.NodeStatus.Asleep: - PAN_Wake.BackColor = Color.Black; - PAN_Dead.BackColor = Color.Black; - break; - - // daed - case Enums.NodeStatus.Dead: - PAN_Wake.BackColor = Color.Black; - PAN_Dead.BackColor = Color.Red; - break; - } - } - - private void Node_Click(object sender, EventArgs e) - { - NodeSelectedEvent?.Invoke(this.ZwaveNode); - } - } -} diff --git a/Visual Studio Projects/Network Toolkit/Network Toolkit/CustomControls/Node.resx b/Visual Studio Projects/Network Toolkit/Network Toolkit/CustomControls/Node.resx deleted file mode 100644 index 1af7de1..0000000 --- a/Visual Studio Projects/Network Toolkit/Network Toolkit/CustomControls/Node.resx +++ /dev/null @@ -1,120 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - text/microsoft-resx - - - 2.0 - - - System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - - - System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - - \ No newline at end of file diff --git a/Visual Studio Projects/Network Toolkit/Network Toolkit/DSK.Designer.cs b/Visual Studio Projects/Network Toolkit/Network Toolkit/DSK.Designer.cs deleted file mode 100644 index cc48955..0000000 --- a/Visual Studio Projects/Network Toolkit/Network Toolkit/DSK.Designer.cs +++ /dev/null @@ -1,209 +0,0 @@ - -namespace Network_Toolkit -{ - partial class DSK - { - /// - /// Required designer variable. - /// - private System.ComponentModel.IContainer components = null; - - /// - /// Clean up any resources being used. - /// - /// true if managed resources should be disposed; otherwise, false. - protected override void Dispose(bool disposing) - { - if (disposing && (components != null)) - { - components.Dispose(); - } - base.Dispose(disposing); - } - - #region Windows Form Designer generated code - - /// - /// Required method for Designer support - do not modify - /// the contents of this method with the code editor. - /// - private void InitializeComponent() - { - this.panel1 = new System.Windows.Forms.Panel(); - this.label2 = new System.Windows.Forms.Label(); - this.TXT_DSK2 = new System.Windows.Forms.TextBox(); - this.TXT_Pin = new System.Windows.Forms.TextBox(); - this.TXT_DSK3 = new System.Windows.Forms.TextBox(); - this.TXT_DSK4 = new System.Windows.Forms.TextBox(); - this.TXT_DSK1 = new System.Windows.Forms.TextBox(); - this.button1 = new System.Windows.Forms.Button(); - this.label1 = new System.Windows.Forms.Label(); - this.TXT_DSK5 = new System.Windows.Forms.TextBox(); - this.TXT_DSK6 = new System.Windows.Forms.TextBox(); - this.TXT_DSK7 = new System.Windows.Forms.TextBox(); - this.panel1.SuspendLayout(); - this.SuspendLayout(); - // - // panel1 - // - this.panel1.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left) - | System.Windows.Forms.AnchorStyles.Right))); - this.panel1.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(16)))), ((int)(((byte)(115)))), ((int)(((byte)(185))))); - this.panel1.Controls.Add(this.label2); - this.panel1.Location = new System.Drawing.Point(-5, -12); - this.panel1.Margin = new System.Windows.Forms.Padding(4); - this.panel1.Name = "panel1"; - this.panel1.Size = new System.Drawing.Size(470, 94); - this.panel1.TabIndex = 5; - // - // label2 - // - this.label2.AutoSize = true; - this.label2.Font = new System.Drawing.Font("Microsoft Sans Serif", 16.75F); - this.label2.ForeColor = System.Drawing.Color.White; - this.label2.Location = new System.Drawing.Point(21, 34); - this.label2.Margin = new System.Windows.Forms.Padding(4, 0, 4, 0); - this.label2.Name = "label2"; - this.label2.Size = new System.Drawing.Size(125, 29); - this.label2.TabIndex = 22; - this.label2.Text = "Enter DSK"; - // - // TXT_DSK2 - // - this.TXT_DSK2.Location = new System.Drawing.Point(231, 210); - this.TXT_DSK2.Name = "TXT_DSK2"; - this.TXT_DSK2.ReadOnly = true; - this.TXT_DSK2.Size = new System.Drawing.Size(57, 22); - this.TXT_DSK2.TabIndex = 6; - this.TXT_DSK2.TextAlign = System.Windows.Forms.HorizontalAlignment.Center; - // - // TXT_Pin - // - this.TXT_Pin.Location = new System.Drawing.Point(105, 210); - this.TXT_Pin.Name = "TXT_Pin"; - this.TXT_Pin.Size = new System.Drawing.Size(57, 22); - this.TXT_Pin.TabIndex = 7; - this.TXT_Pin.TextAlign = System.Windows.Forms.HorizontalAlignment.Center; - // - // TXT_DSK3 - // - this.TXT_DSK3.Location = new System.Drawing.Point(294, 210); - this.TXT_DSK3.Name = "TXT_DSK3"; - this.TXT_DSK3.ReadOnly = true; - this.TXT_DSK3.Size = new System.Drawing.Size(57, 22); - this.TXT_DSK3.TabIndex = 8; - this.TXT_DSK3.TextAlign = System.Windows.Forms.HorizontalAlignment.Center; - // - // TXT_DSK4 - // - this.TXT_DSK4.Location = new System.Drawing.Point(105, 238); - this.TXT_DSK4.Name = "TXT_DSK4"; - this.TXT_DSK4.ReadOnly = true; - this.TXT_DSK4.Size = new System.Drawing.Size(57, 22); - this.TXT_DSK4.TabIndex = 9; - this.TXT_DSK4.TextAlign = System.Windows.Forms.HorizontalAlignment.Center; - // - // TXT_DSK1 - // - this.TXT_DSK1.Location = new System.Drawing.Point(168, 210); - this.TXT_DSK1.Name = "TXT_DSK1"; - this.TXT_DSK1.ReadOnly = true; - this.TXT_DSK1.Size = new System.Drawing.Size(57, 22); - this.TXT_DSK1.TabIndex = 10; - this.TXT_DSK1.TextAlign = System.Windows.Forms.HorizontalAlignment.Center; - // - // button1 - // - this.button1.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(16)))), ((int)(((byte)(115)))), ((int)(((byte)(185))))); - this.button1.FlatStyle = System.Windows.Forms.FlatStyle.Flat; - this.button1.ForeColor = System.Drawing.Color.White; - this.button1.Location = new System.Drawing.Point(322, 359); - this.button1.Margin = new System.Windows.Forms.Padding(4); - this.button1.Name = "button1"; - this.button1.Size = new System.Drawing.Size(127, 42); - this.button1.TabIndex = 22; - this.button1.Text = "OK"; - this.button1.UseVisualStyleBackColor = false; - this.button1.Click += new System.EventHandler(this.button1_Click); - // - // label1 - // - this.label1.Location = new System.Drawing.Point(29, 113); - this.label1.Margin = new System.Windows.Forms.Padding(4, 0, 4, 0); - this.label1.Name = "label1"; - this.label1.Size = new System.Drawing.Size(387, 46); - this.label1.TabIndex = 23; - this.label1.Tag = ""; - this.label1.Text = "Verify the device you\'re adding, by validating it\'s DSK with the below. Enter the" + - " first segement to confirm."; - // - // TXT_DSK5 - // - this.TXT_DSK5.Location = new System.Drawing.Point(168, 238); - this.TXT_DSK5.Name = "TXT_DSK5"; - this.TXT_DSK5.ReadOnly = true; - this.TXT_DSK5.Size = new System.Drawing.Size(57, 22); - this.TXT_DSK5.TabIndex = 24; - this.TXT_DSK5.TextAlign = System.Windows.Forms.HorizontalAlignment.Center; - // - // TXT_DSK6 - // - this.TXT_DSK6.Location = new System.Drawing.Point(231, 238); - this.TXT_DSK6.Name = "TXT_DSK6"; - this.TXT_DSK6.ReadOnly = true; - this.TXT_DSK6.Size = new System.Drawing.Size(57, 22); - this.TXT_DSK6.TabIndex = 25; - this.TXT_DSK6.TextAlign = System.Windows.Forms.HorizontalAlignment.Center; - // - // TXT_DSK7 - // - this.TXT_DSK7.Location = new System.Drawing.Point(294, 238); - this.TXT_DSK7.Name = "TXT_DSK7"; - this.TXT_DSK7.ReadOnly = true; - this.TXT_DSK7.Size = new System.Drawing.Size(57, 22); - this.TXT_DSK7.TabIndex = 26; - this.TXT_DSK7.TextAlign = System.Windows.Forms.HorizontalAlignment.Center; - // - // DSK - // - this.AutoScaleDimensions = new System.Drawing.SizeF(8F, 16F); - this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; - this.ClientSize = new System.Drawing.Size(462, 414); - this.Controls.Add(this.TXT_DSK7); - this.Controls.Add(this.TXT_DSK6); - this.Controls.Add(this.TXT_DSK5); - this.Controls.Add(this.label1); - this.Controls.Add(this.button1); - this.Controls.Add(this.TXT_DSK1); - this.Controls.Add(this.TXT_DSK4); - this.Controls.Add(this.TXT_DSK3); - this.Controls.Add(this.TXT_Pin); - this.Controls.Add(this.TXT_DSK2); - this.Controls.Add(this.panel1); - this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedToolWindow; - this.Name = "DSK"; - this.StartPosition = System.Windows.Forms.FormStartPosition.CenterParent; - this.Text = "Enter DSK"; - this.panel1.ResumeLayout(false); - this.panel1.PerformLayout(); - this.ResumeLayout(false); - this.PerformLayout(); - - } - - #endregion - - private System.Windows.Forms.Panel panel1; - private System.Windows.Forms.Label label2; - private System.Windows.Forms.TextBox TXT_DSK2; - private System.Windows.Forms.TextBox TXT_DSK3; - private System.Windows.Forms.TextBox TXT_DSK4; - private System.Windows.Forms.TextBox TXT_DSK1; - private System.Windows.Forms.Button button1; - private System.Windows.Forms.Label label1; - private System.Windows.Forms.TextBox TXT_DSK5; - internal System.Windows.Forms.TextBox TXT_Pin; - private System.Windows.Forms.TextBox TXT_DSK6; - private System.Windows.Forms.TextBox TXT_DSK7; - } -} \ No newline at end of file diff --git a/Visual Studio Projects/Network Toolkit/Network Toolkit/DSK.cs b/Visual Studio Projects/Network Toolkit/Network Toolkit/DSK.cs deleted file mode 100644 index bc06504..0000000 --- a/Visual Studio Projects/Network Toolkit/Network Toolkit/DSK.cs +++ /dev/null @@ -1,37 +0,0 @@ -using System; -using System.Collections.Generic; -using System.ComponentModel; -using System.Data; -using System.Drawing; -using System.Linq; -using System.Text; -using System.Threading.Tasks; -using System.Windows.Forms; - -namespace Network_Toolkit -{ - public partial class DSK : Form - { - public DSK(string[] Parts) - { - - InitializeComponent(); - - TXT_DSK1.Text = Parts[0]; - TXT_DSK2.Text = Parts[1]; - TXT_DSK3.Text = Parts[2]; - TXT_DSK4.Text = Parts[3]; - TXT_DSK5.Text = Parts[4]; - TXT_DSK6.Text = Parts[5]; - TXT_DSK7.Text = Parts[6]; - - TXT_Pin.Focus(); - } - - private void button1_Click(object sender, EventArgs e) - { - this.DialogResult = DialogResult.OK; - this.Close(); - } - } -} diff --git a/Visual Studio Projects/Network Toolkit/Network Toolkit/DSK.resx b/Visual Studio Projects/Network Toolkit/Network Toolkit/DSK.resx deleted file mode 100644 index 1af7de1..0000000 --- a/Visual Studio Projects/Network Toolkit/Network Toolkit/DSK.resx +++ /dev/null @@ -1,120 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - text/microsoft-resx - - - 2.0 - - - System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - - - System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - - \ No newline at end of file diff --git a/Visual Studio Projects/Network Toolkit/Network Toolkit/Event.Designer.cs b/Visual Studio Projects/Network Toolkit/Network Toolkit/Event.Designer.cs deleted file mode 100644 index 17b722b..0000000 --- a/Visual Studio Projects/Network Toolkit/Network Toolkit/Event.Designer.cs +++ /dev/null @@ -1,216 +0,0 @@ - -namespace Network_Toolkit -{ - partial class Event - { - /// - /// Required designer variable. - /// - private System.ComponentModel.IContainer components = null; - - /// - /// Clean up any resources being used. - /// - /// true if managed resources should be disposed; otherwise, false. - protected override void Dispose(bool disposing) - { - if (disposing && (components != null)) - { - components.Dispose(); - } - base.Dispose(disposing); - } - - #region Windows Form Designer generated code - - /// - /// Required method for Designer support - do not modify - /// the contents of this method with the code editor. - /// - private void InitializeComponent() - { - System.Windows.Forms.ListViewItem listViewItem1 = new System.Windows.Forms.ListViewItem("Commands TX"); - System.Windows.Forms.ListViewItem listViewItem2 = new System.Windows.Forms.ListViewItem("Commands TXD"); - System.Windows.Forms.ListViewItem listViewItem3 = new System.Windows.Forms.ListViewItem("Commands RX"); - System.Windows.Forms.ListViewItem listViewItem4 = new System.Windows.Forms.ListViewItem("Commands RXD"); - System.Windows.Forms.ListViewItem listViewItem5 = new System.Windows.Forms.ListViewItem("Timeouts"); - System.Windows.Forms.ListViewItem listViewItem6 = new System.Windows.Forms.ListViewItem("Round Trip Time"); - this.panel1 = new System.Windows.Forms.Panel(); - this.label2 = new System.Windows.Forms.Label(); - this.button1 = new System.Windows.Forms.Button(); - this.label1 = new System.Windows.Forms.Label(); - this.label3 = new System.Windows.Forms.Label(); - this.LST_Events = new System.Windows.Forms.ListView(); - this.columnHeader1 = ((System.Windows.Forms.ColumnHeader)(new System.Windows.Forms.ColumnHeader())); - this.columnHeader2 = ((System.Windows.Forms.ColumnHeader)(new System.Windows.Forms.ColumnHeader())); - this.columnHeader3 = ((System.Windows.Forms.ColumnHeader)(new System.Windows.Forms.ColumnHeader())); - this.LST_Stats = new System.Windows.Forms.ListView(); - this.columnHeader4 = ((System.Windows.Forms.ColumnHeader)(new System.Windows.Forms.ColumnHeader())); - this.columnHeader5 = ((System.Windows.Forms.ColumnHeader)(new System.Windows.Forms.ColumnHeader())); - this.panel1.SuspendLayout(); - this.SuspendLayout(); - // - // panel1 - // - this.panel1.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left) - | System.Windows.Forms.AnchorStyles.Right))); - this.panel1.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(16)))), ((int)(((byte)(115)))), ((int)(((byte)(185))))); - this.panel1.Controls.Add(this.label2); - this.panel1.Location = new System.Drawing.Point(-5, -12); - this.panel1.Margin = new System.Windows.Forms.Padding(4); - this.panel1.Name = "panel1"; - this.panel1.Size = new System.Drawing.Size(570, 94); - this.panel1.TabIndex = 6; - // - // label2 - // - this.label2.AutoSize = true; - this.label2.Font = new System.Drawing.Font("Microsoft Sans Serif", 16.75F); - this.label2.ForeColor = System.Drawing.Color.White; - this.label2.Location = new System.Drawing.Point(21, 34); - this.label2.Margin = new System.Windows.Forms.Padding(4, 0, 4, 0); - this.label2.Name = "label2"; - this.label2.Size = new System.Drawing.Size(165, 29); - this.label2.TabIndex = 22; - this.label2.Text = "Device Events"; - // - // button1 - // - this.button1.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(16)))), ((int)(((byte)(115)))), ((int)(((byte)(185))))); - this.button1.FlatStyle = System.Windows.Forms.FlatStyle.Flat; - this.button1.ForeColor = System.Drawing.Color.White; - this.button1.Location = new System.Drawing.Point(416, 501); - this.button1.Margin = new System.Windows.Forms.Padding(4); - this.button1.Name = "button1"; - this.button1.Size = new System.Drawing.Size(127, 42); - this.button1.TabIndex = 23; - this.button1.Text = "CLOSE"; - this.button1.UseVisualStyleBackColor = false; - this.button1.Click += new System.EventHandler(this.button1_Click); - // - // label1 - // - this.label1.AutoSize = true; - this.label1.Location = new System.Drawing.Point(13, 97); - this.label1.Name = "label1"; - this.label1.Size = new System.Drawing.Size(79, 13); - this.label1.TabIndex = 24; - this.label1.Text = "ZWave Events"; - // - // label3 - // - this.label3.AutoSize = true; - this.label3.Location = new System.Drawing.Point(13, 336); - this.label3.Name = "label3"; - this.label3.Size = new System.Drawing.Size(92, 13); - this.label3.TabIndex = 25; - this.label3.Text = "Network Statistics"; - // - // LST_Events - // - this.LST_Events.Columns.AddRange(new System.Windows.Forms.ColumnHeader[] { - this.columnHeader1, - this.columnHeader2, - this.columnHeader3}); - this.LST_Events.FullRowSelect = true; - this.LST_Events.HideSelection = false; - this.LST_Events.Location = new System.Drawing.Point(16, 116); - this.LST_Events.Name = "LST_Events"; - this.LST_Events.Size = new System.Drawing.Size(526, 205); - this.LST_Events.TabIndex = 39; - this.LST_Events.UseCompatibleStateImageBehavior = false; - this.LST_Events.View = System.Windows.Forms.View.Details; - // - // columnHeader1 - // - this.columnHeader1.Text = "Date"; - this.columnHeader1.Width = 117; - // - // columnHeader2 - // - this.columnHeader2.Text = "Event Type"; - this.columnHeader2.Width = 152; - // - // columnHeader3 - // - this.columnHeader3.Text = "Object"; - this.columnHeader3.Width = 211; - // - // LST_Stats - // - this.LST_Stats.Columns.AddRange(new System.Windows.Forms.ColumnHeader[] { - this.columnHeader4, - this.columnHeader5}); - this.LST_Stats.FullRowSelect = true; - this.LST_Stats.HideSelection = false; - listViewItem1.Tag = "CTX"; - listViewItem2.Tag = "CTXD"; - listViewItem3.Tag = "CRX"; - listViewItem4.Tag = "CRXD"; - listViewItem5.Tag = "TO"; - listViewItem6.Tag = "RTT"; - this.LST_Stats.Items.AddRange(new System.Windows.Forms.ListViewItem[] { - listViewItem1, - listViewItem2, - listViewItem3, - listViewItem4, - listViewItem5, - listViewItem6}); - this.LST_Stats.Location = new System.Drawing.Point(12, 355); - this.LST_Stats.Name = "LST_Stats"; - this.LST_Stats.Size = new System.Drawing.Size(531, 139); - this.LST_Stats.TabIndex = 40; - this.LST_Stats.UseCompatibleStateImageBehavior = false; - this.LST_Stats.View = System.Windows.Forms.View.Details; - // - // columnHeader4 - // - this.columnHeader4.Text = "Measure"; - this.columnHeader4.Width = 208; - // - // columnHeader5 - // - this.columnHeader5.Text = "Value"; - this.columnHeader5.Width = 246; - // - // Event - // - this.AutoScaleDimensions = new System.Drawing.SizeF(96F, 96F); - this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Dpi; - this.ClientSize = new System.Drawing.Size(555, 562); - this.Controls.Add(this.LST_Stats); - this.Controls.Add(this.LST_Events); - this.Controls.Add(this.label3); - this.Controls.Add(this.label1); - this.Controls.Add(this.button1); - this.Controls.Add(this.panel1); - this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedToolWindow; - this.Margin = new System.Windows.Forms.Padding(4); - this.Name = "Event"; - this.StartPosition = System.Windows.Forms.FormStartPosition.CenterParent; - this.Text = "Device Events"; - this.Load += new System.EventHandler(this.Event_Load); - this.Shown += new System.EventHandler(this.Event_Shown); - this.panel1.ResumeLayout(false); - this.panel1.PerformLayout(); - this.ResumeLayout(false); - this.PerformLayout(); - - } - - #endregion - - private System.Windows.Forms.Panel panel1; - private System.Windows.Forms.Label label2; - private System.Windows.Forms.Button button1; - private System.Windows.Forms.Label label1; - private System.Windows.Forms.Label label3; - private System.Windows.Forms.ListView LST_Events; - private System.Windows.Forms.ColumnHeader columnHeader1; - private System.Windows.Forms.ColumnHeader columnHeader2; - private System.Windows.Forms.ColumnHeader columnHeader3; - private System.Windows.Forms.ListView LST_Stats; - private System.Windows.Forms.ColumnHeader columnHeader4; - private System.Windows.Forms.ColumnHeader columnHeader5; - } -} \ No newline at end of file diff --git a/Visual Studio Projects/Network Toolkit/Network Toolkit/Event.cs b/Visual Studio Projects/Network Toolkit/Network Toolkit/Event.cs deleted file mode 100644 index e8c39b7..0000000 --- a/Visual Studio Projects/Network Toolkit/Network Toolkit/Event.cs +++ /dev/null @@ -1,149 +0,0 @@ -using System; -using System.Collections.Generic; -using System.ComponentModel; -using System.Data; -using System.Drawing; -using System.Linq; -using System.Text; -using System.Threading.Tasks; -using System.Windows.Forms; -using ZWaveJS.NET; - -namespace Network_Toolkit -{ - public partial class Event : Form - { - ZWaveNode _Node; - bool _Shown = false; - public Event(ZWaveNode Node) - { - - InitializeComponent(); - - _Node = Node; - - Node.ValueUpdated += Node_ValueUpdated; - Node.ValueNotification += Node_ValueNotification; - Node.Notification += Node_Notification; - Node.StatisticsUpdated += Node_StatisticsUpdated; - Node.NodeAwake += Node_NodeAwake; - Node.NodeAsleep += Node_NodeAsleep; - } - - private void Node_NodeAsleep(ZWaveNode Node) - { - this.Invoke((MethodInvoker)delegate () - { - ListViewItem LVI = new ListViewItem(DateTime.Now.ToString("dd.MM.yyyy HH:mm")); - LVI.SubItems.Add("SLEEP"); - LVI.SubItems.Add("{}"); - LST_Events.Items.Add(LVI); - - LST_Events.Items[LST_Events.Items.Count - 1].EnsureVisible(); - }); - } - - private void Node_NodeAwake(ZWaveNode Node) - { - this.Invoke((MethodInvoker)delegate () - { - ListViewItem LVI = new ListViewItem(DateTime.Now.ToString("dd.MM.yyyy HH:mm")); - LVI.SubItems.Add("AWAKE"); - LVI.SubItems.Add("{}"); - LST_Events.Items.Add(LVI); - - LST_Events.Items[LST_Events.Items.Count - 1].EnsureVisible(); - }); - } - - private void Node_StatisticsUpdated(ZWaveNode Node, NodeStatistics Statistics) - { - this.Invoke((MethodInvoker)delegate () - { - LST_Stats.Items.Cast().FirstOrDefault((LVI) => LVI.Tag.Equals("CTX")).SubItems[1].Text = Statistics.commandsTX.ToString(); - LST_Stats.Items.Cast().FirstOrDefault((LVI) => LVI.Tag.Equals("CTXD")).SubItems[1].Text = Statistics.commandsDroppedTX.ToString(); - LST_Stats.Items.Cast().FirstOrDefault((LVI) => LVI.Tag.Equals("CRX")).SubItems[1].Text = Statistics.commandsRX.ToString(); - LST_Stats.Items.Cast().FirstOrDefault((LVI) => LVI.Tag.Equals("CRXD")).SubItems[1].Text = Statistics.commandsDroppedRX.ToString(); - LST_Stats.Items.Cast().FirstOrDefault((LVI) => LVI.Tag.Equals("TO")).SubItems[1].Text = Statistics.timeoutResponse.ToString(); - LST_Stats.Items.Cast().FirstOrDefault((LVI) => LVI.Tag.Equals("RTT")).SubItems[1].Text = Statistics.rtt.ToString(); - }); - } - - private void Node_Notification(ZWaveNode Node, int ccId, Newtonsoft.Json.Linq.JObject Args) - { - - this.Invoke((MethodInvoker)delegate () - { - ListViewItem LVI = new ListViewItem(DateTime.Now.ToString("dd.MM.yyyy HH:mm")); - LVI.SubItems.Add("NOTIFICATION"); - LVI.SubItems.Add(Args.ToString()); - LST_Events.Items.Add(LVI); - - LST_Events.Items[LST_Events.Items.Count - 1].EnsureVisible(); - }); - - } - - private void Node_ValueNotification(ZWaveNode Node, Newtonsoft.Json.Linq.JObject Args) - { - this.Invoke((MethodInvoker)delegate () - { - ListViewItem LVI = new ListViewItem(DateTime.Now.ToString("dd.MM.yyyy HH:mm")); - LVI.SubItems.Add("VALUE NOTIFICATION"); - LVI.SubItems.Add(Args.ToString()); - LST_Events.Items.Add(LVI); - - LST_Events.Items[LST_Events.Items.Count - 1].EnsureVisible(); - }); - } - - private void Node_ValueUpdated(ZWaveNode Node, Newtonsoft.Json.Linq.JObject Args) - { - this.Invoke((MethodInvoker)delegate () - { - ListViewItem LVI = new ListViewItem(DateTime.Now.ToString("dd.MM.yyyy HH:mm")); - LVI.SubItems.Add("VALUE UPDATED"); - LVI.SubItems.Add(Args.ToString()); - LST_Events.Items.Add(LVI); - - LST_Events.Items[LST_Events.Items.Count - 1].EnsureVisible(); - }); - } - - private void button1_Click(object sender, EventArgs e) - { - this.Close(); - } - - private void Event_Load(object sender, EventArgs e) - { - this.FormClosing += Event_FormClosing; - } - - private void Event_FormClosing(object sender, FormClosingEventArgs e) - { - _Node.ValueUpdated -= Node_ValueUpdated; - _Node.ValueNotification -= Node_ValueNotification; - _Node.Notification -= Node_Notification; - _Node.StatisticsUpdated -= Node_StatisticsUpdated; - _Node.NodeAwake -= Node_NodeAwake; - _Node.NodeAsleep -= Node_NodeAsleep; - } - - private void Event_Shown(object sender, EventArgs e) - { - if (!_Shown) - { - foreach (ListViewItem LVI in LST_Stats.Items) - { - LVI.SubItems.Add(""); - } - - Node_StatisticsUpdated(_Node, _Node.statistics); - - _Shown = true; - } - - } - } -} diff --git a/Visual Studio Projects/Network Toolkit/Network Toolkit/Event.resx b/Visual Studio Projects/Network Toolkit/Network Toolkit/Event.resx deleted file mode 100644 index 1af7de1..0000000 --- a/Visual Studio Projects/Network Toolkit/Network Toolkit/Event.resx +++ /dev/null @@ -1,120 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - text/microsoft-resx - - - 2.0 - - - System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - - - System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - - \ No newline at end of file diff --git a/Visual Studio Projects/Network Toolkit/Network Toolkit/HealthCheck.Designer.cs b/Visual Studio Projects/Network Toolkit/Network Toolkit/HealthCheck.Designer.cs deleted file mode 100644 index 126c7c4..0000000 --- a/Visual Studio Projects/Network Toolkit/Network Toolkit/HealthCheck.Designer.cs +++ /dev/null @@ -1,220 +0,0 @@ - -namespace Network_Toolkit -{ - partial class HealthCheck - { - /// - /// Required designer variable. - /// - private System.ComponentModel.IContainer components = null; - - /// - /// Clean up any resources being used. - /// - /// true if managed resources should be disposed; otherwise, false. - protected override void Dispose(bool disposing) - { - if (disposing && (components != null)) - { - components.Dispose(); - } - base.Dispose(disposing); - } - - #region Windows Form Designer generated code - - /// - /// Required method for Designer support - do not modify - /// the contents of this method with the code editor. - /// - private void InitializeComponent() - { - this.panel1 = new System.Windows.Forms.Panel(); - this.label2 = new System.Windows.Forms.Label(); - this.LBL_Rating = new System.Windows.Forms.Label(); - this.LST_Rounds = new System.Windows.Forms.ListView(); - this.columnHeader1 = ((System.Windows.Forms.ColumnHeader)(new System.Windows.Forms.ColumnHeader())); - this.columnHeader3 = ((System.Windows.Forms.ColumnHeader)(new System.Windows.Forms.ColumnHeader())); - this.columnHeader2 = ((System.Windows.Forms.ColumnHeader)(new System.Windows.Forms.ColumnHeader())); - this.columnHeader4 = ((System.Windows.Forms.ColumnHeader)(new System.Windows.Forms.ColumnHeader())); - this.columnHeader6 = ((System.Windows.Forms.ColumnHeader)(new System.Windows.Forms.ColumnHeader())); - this.columnHeader7 = ((System.Windows.Forms.ColumnHeader)(new System.Windows.Forms.ColumnHeader())); - this.columnHeader8 = ((System.Windows.Forms.ColumnHeader)(new System.Windows.Forms.ColumnHeader())); - this.columnHeader5 = ((System.Windows.Forms.ColumnHeader)(new System.Windows.Forms.ColumnHeader())); - this.TB_Rounds = new System.Windows.Forms.TrackBar(); - this.button2 = new System.Windows.Forms.Button(); - this.label3 = new System.Windows.Forms.Label(); - this.panel1.SuspendLayout(); - ((System.ComponentModel.ISupportInitialize)(this.TB_Rounds)).BeginInit(); - this.SuspendLayout(); - // - // panel1 - // - this.panel1.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left) - | System.Windows.Forms.AnchorStyles.Right))); - this.panel1.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(16)))), ((int)(((byte)(115)))), ((int)(((byte)(185))))); - this.panel1.Controls.Add(this.label2); - this.panel1.Location = new System.Drawing.Point(-5, -12); - this.panel1.Margin = new System.Windows.Forms.Padding(4); - this.panel1.Name = "panel1"; - this.panel1.Size = new System.Drawing.Size(596, 94); - this.panel1.TabIndex = 7; - // - // label2 - // - this.label2.AutoSize = true; - this.label2.Font = new System.Drawing.Font("Microsoft Sans Serif", 16.75F); - this.label2.ForeColor = System.Drawing.Color.White; - this.label2.Location = new System.Drawing.Point(21, 34); - this.label2.Margin = new System.Windows.Forms.Padding(4, 0, 4, 0); - this.label2.Name = "label2"; - this.label2.Size = new System.Drawing.Size(252, 29); - this.label2.TabIndex = 22; - this.label2.Text = "Network Health Check"; - // - // LBL_Rating - // - this.LBL_Rating.Font = new System.Drawing.Font("Microsoft Sans Serif", 16.25F); - this.LBL_Rating.Location = new System.Drawing.Point(21, 139); - this.LBL_Rating.Name = "LBL_Rating"; - this.LBL_Rating.Size = new System.Drawing.Size(554, 26); - this.LBL_Rating.TabIndex = 8; - this.LBL_Rating.Text = "Health Rating: Not yet known."; - this.LBL_Rating.TextAlign = System.Drawing.ContentAlignment.MiddleCenter; - // - // LST_Rounds - // - this.LST_Rounds.Columns.AddRange(new System.Windows.Forms.ColumnHeader[] { - this.columnHeader1, - this.columnHeader3, - this.columnHeader2, - this.columnHeader4, - this.columnHeader6, - this.columnHeader7, - this.columnHeader8, - this.columnHeader5}); - this.LST_Rounds.FullRowSelect = true; - this.LST_Rounds.HideSelection = false; - this.LST_Rounds.Location = new System.Drawing.Point(21, 212); - this.LST_Rounds.Name = "LST_Rounds"; - this.LST_Rounds.Size = new System.Drawing.Size(555, 196); - this.LST_Rounds.TabIndex = 9; - this.LST_Rounds.UseCompatibleStateImageBehavior = false; - this.LST_Rounds.View = System.Windows.Forms.View.Details; - // - // columnHeader1 - // - this.columnHeader1.Text = "Round"; - this.columnHeader1.Width = 50; - // - // columnHeader3 - // - this.columnHeader3.Text = "Failed Pings"; - this.columnHeader3.Width = 73; - // - // columnHeader2 - // - this.columnHeader2.Text = "Latency"; - this.columnHeader2.Width = 54; - // - // columnHeader4 - // - this.columnHeader4.Text = "Route Changes"; - this.columnHeader4.Width = 92; - // - // columnHeader6 - // - this.columnHeader6.Text = "Min Power"; - this.columnHeader6.Width = 62; - // - // columnHeader7 - // - this.columnHeader7.Text = "Neighbours"; - this.columnHeader7.Width = 56; - // - // columnHeader8 - // - this.columnHeader8.Text = "SNR Margin"; - this.columnHeader8.Width = 84; - // - // columnHeader5 - // - this.columnHeader5.Text = "Rating"; - this.columnHeader5.Width = 54; - // - // TB_Rounds - // - this.TB_Rounds.Location = new System.Drawing.Point(130, 415); - this.TB_Rounds.Maximum = 5; - this.TB_Rounds.Minimum = 1; - this.TB_Rounds.Name = "TB_Rounds"; - this.TB_Rounds.Size = new System.Drawing.Size(311, 45); - this.TB_Rounds.TabIndex = 25; - this.TB_Rounds.Value = 3; - // - // button2 - // - this.button2.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(16)))), ((int)(((byte)(115)))), ((int)(((byte)(185))))); - this.button2.FlatStyle = System.Windows.Forms.FlatStyle.Flat; - this.button2.ForeColor = System.Drawing.Color.White; - this.button2.Location = new System.Drawing.Point(448, 417); - this.button2.Margin = new System.Windows.Forms.Padding(4); - this.button2.Name = "button2"; - this.button2.Size = new System.Drawing.Size(127, 42); - this.button2.TabIndex = 26; - this.button2.Text = "START"; - this.button2.UseVisualStyleBackColor = false; - this.button2.Click += new System.EventHandler(this.button2_Click); - // - // label3 - // - this.label3.AutoSize = true; - this.label3.Font = new System.Drawing.Font("Microsoft Sans Serif", 10.25F); - this.label3.Location = new System.Drawing.Point(18, 429); - this.label3.Name = "label3"; - this.label3.Size = new System.Drawing.Size(92, 17); - this.label3.TabIndex = 27; - this.label3.Text = "Rounds (1-5)"; - // - // HealthCheck - // - this.AutoScaleDimensions = new System.Drawing.SizeF(96F, 96F); - this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Dpi; - this.ClientSize = new System.Drawing.Size(588, 472); - this.Controls.Add(this.label3); - this.Controls.Add(this.button2); - this.Controls.Add(this.TB_Rounds); - this.Controls.Add(this.LST_Rounds); - this.Controls.Add(this.LBL_Rating); - this.Controls.Add(this.panel1); - this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedToolWindow; - this.Name = "HealthCheck"; - this.StartPosition = System.Windows.Forms.FormStartPosition.CenterParent; - this.Text = "Network Health Check"; - this.panel1.ResumeLayout(false); - this.panel1.PerformLayout(); - ((System.ComponentModel.ISupportInitialize)(this.TB_Rounds)).EndInit(); - this.ResumeLayout(false); - this.PerformLayout(); - - } - - #endregion - - private System.Windows.Forms.Panel panel1; - private System.Windows.Forms.Label label2; - private System.Windows.Forms.Label LBL_Rating; - private System.Windows.Forms.ListView LST_Rounds; - private System.Windows.Forms.TrackBar TB_Rounds; - private System.Windows.Forms.Button button2; - private System.Windows.Forms.Label label3; - private System.Windows.Forms.ColumnHeader columnHeader1; - private System.Windows.Forms.ColumnHeader columnHeader3; - private System.Windows.Forms.ColumnHeader columnHeader2; - private System.Windows.Forms.ColumnHeader columnHeader4; - private System.Windows.Forms.ColumnHeader columnHeader5; - private System.Windows.Forms.ColumnHeader columnHeader6; - private System.Windows.Forms.ColumnHeader columnHeader7; - private System.Windows.Forms.ColumnHeader columnHeader8; - } -} \ No newline at end of file diff --git a/Visual Studio Projects/Network Toolkit/Network Toolkit/HealthCheck.cs b/Visual Studio Projects/Network Toolkit/Network Toolkit/HealthCheck.cs deleted file mode 100644 index a6b6da9..0000000 --- a/Visual Studio Projects/Network Toolkit/Network Toolkit/HealthCheck.cs +++ /dev/null @@ -1,79 +0,0 @@ -using System; -using System.Collections.Generic; -using System.ComponentModel; -using System.Data; -using System.Drawing; -using System.Linq; -using System.Text; -using System.Threading.Tasks; -using System.Windows.Forms; -using ZWaveJS.NET; - -namespace Network_Toolkit -{ - public partial class HealthCheck : Form - { - ZWaveNode _Node; - public HealthCheck(ZWaveNode Node) - { - _Node = Node; - InitializeComponent(); - } - - private void button2_Click(object sender, EventArgs e) - { - LBL_Rating.Text = "Health Rating: Please wait...0%"; - LST_Rounds.Items.Clear(); - - _Node.CheckLifelineHealth(TB_Rounds.Value, LifelineHealthCheckProgress).ContinueWith((R) => { - - if (R.Result.Success) - { - LifelineHealthCheckSummary Result = R.Result.ResultPayload as LifelineHealthCheckSummary; - - - this.Invoke((MethodInvoker)delegate () { - - LBL_Rating.Text = "Health Rating: " + Result.rating.ToString(); - - int i = 1; - foreach (LifelineHealthCheckResult HCR in Result.results) - { - ListViewItem LVI = new ListViewItem(string.Format("#{0}", i)); - LVI.SubItems.Add(string.Format("C:{0}, N:{1}", HCR.failedPingsController, HCR.failedPingsNode)); - LVI.SubItems.Add(HCR.latency.ToString()); - LVI.SubItems.Add(HCR.routeChanges.ToString()); - LVI.SubItems.Add(HCR.minPowerlevel.ToString()); - LVI.SubItems.Add(HCR.numNeighbors.ToString()); - LVI.SubItems.Add(HCR.snrMargin.ToString()); - LVI.SubItems.Add(HCR.rating.ToString()); - - - LST_Rounds.Items.Add(LVI); - i++; - } - - }); - } - else - { - this.Invoke((MethodInvoker)delegate () { - - MessageBox.Show(R.Result.Message, "Failed To Complete Health Check", MessageBoxButtons.OK, MessageBoxIcon.Error); - - }); - } - - }); - } - - private void LifelineHealthCheckProgress(int Round, int TotalRounds, int LastRating) - { - this.Invoke((MethodInvoker)delegate () { - - LBL_Rating.Text = "Health Rating: Please wait..." + Math.Round(((decimal)(Round * 100))/TotalRounds)+"%"; - - }); - } - } -} diff --git a/Visual Studio Projects/Network Toolkit/Network Toolkit/HealthCheck.resx b/Visual Studio Projects/Network Toolkit/Network Toolkit/HealthCheck.resx deleted file mode 100644 index 1af7de1..0000000 --- a/Visual Studio Projects/Network Toolkit/Network Toolkit/HealthCheck.resx +++ /dev/null @@ -1,120 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - text/microsoft-resx - - - 2.0 - - - System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - - - System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - - \ No newline at end of file diff --git a/Visual Studio Projects/Network Toolkit/Network Toolkit/Icon.ico b/Visual Studio Projects/Network Toolkit/Network Toolkit/Icon.ico deleted file mode 100644 index a2f917b..0000000 Binary files a/Visual Studio Projects/Network Toolkit/Network Toolkit/Icon.ico and /dev/null differ diff --git a/Visual Studio Projects/Network Toolkit/Network Toolkit/InclusionGrantPrompt.Designer.cs b/Visual Studio Projects/Network Toolkit/Network Toolkit/InclusionGrantPrompt.Designer.cs deleted file mode 100644 index ead3fc0..0000000 --- a/Visual Studio Projects/Network Toolkit/Network Toolkit/InclusionGrantPrompt.Designer.cs +++ /dev/null @@ -1,218 +0,0 @@ - -namespace Network_Toolkit -{ - partial class InclusionGrantPrompt - { - /// - /// Required designer variable. - /// - private System.ComponentModel.IContainer components = null; - - /// - /// Clean up any resources being used. - /// - /// true if managed resources should be disposed; otherwise, false. - protected override void Dispose(bool disposing) - { - if (disposing && (components != null)) - { - components.Dispose(); - } - base.Dispose(disposing); - } - - #region Windows Form Designer generated code - - /// - /// Required method for Designer support - do not modify - /// the contents of this method with the code editor. - /// - private void InitializeComponent() - { - this.CB_S2AC = new System.Windows.Forms.CheckBox(); - this.CB_S2A = new System.Windows.Forms.CheckBox(); - this.CB_S2U = new System.Windows.Forms.CheckBox(); - this.CB_S0 = new System.Windows.Forms.CheckBox(); - this.panel1 = new System.Windows.Forms.Panel(); - this.button1 = new System.Windows.Forms.Button(); - this.label2 = new System.Windows.Forms.Label(); - this.label1 = new System.Windows.Forms.Label(); - this.label3 = new System.Windows.Forms.Label(); - this.label4 = new System.Windows.Forms.Label(); - this.label5 = new System.Windows.Forms.Label(); - this.panel1.SuspendLayout(); - this.SuspendLayout(); - // - // CB_S2AC - // - this.CB_S2AC.AutoSize = true; - this.CB_S2AC.Enabled = false; - this.CB_S2AC.Font = new System.Drawing.Font("Microsoft Sans Serif", 12.25F); - this.CB_S2AC.Location = new System.Drawing.Point(91, 99); - this.CB_S2AC.Name = "CB_S2AC"; - this.CB_S2AC.Size = new System.Drawing.Size(168, 24); - this.CB_S2AC.TabIndex = 0; - this.CB_S2AC.Tag = "S2_AccessControl"; - this.CB_S2AC.Text = "S2 Access Control"; - this.CB_S2AC.UseVisualStyleBackColor = true; - // - // CB_S2A - // - this.CB_S2A.AutoSize = true; - this.CB_S2A.Enabled = false; - this.CB_S2A.Font = new System.Drawing.Font("Microsoft Sans Serif", 12.25F); - this.CB_S2A.Location = new System.Drawing.Point(91, 156); - this.CB_S2A.Name = "CB_S2A"; - this.CB_S2A.Size = new System.Drawing.Size(155, 24); - this.CB_S2A.TabIndex = 1; - this.CB_S2A.Tag = "S2_Authenticated"; - this.CB_S2A.Text = "S2 Authenticated"; - this.CB_S2A.UseVisualStyleBackColor = true; - // - // CB_S2U - // - this.CB_S2U.AutoSize = true; - this.CB_S2U.Enabled = false; - this.CB_S2U.Font = new System.Drawing.Font("Microsoft Sans Serif", 12.25F); - this.CB_S2U.Location = new System.Drawing.Point(91, 214); - this.CB_S2U.Name = "CB_S2U"; - this.CB_S2U.Size = new System.Drawing.Size(174, 24); - this.CB_S2U.TabIndex = 2; - this.CB_S2U.Tag = "S2_Unauthenticated"; - this.CB_S2U.Text = "S2 Unauthenticated"; - this.CB_S2U.UseVisualStyleBackColor = true; - // - // CB_S0 - // - this.CB_S0.AutoSize = true; - this.CB_S0.Enabled = false; - this.CB_S0.Font = new System.Drawing.Font("Microsoft Sans Serif", 12.25F); - this.CB_S0.Location = new System.Drawing.Point(91, 278); - this.CB_S0.Name = "CB_S0"; - this.CB_S0.Size = new System.Drawing.Size(107, 24); - this.CB_S0.TabIndex = 3; - this.CB_S0.Tag = "S0_Legacy"; - this.CB_S0.Text = "S0 Legacy"; - this.CB_S0.UseVisualStyleBackColor = true; - // - // panel1 - // - this.panel1.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left) - | System.Windows.Forms.AnchorStyles.Right))); - this.panel1.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(16)))), ((int)(((byte)(115)))), ((int)(((byte)(185))))); - this.panel1.Controls.Add(this.label2); - this.panel1.Location = new System.Drawing.Point(-4, -10); - this.panel1.Name = "panel1"; - this.panel1.Size = new System.Drawing.Size(501, 76); - this.panel1.TabIndex = 4; - // - // button1 - // - this.button1.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(16)))), ((int)(((byte)(115)))), ((int)(((byte)(185))))); - this.button1.FlatStyle = System.Windows.Forms.FlatStyle.Flat; - this.button1.ForeColor = System.Drawing.Color.White; - this.button1.Location = new System.Drawing.Point(384, 364); - this.button1.Name = "button1"; - this.button1.Size = new System.Drawing.Size(95, 34); - this.button1.TabIndex = 21; - this.button1.Text = "OK"; - this.button1.UseVisualStyleBackColor = false; - this.button1.Click += new System.EventHandler(this.button1_Click); - // - // label2 - // - this.label2.AutoSize = true; - this.label2.Font = new System.Drawing.Font("Microsoft Sans Serif", 16.75F); - this.label2.ForeColor = System.Drawing.Color.White; - this.label2.Location = new System.Drawing.Point(16, 28); - this.label2.Name = "label2"; - this.label2.Size = new System.Drawing.Size(256, 29); - this.label2.TabIndex = 22; - this.label2.Text = "Allow Security Classes"; - // - // label1 - // - this.label1.AutoSize = true; - this.label1.Enabled = false; - this.label1.Location = new System.Drawing.Point(110, 122); - this.label1.Name = "label1"; - this.label1.Size = new System.Drawing.Size(291, 13); - this.label1.TabIndex = 22; - this.label1.Tag = "S2_AccessControl"; - this.label1.Text = "S2 for door locks, garage doors, access control systems etc."; - // - // label3 - // - this.label3.AutoSize = true; - this.label3.Enabled = false; - this.label3.Location = new System.Drawing.Point(110, 177); - this.label3.Name = "label3"; - this.label3.Size = new System.Drawing.Size(287, 13); - this.label3.TabIndex = 23; - this.label3.Tag = "S2_Authenticated"; - this.label3.Text = "Allows the device that is being added, to be verifed that it is"; - // - // label4 - // - this.label4.AutoSize = true; - this.label4.Enabled = false; - this.label4.Location = new System.Drawing.Point(111, 237); - this.label4.Name = "label4"; - this.label4.Size = new System.Drawing.Size(298, 13); - this.label4.TabIndex = 24; - this.label4.Tag = "S2_Unauthenticated"; - this.label4.Text = "Like S2 Authenticated, but without verification that the device"; - // - // label5 - // - this.label5.AutoSize = true; - this.label5.Enabled = false; - this.label5.Location = new System.Drawing.Point(109, 301); - this.label5.Name = "label5"; - this.label5.Size = new System.Drawing.Size(176, 13); - this.label5.TabIndex = 25; - this.label5.Tag = "S0_Legacy"; - this.label5.Text = "S0 for devices that don\'t support S2"; - // - // InclusionGrantPrompt - // - this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F); - this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; - this.ClientSize = new System.Drawing.Size(491, 410); - this.Controls.Add(this.label5); - this.Controls.Add(this.label4); - this.Controls.Add(this.label3); - this.Controls.Add(this.label1); - this.Controls.Add(this.button1); - this.Controls.Add(this.panel1); - this.Controls.Add(this.CB_S0); - this.Controls.Add(this.CB_S2U); - this.Controls.Add(this.CB_S2A); - this.Controls.Add(this.CB_S2AC); - this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedToolWindow; - this.Name = "InclusionGrantPrompt"; - this.StartPosition = System.Windows.Forms.FormStartPosition.CenterParent; - this.Text = "Allow Security Classes"; - this.Load += new System.EventHandler(this.InclusionGrantPrompt_Load); - this.panel1.ResumeLayout(false); - this.panel1.PerformLayout(); - this.ResumeLayout(false); - this.PerformLayout(); - - } - - #endregion - - private System.Windows.Forms.CheckBox CB_S2AC; - private System.Windows.Forms.CheckBox CB_S2A; - private System.Windows.Forms.CheckBox CB_S2U; - private System.Windows.Forms.CheckBox CB_S0; - private System.Windows.Forms.Panel panel1; - private System.Windows.Forms.Button button1; - private System.Windows.Forms.Label label2; - private System.Windows.Forms.Label label1; - private System.Windows.Forms.Label label3; - private System.Windows.Forms.Label label4; - private System.Windows.Forms.Label label5; - } -} \ No newline at end of file diff --git a/Visual Studio Projects/Network Toolkit/Network Toolkit/InclusionGrantPrompt.cs b/Visual Studio Projects/Network Toolkit/Network Toolkit/InclusionGrantPrompt.cs deleted file mode 100644 index 5cf02e0..0000000 --- a/Visual Studio Projects/Network Toolkit/Network Toolkit/InclusionGrantPrompt.cs +++ /dev/null @@ -1,66 +0,0 @@ -using System; -using System.Collections.Generic; -using System.ComponentModel; -using System.Data; -using System.Drawing; -using System.Linq; -using System.Text; -using System.Threading.Tasks; -using System.Windows.Forms; -using ZWaveJS.NET; - -namespace Network_Toolkit -{ - public partial class InclusionGrantPrompt : Form - { - public InclusionGrant IG; - public InclusionGrantPrompt(InclusionGrant IG) - { - this.IG = IG; - InitializeComponent(); - - foreach(Enums.SecurityClass SC in IG.securityClasses) - { - Control[] CTRLs = this.Controls.Cast().Where((T) => T.Tag != null && T.Tag.Equals(SC.ToString())).ToArray(); - - foreach(Control CTRL in CTRLs) - { - CTRL.Enabled = true; - if (CTRL is CheckBox) - { - ((CheckBox)CTRL).Checked = true; - } - } - - - } - } - - private void InclusionGrantPrompt_Load(object sender, EventArgs e) - { - - } - - private void button1_Click(object sender, EventArgs e) - { - List Classes = new List(); - - if (CB_S0.Checked) - Classes.Add(Enums.SecurityClass.S0_Legacy); - - if (CB_S2A.Checked) - Classes.Add(Enums.SecurityClass.S2_Authenticated); - - if (CB_S2AC.Checked) - Classes.Add(Enums.SecurityClass.S2_AccessControl); - - if (CB_S2U.Checked) - Classes.Add(Enums.SecurityClass.S2_Unauthenticated); - - - IG.securityClasses = Classes.ToArray(); - this.DialogResult = DialogResult.OK; - this.Close(); - } - } -} diff --git a/Visual Studio Projects/Network Toolkit/Network Toolkit/InclusionGrantPrompt.resx b/Visual Studio Projects/Network Toolkit/Network Toolkit/InclusionGrantPrompt.resx deleted file mode 100644 index 1af7de1..0000000 --- a/Visual Studio Projects/Network Toolkit/Network Toolkit/InclusionGrantPrompt.resx +++ /dev/null @@ -1,120 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - text/microsoft-resx - - - 2.0 - - - System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - - - System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - - \ No newline at end of file diff --git a/Visual Studio Projects/Network Toolkit/Network Toolkit/Main.Designer.cs b/Visual Studio Projects/Network Toolkit/Network Toolkit/Main.Designer.cs deleted file mode 100644 index 5573e3d..0000000 --- a/Visual Studio Projects/Network Toolkit/Network Toolkit/Main.Designer.cs +++ /dev/null @@ -1,188 +0,0 @@ - -namespace Network_Toolkit -{ - partial class Main - { - /// - /// Required designer variable. - /// - private System.ComponentModel.IContainer components = null; - - /// - /// Clean up any resources being used. - /// - /// true if managed resources should be disposed; otherwise, false. - protected override void Dispose(bool disposing) - { - if (disposing && (components != null)) - { - components.Dispose(); - } - base.Dispose(disposing); - } - - #region Windows Form Designer generated code - - /// - /// Required method for Designer support - do not modify - /// the contents of this method with the code editor. - /// - private void InitializeComponent() - { - System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(Main)); - this.panel1 = new System.Windows.Forms.Panel(); - this.pictureBox1 = new System.Windows.Forms.PictureBox(); - this.button4 = new System.Windows.Forms.Button(); - this.button2 = new System.Windows.Forms.Button(); - this.button1 = new System.Windows.Forms.Button(); - this.PAN_ViewContainer = new System.Windows.Forms.Panel(); - this.statusStrip1 = new System.Windows.Forms.StatusStrip(); - this.LBL_Status = new System.Windows.Forms.ToolStripStatusLabel(); - this.PAN_Nodes = new System.Windows.Forms.FlowLayoutPanel(); - this.panel1.SuspendLayout(); - ((System.ComponentModel.ISupportInitialize)(this.pictureBox1)).BeginInit(); - this.statusStrip1.SuspendLayout(); - this.SuspendLayout(); - // - // panel1 - // - this.panel1.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left) - | System.Windows.Forms.AnchorStyles.Right))); - this.panel1.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(16)))), ((int)(((byte)(115)))), ((int)(((byte)(185))))); - this.panel1.Controls.Add(this.pictureBox1); - this.panel1.Controls.Add(this.button4); - this.panel1.Controls.Add(this.button2); - this.panel1.Controls.Add(this.button1); - this.panel1.Location = new System.Drawing.Point(-2, -24); - this.panel1.Name = "panel1"; - this.panel1.Size = new System.Drawing.Size(905, 100); - this.panel1.TabIndex = 0; - // - // pictureBox1 - // - this.pictureBox1.Image = global::Network_Toolkit.Properties.Resources.logo; - this.pictureBox1.Location = new System.Drawing.Point(-6, 21); - this.pictureBox1.Name = "pictureBox1"; - this.pictureBox1.Size = new System.Drawing.Size(229, 80); - this.pictureBox1.SizeMode = System.Windows.Forms.PictureBoxSizeMode.Zoom; - this.pictureBox1.TabIndex = 4; - this.pictureBox1.TabStop = false; - // - // button4 - // - this.button4.FlatStyle = System.Windows.Forms.FlatStyle.Flat; - this.button4.Font = new System.Drawing.Font("Microsoft Sans Serif", 8.75F); - this.button4.ForeColor = System.Drawing.Color.White; - this.button4.Location = new System.Drawing.Point(791, 42); - this.button4.Name = "button4"; - this.button4.Size = new System.Drawing.Size(93, 40); - this.button4.TabIndex = 3; - this.button4.Text = "Add / Remove Node"; - this.button4.UseVisualStyleBackColor = true; - this.button4.Click += new System.EventHandler(this.button4_Click); - // - // button2 - // - this.button2.FlatStyle = System.Windows.Forms.FlatStyle.Flat; - this.button2.Font = new System.Drawing.Font("Microsoft Sans Serif", 8.75F); - this.button2.ForeColor = System.Drawing.Color.White; - this.button2.Location = new System.Drawing.Point(593, 42); - this.button2.Name = "button2"; - this.button2.Size = new System.Drawing.Size(93, 40); - this.button2.TabIndex = 1; - this.button2.Text = "Backup / Restore NVM"; - this.button2.UseVisualStyleBackColor = true; - this.button2.Click += new System.EventHandler(this.button2_Click); - // - // button1 - // - this.button1.FlatStyle = System.Windows.Forms.FlatStyle.Flat; - this.button1.Font = new System.Drawing.Font("Microsoft Sans Serif", 8.75F); - this.button1.ForeColor = System.Drawing.Color.White; - this.button1.Location = new System.Drawing.Point(692, 42); - this.button1.Name = "button1"; - this.button1.Size = new System.Drawing.Size(93, 40); - this.button1.TabIndex = 0; - this.button1.Text = "Heal Network"; - this.button1.UseVisualStyleBackColor = true; - this.button1.Click += new System.EventHandler(this.button1_Click); - // - // PAN_ViewContainer - // - this.PAN_ViewContainer.BackColor = System.Drawing.Color.White; - this.PAN_ViewContainer.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle; - this.PAN_ViewContainer.Location = new System.Drawing.Point(288, 82); - this.PAN_ViewContainer.Name = "PAN_ViewContainer"; - this.PAN_ViewContainer.Size = new System.Drawing.Size(600, 499); - this.PAN_ViewContainer.TabIndex = 2; - // - // statusStrip1 - // - this.statusStrip1.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(16)))), ((int)(((byte)(115)))), ((int)(((byte)(185))))); - this.statusStrip1.Items.AddRange(new System.Windows.Forms.ToolStripItem[] { - this.LBL_Status}); - this.statusStrip1.Location = new System.Drawing.Point(0, 596); - this.statusStrip1.Name = "statusStrip1"; - this.statusStrip1.Size = new System.Drawing.Size(900, 22); - this.statusStrip1.SizingGrip = false; - this.statusStrip1.TabIndex = 3; - this.statusStrip1.Text = "statusStrip1"; - // - // LBL_Status - // - this.LBL_Status.ForeColor = System.Drawing.Color.White; - this.LBL_Status.Name = "LBL_Status"; - this.LBL_Status.Size = new System.Drawing.Size(88, 17); - this.LBL_Status.Text = "Not Connected"; - // - // PAN_Nodes - // - this.PAN_Nodes.AutoScroll = true; - this.PAN_Nodes.BackColor = System.Drawing.Color.White; - this.PAN_Nodes.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle; - this.PAN_Nodes.FlowDirection = System.Windows.Forms.FlowDirection.TopDown; - this.PAN_Nodes.Location = new System.Drawing.Point(12, 82); - this.PAN_Nodes.Name = "PAN_Nodes"; - this.PAN_Nodes.Padding = new System.Windows.Forms.Padding(3); - this.PAN_Nodes.Size = new System.Drawing.Size(270, 499); - this.PAN_Nodes.TabIndex = 4; - this.PAN_Nodes.WrapContents = false; - // - // Main - // - this.AutoScaleDimensions = new System.Drawing.SizeF(96F, 96F); - this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Dpi; - this.ClientSize = new System.Drawing.Size(900, 618); - this.Controls.Add(this.PAN_Nodes); - this.Controls.Add(this.statusStrip1); - this.Controls.Add(this.PAN_ViewContainer); - this.Controls.Add(this.panel1); - this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedSingle; - this.Icon = ((System.Drawing.Icon)(resources.GetObject("$this.Icon"))); - this.MaximizeBox = false; - this.Name = "Main"; - this.StartPosition = System.Windows.Forms.FormStartPosition.CenterScreen; - this.Text = "ZWave JS : Network Toolkit"; - this.Load += new System.EventHandler(this.Main_Load); - this.panel1.ResumeLayout(false); - ((System.ComponentModel.ISupportInitialize)(this.pictureBox1)).EndInit(); - this.statusStrip1.ResumeLayout(false); - this.statusStrip1.PerformLayout(); - this.ResumeLayout(false); - this.PerformLayout(); - - } - - #endregion - - private System.Windows.Forms.Panel panel1; - private System.Windows.Forms.Panel PAN_ViewContainer; - private System.Windows.Forms.Button button4; - private System.Windows.Forms.Button button2; - private System.Windows.Forms.Button button1; - private System.Windows.Forms.PictureBox pictureBox1; - private System.Windows.Forms.StatusStrip statusStrip1; - private System.Windows.Forms.ToolStripStatusLabel LBL_Status; - private System.Windows.Forms.FlowLayoutPanel PAN_Nodes; - } -} \ No newline at end of file diff --git a/Visual Studio Projects/Network Toolkit/Network Toolkit/Main.cs b/Visual Studio Projects/Network Toolkit/Network Toolkit/Main.cs deleted file mode 100644 index c1b605b..0000000 --- a/Visual Studio Projects/Network Toolkit/Network Toolkit/Main.cs +++ /dev/null @@ -1,387 +0,0 @@ -using System; -using System.Collections.Generic; -using System.ComponentModel; -using System.Data; -using System.Drawing; -using System.Linq; -using System.Text; -using System.Threading.Tasks; -using System.Windows.Forms; -using ZWaveJS.NET; - -namespace Network_Toolkit -{ - public partial class Main : Form - { - public Main() - { - InitializeComponent(); - } - - Driver _Driver; - - private void Main_Load(object sender, EventArgs e) - { - this.FormClosing += Main_FormClosing; - - Views.Connector Connector = new Views.Connector(); - Connector.StartConnectionEvent += Connector_StartConnectionEvent; - Connector.StartConnectionWSEvent += Connector_StartConnectionWSEvent; - Connector.Parent = PAN_ViewContainer; - - PAN_ViewContainer.Controls.Add(Connector); - } - - private void Main_FormClosing(object sender, FormClosingEventArgs e) - { - if(_Driver != null) - { - _Driver.Destroy(); - } - } - - private void Connector_StartConnectionWSEvent(string WS, int Schema) - { - LBL_Status.Text = string.Format("Connecting..."); - - _Driver = new Driver(new Uri(WS), Schema); - _Driver.DriverReady += _Driver_DriverReady; - _Driver.StartupErrorEvent += _Driver_StartupErrorEvent; - _Driver.Start(); - } - - private void Connector_StartConnectionEvent(string SerialPort, ZWaveJS.NET.ZWaveOptions Options) - { - LBL_Status.Text = string.Format("Fetching PSI..."); - Helpers.DownloadPSI().ContinueWith((R) => { - - this.Invoke((MethodInvoker)delegate () { - - LBL_Status.Text = string.Format("Connecting..."); - - _Driver = new Driver(SerialPort, Options); - _Driver.DriverReady += _Driver_DriverReady; - _Driver.StartupErrorEvent += _Driver_StartupErrorEvent; - _Driver.Start(); - - }); - - }); - - } - - private void _Driver_StartupErrorEvent(string Message) - { - MessageBox.Show(Message, "Startup Error", MessageBoxButtons.OK, MessageBoxIcon.Error); - } - - private void ShowDefault() - { - Views.Default Default = new Views.Default(); - Default.Parent = PAN_ViewContainer; - - PAN_ViewContainer.Controls.Clear(); - PAN_ViewContainer.Controls.Add(Default); - - LBL_Status.Text = string.Format("Connected. Server Version: {0}, ZWave JS Driver Version: {1}", _Driver.ZWaveJSServerVersion, _Driver.ZWaveJSDriverVersion); - - } - - private void _Driver_DriverReady() - { - this.Invoke((MethodInvoker)delegate() { - ShowDefault(); - }); - - _Driver.Controller.NodeAdded += Controller_NodeAdded; - _Driver.Controller.NodeRemoved += Controller_NodeRemoved; - - foreach (ZWaveNode ZWN in _Driver.Controller.Nodes.AsArray()) - { - if (!ZWN.isControllerNode) - { - this.Invoke((MethodInvoker)delegate () { - CustomControls.Node N = new CustomControls.Node(ZWN); - N.NodeSelectedEvent += N_NodeSelectedEvent; - N.Parent = PAN_Nodes; - PAN_Nodes.Controls.Add(N); - }); - - } - } - } - - private void N_NodeSelectedEvent(ZWaveNode ZwaveNode) - { - Views.NodeDetails ND = new Views.NodeDetails(ZwaveNode,_Driver); - ND.Parent = PAN_ViewContainer; - - ND.StartReplaceEvent += ND_StartReplaceEvent; - - - PAN_ViewContainer.Controls.Clear(); - PAN_ViewContainer.Controls.Add(ND); - } - - private void ND_StartReplaceEvent(int NodeID) - { - Views.IncludeOptions IO = new Views.IncludeOptions(NodeID); - IO.StartInclusionReplaceEvent += Include_StartInclusionReplaceEvent; - IO.Parent = PAN_ViewContainer; - - - PAN_ViewContainer.Controls.Clear(); - PAN_ViewContainer.Controls.Add(IO); - } - - private void Controller_NodeRemoved(ZWaveNode Node) - { - this.Invoke((MethodInvoker)delegate () { - ShowDefault(); - }); - - this.Invoke((MethodInvoker)delegate () { - CustomControls.Node N = PAN_Nodes.Controls.OfType().FirstOrDefault((_N) => _N.ZwaveNode.id.Equals(Node.id)); - PAN_Nodes.Controls.Remove(N); - }); - - - - - - } - - private void Controller_NodeAdded(ZWaveNode Node, InclusionResult Result) - { - this.Invoke((MethodInvoker)delegate () { - ShowDefault(); - }); - - - this.Invoke((MethodInvoker)delegate () { - CustomControls.Node N = new CustomControls.Node(Node); - N.NodeSelectedEvent += N_NodeSelectedEvent; - N.Parent = PAN_Nodes; - PAN_Nodes.Controls.Add(N); - }); - - - - } - - private void button2_Click(object sender, EventArgs e) - { - if(_Driver != null) - { - Views.NVM NVM = new Views.NVM(_Driver); - NVM.Parent = PAN_ViewContainer; - - PAN_ViewContainer.Controls.Clear(); - PAN_ViewContainer.Controls.Add(NVM); - } - - } - - private void button4_Click(object sender, EventArgs e) - { - if(_Driver != null) - { - Views.IncludeOptions Include = new Views.IncludeOptions(); - Include.StartInclusionExclusionEvent += Include_StartInclusionEvent; - Include.SmartStartEvent += Include_SmartStartEvent; - Include.SmartStartListEvent += Include_SmartStartListEvent; - Include.Parent = PAN_ViewContainer; - - PAN_ViewContainer.Controls.Clear(); - PAN_ViewContainer.Controls.Add(Include); - } - - } - - private void Include_SmartStartListEvent() - { - SSList SS = new SSList(_Driver); - SS.ShowDialog(); - } - - private void Include_SmartStartEvent() - { - SmartStart SS = new SmartStart(_Driver); - SS.ShowDialog(); - } - - private void Include_StartInclusionReplaceEvent(InclusionOptions Options, int NodeID) - { - switch (Options.strategy) - { - case Enums.InclusionStrategy.Security_S2: - Options.userCallbacks = new InclusionUserCallbacks(); - Options.userCallbacks.grantSecurityClasses = HandleIG; - Options.userCallbacks.validateDSKAndEnterPIN = HandleDSK; - Options.userCallbacks.abort = HandleAbort; - break; - } - - _Driver.Controller.ReplaceFailedNode(NodeID, Options).ContinueWith((R) => - { - if (R.Result.Success) - { - - this.Invoke((MethodInvoker)delegate () { - Views.NIFWait NIF = new Views.NIFWait(); - NIF.Parent = PAN_ViewContainer; - - PAN_ViewContainer.Controls.Clear(); - PAN_ViewContainer.Controls.Add(NIF); - }); - - - } - else - { - this.Invoke((MethodInvoker)delegate () { - MessageBox.Show(R.Result.Message, "Failed To Start Inclsuion", MessageBoxButtons.OK, MessageBoxIcon.Error); - }); - - } - - - }); - } - - private void Include_StartInclusionEvent(object OBJ) - { - - if(OBJ is bool) - { - _Driver.Controller.BeginExclusion((bool)OBJ).ContinueWith((R) => - { - if (R.Result.Success) - { - this.Invoke((MethodInvoker)delegate () { - Views.NIFWait NIF = new Views.NIFWait(); - NIF.Parent = PAN_ViewContainer; - - PAN_ViewContainer.Controls.Clear(); - PAN_ViewContainer.Controls.Add(NIF); - }); - } - else - { - this.Invoke((MethodInvoker)delegate () { - MessageBox.Show(R.Result.Message, "Failed To Start Exclusion", MessageBoxButtons.OK, MessageBoxIcon.Error); - }); - - } - - - }); - } - else - { - InclusionOptions IO = (InclusionOptions)OBJ; - switch (IO.strategy) - { - case Enums.InclusionStrategy.Default: - case Enums.InclusionStrategy.Security_S2: - IO.userCallbacks = new InclusionUserCallbacks(); - IO.userCallbacks.grantSecurityClasses = HandleIG; - IO.userCallbacks.validateDSKAndEnterPIN = HandleDSK; - IO.userCallbacks.abort = HandleAbort; - break; - } - - - _Driver.Controller.BeginInclusion(IO).ContinueWith((R) => - { - if (R.Result.Success) - { - - this.Invoke((MethodInvoker)delegate () { - Views.NIFWait NIF = new Views.NIFWait(); - NIF.Parent = PAN_ViewContainer; - - PAN_ViewContainer.Controls.Clear(); - PAN_ViewContainer.Controls.Add(NIF); - }); - - - } - else - { - this.Invoke((MethodInvoker)delegate () { - MessageBox.Show(R.Result.Message, "Failed To Start Inclsuion", MessageBoxButtons.OK, MessageBoxIcon.Error); - }); - - } - - - }); - } - } - - private void HandleAbort() - { - - } - - private InclusionGrant HandleIG(InclusionGrant IG) - { - this.Invoke((MethodInvoker) delegate() { - Views.S2 S2 = new Views.S2(); - S2.Parent = PAN_ViewContainer; - - PAN_ViewContainer.Controls.Clear(); - PAN_ViewContainer.Controls.Add(S2); - }); - - - InclusionGrant _IG = (InclusionGrant)this.Invoke((Func)delegate { - InclusionGrantPrompt IGP = new InclusionGrantPrompt(IG); - IGP.ShowDialog(); - - return IGP.IG; - }); - - return _IG; - - - - - } - - private string HandleDSK(string Partial) - { - this.Invoke((MethodInvoker)delegate () { - Views.S2 S2 = new Views.S2(); - S2.Parent = PAN_ViewContainer; - - PAN_ViewContainer.Controls.Clear(); - PAN_ViewContainer.Controls.Add(S2); - }); - - string[] Parts = Partial.Split(new string[] {"-"},StringSplitOptions.RemoveEmptyEntries); - - string _DSK = (string)this.Invoke((Func)delegate () { - DSK D = new DSK(Parts); - D.ShowDialog(); - return D.TXT_Pin.Text; - }); - - return _DSK; - } - - private void button1_Click(object sender, EventArgs e) - { - if (_Driver != null) - { - Views.NetworkHeal NH = new Views.NetworkHeal(_Driver); - NH.Parent = PAN_ViewContainer; - - PAN_ViewContainer.Controls.Clear(); - PAN_ViewContainer.Controls.Add(NH); - } - - } - } -} diff --git a/Visual Studio Projects/Network Toolkit/Network Toolkit/Main.resx b/Visual Studio Projects/Network Toolkit/Network Toolkit/Main.resx deleted file mode 100644 index adb937a..0000000 --- a/Visual Studio Projects/Network Toolkit/Network Toolkit/Main.resx +++ /dev/null @@ -1,198 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - text/microsoft-resx - - - 2.0 - - - System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - - - System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - - - 17, 17 - - - - - AAABAAEAHyAAAAEAIAAoEAAAFgAAACgAAAAfAAAAQAAAAAEAIAAAAAAAgA8AABMLAAATCwAAAAAAAAAA - AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABbAAAA9AAAAP8AAAD/AAAA/wAA - AP8AAAD/AAAA/wAAAP8AAAD/AAAA/wAAAP8AAAD/AAAA/wAAAPkAAABsAAAAAAAAAAAAAAAAAAAAAAAA - AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAXAAAAxgAAAP8AAADkAAAA3wAA - AN8AAADfAAAA3wAAAN8AAADfAAAA3wAAAN8AAADfAAAA3wAAAOIAAAD9AAAA1QAAACMAAAAAAAAAAAAA - AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAdQAAAP8AAADDAAAAKgAA - AB0AAAAeAAAAHgAAAB4AAAAeAAAAHgAAAB4AAAAeAAAAHgAAAB4AAAAlAAAAtQAAAO0AAABMAAAAAAAA - AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAKQAAAN0AAAD2AAAAUgAA - AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAACsAAAA3AAAAAgAA - AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABAAAAJQAAAD/AAAApgAA - AAgAAAAAAAAAIwAAAFgAAABaAAAAWgAAAFoAAABaAAAAWgAAAFoAAABaAAAAWgAAAFoAAABYAAAAVwAA - AFsAAABDAAAABgAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAEEAAADuAAAA6AAA - ADcAAAAAAAAAAgAAAJ8AAAD/AAAA/gAAAP8AAAD/AAAA/wAAAP8AAAD/AAAA/wAAAP8AAAD/AAAA/wAA - AP8AAAD/AAAA8AAAAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA0AAACyAAAA/wAA - AIgAAAABAAAAAAAAAAAAAABvAAAA/QAAAPkAAAC0AAAAowAAAKQAAACkAAAApAAAAKQAAACkAAAApAAA - AKQAAACjAAAAuwAAAP4AAADCAAAAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABdAAAA+gAA - ANUAAAAiAAAAAAAAAAAAAAAAAAAAFQAAAMMAAAD/AAAAdQAAAAAAAAABAAAAAQAAAAEAAAABAAAAAQAA - AAEAAAABAAAAAAAAABgAAADHAAAA/wAAAG8AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAbAAAAzAAA - AP0AAABpAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABTAAAA9wAAANwAAAApAAAAAAAAAAAAAAAAAAAAAAAA - AAAAAAAAAAAAAAAAAAAAAAAAAAAAWAAAAPgAAADZAAAAJQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAfAAA - AP8AAAC8AAAAEQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAACQAAAKcAAAD/AAAAkwAAAAMAAAAAAAAAAAAA - AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAoAAACsAAAA/wAAAI0AAAADAAAAAAAAAAAAAAAAAAAALgAA - AOEAAAD0AAAATAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA4AAAA6QAAAO4AAABAAAAAAAAA - AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAPAAAAOwAAADpAAAARAAAAAAAAAAAAAAAAwAA - AJkAAAD/AAAAnwAAAAYAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAgAAAIkAAAD/AAAAsQAA - AAwAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAIAAACNAAAA/wAAAMIAAAAAAAAAAAAA - AAsAAAC/AAAA/wAAAHQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAiAAAA1gAA - APoAAABcAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAYQAAAP4AAADrAAAAAAAA - AAAAAAAAAAAAYAAAAPsAAADTAAAAIAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA - AGoAAAD+AAAAywAAABoAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFgAAAMUAAAD9AAAAgQAA - AAAAAAAAAAAAAAAAAA4AAAC1AAAA/wAAAIUAAAABAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA - AAAAAAASAAAAvQAAAP8AAAB7AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAHMAAAD/AAAAwgAA - ABgAAAAAAAAAAAAAAAAAAAAAAAAARAAAAPAAAADnAAAANQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA - AAAAAAAAAAAAAAAAAEwAAAD0AAAA4QAAAC0AAAAAAAAAAAAAAAAAAAAAAAAAAAAAACgAAADcAAAA9wAA - AFMAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAQAAACXAAAA/wAAAKMAAAAIAAAAAAAAAAAAAAAGAAAADgAA - AA4AAAAOAAAADgAAAA0AAAAUAAAAqwAAAP8AAACaAAAABQAAAAAAAAAAAAAAAAAAAAMAAACSAAAA/wAA - AKkAAAAJAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAALAAAAN8AAAD1AAAATwAAAAAAAAAAAAAAWwAA - AM0AAADLAAAAywAAAMsAAADLAAAAygAAAOAAAAD/AAAA7wAAAEEAAAAAAAAAAAAAAAAAAAA/AAAA7QAA - AOkAAAA5AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAB4AAAA/wAAAL8AAAATAAAAAAAA - AG0AAAD1AAAA8wAAAPMAAADzAAAA8wAAAPMAAADyAAAA8AAAAOgAAABNAAAAAAAAAAAAAAAMAAAArwAA - AP8AAACKAAAAAgAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAGAAAAGkAAAApAAAAFwAAAMkAAAD+AAAAbAAA - AAAAAAAXAAAANAAAADQAAAA0AAAANAAAADQAAAA0AAAANAAAADQAAAArAAAABgAAAAAAAAAAAAAAWwAA - APkAAADXAAAAIwAAAAAAAAAAAAAAAAAAAAAAAAACAAAAAAAAAHwAAAD/AAAAmwAAAAMAAABaAAAA+QAA - ANcAAAAkAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAGQAA - AMoAAAD+AAAAawAAAAAAAAAAAAAAAAAAAAAAAABDAAAAiAAAABoAAAAxAAAA5QAAAPIAAABGAAAACAAA - AK8AAAD/AAAAiwAAAAIAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA - AHkAAAD/AAAAvwAAABIAAAAAAAAAAAAAAAAAAAAAAAAAwQAAAP8AAAB+AAAAAAAAAIEAAAD/AAAAuAAA - AAwAAAA9AAAA7QAAAOwAAACLAAAAfQAAAH4AAAB+AAAAfgAAAH4AAAB+AAAAfgAAAH4AAAB+AAAAfQAA - AIYAAADkAAAA9AAAAE4AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFQAAADxAAAA4wAAAC4AAAAbAAAA0AAA - APwAAABkAAAAAQAAAJAAAAD/AAAA/wAAAP8AAAD/AAAA/wAAAP8AAAD/AAAA/wAAAP8AAAD/AAAA/wAA - AP8AAAD/AAAA/wAAAKIAAAAHAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAHAAAAnQAAAP8AAACdAAAAAwAA - AGIAAAD8AAAA0QAAAB0AAAAZAAAAcgAAAIAAAAB/AAAAfwAAAH8AAAB/AAAAfwAAAH8AAAB/AAAAfwAA - AH8AAAB/AAAAgAAAAHYAAAAiAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAADAAAADjAAAA8gAA - AEgAAAAMAAAAtgAAAP8AAACDAAAAAgAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA - AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAfwAA - AP8AAAC5AAAADQAAAEUAAADwAAAA7QAAALAAAACsAAAArAAAAKwAAACsAAAArAAAAK0AAACbAAAAGQAA - AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA - AB0AAADPAAAA/QAAAGUAAAADAAAAlQAAAP0AAAD/AAAA/wAAAP8AAAD/AAAA/wAAAP8AAAD/AAAA5gAA - ACUAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA - AAAAAAAAAAAAYQAAAPsAAADSAAAAHgAAABIAAABKAAAAUAAAAFAAAABQAAAAUAAAAFAAAABQAAAAUQAA - AEgAAAAMAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA - AAAAAAAAAAAAAAAAAA4AAAC1AAAA/wAAAIoAAAAbAAAAGQAAABkAAAAZAAAAGQAAABkAAAAZAAAAGQAA - ABkAAAAXAAAABAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA - AAAAAAAAAAAAAAAAAAAAAAAAAAAARAAAAO4AAAD3AAAA4AAAAN8AAADfAAAA3wAAAN8AAADfAAAA3wAA - AN8AAADgAAAAyQAAACEAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA - AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAYAAACaAAAA/wAAAP8AAAD/AAAA/wAAAP8AAAD/AAAA/wAA - AP8AAAD/AAAA/wAAAOYAAAAlAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA - AAAAAAAAAAAAAP+AAH7/AAA+/wAAPv4f/j78EAAO/CAADvgwAAb4cICG8Ph/wvD4P8Dh/D/gwfwf4MP+ - H/Dh/w/g4P8P4PD/h8LwYAOC+GADhvwgAwbgIAMOoB/+HgAP/h4QAAA+AAAAPgAAAH6AP//+wAA//sAA - P/7gAD/+4AA//vAAP/7wAD/+ - - - \ No newline at end of file diff --git a/Visual Studio Projects/Network Toolkit/Network Toolkit/Network Toolkit.csproj b/Visual Studio Projects/Network Toolkit/Network Toolkit/Network Toolkit.csproj deleted file mode 100644 index 97f7176..0000000 --- a/Visual Studio Projects/Network Toolkit/Network Toolkit/Network Toolkit.csproj +++ /dev/null @@ -1,320 +0,0 @@ - - - - - Debug - AnyCPU - {F2787359-F6F4-41B4-853F-36D7C90DB62B} - WinExe - Network_Toolkit - Network Toolkit - v4.5 - 512 - true - true - publish\ - true - Disk - false - Foreground - 7 - Days - false - false - true - 0 - 1.0.0.%2a - false - false - true - - - - AnyCPU - true - full - false - bin\Debug\ - DEBUG;TRACE - prompt - 4 - - - AnyCPU - pdbonly - true - bin\Release\ - TRACE - prompt - 4 - - - Icon.ico - - - - ..\packages\AForge.2.2.5\lib\AForge.dll - - - ..\packages\AForge.Video.2.2.5\lib\AForge.Video.dll - - - ..\packages\AForge.Video.DirectShow.2.2.5\lib\AForge.Video.DirectShow.dll - - - ..\packages\Newtonsoft.Json.13.0.1\lib\net45\Newtonsoft.Json.dll - - - - - - - - - - - - - - - - ..\packages\ZWaveJS.NET.3.1.0\lib\net45\ZWaveJS.NET.dll - - - ..\packages\ZXing.Net.0.16.8\lib\net45\zxing.dll - - - ..\packages\ZXing.Net.0.16.8\lib\net45\zxing.presentation.dll - - - - - Form - - - Associations.cs - - - UserControl - - - Node.cs - - - Form - - - DSK.cs - - - Form - - - Event.cs - - - Form - - - HealthCheck.cs - - - Form - - - InclusionGrantPrompt.cs - - - Form - - - Main.cs - - - Form - - - NewAssociation.cs - - - Form - - - SmartStart.cs - - - Form - - - Splash.cs - - - - - Form - - - SSList.cs - - - Form - - - UpdateFirmware.cs - - - UserControl - - - Connector.cs - - - UserControl - - - Default.cs - - - UserControl - - - IncludeOptions.cs - - - UserControl - - - NetworkHeal.cs - - - UserControl - - - NIFWait.cs - - - UserControl - - - NodeDetails.cs - - - UserControl - - - NVM.cs - - - UserControl - - - S2.cs - - - Associations.cs - - - Node.cs - - - DSK.cs - - - Event.cs - - - HealthCheck.cs - - - InclusionGrantPrompt.cs - - - Main.cs - - - NewAssociation.cs - - - SmartStart.cs - - - Splash.cs - - - ResXFileCodeGenerator - Resources.Designer.cs - Designer - - - True - Resources.resx - True - - - SSList.cs - - - UpdateFirmware.cs - - - Connector.cs - - - Default.cs - - - IncludeOptions.cs - - - NetworkHeal.cs - - - NIFWait.cs - - - NodeDetails.cs - - - NVM.cs - - - S2.cs - - - - SettingsSingleFileGenerator - Settings.Designer.cs - - - True - Settings.settings - True - - - - - - - - - - - False - Microsoft .NET Framework 4.6.1 %28x86 and x64%29 - true - - - False - .NET Framework 3.5 SP1 - false - - - - - - - - - - - \ No newline at end of file diff --git a/Visual Studio Projects/Network Toolkit/Network Toolkit/Network Toolkit.csproj.user b/Visual Studio Projects/Network Toolkit/Network Toolkit/Network Toolkit.csproj.user deleted file mode 100644 index 51f6223..0000000 --- a/Visual Studio Projects/Network Toolkit/Network Toolkit/Network Toolkit.csproj.user +++ /dev/null @@ -1,13 +0,0 @@ - - - - publish\ - - - - - - en-US - false - - \ No newline at end of file diff --git a/Visual Studio Projects/Network Toolkit/Network Toolkit/NewAssociation.Designer.cs b/Visual Studio Projects/Network Toolkit/Network Toolkit/NewAssociation.Designer.cs deleted file mode 100644 index f6a0403..0000000 --- a/Visual Studio Projects/Network Toolkit/Network Toolkit/NewAssociation.Designer.cs +++ /dev/null @@ -1,152 +0,0 @@ - -namespace Network_Toolkit -{ - partial class NewAssociation - { - /// - /// Required designer variable. - /// - private System.ComponentModel.IContainer components = null; - - /// - /// Clean up any resources being used. - /// - /// true if managed resources should be disposed; otherwise, false. - protected override void Dispose(bool disposing) - { - if (disposing && (components != null)) - { - components.Dispose(); - } - base.Dispose(disposing); - } - - #region Windows Form Designer generated code - - /// - /// Required method for Designer support - do not modify - /// the contents of this method with the code editor. - /// - private void InitializeComponent() - { - this.panel1 = new System.Windows.Forms.Panel(); - this.label2 = new System.Windows.Forms.Label(); - this.label1 = new System.Windows.Forms.Label(); - this.label3 = new System.Windows.Forms.Label(); - this.button1 = new System.Windows.Forms.Button(); - this.NUM_Node = new System.Windows.Forms.NumericUpDown(); - this.NUM_EP = new System.Windows.Forms.NumericUpDown(); - this.panel1.SuspendLayout(); - ((System.ComponentModel.ISupportInitialize)(this.NUM_Node)).BeginInit(); - ((System.ComponentModel.ISupportInitialize)(this.NUM_EP)).BeginInit(); - this.SuspendLayout(); - // - // panel1 - // - this.panel1.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left) - | System.Windows.Forms.AnchorStyles.Right))); - this.panel1.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(16)))), ((int)(((byte)(115)))), ((int)(((byte)(185))))); - this.panel1.Controls.Add(this.label2); - this.panel1.Location = new System.Drawing.Point(-15, -27); - this.panel1.Margin = new System.Windows.Forms.Padding(4); - this.panel1.Name = "panel1"; - this.panel1.Size = new System.Drawing.Size(345, 94); - this.panel1.TabIndex = 8; - // - // label2 - // - this.label2.AutoSize = true; - this.label2.Font = new System.Drawing.Font("Microsoft Sans Serif", 16.75F); - this.label2.ForeColor = System.Drawing.Color.White; - this.label2.Location = new System.Drawing.Point(21, 45); - this.label2.Margin = new System.Windows.Forms.Padding(4, 0, 4, 0); - this.label2.Name = "label2"; - this.label2.Size = new System.Drawing.Size(185, 29); - this.label2.TabIndex = 22; - this.label2.Text = "Add Association"; - // - // label1 - // - this.label1.AutoSize = true; - this.label1.Location = new System.Drawing.Point(33, 92); - this.label1.Name = "label1"; - this.label1.Size = new System.Drawing.Size(67, 13); - this.label1.TabIndex = 10; - this.label1.Text = "Target Node"; - // - // label3 - // - this.label3.AutoSize = true; - this.label3.Location = new System.Drawing.Point(33, 148); - this.label3.Name = "label3"; - this.label3.Size = new System.Drawing.Size(83, 13); - this.label3.TabIndex = 12; - this.label3.Text = "Target Endpoint"; - // - // button1 - // - this.button1.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(16)))), ((int)(((byte)(115)))), ((int)(((byte)(185))))); - this.button1.FlatStyle = System.Windows.Forms.FlatStyle.Flat; - this.button1.ForeColor = System.Drawing.Color.White; - this.button1.Location = new System.Drawing.Point(215, 237); - this.button1.Name = "button1"; - this.button1.Size = new System.Drawing.Size(95, 34); - this.button1.TabIndex = 23; - this.button1.Text = "OK"; - this.button1.UseVisualStyleBackColor = false; - this.button1.Click += new System.EventHandler(this.button1_Click); - // - // NUM_Node - // - this.NUM_Node.Location = new System.Drawing.Point(36, 108); - this.NUM_Node.Name = "NUM_Node"; - this.NUM_Node.Size = new System.Drawing.Size(239, 20); - this.NUM_Node.TabIndex = 24; - this.NUM_Node.Value = new decimal(new int[] { - 1, - 0, - 0, - 0}); - // - // NUM_EP - // - this.NUM_EP.Location = new System.Drawing.Point(36, 164); - this.NUM_EP.Name = "NUM_EP"; - this.NUM_EP.Size = new System.Drawing.Size(239, 20); - this.NUM_EP.TabIndex = 25; - // - // NewAssociation - // - this.AutoScaleDimensions = new System.Drawing.SizeF(96F, 96F); - this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Dpi; - this.ClientSize = new System.Drawing.Size(322, 283); - this.Controls.Add(this.NUM_EP); - this.Controls.Add(this.NUM_Node); - this.Controls.Add(this.button1); - this.Controls.Add(this.label3); - this.Controls.Add(this.label1); - this.Controls.Add(this.panel1); - this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedToolWindow; - this.Name = "NewAssociation"; - this.StartPosition = System.Windows.Forms.FormStartPosition.CenterParent; - this.Text = "Add Association"; - this.panel1.ResumeLayout(false); - this.panel1.PerformLayout(); - ((System.ComponentModel.ISupportInitialize)(this.NUM_Node)).EndInit(); - ((System.ComponentModel.ISupportInitialize)(this.NUM_EP)).EndInit(); - this.ResumeLayout(false); - this.PerformLayout(); - - } - - #endregion - - private System.Windows.Forms.Panel panel1; - private System.Windows.Forms.Label label2; - private System.Windows.Forms.Label label1; - private System.Windows.Forms.Label label3; - private System.Windows.Forms.Button button1; - internal System.Windows.Forms.NumericUpDown NUM_Node; - internal System.Windows.Forms.NumericUpDown NUM_EP; - } -} \ No newline at end of file diff --git a/Visual Studio Projects/Network Toolkit/Network Toolkit/NewAssociation.cs b/Visual Studio Projects/Network Toolkit/Network Toolkit/NewAssociation.cs deleted file mode 100644 index 63942cf..0000000 --- a/Visual Studio Projects/Network Toolkit/Network Toolkit/NewAssociation.cs +++ /dev/null @@ -1,26 +0,0 @@ -using System; -using System.Collections.Generic; -using System.ComponentModel; -using System.Data; -using System.Drawing; -using System.Linq; -using System.Text; -using System.Threading.Tasks; -using System.Windows.Forms; - -namespace Network_Toolkit -{ - public partial class NewAssociation : Form - { - public NewAssociation() - { - InitializeComponent(); - } - - private void button1_Click(object sender, EventArgs e) - { - this.DialogResult = DialogResult.OK; - this.Close(); - } - } -} diff --git a/Visual Studio Projects/Network Toolkit/Network Toolkit/NewAssociation.resx b/Visual Studio Projects/Network Toolkit/Network Toolkit/NewAssociation.resx deleted file mode 100644 index 1af7de1..0000000 --- a/Visual Studio Projects/Network Toolkit/Network Toolkit/NewAssociation.resx +++ /dev/null @@ -1,120 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - text/microsoft-resx - - - 2.0 - - - System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - - - System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - - \ No newline at end of file diff --git a/Visual Studio Projects/Network Toolkit/Network Toolkit/Program.cs b/Visual Studio Projects/Network Toolkit/Network Toolkit/Program.cs deleted file mode 100644 index 5b0d4a0..0000000 --- a/Visual Studio Projects/Network Toolkit/Network Toolkit/Program.cs +++ /dev/null @@ -1,42 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Threading.Tasks; -using System.Windows.Forms; - -namespace Network_Toolkit -{ - static class Program - { - /// - /// The main entry point for the application. - /// - [STAThread] - static void Main() - { - Application.EnableVisualStyles(); - Application.SetCompatibleTextRenderingDefault(false); - Application.Run(new Splash()); - } - } - - public class ComboObject - { - public ComboObject(string Label, object Value) - { - this.Label = Label; - this.Value = Value; - } - - public override string ToString() - { - return this.Label; - } - - - public string Label { get; private set; } - public object Value { get; private set; } - } - - -} diff --git a/Visual Studio Projects/Network Toolkit/Network Toolkit/Properties/AssemblyInfo.cs b/Visual Studio Projects/Network Toolkit/Network Toolkit/Properties/AssemblyInfo.cs deleted file mode 100644 index a2b9e21..0000000 --- a/Visual Studio Projects/Network Toolkit/Network Toolkit/Properties/AssemblyInfo.cs +++ /dev/null @@ -1,36 +0,0 @@ -using System.Reflection; -using System.Runtime.CompilerServices; -using System.Runtime.InteropServices; - -// General Information about an assembly is controlled through the following -// set of attributes. Change these attribute values to modify the information -// associated with an assembly. -[assembly: AssemblyTitle("Network Toolkit")] -[assembly: AssemblyDescription("ZWave JS Network Tookit")] -[assembly: AssemblyConfiguration("")] -[assembly: AssemblyCompany("ZWave-JS")] -[assembly: AssemblyProduct("Network Toolkit")] -[assembly: AssemblyCopyright("Copyright © Marcus Davies 2022")] -[assembly: AssemblyTrademark("")] -[assembly: AssemblyCulture("")] - -// Setting ComVisible to false makes the types in this assembly not visible -// to COM components. If you need to access a type in this assembly from -// COM, set the ComVisible attribute to true on that type. -[assembly: ComVisible(false)] - -// The following GUID is for the ID of the typelib if this project is exposed to COM -[assembly: Guid("f2787359-f6f4-41b4-853f-36d7c90db62b")] - -// Version information for an assembly consists of the following four values: -// -// Major Version -// Minor Version -// Build Number -// Revision -// -// You can specify all the values or you can default the Build and Revision Numbers -// by using the '*' as shown below: -// [assembly: AssemblyVersion("1.0.*")] -[assembly: AssemblyVersion("1.0.0.0")] -[assembly: AssemblyFileVersion("1.0.0.0")] diff --git a/Visual Studio Projects/Network Toolkit/Network Toolkit/Properties/Resources.Designer.cs b/Visual Studio Projects/Network Toolkit/Network Toolkit/Properties/Resources.Designer.cs deleted file mode 100644 index 0778541..0000000 --- a/Visual Studio Projects/Network Toolkit/Network Toolkit/Properties/Resources.Designer.cs +++ /dev/null @@ -1,83 +0,0 @@ -//------------------------------------------------------------------------------ -// -// This code was generated by a tool. -// Runtime Version:4.0.30319.42000 -// -// Changes to this file may cause incorrect behavior and will be lost if -// the code is regenerated. -// -//------------------------------------------------------------------------------ - -namespace Network_Toolkit.Properties { - using System; - - - /// - /// A strongly-typed resource class, for looking up localized strings, etc. - /// - // This class was auto-generated by the StronglyTypedResourceBuilder - // class via a tool like ResGen or Visual Studio. - // To add or remove a member, edit your .ResX file then rerun ResGen - // with the /str option, or rebuild your VS project. - [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "16.0.0.0")] - [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] - [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] - internal class Resources { - - private static global::System.Resources.ResourceManager resourceMan; - - private static global::System.Globalization.CultureInfo resourceCulture; - - [global::System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")] - internal Resources() { - } - - /// - /// Returns the cached ResourceManager instance used by this class. - /// - [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)] - internal static global::System.Resources.ResourceManager ResourceManager { - get { - if (object.ReferenceEquals(resourceMan, null)) { - global::System.Resources.ResourceManager temp = new global::System.Resources.ResourceManager("Network_Toolkit.Properties.Resources", typeof(Resources).Assembly); - resourceMan = temp; - } - return resourceMan; - } - } - - /// - /// Overrides the current thread's CurrentUICulture property for all - /// resource lookups using this strongly typed resource class. - /// - [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)] - internal static global::System.Globalization.CultureInfo Culture { - get { - return resourceCulture; - } - set { - resourceCulture = value; - } - } - - /// - /// Looks up a localized resource of type System.Drawing.Bitmap. - /// - internal static System.Drawing.Bitmap logo { - get { - object obj = ResourceManager.GetObject("logo", resourceCulture); - return ((System.Drawing.Bitmap)(obj)); - } - } - - /// - /// Looks up a localized resource of type System.Drawing.Bitmap. - /// - internal static System.Drawing.Bitmap Splash { - get { - object obj = ResourceManager.GetObject("Splash", resourceCulture); - return ((System.Drawing.Bitmap)(obj)); - } - } - } -} diff --git a/Visual Studio Projects/Network Toolkit/Network Toolkit/Properties/Resources.resx b/Visual Studio Projects/Network Toolkit/Network Toolkit/Properties/Resources.resx deleted file mode 100644 index b99eabf..0000000 --- a/Visual Studio Projects/Network Toolkit/Network Toolkit/Properties/Resources.resx +++ /dev/null @@ -1,127 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - text/microsoft-resx - - - 2.0 - - - System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - - - System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - - - - ..\Resources\Splash.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a - - - ..\Resources\logo.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a - - \ No newline at end of file diff --git a/Visual Studio Projects/Network Toolkit/Network Toolkit/Properties/Settings.Designer.cs b/Visual Studio Projects/Network Toolkit/Network Toolkit/Properties/Settings.Designer.cs deleted file mode 100644 index e0890fa..0000000 --- a/Visual Studio Projects/Network Toolkit/Network Toolkit/Properties/Settings.Designer.cs +++ /dev/null @@ -1,26 +0,0 @@ -//------------------------------------------------------------------------------ -// -// This code was generated by a tool. -// Runtime Version:4.0.30319.42000 -// -// Changes to this file may cause incorrect behavior and will be lost if -// the code is regenerated. -// -//------------------------------------------------------------------------------ - -namespace Network_Toolkit.Properties { - - - [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] - [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.Editors.SettingsDesigner.SettingsSingleFileGenerator", "16.10.0.0")] - internal sealed partial class Settings : global::System.Configuration.ApplicationSettingsBase { - - private static Settings defaultInstance = ((Settings)(global::System.Configuration.ApplicationSettingsBase.Synchronized(new Settings()))); - - public static Settings Default { - get { - return defaultInstance; - } - } - } -} diff --git a/Visual Studio Projects/Network Toolkit/Network Toolkit/Properties/Settings.settings b/Visual Studio Projects/Network Toolkit/Network Toolkit/Properties/Settings.settings deleted file mode 100644 index 3964565..0000000 --- a/Visual Studio Projects/Network Toolkit/Network Toolkit/Properties/Settings.settings +++ /dev/null @@ -1,7 +0,0 @@ - - - - - - - diff --git a/Visual Studio Projects/Network Toolkit/Network Toolkit/Resources/Splash.png b/Visual Studio Projects/Network Toolkit/Network Toolkit/Resources/Splash.png deleted file mode 100644 index 98c8750..0000000 Binary files a/Visual Studio Projects/Network Toolkit/Network Toolkit/Resources/Splash.png and /dev/null differ diff --git a/Visual Studio Projects/Network Toolkit/Network Toolkit/Resources/logo.png b/Visual Studio Projects/Network Toolkit/Network Toolkit/Resources/logo.png deleted file mode 100644 index 2f5b7f7..0000000 Binary files a/Visual Studio Projects/Network Toolkit/Network Toolkit/Resources/logo.png and /dev/null differ diff --git a/Visual Studio Projects/Network Toolkit/Network Toolkit/SSList.Designer.cs b/Visual Studio Projects/Network Toolkit/Network Toolkit/SSList.Designer.cs deleted file mode 100644 index b7c01c7..0000000 --- a/Visual Studio Projects/Network Toolkit/Network Toolkit/SSList.Designer.cs +++ /dev/null @@ -1,142 +0,0 @@ - -namespace Network_Toolkit -{ - partial class SSList - { - /// - /// Required designer variable. - /// - private System.ComponentModel.IContainer components = null; - - /// - /// Clean up any resources being used. - /// - /// true if managed resources should be disposed; otherwise, false. - protected override void Dispose(bool disposing) - { - if (disposing && (components != null)) - { - components.Dispose(); - } - base.Dispose(disposing); - } - - #region Windows Form Designer generated code - - /// - /// Required method for Designer support - do not modify - /// the contents of this method with the code editor. - /// - private void InitializeComponent() - { - this.panel1 = new System.Windows.Forms.Panel(); - this.label2 = new System.Windows.Forms.Label(); - this.button2 = new System.Windows.Forms.Button(); - this.LST_SS = new System.Windows.Forms.ListView(); - this.button1 = new System.Windows.Forms.Button(); - this.columnHeader1 = ((System.Windows.Forms.ColumnHeader)(new System.Windows.Forms.ColumnHeader())); - this.panel1.SuspendLayout(); - this.SuspendLayout(); - // - // panel1 - // - this.panel1.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left) - | System.Windows.Forms.AnchorStyles.Right))); - this.panel1.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(16)))), ((int)(((byte)(115)))), ((int)(((byte)(185))))); - this.panel1.Controls.Add(this.label2); - this.panel1.Location = new System.Drawing.Point(-5, -12); - this.panel1.Margin = new System.Windows.Forms.Padding(4); - this.panel1.Name = "panel1"; - this.panel1.Size = new System.Drawing.Size(498, 94); - this.panel1.TabIndex = 8; - // - // label2 - // - this.label2.AutoSize = true; - this.label2.Font = new System.Drawing.Font("Microsoft Sans Serif", 16.75F); - this.label2.ForeColor = System.Drawing.Color.White; - this.label2.Location = new System.Drawing.Point(21, 34); - this.label2.Margin = new System.Windows.Forms.Padding(4, 0, 4, 0); - this.label2.Name = "label2"; - this.label2.Size = new System.Drawing.Size(313, 29); - this.label2.TabIndex = 22; - this.label2.Text = "Smart Start Provisioning List"; - // - // button2 - // - this.button2.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(16)))), ((int)(((byte)(115)))), ((int)(((byte)(185))))); - this.button2.FlatStyle = System.Windows.Forms.FlatStyle.Flat; - this.button2.ForeColor = System.Drawing.Color.White; - this.button2.Location = new System.Drawing.Point(348, 366); - this.button2.Margin = new System.Windows.Forms.Padding(4); - this.button2.Name = "button2"; - this.button2.Size = new System.Drawing.Size(127, 42); - this.button2.TabIndex = 27; - this.button2.Text = "CLOSE"; - this.button2.UseVisualStyleBackColor = false; - this.button2.Click += new System.EventHandler(this.button2_Click); - // - // LST_SS - // - this.LST_SS.Columns.AddRange(new System.Windows.Forms.ColumnHeader[] { - this.columnHeader1}); - this.LST_SS.FullRowSelect = true; - this.LST_SS.HideSelection = false; - this.LST_SS.Location = new System.Drawing.Point(17, 113); - this.LST_SS.MultiSelect = false; - this.LST_SS.Name = "LST_SS"; - this.LST_SS.Size = new System.Drawing.Size(458, 246); - this.LST_SS.TabIndex = 28; - this.LST_SS.UseCompatibleStateImageBehavior = false; - this.LST_SS.View = System.Windows.Forms.View.Details; - // - // button1 - // - this.button1.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(16)))), ((int)(((byte)(115)))), ((int)(((byte)(185))))); - this.button1.FlatStyle = System.Windows.Forms.FlatStyle.Flat; - this.button1.Font = new System.Drawing.Font("Microsoft Sans Serif", 12.25F); - this.button1.ForeColor = System.Drawing.Color.White; - this.button1.Location = new System.Drawing.Point(17, 366); - this.button1.Margin = new System.Windows.Forms.Padding(4); - this.button1.Name = "button1"; - this.button1.Size = new System.Drawing.Size(40, 34); - this.button1.TabIndex = 29; - this.button1.Text = "-"; - this.button1.UseVisualStyleBackColor = false; - this.button1.Click += new System.EventHandler(this.button1_Click); - // - // columnHeader1 - // - this.columnHeader1.Text = "DSK"; - this.columnHeader1.Width = 418; - // - // SSList - // - this.AutoScaleDimensions = new System.Drawing.SizeF(96F, 96F); - this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Dpi; - this.ClientSize = new System.Drawing.Size(490, 427); - this.Controls.Add(this.button1); - this.Controls.Add(this.LST_SS); - this.Controls.Add(this.button2); - this.Controls.Add(this.panel1); - this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedToolWindow; - this.Name = "SSList"; - this.StartPosition = System.Windows.Forms.FormStartPosition.CenterParent; - this.Text = "Smart Start Provisioning List"; - this.Load += new System.EventHandler(this.SSList_Load); - this.panel1.ResumeLayout(false); - this.panel1.PerformLayout(); - this.ResumeLayout(false); - - } - - #endregion - - private System.Windows.Forms.Panel panel1; - private System.Windows.Forms.Label label2; - private System.Windows.Forms.Button button2; - private System.Windows.Forms.ListView LST_SS; - private System.Windows.Forms.Button button1; - private System.Windows.Forms.ColumnHeader columnHeader1; - } -} \ No newline at end of file diff --git a/Visual Studio Projects/Network Toolkit/Network Toolkit/SSList.cs b/Visual Studio Projects/Network Toolkit/Network Toolkit/SSList.cs deleted file mode 100644 index b6801b6..0000000 --- a/Visual Studio Projects/Network Toolkit/Network Toolkit/SSList.cs +++ /dev/null @@ -1,77 +0,0 @@ -using System; -using System.Collections.Generic; -using System.ComponentModel; -using System.Data; -using System.Drawing; -using System.Linq; -using System.Text; -using System.Threading.Tasks; -using System.Windows.Forms; -using ZWaveJS.NET; - -namespace Network_Toolkit -{ - public partial class SSList : Form - { - Driver _Driver; - public SSList(Driver Driver) - { - InitializeComponent(); - _Driver = Driver; - } - - private void button1_Click(object sender, EventArgs e) - { - if(LST_SS.SelectedItems.Count > 0) - { - _Driver.Controller.UnprovisionSmartStartNode(LST_SS.SelectedItems[0].Text).ContinueWith((R) => { - - if (R.Result.Success) - { - this.Invoke((MethodInvoker)delegate () { - LST_SS.Items.Remove(LST_SS.SelectedItems[0]); - }); - } - else - { - this.Invoke((MethodInvoker)delegate () { - MessageBox.Show(R.Result.Message, "Could Not Remove Smart Start Entry", MessageBoxButtons.OK, MessageBoxIcon.Error); - }); - } - - }); - } - } - - private void SSList_Load(object sender, EventArgs e) - { - _Driver.Controller.GetProvisioningEntries().ContinueWith((R) => { - - if (R.Result.Success) - { - this.Invoke((MethodInvoker)delegate () { - SmartStartProvisioningEntry[] Entries = R.Result.ResultPayload as SmartStartProvisioningEntry[]; - foreach(SmartStartProvisioningEntry SS in Entries) - { - ListViewItem LVI = new ListViewItem(SS.dsk); - LST_SS.Items.Add(LVI); - } - }); - - } - else - { - this.Invoke((MethodInvoker)delegate () { - MessageBox.Show(R.Result.Message, "Could Not Retrieve Smart Start Entries", MessageBoxButtons.OK, MessageBoxIcon.Error); - }); - } - - }); - } - - private void button2_Click(object sender, EventArgs e) - { - this.Close(); - } - } -} diff --git a/Visual Studio Projects/Network Toolkit/Network Toolkit/SSList.resx b/Visual Studio Projects/Network Toolkit/Network Toolkit/SSList.resx deleted file mode 100644 index 1af7de1..0000000 --- a/Visual Studio Projects/Network Toolkit/Network Toolkit/SSList.resx +++ /dev/null @@ -1,120 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - text/microsoft-resx - - - 2.0 - - - System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - - - System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - - \ No newline at end of file diff --git a/Visual Studio Projects/Network Toolkit/Network Toolkit/SmartStart.Designer.cs b/Visual Studio Projects/Network Toolkit/Network Toolkit/SmartStart.Designer.cs deleted file mode 100644 index 35bc046..0000000 --- a/Visual Studio Projects/Network Toolkit/Network Toolkit/SmartStart.Designer.cs +++ /dev/null @@ -1,137 +0,0 @@ - -namespace Network_Toolkit -{ - partial class SmartStart - { - /// - /// Required designer variable. - /// - private System.ComponentModel.IContainer components = null; - - /// - /// Clean up any resources being used. - /// - /// true if managed resources should be disposed; otherwise, false. - protected override void Dispose(bool disposing) - { - if (disposing && (components != null)) - { - components.Dispose(); - } - base.Dispose(disposing); - } - - #region Windows Form Designer generated code - - /// - /// Required method for Designer support - do not modify - /// the contents of this method with the code editor. - /// - private void InitializeComponent() - { - this.panel1 = new System.Windows.Forms.Panel(); - this.label2 = new System.Windows.Forms.Label(); - this.COM_Cams = new System.Windows.Forms.ComboBox(); - this.button1 = new System.Windows.Forms.Button(); - this.label1 = new System.Windows.Forms.Label(); - this.PAN_Image = new System.Windows.Forms.Panel(); - this.panel1.SuspendLayout(); - this.SuspendLayout(); - // - // panel1 - // - this.panel1.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left) - | System.Windows.Forms.AnchorStyles.Right))); - this.panel1.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(16)))), ((int)(((byte)(115)))), ((int)(((byte)(185))))); - this.panel1.Controls.Add(this.label2); - this.panel1.Location = new System.Drawing.Point(-5, -12); - this.panel1.Margin = new System.Windows.Forms.Padding(4); - this.panel1.Name = "panel1"; - this.panel1.Size = new System.Drawing.Size(597, 94); - this.panel1.TabIndex = 7; - // - // label2 - // - this.label2.AutoSize = true; - this.label2.Font = new System.Drawing.Font("Microsoft Sans Serif", 16.75F); - this.label2.ForeColor = System.Drawing.Color.White; - this.label2.Location = new System.Drawing.Point(21, 34); - this.label2.Margin = new System.Windows.Forms.Padding(4, 0, 4, 0); - this.label2.Name = "label2"; - this.label2.Size = new System.Drawing.Size(333, 29); - this.label2.TabIndex = 22; - this.label2.Text = "Smart Start QR Code Scanner"; - // - // COM_Cams - // - this.COM_Cams.FormattingEnabled = true; - this.COM_Cams.Location = new System.Drawing.Point(17, 124); - this.COM_Cams.Name = "COM_Cams"; - this.COM_Cams.Size = new System.Drawing.Size(211, 21); - this.COM_Cams.TabIndex = 8; - this.COM_Cams.Text = "Select Device"; - this.COM_Cams.SelectedValueChanged += new System.EventHandler(this.COM_Cams_SelectedValueChanged); - // - // button1 - // - this.button1.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(16)))), ((int)(((byte)(115)))), ((int)(((byte)(185))))); - this.button1.FlatStyle = System.Windows.Forms.FlatStyle.Flat; - this.button1.ForeColor = System.Drawing.Color.White; - this.button1.Location = new System.Drawing.Point(374, 401); - this.button1.Margin = new System.Windows.Forms.Padding(4); - this.button1.Name = "button1"; - this.button1.Size = new System.Drawing.Size(127, 42); - this.button1.TabIndex = 24; - this.button1.Text = "CLOSE"; - this.button1.UseVisualStyleBackColor = false; - this.button1.Click += new System.EventHandler(this.button1_Click); - // - // label1 - // - this.label1.AutoSize = true; - this.label1.Location = new System.Drawing.Point(14, 108); - this.label1.Name = "label1"; - this.label1.Size = new System.Drawing.Size(81, 13); - this.label1.TabIndex = 25; - this.label1.Text = "Capture Device"; - // - // PAN_Image - // - this.PAN_Image.BackgroundImageLayout = System.Windows.Forms.ImageLayout.Zoom; - this.PAN_Image.Location = new System.Drawing.Point(17, 151); - this.PAN_Image.Name = "PAN_Image"; - this.PAN_Image.Size = new System.Drawing.Size(484, 243); - this.PAN_Image.TabIndex = 26; - // - // SmartStart - // - this.AutoScaleDimensions = new System.Drawing.SizeF(96F, 96F); - this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Dpi; - this.ClientSize = new System.Drawing.Size(518, 456); - this.Controls.Add(this.PAN_Image); - this.Controls.Add(this.label1); - this.Controls.Add(this.button1); - this.Controls.Add(this.COM_Cams); - this.Controls.Add(this.panel1); - this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedToolWindow; - this.Name = "SmartStart"; - this.StartPosition = System.Windows.Forms.FormStartPosition.CenterParent; - this.Text = "Smart Start QR Code Scanner"; - this.Load += new System.EventHandler(this.SmartStart_Load); - this.panel1.ResumeLayout(false); - this.panel1.PerformLayout(); - this.ResumeLayout(false); - this.PerformLayout(); - - } - - #endregion - - private System.Windows.Forms.Panel panel1; - private System.Windows.Forms.Label label2; - private System.Windows.Forms.ComboBox COM_Cams; - private System.Windows.Forms.Button button1; - private System.Windows.Forms.Label label1; - private System.Windows.Forms.Panel PAN_Image; - } -} \ No newline at end of file diff --git a/Visual Studio Projects/Network Toolkit/Network Toolkit/SmartStart.cs b/Visual Studio Projects/Network Toolkit/Network Toolkit/SmartStart.cs deleted file mode 100644 index f960b84..0000000 --- a/Visual Studio Projects/Network Toolkit/Network Toolkit/SmartStart.cs +++ /dev/null @@ -1,126 +0,0 @@ -using System; -using System.Collections.Generic; -using System.ComponentModel; -using System.Data; -using System.Drawing; -using System.Linq; -using System.Text; -using System.Threading.Tasks; -using System.Windows.Forms; -using AForge.Video.DirectShow; -using ZWaveJS.NET; - -namespace Network_Toolkit -{ - public partial class SmartStart : Form - { - VideoCaptureDevice Camera; - ZXing.BarcodeReader Reader; - Driver _Driver; - List Scanned; - - public SmartStart(Driver Driver) - { - InitializeComponent(); - _Driver = Driver; - } - - - - private void SmartStart_Load(object sender, EventArgs e) - { - this.FormClosing += SmartStart_FormClosing; - Reader = new ZXing.BarcodeReader(); - Scanned = new List(); - - FilterInfoCollection Cams = new AForge.Video.DirectShow.FilterInfoCollection(FilterCategory.VideoInputDevice); - foreach(FilterInfo FI in Cams) - { - ComboObject CO = new ComboObject(FI.Name, FI.MonikerString); - COM_Cams.Items.Add(CO); - } - - - } - - private void SmartStart_FormClosing(object sender, FormClosingEventArgs e) - { - if (Camera != null) - { - Camera.SignalToStop(); - Camera = null; - } - } - - private void COM_Cams_SelectedValueChanged(object sender, EventArgs e) - { - if(Camera != null) - { - Camera.SignalToStop(); - Camera = null; - } - - Camera = new VideoCaptureDevice(((ComboObject)COM_Cams.SelectedItem).Value.ToString()); - Camera.SetCameraProperty(CameraControlProperty.Focus, 1, CameraControlFlags.Auto); - Camera.NewFrame += Cam_NewFrame; - - Camera.Start(); - } - - - - private void Cam_NewFrame(object sender, AForge.Video.NewFrameEventArgs eventArgs) - { - if(PAN_Image.BackgroundImage != null) - { - PAN_Image.BackgroundImage.Dispose(); - } - - PAN_Image.BackgroundImage = (Bitmap)eventArgs.Frame.Clone(); - - using(Bitmap IMG = (Bitmap)eventArgs.Frame.Clone()) - { - - ZXing.Result Res = Reader.Decode(IMG); - if (Res != null && Res.BarcodeFormat == ZXing.BarcodeFormat.QR_CODE && !Scanned.Contains(Res.Text)) - { - Camera.SignalToStop(); - _Driver.Controller.ProvisionSmartStartNode(Res.Text).ContinueWith((R) => { - - if (R.Result.Success) - { - Scanned.Add(Res.Text); - - this.Invoke((MethodInvoker)delegate () - { - MessageBox.Show("The ZWave Device has been Successfully Provisioned", "Smart Start", MessageBoxButtons.OK, MessageBoxIcon.Information); - Camera.Start(); - }); - } - else - { - Scanned.Add(Res.Text); - - this.Invoke((MethodInvoker)delegate () - { - MessageBox.Show(R.Result.Message, "Smart Start", MessageBoxButtons.OK, MessageBoxIcon.Error); - Camera.Start(); - }); - } - - }); - - } - - - } - - - } - - private void button1_Click(object sender, EventArgs e) - { - this.Close(); - } - } -} diff --git a/Visual Studio Projects/Network Toolkit/Network Toolkit/SmartStart.resx b/Visual Studio Projects/Network Toolkit/Network Toolkit/SmartStart.resx deleted file mode 100644 index 1af7de1..0000000 --- a/Visual Studio Projects/Network Toolkit/Network Toolkit/SmartStart.resx +++ /dev/null @@ -1,120 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - text/microsoft-resx - - - 2.0 - - - System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - - - System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - - \ No newline at end of file diff --git a/Visual Studio Projects/Network Toolkit/Network Toolkit/Splash.Designer.cs b/Visual Studio Projects/Network Toolkit/Network Toolkit/Splash.Designer.cs deleted file mode 100644 index 4e8ad45..0000000 --- a/Visual Studio Projects/Network Toolkit/Network Toolkit/Splash.Designer.cs +++ /dev/null @@ -1,94 +0,0 @@ - -namespace Network_Toolkit -{ - partial class Splash - { - /// - /// Required designer variable. - /// - private System.ComponentModel.IContainer components = null; - - /// - /// Clean up any resources being used. - /// - /// true if managed resources should be disposed; otherwise, false. - protected override void Dispose(bool disposing) - { - if (disposing && (components != null)) - { - components.Dispose(); - } - base.Dispose(disposing); - } - - #region Windows Form Designer generated code - - /// - /// Required method for Designer support - do not modify - /// the contents of this method with the code editor. - /// - private void InitializeComponent() - { - this.components = new System.ComponentModel.Container(); - this.MainFormTimer = new System.Windows.Forms.Timer(this.components); - this.LBL_Version = new System.Windows.Forms.Label(); - this.pictureBox1 = new System.Windows.Forms.PictureBox(); - ((System.ComponentModel.ISupportInitialize)(this.pictureBox1)).BeginInit(); - this.SuspendLayout(); - // - // MainFormTimer - // - this.MainFormTimer.Enabled = true; - this.MainFormTimer.Interval = 3000; - this.MainFormTimer.Tick += new System.EventHandler(this.MainFormTimer_Tick); - // - // LBL_Version - // - this.LBL_Version.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(16)))), ((int)(((byte)(115)))), ((int)(((byte)(185))))); - this.LBL_Version.ForeColor = System.Drawing.Color.White; - this.LBL_Version.Location = new System.Drawing.Point(272, 329); - this.LBL_Version.Name = "LBL_Version"; - this.LBL_Version.Size = new System.Drawing.Size(173, 23); - this.LBL_Version.TabIndex = 1; - this.LBL_Version.Text = "label1"; - this.LBL_Version.TextAlign = System.Drawing.ContentAlignment.MiddleRight; - // - // pictureBox1 - // - this.pictureBox1.BackColor = System.Drawing.Color.Transparent; - this.pictureBox1.Image = global::Network_Toolkit.Properties.Resources.Splash; - this.pictureBox1.Location = new System.Drawing.Point(12, 12); - this.pictureBox1.Name = "pictureBox1"; - this.pictureBox1.Size = new System.Drawing.Size(500, 375); - this.pictureBox1.SizeMode = System.Windows.Forms.PictureBoxSizeMode.AutoSize; - this.pictureBox1.TabIndex = 0; - this.pictureBox1.TabStop = false; - // - // Splash - // - this.AutoScaleDimensions = new System.Drawing.SizeF(96F, 96F); - this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Dpi; - this.ClientSize = new System.Drawing.Size(525, 404); - this.Controls.Add(this.LBL_Version); - this.Controls.Add(this.pictureBox1); - this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.None; - this.Name = "Splash"; - this.ShowInTaskbar = false; - this.StartPosition = System.Windows.Forms.FormStartPosition.CenterScreen; - this.Text = "Form1"; - this.TransparencyKey = System.Drawing.SystemColors.Control; - this.Load += new System.EventHandler(this.Form1_Load); - ((System.ComponentModel.ISupportInitialize)(this.pictureBox1)).EndInit(); - this.ResumeLayout(false); - this.PerformLayout(); - - } - - #endregion - - private System.Windows.Forms.PictureBox pictureBox1; - private System.Windows.Forms.Timer MainFormTimer; - private System.Windows.Forms.Label LBL_Version; - } -} - diff --git a/Visual Studio Projects/Network Toolkit/Network Toolkit/Splash.cs b/Visual Studio Projects/Network Toolkit/Network Toolkit/Splash.cs deleted file mode 100644 index 954b355..0000000 --- a/Visual Studio Projects/Network Toolkit/Network Toolkit/Splash.cs +++ /dev/null @@ -1,41 +0,0 @@ -using System; -using System.Collections.Generic; -using System.ComponentModel; -using System.Data; -using System.Drawing; -using System.Linq; -using System.Text; -using System.Threading.Tasks; -using System.Windows.Forms; -using System.Reflection; - -namespace Network_Toolkit -{ - public partial class Splash : Form - { - public Splash() - { - InitializeComponent(); - } - - private void Form1_Load(object sender, EventArgs e) - { - pictureBox1.Enabled = false; - LBL_Version.Text = Assembly.GetExecutingAssembly().GetName().Version.ToString(); - } - - private void MainFormTimer_Tick(object sender, EventArgs e) - { - this.Hide(); - Main M = new Main(); - M.FormClosed += M_FormClosed; - M.Show(); - MainFormTimer.Enabled = false; - } - - private void M_FormClosed(object sender, FormClosedEventArgs e) - { - Application.Exit(); - } - } -} diff --git a/Visual Studio Projects/Network Toolkit/Network Toolkit/Splash.resx b/Visual Studio Projects/Network Toolkit/Network Toolkit/Splash.resx deleted file mode 100644 index 376e133..0000000 --- a/Visual Studio Projects/Network Toolkit/Network Toolkit/Splash.resx +++ /dev/null @@ -1,123 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - text/microsoft-resx - - - 2.0 - - - System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - - - System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - - - 17, 17 - - \ No newline at end of file diff --git a/Visual Studio Projects/Network Toolkit/Network Toolkit/UpdateFirmware.Designer.cs b/Visual Studio Projects/Network Toolkit/Network Toolkit/UpdateFirmware.Designer.cs deleted file mode 100644 index fdd6c02..0000000 --- a/Visual Studio Projects/Network Toolkit/Network Toolkit/UpdateFirmware.Designer.cs +++ /dev/null @@ -1,168 +0,0 @@ - -namespace Network_Toolkit -{ - partial class UpdateFirmware - { - /// - /// Required designer variable. - /// - private System.ComponentModel.IContainer components = null; - - /// - /// Clean up any resources being used. - /// - /// true if managed resources should be disposed; otherwise, false. - protected override void Dispose(bool disposing) - { - if (disposing && (components != null)) - { - components.Dispose(); - } - base.Dispose(disposing); - } - - #region Windows Form Designer generated code - - /// - /// Required method for Designer support - do not modify - /// the contents of this method with the code editor. - /// - private void InitializeComponent() - { - this.panel1 = new System.Windows.Forms.Panel(); - this.label2 = new System.Windows.Forms.Label(); - this.PB_Progress = new System.Windows.Forms.ProgressBar(); - this.button2 = new System.Windows.Forms.Button(); - this.TXT_File = new System.Windows.Forms.TextBox(); - this.label3 = new System.Windows.Forms.Label(); - this.button1 = new System.Windows.Forms.Button(); - this.button3 = new System.Windows.Forms.Button(); - this.panel1.SuspendLayout(); - this.SuspendLayout(); - // - // panel1 - // - this.panel1.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left) - | System.Windows.Forms.AnchorStyles.Right))); - this.panel1.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(16)))), ((int)(((byte)(115)))), ((int)(((byte)(185))))); - this.panel1.Controls.Add(this.label2); - this.panel1.Location = new System.Drawing.Point(-5, -12); - this.panel1.Margin = new System.Windows.Forms.Padding(4); - this.panel1.Name = "panel1"; - this.panel1.Size = new System.Drawing.Size(484, 94); - this.panel1.TabIndex = 7; - // - // label2 - // - this.label2.AutoSize = true; - this.label2.Font = new System.Drawing.Font("Microsoft Sans Serif", 16.75F); - this.label2.ForeColor = System.Drawing.Color.White; - this.label2.Location = new System.Drawing.Point(21, 34); - this.label2.Margin = new System.Windows.Forms.Padding(4, 0, 4, 0); - this.label2.Name = "label2"; - this.label2.Size = new System.Drawing.Size(199, 29); - this.label2.TabIndex = 22; - this.label2.Text = "Update Firmware"; - // - // PB_Progress - // - this.PB_Progress.Location = new System.Drawing.Point(40, 172); - this.PB_Progress.Name = "PB_Progress"; - this.PB_Progress.Size = new System.Drawing.Size(394, 23); - this.PB_Progress.TabIndex = 24; - // - // button2 - // - this.button2.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(16)))), ((int)(((byte)(115)))), ((int)(((byte)(185))))); - this.button2.FlatStyle = System.Windows.Forms.FlatStyle.Flat; - this.button2.ForeColor = System.Drawing.Color.White; - this.button2.Location = new System.Drawing.Point(172, 308); - this.button2.Margin = new System.Windows.Forms.Padding(4); - this.button2.Name = "button2"; - this.button2.Size = new System.Drawing.Size(127, 42); - this.button2.TabIndex = 26; - this.button2.Text = "START"; - this.button2.UseVisualStyleBackColor = false; - this.button2.Click += new System.EventHandler(this.button2_Click); - // - // TXT_File - // - this.TXT_File.Location = new System.Drawing.Point(40, 131); - this.TXT_File.Name = "TXT_File"; - this.TXT_File.ReadOnly = true; - this.TXT_File.Size = new System.Drawing.Size(328, 20); - this.TXT_File.TabIndex = 27; - // - // label3 - // - this.label3.AutoSize = true; - this.label3.Location = new System.Drawing.Point(37, 115); - this.label3.Name = "label3"; - this.label3.Size = new System.Drawing.Size(68, 13); - this.label3.TabIndex = 28; - this.label3.Text = "Firmware File"; - // - // button1 - // - this.button1.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(16)))), ((int)(((byte)(115)))), ((int)(((byte)(185))))); - this.button1.FlatStyle = System.Windows.Forms.FlatStyle.Flat; - this.button1.ForeColor = System.Drawing.Color.White; - this.button1.Location = new System.Drawing.Point(307, 308); - this.button1.Margin = new System.Windows.Forms.Padding(4); - this.button1.Name = "button1"; - this.button1.Size = new System.Drawing.Size(127, 42); - this.button1.TabIndex = 29; - this.button1.Text = "ABORT"; - this.button1.UseVisualStyleBackColor = false; - this.button1.Click += new System.EventHandler(this.button1_Click); - // - // button3 - // - this.button3.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(16)))), ((int)(((byte)(115)))), ((int)(((byte)(185))))); - this.button3.FlatStyle = System.Windows.Forms.FlatStyle.Flat; - this.button3.ForeColor = System.Drawing.Color.White; - this.button3.Location = new System.Drawing.Point(384, 125); - this.button3.Margin = new System.Windows.Forms.Padding(4); - this.button3.Name = "button3"; - this.button3.Size = new System.Drawing.Size(50, 31); - this.button3.TabIndex = 30; - this.button3.Text = ". . ."; - this.button3.UseVisualStyleBackColor = false; - this.button3.Click += new System.EventHandler(this.button3_Click); - // - // UpdateFirmware - // - this.AutoScaleDimensions = new System.Drawing.SizeF(96F, 96F); - this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Dpi; - this.ClientSize = new System.Drawing.Size(474, 378); - this.Controls.Add(this.button3); - this.Controls.Add(this.button1); - this.Controls.Add(this.label3); - this.Controls.Add(this.TXT_File); - this.Controls.Add(this.button2); - this.Controls.Add(this.PB_Progress); - this.Controls.Add(this.panel1); - this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedToolWindow; - this.Name = "UpdateFirmware"; - this.StartPosition = System.Windows.Forms.FormStartPosition.CenterParent; - this.Text = "Update Firmware"; - this.Load += new System.EventHandler(this.UpdateFirmware_Load); - this.panel1.ResumeLayout(false); - this.panel1.PerformLayout(); - this.ResumeLayout(false); - this.PerformLayout(); - - } - - #endregion - - private System.Windows.Forms.Panel panel1; - private System.Windows.Forms.Label label2; - private System.Windows.Forms.ProgressBar PB_Progress; - private System.Windows.Forms.Button button2; - private System.Windows.Forms.TextBox TXT_File; - private System.Windows.Forms.Label label3; - private System.Windows.Forms.Button button1; - private System.Windows.Forms.Button button3; - } -} \ No newline at end of file diff --git a/Visual Studio Projects/Network Toolkit/Network Toolkit/UpdateFirmware.cs b/Visual Studio Projects/Network Toolkit/Network Toolkit/UpdateFirmware.cs deleted file mode 100644 index 3392ca0..0000000 --- a/Visual Studio Projects/Network Toolkit/Network Toolkit/UpdateFirmware.cs +++ /dev/null @@ -1,144 +0,0 @@ -using System; -using System.Collections.Generic; -using System.ComponentModel; -using System.Data; -using System.Drawing; -using System.Linq; -using System.Text; -using System.Threading.Tasks; -using System.Windows.Forms; -using ZWaveJS.NET; - -namespace Network_Toolkit -{ - public partial class UpdateFirmware : Form - { - ZWaveNode _Node; - public UpdateFirmware(ZWaveNode Node) - { - InitializeComponent(); - _Node = Node; - } - - private void button1_Click(object sender, EventArgs e) - { - - - _Node.AbortFirmwareUpdate().ContinueWith((R) => - { - if (R.Result.Success) - { - _Node.FirmwareUpdateProgress -= _Node_FirmwareUpdateProgress; - _Node.FirmwareUpdateFinished -= _Node_FirmwareUpdateFinished; - - this.Invoke((MethodInvoker)delegate () { - MessageBox.Show("The Firmware update has been aborted.", "Firmware Update Aborted", MessageBoxButtons.OK, MessageBoxIcon.Error); - }); - } - else - { - this.Invoke((MethodInvoker)delegate () { - MessageBox.Show(R.Result.Message, "Could Not Abort Firmware Update", MessageBoxButtons.OK, MessageBoxIcon.Error); - }); - - } - }); - } - - private void button2_Click(object sender, EventArgs e) - { - - - _Node.BeginFirmwareUpdate(TXT_File.Text).ContinueWith((R) => { - - if (R.Result.Success) - { - _Node.FirmwareUpdateProgress += _Node_FirmwareUpdateProgress; - _Node.FirmwareUpdateFinished += _Node_FirmwareUpdateFinished; - - } - else - { - this.Invoke((MethodInvoker)delegate () { - MessageBox.Show(R.Result.Message, "Could Not Update Firmware", MessageBoxButtons.OK, MessageBoxIcon.Error); - }); - } - - - }); - - } - - private void _Node_FirmwareUpdateFinished(ZWaveNode Node, int Status, int WaitTime) - { - _Node.FirmwareUpdateProgress -= _Node_FirmwareUpdateProgress; - _Node.FirmwareUpdateFinished -= _Node_FirmwareUpdateFinished; - - string Message = ""; - MessageBoxIcon Icon = MessageBoxIcon.Error; - - switch (Status) - { - case 253: - Message = "The firmware for node "+Node.id+" has been updated. Activation is pending."; - Icon = MessageBoxIcon.Information; - break; - - case 254: - Message = "The firmware for node "+Node.id+" has been updated."; - Icon = MessageBoxIcon.Information; - break; - - case 255: - Message = "The firmware for node "+Node.id+" has been updated. A restart is required (which may happen automatically)"; - Icon = MessageBoxIcon.Information; - break; - - default: - Message = "The firmware for node " + Node.id + " failed to get updated. Error Code: "+Status; - Icon = MessageBoxIcon.Error; - break; - } - - - this.Invoke((MethodInvoker)delegate () { - MessageBox.Show(Message, "Firmware Updated", MessageBoxButtons.OK, Icon); - }); - - - } - - private void _Node_FirmwareUpdateProgress(ZWaveNode Node, int SentFragments, int TotalFragments) - { - this.Invoke((MethodInvoker)delegate () { - decimal P = Math.Round(((decimal)(SentFragments * 100)) / TotalFragments); - PB_Progress.Value = Convert.ToInt32(P); - }); - } - - private void button3_Click(object sender, EventArgs e) - { - OpenFileDialog OFD = new OpenFileDialog(); - - if(OFD.ShowDialog() == DialogResult.OK) - { - TXT_File.Text = OFD.FileName; - } - } - - private void UpdateFirmware_Load(object sender, EventArgs e) - { - this.FormClosing += UpdateFirmware_FormClosing; - } - - private void UpdateFirmware_FormClosing(object sender, FormClosingEventArgs e) - { - _Node.AbortFirmwareUpdate().ContinueWith((R) => - { - _Node.FirmwareUpdateProgress -= _Node_FirmwareUpdateProgress; - _Node.FirmwareUpdateFinished -= _Node_FirmwareUpdateFinished; - - }); - } - } -} diff --git a/Visual Studio Projects/Network Toolkit/Network Toolkit/UpdateFirmware.resx b/Visual Studio Projects/Network Toolkit/Network Toolkit/UpdateFirmware.resx deleted file mode 100644 index 1af7de1..0000000 --- a/Visual Studio Projects/Network Toolkit/Network Toolkit/UpdateFirmware.resx +++ /dev/null @@ -1,120 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - text/microsoft-resx - - - 2.0 - - - System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - - - System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - - \ No newline at end of file diff --git a/Visual Studio Projects/Network Toolkit/Network Toolkit/Views/Connector.Designer.cs b/Visual Studio Projects/Network Toolkit/Network Toolkit/Views/Connector.Designer.cs deleted file mode 100644 index fcb2a4f..0000000 --- a/Visual Studio Projects/Network Toolkit/Network Toolkit/Views/Connector.Designer.cs +++ /dev/null @@ -1,380 +0,0 @@ - -namespace Network_Toolkit.Views -{ - partial class Connector - { - /// - /// Required designer variable. - /// - private System.ComponentModel.IContainer components = null; - - /// - /// Clean up any resources being used. - /// - /// true if managed resources should be disposed; otherwise, false. - protected override void Dispose(bool disposing) - { - if (disposing && (components != null)) - { - components.Dispose(); - } - base.Dispose(disposing); - } - - #region Component Designer generated code - - /// - /// Required method for Designer support - do not modify - /// the contents of this method with the code editor. - /// - private void InitializeComponent() - { - this.label2 = new System.Windows.Forms.Label(); - this.COM_SerialPort = new System.Windows.Forms.ComboBox(); - this.label3 = new System.Windows.Forms.Label(); - this.label4 = new System.Windows.Forms.Label(); - this.TXT_S0 = new System.Windows.Forms.TextBox(); - this.TXT_S2AC = new System.Windows.Forms.TextBox(); - this.label5 = new System.Windows.Forms.Label(); - this.TXT_S2A = new System.Windows.Forms.TextBox(); - this.label6 = new System.Windows.Forms.Label(); - this.TXT_S2U = new System.Windows.Forms.TextBox(); - this.label7 = new System.Windows.Forms.Label(); - this.label8 = new System.Windows.Forms.Label(); - this.CB_Logging = new System.Windows.Forms.CheckBox(); - this.button1 = new System.Windows.Forms.Button(); - this.button2 = new System.Windows.Forms.Button(); - this.button3 = new System.Windows.Forms.Button(); - this.button4 = new System.Windows.Forms.Button(); - this.button5 = new System.Windows.Forms.Button(); - this.groupBox1 = new System.Windows.Forms.GroupBox(); - this.groupBox2 = new System.Windows.Forms.GroupBox(); - this.label9 = new System.Windows.Forms.Label(); - this.NUM_Schema = new System.Windows.Forms.NumericUpDown(); - this.button6 = new System.Windows.Forms.Button(); - this.TXT_WS = new System.Windows.Forms.TextBox(); - this.label1 = new System.Windows.Forms.Label(); - this.groupBox1.SuspendLayout(); - this.groupBox2.SuspendLayout(); - ((System.ComponentModel.ISupportInitialize)(this.NUM_Schema)).BeginInit(); - this.SuspendLayout(); - // - // label2 - // - this.label2.AutoSize = true; - this.label2.Font = new System.Drawing.Font("Microsoft Sans Serif", 16.75F); - this.label2.Location = new System.Drawing.Point(18, 14); - this.label2.Name = "label2"; - this.label2.Size = new System.Drawing.Size(135, 29); - this.label2.TabIndex = 3; - this.label2.Text = "Connection"; - // - // COM_SerialPort - // - this.COM_SerialPort.FormattingEnabled = true; - this.COM_SerialPort.Location = new System.Drawing.Point(216, 42); - this.COM_SerialPort.Name = "COM_SerialPort"; - this.COM_SerialPort.Size = new System.Drawing.Size(260, 21); - this.COM_SerialPort.TabIndex = 4; - this.COM_SerialPort.Text = "Select Port"; - // - // label3 - // - this.label3.AutoSize = true; - this.label3.Location = new System.Drawing.Point(44, 45); - this.label3.Name = "label3"; - this.label3.Size = new System.Drawing.Size(57, 13); - this.label3.TabIndex = 5; - this.label3.Text = "Sierial Port"; - // - // label4 - // - this.label4.AutoSize = true; - this.label4.Location = new System.Drawing.Point(44, 87); - this.label4.Name = "label4"; - this.label4.Size = new System.Drawing.Size(41, 13); - this.label4.TabIndex = 6; - this.label4.Text = "S0 Key"; - // - // TXT_S0 - // - this.TXT_S0.Location = new System.Drawing.Point(216, 84); - this.TXT_S0.Name = "TXT_S0"; - this.TXT_S0.Size = new System.Drawing.Size(207, 20); - this.TXT_S0.TabIndex = 7; - // - // TXT_S2AC - // - this.TXT_S2AC.Location = new System.Drawing.Point(216, 112); - this.TXT_S2AC.Name = "TXT_S2AC"; - this.TXT_S2AC.Size = new System.Drawing.Size(207, 20); - this.TXT_S2AC.TabIndex = 9; - // - // label5 - // - this.label5.AutoSize = true; - this.label5.Location = new System.Drawing.Point(44, 115); - this.label5.Name = "label5"; - this.label5.Size = new System.Drawing.Size(121, 13); - this.label5.TabIndex = 8; - this.label5.Text = "S2 Key (Access Control)"; - // - // TXT_S2A - // - this.TXT_S2A.Location = new System.Drawing.Point(216, 140); - this.TXT_S2A.Name = "TXT_S2A"; - this.TXT_S2A.Size = new System.Drawing.Size(207, 20); - this.TXT_S2A.TabIndex = 11; - // - // label6 - // - this.label6.AutoSize = true; - this.label6.Location = new System.Drawing.Point(44, 143); - this.label6.Name = "label6"; - this.label6.Size = new System.Drawing.Size(100, 13); - this.label6.TabIndex = 10; - this.label6.Text = "S2 Key (Authorised)"; - // - // TXT_S2U - // - this.TXT_S2U.Location = new System.Drawing.Point(216, 168); - this.TXT_S2U.Name = "TXT_S2U"; - this.TXT_S2U.Size = new System.Drawing.Size(207, 20); - this.TXT_S2U.TabIndex = 13; - // - // label7 - // - this.label7.AutoSize = true; - this.label7.Location = new System.Drawing.Point(44, 171); - this.label7.Name = "label7"; - this.label7.Size = new System.Drawing.Size(113, 13); - this.label7.TabIndex = 12; - this.label7.Text = "S2 Key (Unauthorised)"; - // - // label8 - // - this.label8.AutoSize = true; - this.label8.Location = new System.Drawing.Point(44, 210); - this.label8.Name = "label8"; - this.label8.Size = new System.Drawing.Size(81, 13); - this.label8.TabIndex = 14; - this.label8.Text = "Enable Logging"; - // - // CB_Logging - // - this.CB_Logging.AutoSize = true; - this.CB_Logging.Location = new System.Drawing.Point(216, 212); - this.CB_Logging.Name = "CB_Logging"; - this.CB_Logging.Size = new System.Drawing.Size(15, 14); - this.CB_Logging.TabIndex = 15; - this.CB_Logging.UseVisualStyleBackColor = true; - // - // button1 - // - this.button1.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(16)))), ((int)(((byte)(115)))), ((int)(((byte)(185))))); - this.button1.FlatStyle = System.Windows.Forms.FlatStyle.Flat; - this.button1.ForeColor = System.Drawing.Color.White; - this.button1.Location = new System.Drawing.Point(447, 238); - this.button1.Name = "button1"; - this.button1.Size = new System.Drawing.Size(95, 34); - this.button1.TabIndex = 20; - this.button1.Text = "Connect"; - this.button1.UseVisualStyleBackColor = false; - this.button1.Click += new System.EventHandler(this.button1_Click); - // - // button2 - // - this.button2.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(16)))), ((int)(((byte)(115)))), ((int)(((byte)(185))))); - this.button2.FlatStyle = System.Windows.Forms.FlatStyle.Flat; - this.button2.ForeColor = System.Drawing.Color.White; - this.button2.Location = new System.Drawing.Point(429, 84); - this.button2.Name = "button2"; - this.button2.Size = new System.Drawing.Size(47, 20); - this.button2.TabIndex = 21; - this.button2.Text = "Gen"; - this.button2.TextAlign = System.Drawing.ContentAlignment.TopCenter; - this.button2.UseVisualStyleBackColor = false; - this.button2.Click += new System.EventHandler(this.button2_Click); - // - // button3 - // - this.button3.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(16)))), ((int)(((byte)(115)))), ((int)(((byte)(185))))); - this.button3.FlatStyle = System.Windows.Forms.FlatStyle.Flat; - this.button3.ForeColor = System.Drawing.Color.White; - this.button3.Location = new System.Drawing.Point(429, 112); - this.button3.Name = "button3"; - this.button3.Size = new System.Drawing.Size(47, 20); - this.button3.TabIndex = 22; - this.button3.Text = "Gen"; - this.button3.TextAlign = System.Drawing.ContentAlignment.TopCenter; - this.button3.UseVisualStyleBackColor = false; - this.button3.Click += new System.EventHandler(this.button3_Click); - // - // button4 - // - this.button4.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(16)))), ((int)(((byte)(115)))), ((int)(((byte)(185))))); - this.button4.FlatStyle = System.Windows.Forms.FlatStyle.Flat; - this.button4.ForeColor = System.Drawing.Color.White; - this.button4.Location = new System.Drawing.Point(429, 143); - this.button4.Name = "button4"; - this.button4.Size = new System.Drawing.Size(47, 20); - this.button4.TabIndex = 23; - this.button4.Text = "Gen"; - this.button4.TextAlign = System.Drawing.ContentAlignment.TopCenter; - this.button4.UseVisualStyleBackColor = false; - this.button4.Click += new System.EventHandler(this.button4_Click); - // - // button5 - // - this.button5.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(16)))), ((int)(((byte)(115)))), ((int)(((byte)(185))))); - this.button5.FlatStyle = System.Windows.Forms.FlatStyle.Flat; - this.button5.ForeColor = System.Drawing.Color.White; - this.button5.Location = new System.Drawing.Point(429, 168); - this.button5.Name = "button5"; - this.button5.Size = new System.Drawing.Size(47, 20); - this.button5.TabIndex = 24; - this.button5.Text = "Gen"; - this.button5.TextAlign = System.Drawing.ContentAlignment.TopCenter; - this.button5.UseVisualStyleBackColor = false; - this.button5.Click += new System.EventHandler(this.button5_Click); - // - // groupBox1 - // - this.groupBox1.Controls.Add(this.label3); - this.groupBox1.Controls.Add(this.button1); - this.groupBox1.Controls.Add(this.button5); - this.groupBox1.Controls.Add(this.label4); - this.groupBox1.Controls.Add(this.button4); - this.groupBox1.Controls.Add(this.COM_SerialPort); - this.groupBox1.Controls.Add(this.button3); - this.groupBox1.Controls.Add(this.TXT_S0); - this.groupBox1.Controls.Add(this.button2); - this.groupBox1.Controls.Add(this.label5); - this.groupBox1.Controls.Add(this.TXT_S2AC); - this.groupBox1.Controls.Add(this.CB_Logging); - this.groupBox1.Controls.Add(this.label6); - this.groupBox1.Controls.Add(this.label8); - this.groupBox1.Controls.Add(this.TXT_S2A); - this.groupBox1.Controls.Add(this.TXT_S2U); - this.groupBox1.Controls.Add(this.label7); - this.groupBox1.Location = new System.Drawing.Point(23, 54); - this.groupBox1.Name = "groupBox1"; - this.groupBox1.Size = new System.Drawing.Size(548, 278); - this.groupBox1.TabIndex = 25; - this.groupBox1.TabStop = false; - this.groupBox1.Text = "Self Hosted"; - // - // groupBox2 - // - this.groupBox2.Controls.Add(this.label9); - this.groupBox2.Controls.Add(this.NUM_Schema); - this.groupBox2.Controls.Add(this.button6); - this.groupBox2.Controls.Add(this.TXT_WS); - this.groupBox2.Controls.Add(this.label1); - this.groupBox2.Location = new System.Drawing.Point(23, 339); - this.groupBox2.Name = "groupBox2"; - this.groupBox2.Size = new System.Drawing.Size(548, 141); - this.groupBox2.TabIndex = 26; - this.groupBox2.TabStop = false; - this.groupBox2.Text = "ZWave JS Server Client"; - // - // label9 - // - this.label9.AutoSize = true; - this.label9.Location = new System.Drawing.Point(44, 67); - this.label9.Name = "label9"; - this.label9.Size = new System.Drawing.Size(84, 13); - this.label9.TabIndex = 23; - this.label9.Text = "Schema Version"; - // - // NUM_Schema - // - this.NUM_Schema.Location = new System.Drawing.Point(216, 65); - this.NUM_Schema.Name = "NUM_Schema"; - this.NUM_Schema.Size = new System.Drawing.Size(260, 20); - this.NUM_Schema.TabIndex = 22; - this.NUM_Schema.Value = new decimal(new int[] { - 17, - 0, - 0, - 0}); - // - // button6 - // - this.button6.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(16)))), ((int)(((byte)(115)))), ((int)(((byte)(185))))); - this.button6.FlatStyle = System.Windows.Forms.FlatStyle.Flat; - this.button6.ForeColor = System.Drawing.Color.White; - this.button6.Location = new System.Drawing.Point(447, 101); - this.button6.Name = "button6"; - this.button6.Size = new System.Drawing.Size(95, 34); - this.button6.TabIndex = 21; - this.button6.Text = "Connect"; - this.button6.UseVisualStyleBackColor = false; - this.button6.Click += new System.EventHandler(this.button6_Click); - // - // TXT_WS - // - this.TXT_WS.Location = new System.Drawing.Point(216, 36); - this.TXT_WS.Name = "TXT_WS"; - this.TXT_WS.Size = new System.Drawing.Size(260, 20); - this.TXT_WS.TabIndex = 8; - this.TXT_WS.Text = "ws://"; - // - // label1 - // - this.label1.AutoSize = true; - this.label1.Location = new System.Drawing.Point(44, 39); - this.label1.Name = "label1"; - this.label1.Size = new System.Drawing.Size(103, 13); - this.label1.TabIndex = 7; - this.label1.Text = "WS Socket Address"; - // - // Connector - // - this.AutoScaleDimensions = new System.Drawing.SizeF(96F, 96F); - this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Dpi; - this.AutoSize = true; - this.Controls.Add(this.groupBox2); - this.Controls.Add(this.groupBox1); - this.Controls.Add(this.label2); - this.Name = "Connector"; - this.Size = new System.Drawing.Size(600, 499); - this.Load += new System.EventHandler(this.Connector_Load); - this.groupBox1.ResumeLayout(false); - this.groupBox1.PerformLayout(); - this.groupBox2.ResumeLayout(false); - this.groupBox2.PerformLayout(); - ((System.ComponentModel.ISupportInitialize)(this.NUM_Schema)).EndInit(); - this.ResumeLayout(false); - this.PerformLayout(); - - } - - #endregion - private System.Windows.Forms.Label label2; - private System.Windows.Forms.ComboBox COM_SerialPort; - private System.Windows.Forms.Label label3; - private System.Windows.Forms.Label label4; - private System.Windows.Forms.TextBox TXT_S0; - private System.Windows.Forms.TextBox TXT_S2AC; - private System.Windows.Forms.Label label5; - private System.Windows.Forms.TextBox TXT_S2A; - private System.Windows.Forms.Label label6; - private System.Windows.Forms.TextBox TXT_S2U; - private System.Windows.Forms.Label label7; - private System.Windows.Forms.Label label8; - private System.Windows.Forms.CheckBox CB_Logging; - private System.Windows.Forms.Button button1; - private System.Windows.Forms.Button button2; - private System.Windows.Forms.Button button3; - private System.Windows.Forms.Button button4; - private System.Windows.Forms.Button button5; - private System.Windows.Forms.GroupBox groupBox1; - private System.Windows.Forms.GroupBox groupBox2; - private System.Windows.Forms.Button button6; - private System.Windows.Forms.TextBox TXT_WS; - private System.Windows.Forms.Label label1; - private System.Windows.Forms.Label label9; - private System.Windows.Forms.NumericUpDown NUM_Schema; - } -} diff --git a/Visual Studio Projects/Network Toolkit/Network Toolkit/Views/Connector.cs b/Visual Studio Projects/Network Toolkit/Network Toolkit/Views/Connector.cs deleted file mode 100644 index f896cf7..0000000 --- a/Visual Studio Projects/Network Toolkit/Network Toolkit/Views/Connector.cs +++ /dev/null @@ -1,103 +0,0 @@ -using System; -using System.Collections.Generic; -using System.ComponentModel; -using System.Data; -using System.Drawing; -using System.Linq; -using System.Text; -using System.Threading.Tasks; -using System.Windows.Forms; -using System.IO.Ports; -using ZWaveJS.NET; - -namespace Network_Toolkit.Views -{ - public partial class Connector : UserControl - { - public delegate void StartConnection(string SerialPort, ZWaveOptions Options); - public event StartConnection StartConnectionEvent; - - public delegate void StartConnectionWS(string WS, int Schema); - public event StartConnectionWS StartConnectionWSEvent; - - public Connector() - { - InitializeComponent(); - } - - private void Connector_Load(object sender, EventArgs e) - { - COM_SerialPort.Items.Add("Select Port"); - foreach (string Port in SerialPort.GetPortNames()) - { - COM_SerialPort.Items.Add(Port); - } - } - - private void button1_Click(object sender, EventArgs e) - { - ZWaveOptions Options = new ZWaveOptions(); - Options.logConfig.enabled = CB_Logging.Checked; - Options.logConfig.logToFile = CB_Logging.Checked; - - if (TXT_S0.Text.Length > 0) - Options.securityKeys.S0_Legacy = TXT_S0.Text; - - if (TXT_S2A.Text.Length > 0) - Options.securityKeys.S2_Authenticated = TXT_S2A.Text; - - if (TXT_S2AC.Text.Length > 0) - Options.securityKeys.S2_AccessControl = TXT_S2AC.Text; - - if (TXT_S2U.Text.Length > 0) - Options.securityKeys.S2_Unauthenticated = TXT_S2U.Text; - - - - - - StartConnectionEvent?.Invoke(COM_SerialPort.SelectedItem.ToString(),Options); - - - } - - private void button2_Click(object sender, EventArgs e) - { - Random R = new Random(); - byte[] Key = new byte[16]; - R.NextBytes(Key); - TXT_S0.Text = BitConverter.ToString(Key).ToLower().Replace("-", ""); - - } - - private void button3_Click(object sender, EventArgs e) - { - Random R = new Random(); - byte[] Key = new byte[16]; - R.NextBytes(Key); - TXT_S2AC.Text = BitConverter.ToString(Key).ToLower().Replace("-", ""); - } - - private void button4_Click(object sender, EventArgs e) - { - Random R = new Random(); - byte[] Key = new byte[16]; - R.NextBytes(Key); - TXT_S2A.Text = BitConverter.ToString(Key).ToLower().Replace("-", ""); - } - - private void button5_Click(object sender, EventArgs e) - { - Random R = new Random(); - byte[] Key = new byte[16]; - R.NextBytes(Key); - TXT_S2U.Text = BitConverter.ToString(Key).ToLower().Replace("-", ""); - } - - private void button6_Click(object sender, EventArgs e) - { - - StartConnectionWSEvent.Invoke(TXT_WS.Text, Convert.ToInt32(NUM_Schema.Value)); - } - } -} diff --git a/Visual Studio Projects/Network Toolkit/Network Toolkit/Views/Connector.resx b/Visual Studio Projects/Network Toolkit/Network Toolkit/Views/Connector.resx deleted file mode 100644 index 1af7de1..0000000 --- a/Visual Studio Projects/Network Toolkit/Network Toolkit/Views/Connector.resx +++ /dev/null @@ -1,120 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - text/microsoft-resx - - - 2.0 - - - System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - - - System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - - \ No newline at end of file diff --git a/Visual Studio Projects/Network Toolkit/Network Toolkit/Views/Default.Designer.cs b/Visual Studio Projects/Network Toolkit/Network Toolkit/Views/Default.Designer.cs deleted file mode 100644 index b6fa365..0000000 --- a/Visual Studio Projects/Network Toolkit/Network Toolkit/Views/Default.Designer.cs +++ /dev/null @@ -1,74 +0,0 @@ - -namespace Network_Toolkit.Views -{ - partial class Default - { - /// - /// Required designer variable. - /// - private System.ComponentModel.IContainer components = null; - - /// - /// Clean up any resources being used. - /// - /// true if managed resources should be disposed; otherwise, false. - protected override void Dispose(bool disposing) - { - if (disposing && (components != null)) - { - components.Dispose(); - } - base.Dispose(disposing); - } - - #region Component Designer generated code - - /// - /// Required method for Designer support - do not modify - /// the contents of this method with the code editor. - /// - private void InitializeComponent() - { - this.label2 = new System.Windows.Forms.Label(); - this.label1 = new System.Windows.Forms.Label(); - this.SuspendLayout(); - // - // label2 - // - this.label2.AutoSize = true; - this.label2.Font = new System.Drawing.Font("Microsoft Sans Serif", 16.75F); - this.label2.Location = new System.Drawing.Point(18, 14); - this.label2.Name = "label2"; - this.label2.Size = new System.Drawing.Size(88, 29); - this.label2.TabIndex = 24; - this.label2.Text = "Ready."; - // - // label1 - // - this.label1.AutoSize = true; - this.label1.Font = new System.Drawing.Font("Microsoft Sans Serif", 12.75F); - this.label1.Location = new System.Drawing.Point(19, 43); - this.label1.Name = "label1"; - this.label1.Size = new System.Drawing.Size(412, 20); - this.label1.TabIndex = 25; - this.label1.Text = "Choose a node from the left, or an option from the top."; - // - // Default - // - this.AutoScaleDimensions = new System.Drawing.SizeF(96F, 96F); - this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Dpi; - this.Controls.Add(this.label1); - this.Controls.Add(this.label2); - this.Name = "Default"; - this.Size = new System.Drawing.Size(600, 499); - this.ResumeLayout(false); - this.PerformLayout(); - - } - - #endregion - - private System.Windows.Forms.Label label2; - private System.Windows.Forms.Label label1; - } -} diff --git a/Visual Studio Projects/Network Toolkit/Network Toolkit/Views/Default.cs b/Visual Studio Projects/Network Toolkit/Network Toolkit/Views/Default.cs deleted file mode 100644 index f77fb18..0000000 --- a/Visual Studio Projects/Network Toolkit/Network Toolkit/Views/Default.cs +++ /dev/null @@ -1,20 +0,0 @@ -using System; -using System.Collections.Generic; -using System.ComponentModel; -using System.Data; -using System.Drawing; -using System.Linq; -using System.Text; -using System.Threading.Tasks; -using System.Windows.Forms; - -namespace Network_Toolkit.Views -{ - public partial class Default : UserControl - { - public Default() - { - InitializeComponent(); - } - } -} diff --git a/Visual Studio Projects/Network Toolkit/Network Toolkit/Views/Default.resx b/Visual Studio Projects/Network Toolkit/Network Toolkit/Views/Default.resx deleted file mode 100644 index 1af7de1..0000000 --- a/Visual Studio Projects/Network Toolkit/Network Toolkit/Views/Default.resx +++ /dev/null @@ -1,120 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - text/microsoft-resx - - - 2.0 - - - System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - - - System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - - \ No newline at end of file diff --git a/Visual Studio Projects/Network Toolkit/Network Toolkit/Views/IncludeOptions.Designer.cs b/Visual Studio Projects/Network Toolkit/Network Toolkit/Views/IncludeOptions.Designer.cs deleted file mode 100644 index 6aa09c2..0000000 --- a/Visual Studio Projects/Network Toolkit/Network Toolkit/Views/IncludeOptions.Designer.cs +++ /dev/null @@ -1,316 +0,0 @@ - -namespace Network_Toolkit.Views -{ - partial class IncludeOptions - { - /// - /// Required designer variable. - /// - private System.ComponentModel.IContainer components = null; - - /// - /// Clean up any resources being used. - /// - /// true if managed resources should be disposed; otherwise, false. - protected override void Dispose(bool disposing) - { - if (disposing && (components != null)) - { - components.Dispose(); - } - base.Dispose(disposing); - } - - #region Component Designer generated code - - /// - /// Required method for Designer support - do not modify - /// the contents of this method with the code editor. - /// - private void InitializeComponent() - { - this.label2 = new System.Windows.Forms.Label(); - this.label1 = new System.Windows.Forms.Label(); - this.label3 = new System.Windows.Forms.Label(); - this.label4 = new System.Windows.Forms.Label(); - this.label5 = new System.Windows.Forms.Label(); - this.button5 = new System.Windows.Forms.Button(); - this.button6 = new System.Windows.Forms.Button(); - this.button7 = new System.Windows.Forms.Button(); - this.button8 = new System.Windows.Forms.Button(); - this.button1 = new System.Windows.Forms.Button(); - this.label6 = new System.Windows.Forms.Label(); - this.groupBox1 = new System.Windows.Forms.GroupBox(); - this.label7 = new System.Windows.Forms.Label(); - this.button2 = new System.Windows.Forms.Button(); - this.checkBox2 = new System.Windows.Forms.CheckBox(); - this.GP_Exclude = new System.Windows.Forms.GroupBox(); - this.checkBox1 = new System.Windows.Forms.CheckBox(); - this.button3 = new System.Windows.Forms.Button(); - this.label8 = new System.Windows.Forms.Label(); - this.groupBox1.SuspendLayout(); - this.GP_Exclude.SuspendLayout(); - this.SuspendLayout(); - // - // label2 - // - this.label2.AutoSize = true; - this.label2.Font = new System.Drawing.Font("Microsoft Sans Serif", 16.75F); - this.label2.Location = new System.Drawing.Point(18, 14); - this.label2.Name = "label2"; - this.label2.Size = new System.Drawing.Size(390, 29); - this.label2.TabIndex = 22; - this.label2.Text = "ZWave Device Inclusion / Exclusion"; - // - // label1 - // - this.label1.AutoSize = true; - this.label1.Location = new System.Drawing.Point(125, 32); - this.label1.Name = "label1"; - this.label1.Size = new System.Drawing.Size(336, 13); - this.label1.TabIndex = 26; - this.label1.Tag = ""; - this.label1.Text = "S2 if supported, S0 ONLY if required, else no security. (recommended)"; - // - // label3 - // - this.label3.AutoSize = true; - this.label3.Location = new System.Drawing.Point(125, 79); - this.label3.Name = "label3"; - this.label3.Size = new System.Drawing.Size(93, 13); - this.label3.TabIndex = 27; - this.label3.Text = "S2 Security ONLY"; - // - // label4 - // - this.label4.AutoSize = true; - this.label4.Location = new System.Drawing.Point(125, 161); - this.label4.Name = "label4"; - this.label4.Size = new System.Drawing.Size(146, 13); - this.label4.TabIndex = 28; - this.label4.Text = "S0 ONLY (not recommended)"; - // - // label5 - // - this.label5.AutoSize = true; - this.label5.Location = new System.Drawing.Point(125, 201); - this.label5.Name = "label5"; - this.label5.Size = new System.Drawing.Size(156, 13); - this.label5.TabIndex = 29; - this.label5.Text = "No Security (not recommended)"; - // - // button5 - // - this.button5.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(16)))), ((int)(((byte)(115)))), ((int)(((byte)(185))))); - this.button5.FlatStyle = System.Windows.Forms.FlatStyle.Flat; - this.button5.ForeColor = System.Drawing.Color.White; - this.button5.Location = new System.Drawing.Point(12, 30); - this.button5.Name = "button5"; - this.button5.Size = new System.Drawing.Size(95, 34); - this.button5.TabIndex = 30; - this.button5.Tag = ""; - this.button5.Text = "Default"; - this.button5.UseVisualStyleBackColor = false; - this.button5.Click += new System.EventHandler(this.button5_Click); - // - // button6 - // - this.button6.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(16)))), ((int)(((byte)(115)))), ((int)(((byte)(185))))); - this.button6.FlatStyle = System.Windows.Forms.FlatStyle.Flat; - this.button6.ForeColor = System.Drawing.Color.White; - this.button6.Location = new System.Drawing.Point(12, 70); - this.button6.Name = "button6"; - this.button6.Size = new System.Drawing.Size(95, 34); - this.button6.TabIndex = 31; - this.button6.Text = "S2"; - this.button6.UseVisualStyleBackColor = false; - this.button6.Click += new System.EventHandler(this.button6_Click); - // - // button7 - // - this.button7.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(16)))), ((int)(((byte)(115)))), ((int)(((byte)(185))))); - this.button7.FlatStyle = System.Windows.Forms.FlatStyle.Flat; - this.button7.ForeColor = System.Drawing.Color.White; - this.button7.Location = new System.Drawing.Point(12, 152); - this.button7.Name = "button7"; - this.button7.Size = new System.Drawing.Size(95, 34); - this.button7.TabIndex = 32; - this.button7.Text = "S0"; - this.button7.UseVisualStyleBackColor = false; - this.button7.Click += new System.EventHandler(this.button7_Click); - // - // button8 - // - this.button8.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(16)))), ((int)(((byte)(115)))), ((int)(((byte)(185))))); - this.button8.FlatStyle = System.Windows.Forms.FlatStyle.Flat; - this.button8.ForeColor = System.Drawing.Color.White; - this.button8.Location = new System.Drawing.Point(12, 192); - this.button8.Name = "button8"; - this.button8.Size = new System.Drawing.Size(95, 34); - this.button8.TabIndex = 33; - this.button8.Text = "No Security"; - this.button8.UseVisualStyleBackColor = false; - this.button8.Click += new System.EventHandler(this.button8_Click); - // - // button1 - // - this.button1.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(16)))), ((int)(((byte)(115)))), ((int)(((byte)(185))))); - this.button1.FlatStyle = System.Windows.Forms.FlatStyle.Flat; - this.button1.ForeColor = System.Drawing.Color.White; - this.button1.Location = new System.Drawing.Point(12, 31); - this.button1.Name = "button1"; - this.button1.Size = new System.Drawing.Size(95, 34); - this.button1.TabIndex = 35; - this.button1.Text = "Exclude"; - this.button1.UseVisualStyleBackColor = false; - this.button1.Click += new System.EventHandler(this.button1_Click); - // - // label6 - // - this.label6.AutoSize = true; - this.label6.Location = new System.Drawing.Point(125, 32); - this.label6.Name = "label6"; - this.label6.Size = new System.Drawing.Size(83, 13); - this.label6.TabIndex = 34; - this.label6.Text = "Exclude a Node"; - // - // groupBox1 - // - this.groupBox1.Controls.Add(this.label7); - this.groupBox1.Controls.Add(this.button2); - this.groupBox1.Controls.Add(this.checkBox2); - this.groupBox1.Controls.Add(this.button5); - this.groupBox1.Controls.Add(this.label1); - this.groupBox1.Controls.Add(this.label3); - this.groupBox1.Controls.Add(this.button8); - this.groupBox1.Controls.Add(this.label4); - this.groupBox1.Controls.Add(this.button7); - this.groupBox1.Controls.Add(this.label5); - this.groupBox1.Controls.Add(this.button6); - this.groupBox1.Location = new System.Drawing.Point(23, 61); - this.groupBox1.Name = "groupBox1"; - this.groupBox1.Size = new System.Drawing.Size(556, 250); - this.groupBox1.TabIndex = 36; - this.groupBox1.TabStop = false; - this.groupBox1.Text = "Include"; - // - // label7 - // - this.label7.AutoSize = true; - this.label7.Location = new System.Drawing.Point(125, 121); - this.label7.Name = "label7"; - this.label7.Size = new System.Drawing.Size(165, 13); - this.label7.TabIndex = 39; - this.label7.Text = "Enroll a device using its QR Code"; - // - // button2 - // - this.button2.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(16)))), ((int)(((byte)(115)))), ((int)(((byte)(185))))); - this.button2.FlatStyle = System.Windows.Forms.FlatStyle.Flat; - this.button2.ForeColor = System.Drawing.Color.White; - this.button2.Location = new System.Drawing.Point(12, 110); - this.button2.Name = "button2"; - this.button2.Size = new System.Drawing.Size(95, 34); - this.button2.TabIndex = 38; - this.button2.Text = "Smart Start"; - this.button2.UseVisualStyleBackColor = false; - this.button2.Click += new System.EventHandler(this.button2_Click); - // - // checkBox2 - // - this.checkBox2.AutoSize = true; - this.checkBox2.Location = new System.Drawing.Point(128, 48); - this.checkBox2.Name = "checkBox2"; - this.checkBox2.Size = new System.Drawing.Size(164, 17); - this.checkBox2.TabIndex = 37; - this.checkBox2.Tag = ""; - this.checkBox2.Text = "Prefer S0 over no encryption."; - this.checkBox2.UseVisualStyleBackColor = true; - // - // GP_Exclude - // - this.GP_Exclude.Controls.Add(this.label8); - this.GP_Exclude.Controls.Add(this.button3); - this.GP_Exclude.Controls.Add(this.checkBox1); - this.GP_Exclude.Controls.Add(this.button1); - this.GP_Exclude.Controls.Add(this.label6); - this.GP_Exclude.Location = new System.Drawing.Point(23, 317); - this.GP_Exclude.Name = "GP_Exclude"; - this.GP_Exclude.Size = new System.Drawing.Size(556, 142); - this.GP_Exclude.TabIndex = 37; - this.GP_Exclude.TabStop = false; - this.GP_Exclude.Tag = ""; - this.GP_Exclude.Text = "Exclusion"; - // - // checkBox1 - // - this.checkBox1.AutoSize = true; - this.checkBox1.Location = new System.Drawing.Point(128, 48); - this.checkBox1.Name = "checkBox1"; - this.checkBox1.Size = new System.Drawing.Size(214, 17); - this.checkBox1.TabIndex = 36; - this.checkBox1.Text = "Remove from Start Start Provisioning list"; - this.checkBox1.UseVisualStyleBackColor = true; - // - // button3 - // - this.button3.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(16)))), ((int)(((byte)(115)))), ((int)(((byte)(185))))); - this.button3.FlatStyle = System.Windows.Forms.FlatStyle.Flat; - this.button3.ForeColor = System.Drawing.Color.White; - this.button3.Location = new System.Drawing.Point(12, 71); - this.button3.Name = "button3"; - this.button3.Size = new System.Drawing.Size(95, 34); - this.button3.TabIndex = 37; - this.button3.Text = "Provisioning List"; - this.button3.UseVisualStyleBackColor = false; - this.button3.Click += new System.EventHandler(this.button3_Click); - // - // label8 - // - this.label8.AutoSize = true; - this.label8.Location = new System.Drawing.Point(127, 82); - this.label8.Name = "label8"; - this.label8.Size = new System.Drawing.Size(136, 13); - this.label8.TabIndex = 40; - this.label8.Text = "Manage Smart Start Entries"; - // - // IncludeOptions - // - this.AutoScaleDimensions = new System.Drawing.SizeF(96F, 96F); - this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Dpi; - this.Controls.Add(this.GP_Exclude); - this.Controls.Add(this.groupBox1); - this.Controls.Add(this.label2); - this.Name = "IncludeOptions"; - this.Size = new System.Drawing.Size(600, 499); - this.groupBox1.ResumeLayout(false); - this.groupBox1.PerformLayout(); - this.GP_Exclude.ResumeLayout(false); - this.GP_Exclude.PerformLayout(); - this.ResumeLayout(false); - this.PerformLayout(); - - } - - #endregion - private System.Windows.Forms.Label label2; - private System.Windows.Forms.Label label1; - private System.Windows.Forms.Label label3; - private System.Windows.Forms.Label label4; - private System.Windows.Forms.Label label5; - private System.Windows.Forms.Button button5; - private System.Windows.Forms.Button button6; - private System.Windows.Forms.Button button7; - private System.Windows.Forms.Button button8; - private System.Windows.Forms.Button button1; - private System.Windows.Forms.Label label6; - private System.Windows.Forms.GroupBox groupBox1; - private System.Windows.Forms.GroupBox GP_Exclude; - private System.Windows.Forms.CheckBox checkBox1; - private System.Windows.Forms.CheckBox checkBox2; - private System.Windows.Forms.Label label7; - private System.Windows.Forms.Button button2; - private System.Windows.Forms.Label label8; - private System.Windows.Forms.Button button3; - } -} diff --git a/Visual Studio Projects/Network Toolkit/Network Toolkit/Views/IncludeOptions.cs b/Visual Studio Projects/Network Toolkit/Network Toolkit/Views/IncludeOptions.cs deleted file mode 100644 index e761649..0000000 --- a/Visual Studio Projects/Network Toolkit/Network Toolkit/Views/IncludeOptions.cs +++ /dev/null @@ -1,136 +0,0 @@ -using System; -using System.Collections.Generic; -using System.ComponentModel; -using System.Data; -using System.Drawing; -using System.Linq; -using System.Text; -using System.Threading.Tasks; -using System.Windows.Forms; -using ZWaveJS.NET; - -namespace Network_Toolkit.Views -{ - - public partial class IncludeOptions : UserControl - { - public delegate void StartInclusionExclusion(object Options); - public event StartInclusionExclusion StartInclusionExclusionEvent; - - public delegate void SmartStart(); - public event SmartStart SmartStartEvent; - - public delegate void SmartStartList(); - public event SmartStartList SmartStartListEvent; - - public delegate void StartInclusionReplace(InclusionOptions Options, int NodeID); - public event StartInclusionReplace StartInclusionReplaceEvent; - private int ReplaceNodeID; - - - public IncludeOptions() - { - InitializeComponent(); - } - - public IncludeOptions(int ReplaceNode) - { - InitializeComponent(); - - ReplaceNodeID = ReplaceNode; - - button2.Enabled = false; - label7.Enabled = false; - GP_Exclude.Enabled = false; - button5.Enabled = false; - label1.Enabled = false; - checkBox2.Enabled = false; - - label2.Text = "ZWave Device Replacement Strategy"; - - - - - } - - private void button8_Click(object sender, EventArgs e) - { - InclusionOptions IO = new InclusionOptions(); - IO.strategy = Enums.InclusionStrategy.Insecure; - - - if (ReplaceNodeID > 0) - { - StartInclusionReplaceEvent?.Invoke(IO, ReplaceNodeID); - } - else - { - StartInclusionExclusionEvent?.Invoke(IO); - } - - } - - private void button1_Click(object sender, EventArgs e) - { - - StartInclusionExclusionEvent?.Invoke(checkBox1.Checked); - } - - private void button5_Click(object sender, EventArgs e) - { - InclusionOptions IO = new InclusionOptions(); - IO.strategy = Enums.InclusionStrategy.Default; - IO.forceSecurity = checkBox2.Checked; - - - StartInclusionExclusionEvent?.Invoke(IO); - } - - private void button6_Click(object sender, EventArgs e) - { - InclusionOptions IO = new InclusionOptions(); - IO.strategy = Enums.InclusionStrategy.Security_S2; - - if (ReplaceNodeID > 0) - { - StartInclusionReplaceEvent?.Invoke(IO, ReplaceNodeID); - } - else - { - StartInclusionExclusionEvent?.Invoke(IO); - } - - - - } - - private void button7_Click(object sender, EventArgs e) - { - InclusionOptions IO = new InclusionOptions(); - IO.strategy = Enums.InclusionStrategy.Security_S0; - - - if (ReplaceNodeID > 0) - { - StartInclusionReplaceEvent?.Invoke(IO, ReplaceNodeID); - } - else - { - StartInclusionExclusionEvent?.Invoke(IO); - } - } - - private void button2_Click(object sender, EventArgs e) - { - SmartStartEvent?.Invoke(); - - } - - private void button3_Click(object sender, EventArgs e) - { - SmartStartListEvent?.Invoke(); - - - } - } -} diff --git a/Visual Studio Projects/Network Toolkit/Network Toolkit/Views/IncludeOptions.resx b/Visual Studio Projects/Network Toolkit/Network Toolkit/Views/IncludeOptions.resx deleted file mode 100644 index 1af7de1..0000000 --- a/Visual Studio Projects/Network Toolkit/Network Toolkit/Views/IncludeOptions.resx +++ /dev/null @@ -1,120 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - text/microsoft-resx - - - 2.0 - - - System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - - - System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - - \ No newline at end of file diff --git a/Visual Studio Projects/Network Toolkit/Network Toolkit/Views/NIFWait.Designer.cs b/Visual Studio Projects/Network Toolkit/Network Toolkit/Views/NIFWait.Designer.cs deleted file mode 100644 index 4832628..0000000 --- a/Visual Studio Projects/Network Toolkit/Network Toolkit/Views/NIFWait.Designer.cs +++ /dev/null @@ -1,74 +0,0 @@ - -namespace Network_Toolkit.Views -{ - partial class NIFWait - { - /// - /// Required designer variable. - /// - private System.ComponentModel.IContainer components = null; - - /// - /// Clean up any resources being used. - /// - /// true if managed resources should be disposed; otherwise, false. - protected override void Dispose(bool disposing) - { - if (disposing && (components != null)) - { - components.Dispose(); - } - base.Dispose(disposing); - } - - #region Component Designer generated code - - /// - /// Required method for Designer support - do not modify - /// the contents of this method with the code editor. - /// - private void InitializeComponent() - { - this.label2 = new System.Windows.Forms.Label(); - this.label1 = new System.Windows.Forms.Label(); - this.SuspendLayout(); - // - // label2 - // - this.label2.AutoSize = true; - this.label2.Font = new System.Drawing.Font("Microsoft Sans Serif", 16.75F); - this.label2.Location = new System.Drawing.Point(18, 14); - this.label2.Name = "label2"; - this.label2.Size = new System.Drawing.Size(390, 29); - this.label2.TabIndex = 23; - this.label2.Text = "ZWave Device Inclusion / Exclusion"; - // - // label1 - // - this.label1.AutoSize = true; - this.label1.Font = new System.Drawing.Font("Microsoft Sans Serif", 12.75F); - this.label1.Location = new System.Drawing.Point(19, 43); - this.label1.Name = "label1"; - this.label1.Size = new System.Drawing.Size(330, 20); - this.label1.TabIndex = 24; - this.label1.Text = "Waiting for Node Information Frame (NIF)..."; - // - // NIFWait - // - this.AutoScaleDimensions = new System.Drawing.SizeF(96F, 96F); - this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Dpi; - this.Controls.Add(this.label1); - this.Controls.Add(this.label2); - this.Name = "NIFWait"; - this.Size = new System.Drawing.Size(600, 499); - this.ResumeLayout(false); - this.PerformLayout(); - - } - - #endregion - - private System.Windows.Forms.Label label2; - private System.Windows.Forms.Label label1; - } -} diff --git a/Visual Studio Projects/Network Toolkit/Network Toolkit/Views/NIFWait.cs b/Visual Studio Projects/Network Toolkit/Network Toolkit/Views/NIFWait.cs deleted file mode 100644 index 8da1b4f..0000000 --- a/Visual Studio Projects/Network Toolkit/Network Toolkit/Views/NIFWait.cs +++ /dev/null @@ -1,20 +0,0 @@ -using System; -using System.Collections.Generic; -using System.ComponentModel; -using System.Data; -using System.Drawing; -using System.Linq; -using System.Text; -using System.Threading.Tasks; -using System.Windows.Forms; - -namespace Network_Toolkit.Views -{ - public partial class NIFWait : UserControl - { - public NIFWait() - { - InitializeComponent(); - } - } -} diff --git a/Visual Studio Projects/Network Toolkit/Network Toolkit/Views/NIFWait.resx b/Visual Studio Projects/Network Toolkit/Network Toolkit/Views/NIFWait.resx deleted file mode 100644 index 1af7de1..0000000 --- a/Visual Studio Projects/Network Toolkit/Network Toolkit/Views/NIFWait.resx +++ /dev/null @@ -1,120 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - text/microsoft-resx - - - 2.0 - - - System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - - - System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - - \ No newline at end of file diff --git a/Visual Studio Projects/Network Toolkit/Network Toolkit/Views/NVM.Designer.cs b/Visual Studio Projects/Network Toolkit/Network Toolkit/Views/NVM.Designer.cs deleted file mode 100644 index c3916ce..0000000 --- a/Visual Studio Projects/Network Toolkit/Network Toolkit/Views/NVM.Designer.cs +++ /dev/null @@ -1,103 +0,0 @@ - -namespace Network_Toolkit.Views -{ - partial class NVM - { - /// - /// Required designer variable. - /// - private System.ComponentModel.IContainer components = null; - - /// - /// Clean up any resources being used. - /// - /// true if managed resources should be disposed; otherwise, false. - protected override void Dispose(bool disposing) - { - if (disposing && (components != null)) - { - components.Dispose(); - } - base.Dispose(disposing); - } - - #region Component Designer generated code - - /// - /// Required method for Designer support - do not modify - /// the contents of this method with the code editor. - /// - private void InitializeComponent() - { - this.label2 = new System.Windows.Forms.Label(); - this.button1 = new System.Windows.Forms.Button(); - this.button2 = new System.Windows.Forms.Button(); - this.PB_Progress = new System.Windows.Forms.ProgressBar(); - this.SuspendLayout(); - // - // label2 - // - this.label2.AutoSize = true; - this.label2.Font = new System.Drawing.Font("Microsoft Sans Serif", 16.75F); - this.label2.Location = new System.Drawing.Point(18, 14); - this.label2.Name = "label2"; - this.label2.Size = new System.Drawing.Size(256, 29); - this.label2.TabIndex = 4; - this.label2.Text = "NVM Backup / Restore"; - // - // button1 - // - this.button1.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(16)))), ((int)(((byte)(115)))), ((int)(((byte)(185))))); - this.button1.FlatStyle = System.Windows.Forms.FlatStyle.Flat; - this.button1.ForeColor = System.Drawing.Color.White; - this.button1.Location = new System.Drawing.Point(23, 79); - this.button1.Name = "button1"; - this.button1.Size = new System.Drawing.Size(95, 34); - this.button1.TabIndex = 21; - this.button1.Text = "Restore"; - this.button1.UseVisualStyleBackColor = false; - this.button1.Click += new System.EventHandler(this.button1_Click); - // - // button2 - // - this.button2.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(16)))), ((int)(((byte)(115)))), ((int)(((byte)(185))))); - this.button2.FlatStyle = System.Windows.Forms.FlatStyle.Flat; - this.button2.ForeColor = System.Drawing.Color.White; - this.button2.Location = new System.Drawing.Point(133, 79); - this.button2.Name = "button2"; - this.button2.Size = new System.Drawing.Size(95, 34); - this.button2.TabIndex = 22; - this.button2.Text = "Backup"; - this.button2.UseVisualStyleBackColor = false; - this.button2.Click += new System.EventHandler(this.button2_Click); - // - // PB_Progress - // - this.PB_Progress.Location = new System.Drawing.Point(23, 443); - this.PB_Progress.Name = "PB_Progress"; - this.PB_Progress.Size = new System.Drawing.Size(545, 23); - this.PB_Progress.TabIndex = 23; - // - // NVM - // - this.AutoScaleDimensions = new System.Drawing.SizeF(96F, 96F); - this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Dpi; - this.Controls.Add(this.PB_Progress); - this.Controls.Add(this.button2); - this.Controls.Add(this.button1); - this.Controls.Add(this.label2); - this.Name = "NVM"; - this.Size = new System.Drawing.Size(600, 499); - this.ResumeLayout(false); - this.PerformLayout(); - - } - - #endregion - - private System.Windows.Forms.Label label2; - private System.Windows.Forms.Button button1; - private System.Windows.Forms.Button button2; - private System.Windows.Forms.ProgressBar PB_Progress; - } -} diff --git a/Visual Studio Projects/Network Toolkit/Network Toolkit/Views/NVM.cs b/Visual Studio Projects/Network Toolkit/Network Toolkit/Views/NVM.cs deleted file mode 100644 index 5c688e8..0000000 --- a/Visual Studio Projects/Network Toolkit/Network Toolkit/Views/NVM.cs +++ /dev/null @@ -1,116 +0,0 @@ -using System; -using System.Collections.Generic; -using System.ComponentModel; -using System.Data; -using System.Drawing; -using System.Linq; -using System.Text; -using System.Threading.Tasks; -using System.Windows.Forms; -using ZWaveJS.NET; -using System.IO; - - -namespace Network_Toolkit.Views -{ - public partial class NVM : UserControl - { - Driver _Driver; - public NVM(Driver Driver) - { - _Driver = Driver; - InitializeComponent(); - } - - private void button2_Click(object sender, EventArgs e) - { - SaveFileDialog SFD = new SaveFileDialog(); - SFD.FileName = "ZWave NVM.bin"; - SFD.Filter = "ZWave NVM|*.bin"; - - if (SFD.ShowDialog() == DialogResult.OK) - { - _Driver.Controller.BackupNVMRaw(Progress).ContinueWith((R) => - { - if (R.Result.Success) - { - File.WriteAllBytes(SFD.FileName, R.Result.ResultPayload as byte[]); - - this.Invoke((MethodInvoker)delegate () { - MessageBox.Show("NVM backup has completed", "Backup NVM Completed", MessageBoxButtons.OK, MessageBoxIcon.Information); - }); - } - else - { - this.Invoke((MethodInvoker)delegate () { - MessageBox.Show(R.Result.Message, "Failed To Backup NVM", MessageBoxButtons.OK, MessageBoxIcon.Error); - }); - } - - - }); - } - } - - private void Progress(int Read, int Total) - { - this.Invoke((MethodInvoker)delegate () { - PB_Progress.Value = Convert.ToInt32(((decimal)Read / (decimal)Total) * 100); - }); - - - } - - private void button1_Click(object sender, EventArgs e) - { - OpenFileDialog OFD = new OpenFileDialog(); - OFD.FileName = "ZWave NVM.bin"; - OFD.Filter = "ZWave NVM|*.bin"; - - if (OFD.ShowDialog() == DialogResult.OK) - { - - - byte[] Data = File.ReadAllBytes(OFD.FileName); - - - - _Driver.Controller.RestoreNVM(Data,_Convert,Write).ContinueWith((R) => - { - if (R.Result.Success) - { - this.Invoke((MethodInvoker)delegate () { - MessageBox.Show("NVM restore has completed. Please allow 60 seconds for the Driver to restart.", "Restore NVM Completed", MessageBoxButtons.OK, MessageBoxIcon.Information); - }); - } - else - { - this.Invoke((MethodInvoker)delegate () { - MessageBox.Show(R.Result.Message, "Failed To Restore NVM", MessageBoxButtons.OK, MessageBoxIcon.Error); - }); - } - - - - }); - } - } - - private void _Convert(int Read, int Total) - { - this.Invoke((MethodInvoker)delegate () { - PB_Progress.Value = Convert.ToInt32(((decimal)Read / (decimal)Total) * 100); - }); - - - } - - private void Write(int Read, int Total) - { - this.Invoke((MethodInvoker)delegate () { - PB_Progress.Value = Convert.ToInt32(((decimal)Read / (decimal)Total) * 100); - }); - - } - } -} diff --git a/Visual Studio Projects/Network Toolkit/Network Toolkit/Views/NVM.resx b/Visual Studio Projects/Network Toolkit/Network Toolkit/Views/NVM.resx deleted file mode 100644 index 1af7de1..0000000 --- a/Visual Studio Projects/Network Toolkit/Network Toolkit/Views/NVM.resx +++ /dev/null @@ -1,120 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - text/microsoft-resx - - - 2.0 - - - System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - - - System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - - \ No newline at end of file diff --git a/Visual Studio Projects/Network Toolkit/Network Toolkit/Views/NetworkHeal.Designer.cs b/Visual Studio Projects/Network Toolkit/Network Toolkit/Views/NetworkHeal.Designer.cs deleted file mode 100644 index 129cfdb..0000000 --- a/Visual Studio Projects/Network Toolkit/Network Toolkit/Views/NetworkHeal.Designer.cs +++ /dev/null @@ -1,139 +0,0 @@ - -namespace Network_Toolkit.Views -{ - partial class NetworkHeal - { - /// - /// Required designer variable. - /// - private System.ComponentModel.IContainer components = null; - - /// - /// Clean up any resources being used. - /// - /// true if managed resources should be disposed; otherwise, false. - protected override void Dispose(bool disposing) - { - if (disposing && (components != null)) - { - components.Dispose(); - } - base.Dispose(disposing); - } - - #region Component Designer generated code - - /// - /// Required method for Designer support - do not modify - /// the contents of this method with the code editor. - /// - private void InitializeComponent() - { - this.label2 = new System.Windows.Forms.Label(); - this.button5 = new System.Windows.Forms.Button(); - this.button1 = new System.Windows.Forms.Button(); - this.LST_Nodes = new System.Windows.Forms.ListView(); - this.columnHeader1 = ((System.Windows.Forms.ColumnHeader)(new System.Windows.Forms.ColumnHeader())); - this.columnHeader2 = ((System.Windows.Forms.ColumnHeader)(new System.Windows.Forms.ColumnHeader())); - this.LBL_Status = new System.Windows.Forms.Label(); - this.SuspendLayout(); - // - // label2 - // - this.label2.AutoSize = true; - this.label2.Font = new System.Drawing.Font("Microsoft Sans Serif", 16.75F); - this.label2.Location = new System.Drawing.Point(18, 14); - this.label2.Name = "label2"; - this.label2.Size = new System.Drawing.Size(159, 29); - this.label2.TabIndex = 23; - this.label2.Text = "Network Heal"; - // - // button5 - // - this.button5.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(16)))), ((int)(((byte)(115)))), ((int)(((byte)(185))))); - this.button5.FlatStyle = System.Windows.Forms.FlatStyle.Flat; - this.button5.ForeColor = System.Drawing.Color.White; - this.button5.Location = new System.Drawing.Point(23, 79); - this.button5.Name = "button5"; - this.button5.Size = new System.Drawing.Size(95, 34); - this.button5.TabIndex = 31; - this.button5.Tag = ""; - this.button5.Text = "Stop"; - this.button5.UseVisualStyleBackColor = false; - this.button5.Click += new System.EventHandler(this.button5_Click); - // - // button1 - // - this.button1.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(16)))), ((int)(((byte)(115)))), ((int)(((byte)(185))))); - this.button1.FlatStyle = System.Windows.Forms.FlatStyle.Flat; - this.button1.ForeColor = System.Drawing.Color.White; - this.button1.Location = new System.Drawing.Point(133, 79); - this.button1.Name = "button1"; - this.button1.Size = new System.Drawing.Size(95, 34); - this.button1.TabIndex = 33; - this.button1.Tag = ""; - this.button1.Text = "Begin"; - this.button1.UseVisualStyleBackColor = false; - this.button1.Click += new System.EventHandler(this.button1_Click); - // - // LST_Nodes - // - this.LST_Nodes.Columns.AddRange(new System.Windows.Forms.ColumnHeader[] { - this.columnHeader1, - this.columnHeader2}); - this.LST_Nodes.FullRowSelect = true; - this.LST_Nodes.HideSelection = false; - this.LST_Nodes.Location = new System.Drawing.Point(23, 159); - this.LST_Nodes.Name = "LST_Nodes"; - this.LST_Nodes.Size = new System.Drawing.Size(554, 296); - this.LST_Nodes.TabIndex = 34; - this.LST_Nodes.UseCompatibleStateImageBehavior = false; - this.LST_Nodes.View = System.Windows.Forms.View.Details; - // - // columnHeader1 - // - this.columnHeader1.Text = "Node"; - this.columnHeader1.Width = 217; - // - // columnHeader2 - // - this.columnHeader2.Text = "Status"; - this.columnHeader2.Width = 279; - // - // LBL_Status - // - this.LBL_Status.AutoSize = true; - this.LBL_Status.Font = new System.Drawing.Font("Microsoft Sans Serif", 12.25F); - this.LBL_Status.Location = new System.Drawing.Point(19, 127); - this.LBL_Status.Name = "LBL_Status"; - this.LBL_Status.Size = new System.Drawing.Size(203, 20); - this.LBL_Status.TabIndex = 35; - this.LBL_Status.Text = "Heal Status: Not Running."; - // - // NetworkHeal - // - this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F); - this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; - this.Controls.Add(this.LBL_Status); - this.Controls.Add(this.LST_Nodes); - this.Controls.Add(this.button1); - this.Controls.Add(this.button5); - this.Controls.Add(this.label2); - this.Name = "NetworkHeal"; - this.Size = new System.Drawing.Size(600, 499); - this.ResumeLayout(false); - this.PerformLayout(); - - } - - #endregion - - private System.Windows.Forms.Label label2; - private System.Windows.Forms.Button button5; - private System.Windows.Forms.Button button1; - private System.Windows.Forms.ListView LST_Nodes; - private System.Windows.Forms.ColumnHeader columnHeader1; - private System.Windows.Forms.ColumnHeader columnHeader2; - private System.Windows.Forms.Label LBL_Status; - } -} diff --git a/Visual Studio Projects/Network Toolkit/Network Toolkit/Views/NetworkHeal.cs b/Visual Studio Projects/Network Toolkit/Network Toolkit/Views/NetworkHeal.cs deleted file mode 100644 index 453bcfa..0000000 --- a/Visual Studio Projects/Network Toolkit/Network Toolkit/Views/NetworkHeal.cs +++ /dev/null @@ -1,119 +0,0 @@ -using System; -using System.Collections.Generic; -using System.ComponentModel; -using System.Data; -using System.Drawing; -using System.Linq; -using System.Text; -using System.Threading.Tasks; -using System.Windows.Forms; -using ZWaveJS.NET; - -namespace Network_Toolkit.Views -{ - public partial class NetworkHeal : UserControl - { - Driver _Driver; - public NetworkHeal(Driver Driver) - { - InitializeComponent(); - _Driver = Driver; - - if (_Driver.Controller.isHealNetworkActive) - { - _Driver.Controller.HealNetworkProgress += Controller_HealNetworkProgress; - _Driver.Controller.HealNetworkDone += Controller_HealNetworkDone; - - LBL_Status.Text = "Heal Status: Running..."; - } - } - - private void button1_Click(object sender, EventArgs e) - { - if (!_Driver.Controller.isHealNetworkActive) - { - - _Driver.Controller.BeginHealingNetwork().ContinueWith((R) => { - - if (!R.Result.Success) - { - this.Invoke((MethodInvoker)delegate () { - MessageBox.Show(R.Result.Message, "Could Not Heal Network", MessageBoxButtons.OK, MessageBoxIcon.Error); - }); - } - else - { - _Driver.Controller.HealNetworkProgress += Controller_HealNetworkProgress; - _Driver.Controller.HealNetworkDone += Controller_HealNetworkDone; - - this.Invoke((MethodInvoker)delegate () { - LBL_Status.Text = "Heal Status: Running..."; - }); - } - - }); - } - - - } - - private void Controller_HealNetworkDone(Dictionary Result) - { - _Driver.Controller.HealNetworkProgress -= Controller_HealNetworkProgress; - _Driver.Controller.HealNetworkDone -= Controller_HealNetworkDone; - - this.Invoke((MethodInvoker)delegate () { - - LBL_Status.Text = "Heal Status: Not Running."; - - LST_Nodes.Items.Clear(); - - foreach(string KEY in Result.Keys) - { - ListViewItem LVI = new ListViewItem(KEY); - LVI.SubItems.Add(Result[KEY].ToUpper()); - LST_Nodes.Items.Add(LVI); - } - }); - } - - private void Controller_HealNetworkProgress(Dictionary Progress) - { - this.Invoke((MethodInvoker)delegate () { - - LST_Nodes.Items.Clear(); - - foreach (string KEY in Progress.Keys) - { - ListViewItem LVI = new ListViewItem(KEY); - LVI.SubItems.Add(Progress[KEY].ToUpper()); - LST_Nodes.Items.Add(LVI); - } - - }); - } - - private void button5_Click(object sender, EventArgs e) - { - _Driver.Controller.StopHealingNetwork().ContinueWith((R) => { - - if (!R.Result.Success) - { - this.Invoke((MethodInvoker)delegate () { - MessageBox.Show(R.Result.Message, "Could Not Stop Network", MessageBoxButtons.OK, MessageBoxIcon.Error); - }); - } - else - { - this.Invoke((MethodInvoker)delegate () { - LBL_Status.Text = "Heal Status: Not Running."; - }); - - _Driver.Controller.HealNetworkProgress -= Controller_HealNetworkProgress; - _Driver.Controller.HealNetworkDone -= Controller_HealNetworkDone; - } - - }); - } - } -} diff --git a/Visual Studio Projects/Network Toolkit/Network Toolkit/Views/NetworkHeal.resx b/Visual Studio Projects/Network Toolkit/Network Toolkit/Views/NetworkHeal.resx deleted file mode 100644 index 1af7de1..0000000 --- a/Visual Studio Projects/Network Toolkit/Network Toolkit/Views/NetworkHeal.resx +++ /dev/null @@ -1,120 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - text/microsoft-resx - - - 2.0 - - - System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - - - System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - - \ No newline at end of file diff --git a/Visual Studio Projects/Network Toolkit/Network Toolkit/Views/NodeDetails.Designer.cs b/Visual Studio Projects/Network Toolkit/Network Toolkit/Views/NodeDetails.Designer.cs deleted file mode 100644 index eaa2234..0000000 --- a/Visual Studio Projects/Network Toolkit/Network Toolkit/Views/NodeDetails.Designer.cs +++ /dev/null @@ -1,280 +0,0 @@ - -namespace Network_Toolkit.Views -{ - partial class NodeDetails - { - /// - /// Required designer variable. - /// - private System.ComponentModel.IContainer components = null; - - /// - /// Clean up any resources being used. - /// - /// true if managed resources should be disposed; otherwise, false. - protected override void Dispose(bool disposing) - { - if (disposing && (components != null)) - { - components.Dispose(); - } - base.Dispose(disposing); - } - - #region Component Designer generated code - - /// - /// Required method for Designer support - do not modify - /// the contents of this method with the code editor. - /// - private void InitializeComponent() - { - this.label2 = new System.Windows.Forms.Label(); - this.button5 = new System.Windows.Forms.Button(); - this.button1 = new System.Windows.Forms.Button(); - this.button2 = new System.Windows.Forms.Button(); - this.button3 = new System.Windows.Forms.Button(); - this.button4 = new System.Windows.Forms.Button(); - this.LBL_NodeID = new System.Windows.Forms.Label(); - this.LBL_Label = new System.Windows.Forms.Label(); - this.LBL_Description = new System.Windows.Forms.Label(); - this.LST_Values = new System.Windows.Forms.ListView(); - this.Property = ((System.Windows.Forms.ColumnHeader)(new System.Windows.Forms.ColumnHeader())); - this.Endpoint = ((System.Windows.Forms.ColumnHeader)(new System.Windows.Forms.ColumnHeader())); - this.Value = ((System.Windows.Forms.ColumnHeader)(new System.Windows.Forms.ColumnHeader())); - this.label1 = new System.Windows.Forms.Label(); - this.button6 = new System.Windows.Forms.Button(); - this.button7 = new System.Windows.Forms.Button(); - this.button8 = new System.Windows.Forms.Button(); - this.SuspendLayout(); - // - // label2 - // - this.label2.AutoSize = true; - this.label2.Font = new System.Drawing.Font("Microsoft Sans Serif", 16.75F); - this.label2.Location = new System.Drawing.Point(18, 14); - this.label2.Name = "label2"; - this.label2.Size = new System.Drawing.Size(153, 29); - this.label2.TabIndex = 23; - this.label2.Text = "Node Details"; - // - // button5 - // - this.button5.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(16)))), ((int)(((byte)(115)))), ((int)(((byte)(185))))); - this.button5.FlatStyle = System.Windows.Forms.FlatStyle.Flat; - this.button5.ForeColor = System.Drawing.Color.White; - this.button5.Location = new System.Drawing.Point(23, 125); - this.button5.Name = "button5"; - this.button5.Size = new System.Drawing.Size(61, 46); - this.button5.TabIndex = 31; - this.button5.Text = "Remove Failed"; - this.button5.UseVisualStyleBackColor = false; - this.button5.Click += new System.EventHandler(this.button5_Click); - // - // button1 - // - this.button1.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(16)))), ((int)(((byte)(115)))), ((int)(((byte)(185))))); - this.button1.FlatStyle = System.Windows.Forms.FlatStyle.Flat; - this.button1.ForeColor = System.Drawing.Color.White; - this.button1.Location = new System.Drawing.Point(90, 125); - this.button1.Name = "button1"; - this.button1.Size = new System.Drawing.Size(60, 46); - this.button1.TabIndex = 32; - this.button1.Text = "Replace Failed"; - this.button1.UseVisualStyleBackColor = false; - this.button1.Click += new System.EventHandler(this.button1_Click); - // - // button2 - // - this.button2.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(16)))), ((int)(((byte)(115)))), ((int)(((byte)(185))))); - this.button2.FlatStyle = System.Windows.Forms.FlatStyle.Flat; - this.button2.ForeColor = System.Drawing.Color.White; - this.button2.Location = new System.Drawing.Point(156, 125); - this.button2.Name = "button2"; - this.button2.Size = new System.Drawing.Size(59, 46); - this.button2.TabIndex = 33; - this.button2.Text = "Update FW"; - this.button2.UseVisualStyleBackColor = false; - this.button2.Click += new System.EventHandler(this.button2_Click); - // - // button3 - // - this.button3.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(16)))), ((int)(((byte)(115)))), ((int)(((byte)(185))))); - this.button3.FlatStyle = System.Windows.Forms.FlatStyle.Flat; - this.button3.ForeColor = System.Drawing.Color.White; - this.button3.Location = new System.Drawing.Point(221, 125); - this.button3.Name = "button3"; - this.button3.Size = new System.Drawing.Size(63, 46); - this.button3.TabIndex = 34; - this.button3.Text = "Asso MGMT"; - this.button3.UseVisualStyleBackColor = false; - this.button3.Click += new System.EventHandler(this.button3_Click); - // - // button4 - // - this.button4.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(16)))), ((int)(((byte)(115)))), ((int)(((byte)(185))))); - this.button4.FlatStyle = System.Windows.Forms.FlatStyle.Flat; - this.button4.ForeColor = System.Drawing.Color.White; - this.button4.Location = new System.Drawing.Point(290, 125); - this.button4.Name = "button4"; - this.button4.Size = new System.Drawing.Size(63, 46); - this.button4.TabIndex = 35; - this.button4.Text = "Health Check"; - this.button4.UseVisualStyleBackColor = false; - this.button4.Click += new System.EventHandler(this.button4_Click); - // - // LBL_NodeID - // - this.LBL_NodeID.AutoSize = true; - this.LBL_NodeID.Font = new System.Drawing.Font("Microsoft Sans Serif", 16.75F); - this.LBL_NodeID.Location = new System.Drawing.Point(168, 14); - this.LBL_NodeID.Name = "LBL_NodeID"; - this.LBL_NodeID.Size = new System.Drawing.Size(51, 29); - this.LBL_NodeID.TabIndex = 36; - this.LBL_NodeID.Text = ": #1"; - // - // LBL_Label - // - this.LBL_Label.AutoSize = true; - this.LBL_Label.Font = new System.Drawing.Font("Microsoft Sans Serif", 12.75F); - this.LBL_Label.Location = new System.Drawing.Point(19, 54); - this.LBL_Label.Name = "LBL_Label"; - this.LBL_Label.Size = new System.Drawing.Size(50, 20); - this.LBL_Label.TabIndex = 37; - this.LBL_Label.Text = "Label"; - // - // LBL_Description - // - this.LBL_Description.AutoSize = true; - this.LBL_Description.Font = new System.Drawing.Font("Microsoft Sans Serif", 10.75F); - this.LBL_Description.Location = new System.Drawing.Point(20, 74); - this.LBL_Description.Name = "LBL_Description"; - this.LBL_Description.Size = new System.Drawing.Size(83, 18); - this.LBL_Description.TabIndex = 38; - this.LBL_Description.Text = "Description"; - // - // LST_Values - // - this.LST_Values.Columns.AddRange(new System.Windows.Forms.ColumnHeader[] { - this.Property, - this.Endpoint, - this.Value}); - this.LST_Values.FullRowSelect = true; - this.LST_Values.HideSelection = false; - this.LST_Values.Location = new System.Drawing.Point(23, 213); - this.LST_Values.Name = "LST_Values"; - this.LST_Values.Size = new System.Drawing.Size(548, 256); - this.LST_Values.TabIndex = 39; - this.LST_Values.UseCompatibleStateImageBehavior = false; - this.LST_Values.View = System.Windows.Forms.View.Details; - // - // Property - // - this.Property.Text = "Property"; - this.Property.Width = 241; - // - // Endpoint - // - this.Endpoint.Text = "Endpoint"; - this.Endpoint.Width = 75; - // - // Value - // - this.Value.Text = "Value"; - this.Value.Width = 93; - // - // label1 - // - this.label1.AutoSize = true; - this.label1.Font = new System.Drawing.Font("Microsoft Sans Serif", 10.75F); - this.label1.Location = new System.Drawing.Point(20, 192); - this.label1.Name = "label1"; - this.label1.Size = new System.Drawing.Size(168, 18); - this.label1.TabIndex = 40; - this.label1.Text = "Command Class Values"; - // - // button6 - // - this.button6.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(16)))), ((int)(((byte)(115)))), ((int)(((byte)(185))))); - this.button6.FlatStyle = System.Windows.Forms.FlatStyle.Flat; - this.button6.ForeColor = System.Drawing.Color.White; - this.button6.Location = new System.Drawing.Point(428, 125); - this.button6.Name = "button6"; - this.button6.Size = new System.Drawing.Size(63, 46); - this.button6.TabIndex = 41; - this.button6.Text = "Interview Node"; - this.button6.UseVisualStyleBackColor = false; - this.button6.Click += new System.EventHandler(this.button6_Click); - // - // button7 - // - this.button7.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(16)))), ((int)(((byte)(115)))), ((int)(((byte)(185))))); - this.button7.FlatStyle = System.Windows.Forms.FlatStyle.Flat; - this.button7.ForeColor = System.Drawing.Color.White; - this.button7.Location = new System.Drawing.Point(497, 125); - this.button7.Name = "button7"; - this.button7.Size = new System.Drawing.Size(63, 46); - this.button7.TabIndex = 42; - this.button7.Text = "Event Monitor"; - this.button7.UseVisualStyleBackColor = false; - this.button7.Click += new System.EventHandler(this.button7_Click); - // - // button8 - // - this.button8.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(16)))), ((int)(((byte)(115)))), ((int)(((byte)(185))))); - this.button8.FlatStyle = System.Windows.Forms.FlatStyle.Flat; - this.button8.ForeColor = System.Drawing.Color.White; - this.button8.Location = new System.Drawing.Point(359, 125); - this.button8.Name = "button8"; - this.button8.Size = new System.Drawing.Size(63, 46); - this.button8.TabIndex = 43; - this.button8.Text = "Heal Node"; - this.button8.UseVisualStyleBackColor = false; - this.button8.Click += new System.EventHandler(this.button8_Click); - // - // NodeDetails - // - this.AutoScaleDimensions = new System.Drawing.SizeF(96F, 96F); - this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Dpi; - this.Controls.Add(this.button8); - this.Controls.Add(this.button7); - this.Controls.Add(this.button6); - this.Controls.Add(this.label1); - this.Controls.Add(this.LST_Values); - this.Controls.Add(this.LBL_Description); - this.Controls.Add(this.LBL_Label); - this.Controls.Add(this.LBL_NodeID); - this.Controls.Add(this.button4); - this.Controls.Add(this.button3); - this.Controls.Add(this.button2); - this.Controls.Add(this.button1); - this.Controls.Add(this.button5); - this.Controls.Add(this.label2); - this.Name = "NodeDetails"; - this.Size = new System.Drawing.Size(600, 499); - this.ResumeLayout(false); - this.PerformLayout(); - - } - - #endregion - - private System.Windows.Forms.Label label2; - private System.Windows.Forms.Button button5; - private System.Windows.Forms.Button button1; - private System.Windows.Forms.Button button2; - private System.Windows.Forms.Button button3; - private System.Windows.Forms.Button button4; - private System.Windows.Forms.Label LBL_NodeID; - private System.Windows.Forms.Label LBL_Label; - private System.Windows.Forms.Label LBL_Description; - private System.Windows.Forms.ListView LST_Values; - private System.Windows.Forms.ColumnHeader Property; - private System.Windows.Forms.ColumnHeader Value; - private System.Windows.Forms.Label label1; - private System.Windows.Forms.Button button6; - private System.Windows.Forms.Button button7; - private System.Windows.Forms.Button button8; - private System.Windows.Forms.ColumnHeader Endpoint; - } -} diff --git a/Visual Studio Projects/Network Toolkit/Network Toolkit/Views/NodeDetails.cs b/Visual Studio Projects/Network Toolkit/Network Toolkit/Views/NodeDetails.cs deleted file mode 100644 index 5e9bd14..0000000 --- a/Visual Studio Projects/Network Toolkit/Network Toolkit/Views/NodeDetails.cs +++ /dev/null @@ -1,219 +0,0 @@ -using System; -using System.Collections.Generic; -using System.ComponentModel; -using System.Data; -using System.Drawing; -using System.Linq; -using System.Text; -using System.Threading.Tasks; -using System.Windows.Forms; -using ZWaveJS.NET; -using Newtonsoft.Json.Linq; - -namespace Network_Toolkit.Views -{ - public partial class NodeDetails : UserControl - { - - public delegate void StartReplace(int NodeID); - public event StartReplace StartReplaceEvent; - - public ZWaveNode ZwaveNode; - private Driver Driver; - public NodeDetails(ZWaveNode Node, Driver Driver) - { - InitializeComponent(); - this.ZwaveNode = Node; - this.Driver = Driver; - - LBL_NodeID.Text = "#"+Node.id.ToString(); - LBL_Label.Text = Node.deviceConfig?.label ?? "Unknown"; - LBL_Description.Text = Node.deviceConfig?.description; - - new Task(async () => { - - ValueID[] VIDs = null; - CMDResult Res = await Node.GetDefinedValueIDs(); - - if (Res.Success) - { - VIDs = Res.ResultPayload as ValueID[]; - } - else - { - this.Invoke((MethodInvoker)delegate () { - MessageBox.Show(Res.Message, "Failed To Obtain Value IDs", MessageBoxButtons.OK, MessageBoxIcon.Error); - }); - - return; - } - - - var CCGroups = VIDs.GroupBy((VID) => VID.commandClassName).OrderBy((G) => G.Key); - - foreach (var Group in CCGroups) - { - string GroupName = Group.Key; - ListViewGroup LVG = new ListViewGroup(GroupName); - - this.Invoke((MethodInvoker)delegate () { - LST_Values.Groups.Add(LVG); - }); - - foreach (ValueID VID in Group) - { - CMDResult VMDCMD = await Node.GetValueMetadata(VID); - ValueMetadata VMD = null; - if (VMDCMD.Success) - { - VMD = VMDCMD.ResultPayload as ValueMetadata; - } - else - { - this.Invoke((MethodInvoker)delegate () - { - MessageBox.Show(Res.Message, "Failed To Obtain Value Meatadata", MessageBoxButtons.OK, MessageBoxIcon.Error); - }); - - return; - } - - - CMDResult VCMD = await Node.GetValue(VID); - JObject V = null; - if (VCMD.Success) - { - V = VCMD.ResultPayload as JObject; - } - else - { - this.Invoke((MethodInvoker)delegate () - { - MessageBox.Show(Res.Message, "Failed To Obtain Value", MessageBoxButtons.OK, MessageBoxIcon.Error); - }); - - return; - } - - ListViewItem LVI = new ListViewItem(VMD.label); - - - LVI.Group = LVG; - - LVI.SubItems.Add(VID.endpoint.ToString()); - if (V.ContainsKey("value")) - { - LVI.SubItems.Add(V.SelectToken("value").ToString()); - } - else - { - LVI.SubItems.Add(""); - - } - - if (VMD.type == "number" && VMD.writeable) - { - LVI.Tag = VID; - } - - - this.Invoke((MethodInvoker)delegate () - { - LST_Values.Items.Add(LVI); - }); - - } - } - - }).Start(); - - } - - // Heal - private void button8_Click(object sender, EventArgs e) - { - Driver.Controller.HealNode(ZwaveNode.id).ContinueWith((R) => - { - if (R.Result.Success) - { - this.Invoke((MethodInvoker)delegate () { - MessageBox.Show("The Node has been healed!", "Node Healed", MessageBoxButtons.OK, MessageBoxIcon.Information); - }); - } - else - { - this.Invoke((MethodInvoker)delegate () { - MessageBox.Show(R.Result.Message ?? "", "Failed To Heal Node", MessageBoxButtons.OK, MessageBoxIcon.Error); - }); - } - - }); - } - - - // Interview - private void button6_Click(object sender, EventArgs e) - { - ZwaveNode.RefreshInfo().ContinueWith((R) => - { - if (!R.Result.Success) - { - this.Invoke((MethodInvoker)delegate () { - MessageBox.Show(R.Result.Message, "Failed To Interview Node", MessageBoxButtons.OK, MessageBoxIcon.Error); - }); - } - }); - - } - - private void button5_Click(object sender, EventArgs e) - { - Driver.Controller.RemoveFailedNode(ZwaveNode.id).ContinueWith((R) => { - if(R.Result.Success) - { - this.Invoke((MethodInvoker)delegate () { - MessageBox.Show("The node has been removed!", "Node Removed", MessageBoxButtons.OK, MessageBoxIcon.Information); - }); - } - else - { - this.Invoke((MethodInvoker)delegate () { - MessageBox.Show(R.Result.Message, "Failed To Remove Node", MessageBoxButtons.OK, MessageBoxIcon.Error); - }); - } - - - }); - } - - private void button7_Click(object sender, EventArgs e) - { - Event E = new Event(ZwaveNode); - E.Show(); - - } - - private void button2_Click(object sender, EventArgs e) - { - UpdateFirmware UF = new UpdateFirmware(ZwaveNode); - UF.ShowDialog(); - } - - private void button1_Click(object sender, EventArgs e) - { - StartReplaceEvent?.Invoke(ZwaveNode.id); - } - - private void button4_Click(object sender, EventArgs e) - { - HealthCheck HC = new HealthCheck(ZwaveNode); - HC.ShowDialog(); - } - - private void button3_Click(object sender, EventArgs e) - { - Associations A = new Associations(ZwaveNode, Driver); - A.ShowDialog(); - } - } -} diff --git a/Visual Studio Projects/Network Toolkit/Network Toolkit/Views/NodeDetails.resx b/Visual Studio Projects/Network Toolkit/Network Toolkit/Views/NodeDetails.resx deleted file mode 100644 index 1af7de1..0000000 --- a/Visual Studio Projects/Network Toolkit/Network Toolkit/Views/NodeDetails.resx +++ /dev/null @@ -1,120 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - text/microsoft-resx - - - 2.0 - - - System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - - - System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - - \ No newline at end of file diff --git a/Visual Studio Projects/Network Toolkit/Network Toolkit/Views/S2.Designer.cs b/Visual Studio Projects/Network Toolkit/Network Toolkit/Views/S2.Designer.cs deleted file mode 100644 index 4c36084..0000000 --- a/Visual Studio Projects/Network Toolkit/Network Toolkit/Views/S2.Designer.cs +++ /dev/null @@ -1,74 +0,0 @@ - -namespace Network_Toolkit.Views -{ - partial class S2 - { - /// - /// Required designer variable. - /// - private System.ComponentModel.IContainer components = null; - - /// - /// Clean up any resources being used. - /// - /// true if managed resources should be disposed; otherwise, false. - protected override void Dispose(bool disposing) - { - if (disposing && (components != null)) - { - components.Dispose(); - } - base.Dispose(disposing); - } - - #region Component Designer generated code - - /// - /// Required method for Designer support - do not modify - /// the contents of this method with the code editor. - /// - private void InitializeComponent() - { - this.label1 = new System.Windows.Forms.Label(); - this.label2 = new System.Windows.Forms.Label(); - this.SuspendLayout(); - // - // label1 - // - this.label1.AutoSize = true; - this.label1.Font = new System.Drawing.Font("Microsoft Sans Serif", 12.75F); - this.label1.Location = new System.Drawing.Point(19, 43); - this.label1.Name = "label1"; - this.label1.Size = new System.Drawing.Size(297, 20); - this.label1.TabIndex = 26; - this.label1.Text = "Waiting for S2 Bootstrap to complete..."; - // - // label2 - // - this.label2.AutoSize = true; - this.label2.Font = new System.Drawing.Font("Microsoft Sans Serif", 16.75F); - this.label2.Location = new System.Drawing.Point(18, 14); - this.label2.Name = "label2"; - this.label2.Size = new System.Drawing.Size(390, 29); - this.label2.TabIndex = 25; - this.label2.Text = "ZWave Device Inclusion / Exclusion"; - // - // S2 - // - this.AutoScaleDimensions = new System.Drawing.SizeF(96F, 96F); - this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Dpi; - this.Controls.Add(this.label1); - this.Controls.Add(this.label2); - this.Name = "S2"; - this.Size = new System.Drawing.Size(600, 499); - this.ResumeLayout(false); - this.PerformLayout(); - - } - - #endregion - - private System.Windows.Forms.Label label1; - private System.Windows.Forms.Label label2; - } -} diff --git a/Visual Studio Projects/Network Toolkit/Network Toolkit/Views/S2.cs b/Visual Studio Projects/Network Toolkit/Network Toolkit/Views/S2.cs deleted file mode 100644 index 265c315..0000000 --- a/Visual Studio Projects/Network Toolkit/Network Toolkit/Views/S2.cs +++ /dev/null @@ -1,20 +0,0 @@ -using System; -using System.Collections.Generic; -using System.ComponentModel; -using System.Data; -using System.Drawing; -using System.Linq; -using System.Text; -using System.Threading.Tasks; -using System.Windows.Forms; - -namespace Network_Toolkit.Views -{ - public partial class S2 : UserControl - { - public S2() - { - InitializeComponent(); - } - } -} diff --git a/Visual Studio Projects/Network Toolkit/Network Toolkit/Views/S2.resx b/Visual Studio Projects/Network Toolkit/Network Toolkit/Views/S2.resx deleted file mode 100644 index 1af7de1..0000000 --- a/Visual Studio Projects/Network Toolkit/Network Toolkit/Views/S2.resx +++ /dev/null @@ -1,120 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - text/microsoft-resx - - - 2.0 - - - System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - - - System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - - \ No newline at end of file diff --git a/Visual Studio Projects/Network Toolkit/Network Toolkit/logo.ico b/Visual Studio Projects/Network Toolkit/Network Toolkit/logo.ico deleted file mode 100644 index d258589..0000000 Binary files a/Visual Studio Projects/Network Toolkit/Network Toolkit/logo.ico and /dev/null differ diff --git a/Visual Studio Projects/Network Toolkit/Network Toolkit/packages.config b/Visual Studio Projects/Network Toolkit/Network Toolkit/packages.config deleted file mode 100644 index 8e3479b..0000000 --- a/Visual Studio Projects/Network Toolkit/Network Toolkit/packages.config +++ /dev/null @@ -1,9 +0,0 @@ - - - - - - - - - \ No newline at end of file diff --git a/Visual Studio Projects/Network Toolkit/Splash.png b/Visual Studio Projects/Network Toolkit/Splash.png deleted file mode 100644 index 98c8750..0000000 Binary files a/Visual Studio Projects/Network Toolkit/Splash.png and /dev/null differ diff --git a/Visual Studio Projects/Network Toolkit/logo.png b/Visual Studio Projects/Network Toolkit/logo.png deleted file mode 100644 index 2f5b7f7..0000000 Binary files a/Visual Studio Projects/Network Toolkit/logo.png and /dev/null differ diff --git a/Visual Studio Projects/ZWaveJS.NET/Scratch Pad/Program.cs b/Visual Studio Projects/ZWaveJS.NET/Scratch Pad/Program.cs deleted file mode 100644 index 18e6de2..0000000 --- a/Visual Studio Projects/ZWaveJS.NET/Scratch Pad/Program.cs +++ /dev/null @@ -1,45 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; -using ZWaveJS.NET; - -namespace Scratch_Pad -{ - class Program - { - static Driver _Driver; - static void Main(string[] args) - { - - ZWaveJS.NET.Helpers.DownloadPSI().ContinueWith((R) => { - - var B = "sadsdsa"; - - - }); - } - - private static void _Driver_StartupErrorEvent(string Message) - { - Console.WriteLine(Message); - } - - private static void _Driver_DriverReady() - { - var ddd = new InclusionOptions(); - ddd.strategy = Enums.InclusionStrategy.Security_S0; - _Driver.Controller.ReplaceFailedNode(4, ddd).ContinueWith((R) => { - - var Res = R; - - }); - } - - private static void Program_NodeDead(ZWaveNode Node) - { - - } - } -} diff --git a/Visual Studio Projects/ZWaveJS.NET/Scratch Pad/App.config b/Visual Studio Projects/ZWaveJS.NET/Test/App.config similarity index 92% rename from Visual Studio Projects/ZWaveJS.NET/Scratch Pad/App.config rename to Visual Studio Projects/ZWaveJS.NET/Test/App.config index 8e15646..193aecc 100644 --- a/Visual Studio Projects/ZWaveJS.NET/Scratch Pad/App.config +++ b/Visual Studio Projects/ZWaveJS.NET/Test/App.config @@ -1,6 +1,6 @@  - + \ No newline at end of file diff --git a/Visual Studio Projects/ZWaveJS.NET/Test/Program.cs b/Visual Studio Projects/ZWaveJS.NET/Test/Program.cs new file mode 100644 index 0000000..9e045b9 --- /dev/null +++ b/Visual Studio Projects/ZWaveJS.NET/Test/Program.cs @@ -0,0 +1,49 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using ZWaveJS.NET; + +namespace Test +{ + internal class Program + { + static void Main(string[] args) + { + ZWaveJS.NET.ZWaveOptions ZWO = new ZWaveJS.NET.ZWaveOptions(); + + ZWO.securityKeys.S0_Legacy = "c84de525ba1382374615f93427a18138"; + ZWO.securityKeys.S2_AccessControl = "3d18628e80743ebaf96d97707cffb139"; + ZWO.securityKeys.S2_Authenticated = "c2da28bc56ad5484fcf10efd2a1ed1c1"; + ZWO.securityKeys.S2_Unauthenticated = "69ded77863e0b64401f1ac12c4d15c86"; + + ZWO.securityKeysLongRange.S2_AccessControl = "1e76388da0674c6d799e6f1f6bef0c91"; + ZWO.securityKeysLongRange.S2_Authenticated = "6b948cf3ea8679e57b7f89cce47bcb18"; + + ZWO.logConfig.logToFile = false; + ZWO.logConfig.enabled = true; + ZWO.enableSoftReset = false; + + ZWaveJS.NET.Driver D = new ZWaveJS.NET.Driver("COM3", ZWO); + + D.DriverReady += () => { + + D.Utils.ParseQRCodeString("900143047006000000000000000000000000000000000000000000100025800002022000004000050000601800080201").ContinueWith((R1) => + { + QRProvisioningInformation QRI = R1.Result.ResultPayload as QRProvisioningInformation; + + // Modify based on users choice (Protoccol) + // Then... + // D.Controller.ProvisionSmartStartNode(QRI).ContinueWith((R2) => { ... }); + }); + + }; + + D.Start(); + Console.ReadLine(); + + + } + } +} diff --git a/Visual Studio Projects/ZWaveJS.NET/Scratch Pad/Properties/AssemblyInfo.cs b/Visual Studio Projects/ZWaveJS.NET/Test/Properties/AssemblyInfo.cs similarity index 86% rename from Visual Studio Projects/ZWaveJS.NET/Scratch Pad/Properties/AssemblyInfo.cs rename to Visual Studio Projects/ZWaveJS.NET/Test/Properties/AssemblyInfo.cs index a91b9b7..0be8e7e 100644 --- a/Visual Studio Projects/ZWaveJS.NET/Scratch Pad/Properties/AssemblyInfo.cs +++ b/Visual Studio Projects/ZWaveJS.NET/Test/Properties/AssemblyInfo.cs @@ -5,12 +5,12 @@ // General Information about an assembly is controlled through the following // set of attributes. Change these attribute values to modify the information // associated with an assembly. -[assembly: AssemblyTitle("Scratch Pad")] +[assembly: AssemblyTitle("Test")] [assembly: AssemblyDescription("")] [assembly: AssemblyConfiguration("")] [assembly: AssemblyCompany("")] -[assembly: AssemblyProduct("Scratch Pad")] -[assembly: AssemblyCopyright("Copyright © 2022")] +[assembly: AssemblyProduct("Test")] +[assembly: AssemblyCopyright("Copyright © 2024")] [assembly: AssemblyTrademark("")] [assembly: AssemblyCulture("")] @@ -20,7 +20,7 @@ [assembly: ComVisible(false)] // The following GUID is for the ID of the typelib if this project is exposed to COM -[assembly: Guid("255257d9-f1d0-4f9a-b38a-350a2b064e6b")] +[assembly: Guid("fc3e7bc3-0a0f-4dd6-bac1-16e0d1c839e8")] // Version information for an assembly consists of the following four values: // diff --git a/Visual Studio Projects/ZWaveJS.NET/Scratch Pad/Scratch Pad.csproj b/Visual Studio Projects/ZWaveJS.NET/Test/Test.csproj similarity index 89% rename from Visual Studio Projects/ZWaveJS.NET/Scratch Pad/Scratch Pad.csproj rename to Visual Studio Projects/ZWaveJS.NET/Test/Test.csproj index 9ea9ce2..dea7cc3 100644 --- a/Visual Studio Projects/ZWaveJS.NET/Scratch Pad/Scratch Pad.csproj +++ b/Visual Studio Projects/ZWaveJS.NET/Test/Test.csproj @@ -4,12 +4,13 @@ Debug AnyCPU - {255257D9-F1D0-4F9A-B38A-350A2B064E6B} + {FC3E7BC3-0A0F-4DD6-BAC1-16E0D1C839E8} Exe - Scratch_Pad - Scratch Pad - v4.5 + Test + Test + v4.8 512 + true true diff --git a/Visual Studio Projects/ZWaveJS.NET/ZWaveJS.NET.sln b/Visual Studio Projects/ZWaveJS.NET/ZWaveJS.NET.sln index 7c5467e..b0d4074 100644 --- a/Visual Studio Projects/ZWaveJS.NET/ZWaveJS.NET.sln +++ b/Visual Studio Projects/ZWaveJS.NET/ZWaveJS.NET.sln @@ -1,11 +1,11 @@  Microsoft Visual Studio Solution File, Format Version 12.00 -# Visual Studio Version 16 -VisualStudioVersion = 16.0.32510.428 +# Visual Studio Version 17 +VisualStudioVersion = 17.6.33829.357 MinimumVisualStudioVersion = 10.0.40219.1 Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "ZWaveJS.NET", "ZWaveJS.NET\ZWaveJS.NET.csproj", "{98625F2D-8F29-4DDD-9E83-7C8607803FE4}" EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Scratch Pad", "Scratch Pad\Scratch Pad.csproj", "{255257D9-F1D0-4F9A-B38A-350A2B064E6B}" +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Test", "Test\Test.csproj", "{FC3E7BC3-0A0F-4DD6-BAC1-16E0D1C839E8}" EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution @@ -17,10 +17,10 @@ Global {98625F2D-8F29-4DDD-9E83-7C8607803FE4}.Debug|Any CPU.Build.0 = Debug|Any CPU {98625F2D-8F29-4DDD-9E83-7C8607803FE4}.Release|Any CPU.ActiveCfg = Release|Any CPU {98625F2D-8F29-4DDD-9E83-7C8607803FE4}.Release|Any CPU.Build.0 = Release|Any CPU - {255257D9-F1D0-4F9A-B38A-350A2B064E6B}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {255257D9-F1D0-4F9A-B38A-350A2B064E6B}.Debug|Any CPU.Build.0 = Debug|Any CPU - {255257D9-F1D0-4F9A-B38A-350A2B064E6B}.Release|Any CPU.ActiveCfg = Release|Any CPU - {255257D9-F1D0-4F9A-B38A-350A2B064E6B}.Release|Any CPU.Build.0 = Release|Any CPU + {FC3E7BC3-0A0F-4DD6-BAC1-16E0D1C839E8}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {FC3E7BC3-0A0F-4DD6-BAC1-16E0D1C839E8}.Debug|Any CPU.Build.0 = Debug|Any CPU + {FC3E7BC3-0A0F-4DD6-BAC1-16E0D1C839E8}.Release|Any CPU.ActiveCfg = Release|Any CPU + {FC3E7BC3-0A0F-4DD6-BAC1-16E0D1C839E8}.Release|Any CPU.Build.0 = Release|Any CPU EndGlobalSection GlobalSection(SolutionProperties) = preSolution HideSolutionNode = FALSE diff --git a/Visual Studio Projects/ZWaveJS.NET/ZWaveJS.NET/CMDResult.cs b/Visual Studio Projects/ZWaveJS.NET/ZWaveJS.NET/CMDResult.cs index 46d7323..7f6f37b 100644 --- a/Visual Studio Projects/ZWaveJS.NET/ZWaveJS.NET/CMDResult.cs +++ b/Visual Studio Projects/ZWaveJS.NET/ZWaveJS.NET/CMDResult.cs @@ -1,8 +1,5 @@ using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; + using Newtonsoft.Json.Linq; namespace ZWaveJS.NET diff --git a/Visual Studio Projects/ZWaveJS.NET/ZWaveJS.NET/Controller.cs b/Visual Studio Projects/ZWaveJS.NET/ZWaveJS.NET/Controller.cs index 2175cf0..40de4c1 100644 --- a/Visual Studio Projects/ZWaveJS.NET/ZWaveJS.NET/Controller.cs +++ b/Visual Studio Projects/ZWaveJS.NET/ZWaveJS.NET/Controller.cs @@ -2,13 +2,18 @@ using System.Threading.Tasks; using System.Collections.Generic; using Newtonsoft.Json; +using Newtonsoft.Json.Linq; +using static ZWaveJS.NET.Enums; +using System.Linq; + namespace ZWaveJS.NET { public class Controller { - internal Controller() + private Driver _driver; + internal Controller(Driver driver) { - + _driver = driver; } public delegate void BackupNVMProgress(int BytesRead, int Total); @@ -32,27 +37,27 @@ internal void Trigger_RestoreNVMProgressSub(int BytesWritten, int Total) RestoreNVMProgressSub?.Invoke(BytesWritten, Total); } - public delegate void StatisticsUpdatedEvent(ControllerStatistics Statistics); + public delegate void StatisticsUpdatedEvent(ControllerStatisticsUpdatedArgs Args); public event StatisticsUpdatedEvent StatisticsUpdated; - internal void Trigger_StatisticsUpdated(ControllerStatistics Statistics) + internal void Trigger_StatisticsUpdated(ControllerStatisticsUpdatedArgs Args) { - this.statistics = Statistics; - StatisticsUpdated?.Invoke(Statistics); + this.statistics = Args; + StatisticsUpdated?.Invoke(Args); } - public delegate void HealNetworkProgressEvent(Dictionary Progress); - public event HealNetworkProgressEvent HealNetworkProgress; - internal void Trigger_HealNetworkProgress(Dictionary Progress) + public delegate void RebuildRoutesProgressEvent(RebuildRoutesProgressArgs Args); + public event RebuildRoutesProgressEvent RebuildRoutesProgress; + internal void Trigger_RebuildRoutesProgress(RebuildRoutesProgressArgs Args) { - HealNetworkProgress?.Invoke(Progress); + RebuildRoutesProgress?.Invoke(Args); } - public delegate void HealNetworkDoneEvent(Dictionary Result); - public event HealNetworkDoneEvent HealNetworkDone; - internal void Trigger_HealNetworkDone(Dictionary Result) + public delegate void RebuildRoutesDoneEvent(RebuildRoutesDoneArgs Args); + public event RebuildRoutesDoneEvent RebuildRoutesDone; + internal void Trigger_RebuildRoutesDone(RebuildRoutesDoneArgs Args) { - this.isHealNetworkActive = false; - HealNetworkDone?.Invoke(Result); + this.isRebuildingRoutes = false; + RebuildRoutesDone?.Invoke(Args); } private Abort AbortSub; @@ -101,66 +106,319 @@ internal void Trigger_ExclusionStopped() ExclusionStopped?.Invoke(); } - public delegate void NodeRemovedEvent(ZWaveNode Node); + public delegate void NodeRemovedEvent(ZWaveNode Node, Enums.RemoveNodeReason Reason); public event NodeRemovedEvent NodeRemoved; - internal void Trigger_NodeRemoved(ZWaveNode Node) + internal void Trigger_NodeRemoved(ZWaveNode Node, Enums.RemoveNodeReason Reason) { - NodeRemoved?.Invoke(Node); + NodeRemoved?.Invoke(Node, Reason); } - public delegate void NodeAddedEvent(ZWaveNode Node, InclusionResult Result); + public delegate void NodeAddedEvent(ZWaveNode Node, InclusionResultArgs Args); public event NodeAddedEvent NodeAdded; - internal void Trigger_NodeAdded(ZWaveNode Node, InclusionResult Result) + internal void Trigger_NodeAdded(ZWaveNode Node, InclusionResultArgs Args) { - NodeAdded?.Invoke(Node, Result); + NodeAdded?.Invoke(Node, Args); } - public VirtualNode GetMulticastGroup(int[] Nodes) + public delegate void NodeFoundEvent(int NodeID); + public event NodeFoundEvent NodeFound; + internal void Trigger_NodeFound(int NodeID) { - VirtualNode VN = new VirtualNode(Nodes); - return VN; + NodeFound?.Invoke(NodeID); } - public Task GetProvisioningEntries() + public delegate void FirmwareUpdateFinishedEvent(ControllerFirmwareUpdateResultArgs Args); + public event FirmwareUpdateFinishedEvent FirmwareUpdateFinished; + internal void Trigger_FirmwareUpdateFinished(ControllerFirmwareUpdateResultArgs Args) + { + FirmwareUpdateFinished?.Invoke(Args); + } + + public delegate void FirmwareUpdateProgressEvent(ControllerFirmwareUpdateProgressArgs Args); + public event FirmwareUpdateProgressEvent FirmwareUpdateProgress; + internal void Trigger_FirmwareUpdateProgress(ControllerFirmwareUpdateProgressArgs Args) + { + FirmwareUpdateProgress?.Invoke(Args); + } + + // CHECKED + public Task GetAvailableFirmwareUpdates(int NodeID, bool IncludePrereleases, UsageEnvironment Environment, string APIKey = null) { + + + + Guid ID = Guid.NewGuid(); + TaskCompletionSource Result = new TaskCompletionSource(); - Driver.Callbacks.Add(ID, (JO) => + + if (Environment == UsageEnvironment.Commercial && string.IsNullOrEmpty(APIKey)) + { + CMDResult Res = new CMDResult(Enums.ErrorCodes.CommercialAPIKey, "A valid API license key is required for commercial use", false); + Result.SetResult(Res); + return Result.Task; + } + + _driver.Callbacks.Add(ID, (JO) => { CMDResult Res = new CMDResult(JO); if (Res.Success) { - SmartStartProvisioningEntry[] Entries = JsonConvert.DeserializeObject(JO.SelectToken("result.entries").ToString()); - Res.SetPayload(Entries); + FirmwareUpdateInfo[] FUI = JO.SelectToken("result.updates").ToObject(); + Res.SetPayload(FUI); } Result.SetResult(Res); }); + Dictionary Request = new Dictionary(); + Request.Add("messageId", ID); + Request.Add("command", Enums.Commands.GetAvailableFirmwareUpdates); + Request.Add("nodeId", NodeID); + Request.Add("apiKey", APIKey ?? Driver.FWUSAPIKey); + Request.Add("includePrereleases", IncludePrereleases); + + string RequestPL = Newtonsoft.Json.JsonConvert.SerializeObject(Request); + _driver.ClientWebSocket.SendInstant(RequestPL); + + return Result.Task; + } + + // CHECKED + public Task FirmwareUpdateOTA(int NodeID, FirmwareUpdateInfo Update) + { + Guid ID = Guid.NewGuid(); + + TaskCompletionSource Result = new TaskCompletionSource(); + + _driver.Callbacks.Add(ID, (JO) => + { + CMDResult Res = new CMDResult(JO); + if (Res.Success) + { + NodeFirmwareUpdateResultArgs FUR = JO.SelectToken("result").ToObject(); + Res.SetPayload(FUR); + } + + + Result.SetResult(Res); + + }); Dictionary Request = new Dictionary(); Request.Add("messageId", ID); - Request.Add("command", Enums.Commands.GetProvisioningEntries); - + Request.Add("command", Enums.Commands.FirmwareUpdateOTA); + Request.Add("nodeId", NodeID); + Request.Add("updateInfo", Update); + + string RequestPL = Newtonsoft.Json.JsonConvert.SerializeObject(Request); + _driver.ClientWebSocket.SendInstant(RequestPL); + + return Result.Task; + } + + // CHECKED + public Task GetRFRegion() + { + Guid ID = Guid.NewGuid(); + TaskCompletionSource Result = new TaskCompletionSource(); + _driver.Callbacks.Add(ID, (JO) => + { + CMDResult Res = new CMDResult(JO); + + if (Res.Success) + { + Enums.RFRegion Region = JO.SelectToken("result.region").ToObject(); + Res.SetPayload(Region); + } + Result.SetResult(Res); + + }); + + Dictionary Request = new Dictionary(); + Request.Add("messageId", ID); + Request.Add("command", Enums.Commands.GetRFRegion); + string RequestPL = Newtonsoft.Json.JsonConvert.SerializeObject(Request); - Driver.Client.SendAsync(RequestPL); + _driver.ClientWebSocket.SendInstant(RequestPL); return Result.Task; } - public Task RemoveAssociations(AssociationAddress Source, int Group, AssociationAddress[] Targets) + // CHECKED + public Task SetRFRegion(Enums.RFRegion Region) { Guid ID = Guid.NewGuid(); + TaskCompletionSource Result = new TaskCompletionSource(); - Driver.Callbacks.Add(ID, (JO) => + + _driver.Callbacks.Add(ID, (JO) => { CMDResult Res = new CMDResult(JO); Result.SetResult(Res); }); + + Dictionary Request = new Dictionary(); + Request.Add("messageId", ID); + Request.Add("command", Enums.Commands.SetRFRegion); + Request.Add("region", Region); + + string RequestPL = Newtonsoft.Json.JsonConvert.SerializeObject(Request); + _driver.ClientWebSocket.SendInstant(RequestPL); + + return Result.Task; + } + + // CHECKED + public Task GetPowerLevel() + { + Guid ID = Guid.NewGuid(); + + TaskCompletionSource Result = new TaskCompletionSource(); + + _driver.Callbacks.Add(ID, (JO) => + { + CMDResult Res = new CMDResult(JO); + + if (Res.Success) + { + PowerLevel Level = JO.SelectToken("result").ToObject(); + Res.SetPayload(Level); + } + Result.SetResult(Res); + + }); + + Dictionary Request = new Dictionary(); + Request.Add("messageId", ID); + Request.Add("command", Enums.Commands.GetPowerlevel); + + + string RequestPL = Newtonsoft.Json.JsonConvert.SerializeObject(Request); + _driver.ClientWebSocket.SendInstant(RequestPL); + + return Result.Task; + } + + // CHECKED + public Task SetPowerLevel(decimal PowerLevel, decimal Measured0dBm) + { + Guid ID = Guid.NewGuid(); + + TaskCompletionSource Result = new TaskCompletionSource(); + + _driver.Callbacks.Add(ID, (JO) => + { + CMDResult Res = new CMDResult(JO); + Result.SetResult(Res); + + }); + + Dictionary Request = new Dictionary(); + Request.Add("messageId", ID); + Request.Add("command", Enums.Commands.SetPowerlevel); + Request.Add("powerlevel", PowerLevel); + Request.Add("measured0dBm", Measured0dBm); + + string RequestPL = Newtonsoft.Json.JsonConvert.SerializeObject(Request); + _driver.ClientWebSocket.SendInstant(RequestPL); + + return Result.Task; + } + + // LOCAL + public VirtualNode GetMulticastGroup(int[] Nodes) + { + VirtualNode VN = new VirtualNode(_driver, Nodes); + return VN; + } + + // CHECKED + public Task FirmwareUpdateOTW(FirmwareUpdate Update) + { + + if (Update.firmwareTarget != null) + { + TaskCompletionSource Fail = new TaskCompletionSource(); + CMDResult Res = new CMDResult(Enums.ErrorCodes.WrongOverride, "Please use the override that DOES NOT include 'firmwareTarget'", false); + Fail.SetResult(Res); + + return Fail.Task; + } + + Guid ID = Guid.NewGuid(); + + TaskCompletionSource Result = new TaskCompletionSource(); + + _driver.Callbacks.Add(ID, (JO) => + { + CMDResult Res = new CMDResult(JO); + + if (Res.Success) + { + ControllerFirmwareUpdateResultArgs UpdateResult = JO.SelectToken("result").ToObject(); + Res.SetPayload(UpdateResult); + } + Result.SetResult(Res); + + }); + + + Dictionary Request = new Dictionary(); + Request.Add("messageId", ID); + Request.Add("command", Enums.Commands.FirmwareUpdateOTW); + Request.Add("file", Update.data); + Request.Add("filename", Update.filename); + + string RequestPL = Newtonsoft.Json.JsonConvert.SerializeObject(Request); + _driver.ClientWebSocket.SendInstant(RequestPL); + + return Result.Task; + } + + // CHECKED + public Task GetProvisioningEntries() + { + Guid ID = Guid.NewGuid(); + TaskCompletionSource Result = new TaskCompletionSource(); + _driver.Callbacks.Add(ID, (JO) => + { + CMDResult Res = new CMDResult(JO); + + if (Res.Success) + { + SmartStartProvisioningEntry[] Entries = JO.SelectToken("result.entries").ToObject(); + Res.SetPayload(Entries); + } + Result.SetResult(Res); + + }); + + Dictionary Request = new Dictionary(); + Request.Add("messageId", ID); + Request.Add("command", Enums.Commands.GetProvisioningEntries); + + string RequestPL = Newtonsoft.Json.JsonConvert.SerializeObject(Request); + _driver.ClientWebSocket.SendInstant(RequestPL); + + return Result.Task; + } + + // CHECKED + public Task RemoveAssociations(AssociationAddress Source, int Group, AssociationAddress[] Targets) + { + Guid ID = Guid.NewGuid(); + TaskCompletionSource Result = new TaskCompletionSource(); + _driver.Callbacks.Add(ID, (JO) => + { + CMDResult Res = new CMDResult(JO); + Result.SetResult(Res); + + }); Dictionary Request = new Dictionary(); Request.Add("messageId", ID); @@ -172,16 +430,17 @@ public Task RemoveAssociations(AssociationAddress Source, int Group, string RequestPL = Newtonsoft.Json.JsonConvert.SerializeObject(Request); - Driver.Client.SendAsync(RequestPL); + _driver.ClientWebSocket.SendInstant(RequestPL); return Result.Task; } + // CHECKED public Task AddAssociations(AssociationAddress Source, int Group, AssociationAddress[] Targets) { Guid ID = Guid.NewGuid(); TaskCompletionSource Result = new TaskCompletionSource(); - Driver.Callbacks.Add(ID, (JO) => + _driver.Callbacks.Add(ID, (JO) => { CMDResult Res = new CMDResult(JO); Result.SetResult(Res); @@ -198,27 +457,28 @@ public Task AddAssociations(AssociationAddress Source, int Group, Ass string RequestPL = Newtonsoft.Json.JsonConvert.SerializeObject(Request); - Driver.Client.SendAsync(RequestPL); + _driver.ClientWebSocket.SendInstant(RequestPL); return Result.Task; } + // CHECKED public Task GetAssociations(int Node, int Endpoint) { Guid ID = Guid.NewGuid(); TaskCompletionSource Result = new TaskCompletionSource(); - Driver.Callbacks.Add(ID, (JO) => - { - CMDResult Res = new CMDResult(JO); - if (Res.Success) - { - Dictionary Associations = JsonConvert.DeserializeObject>(JO.SelectToken("result.associations").ToString()); - Res.SetPayload(Associations); - } + _driver.Callbacks.Add(ID, (JO) => + { + CMDResult Res = new CMDResult(JO); + if (Res.Success) + { + Dictionary Associations = JO.SelectToken("result.associations").ToObject>(); + Res.SetPayload(Associations); + } - Result.SetResult(Res); + Result.SetResult(Res); - }); + }); Dictionary Request = new Dictionary(); Request.Add("messageId", ID); @@ -227,40 +487,43 @@ public Task GetAssociations(int Node, int Endpoint) Request.Add("endpoint", Endpoint); string RequestPL = Newtonsoft.Json.JsonConvert.SerializeObject(Request); - Driver.Client.SendAsync(RequestPL); + _driver.ClientWebSocket.SendInstant(RequestPL); return Result.Task; } + // CHECKED public Task GetAssociationGroups(int Node, int Endpoint) { Guid ID = Guid.NewGuid(); TaskCompletionSource Result = new TaskCompletionSource(); - Driver.Callbacks.Add(ID, (JO) => - { - CMDResult Res = new CMDResult(JO); - if (Res.Success) - { - Dictionary Groups = JsonConvert.DeserializeObject>(JO.SelectToken("result.groups").ToString()); - Res.SetPayload(Groups); - } + _driver.Callbacks.Add(ID, (JO) => + { + CMDResult Res = new CMDResult(JO); + if (Res.Success) + { + Dictionary Groups = JO.SelectToken("result.groups").ToObject>(); - Result.SetResult(Res); + Res.SetPayload(Groups); + } - }); + Result.SetResult(Res); + + }); Dictionary Request = new Dictionary(); Request.Add("messageId", ID); Request.Add("command", Enums.Commands.GetAssociationGroups); - Request.Add("nodeId",Node); + Request.Add("nodeId", Node); Request.Add("endpoint", Endpoint); string RequestPL = Newtonsoft.Json.JsonConvert.SerializeObject(Request); - Driver.Client.SendAsync(RequestPL); + _driver.ClientWebSocket.SendInstant(RequestPL); return Result.Task; } + // CHECKED public Task RestoreNVM(byte[] NVMData, ConvertRestoreNVMProgress ConvertProgress = null, RestoreNVMProgress RestoreProgress = null) { ConvertRestoreNVMProgressSub = ConvertProgress; @@ -268,16 +531,16 @@ public Task RestoreNVM(byte[] NVMData, ConvertRestoreNVMProgress Conv Guid ID = Guid.NewGuid(); TaskCompletionSource Result = new TaskCompletionSource(); - Driver.Callbacks.Add(ID, (JO) => - { - CMDResult Res = new CMDResult(JO); - if (Res.Success) - { - _Driver.Restart(); - } - Result.SetResult(Res); + _driver.Callbacks.Add(ID, (JO) => + { + CMDResult Res = new CMDResult(JO); + if (Res.Success) + { + _driver.Restart(); + } + Result.SetResult(Res); - }); + }); Dictionary Request = new Dictionary(); Request.Add("messageId", ID); @@ -285,40 +548,42 @@ public Task RestoreNVM(byte[] NVMData, ConvertRestoreNVMProgress Conv Request.Add("nvmData", Convert.ToBase64String(NVMData)); string RequestPL = Newtonsoft.Json.JsonConvert.SerializeObject(Request); - Driver.Client.SendAsync(RequestPL); + _driver.ClientWebSocket.SendInstant(RequestPL); return Result.Task; } + // CHECKED public Task BackupNVMRaw(BackupNVMProgress OnProgress = null) { BackupNVMProgressSub = OnProgress; Guid ID = Guid.NewGuid(); TaskCompletionSource Result = new TaskCompletionSource(); - Driver.Callbacks.Add(ID, (JO) => - { - CMDResult Res = new CMDResult(JO); - if (Res.Success) - { - string B64 = JO.SelectToken("result.nvmData").ToString(); - Res.SetPayload(Convert.FromBase64String(B64)); - } + _driver.Callbacks.Add(ID, (JO) => + { + CMDResult Res = new CMDResult(JO); + if (Res.Success) + { + string B64 = JO.SelectToken("result.nvmData").ToObject(); + Res.SetPayload(Convert.FromBase64String(B64)); + } - Result.SetResult(Res); - - }); + Result.SetResult(Res); + + }); Dictionary Request = new Dictionary(); Request.Add("messageId", ID); Request.Add("command", Enums.Commands.BackUpNVM); string RequestPL = Newtonsoft.Json.JsonConvert.SerializeObject(Request); - Driver.Client.SendAsync(RequestPL); + _driver.ClientWebSocket.SendInstant(RequestPL); return Result.Task; } + // CHECKED public Task ReplaceFailedNode(int NodeID, InclusionOptions Options) { ValidateDSKAndEnterPINSub = null; @@ -327,7 +592,7 @@ public Task ReplaceFailedNode(int NodeID, InclusionOptions Options) Guid ID = Guid.NewGuid(); TaskCompletionSource Result = new TaskCompletionSource(); - + switch (Options.strategy) { case Enums.InclusionStrategy.Default: @@ -342,7 +607,7 @@ public Task ReplaceFailedNode(int NodeID, InclusionOptions Options) break; } - + if (Options.strategy == Enums.InclusionStrategy.Security_S2) { if (ValidateDSKAndEnterPINSub == null || GrantSecurityClassesSub == null || AbortSub == null) @@ -352,7 +617,7 @@ public Task ReplaceFailedNode(int NodeID, InclusionOptions Options) return Result.Task; } - if (_Driver.Options != null && _Driver.Options.MissingKeys(true, false)) + if (_driver.Options != null && _driver.Options.MissingKeys(true, false)) { CMDResult Res = new CMDResult(Enums.ErrorCodes.MissingKeys, "Missing Security Keys in Options", false); Result.SetResult(Res); @@ -360,9 +625,9 @@ public Task ReplaceFailedNode(int NodeID, InclusionOptions Options) } } - if(Options.strategy == Enums.InclusionStrategy.Security_S0) + if (Options.strategy == Enums.InclusionStrategy.Security_S0) { - if (_Driver.Options != null && _Driver.Options.MissingKeys(false, true)) + if (_driver.Options != null && _driver.Options.MissingKeys(false, true)) { CMDResult Res = new CMDResult(Enums.ErrorCodes.MissingKeys, "Missing Security Keys in Options", false); Result.SetResult(Res); @@ -370,19 +635,19 @@ public Task ReplaceFailedNode(int NodeID, InclusionOptions Options) } } - if (_Driver.Options != null && !_Driver.Options.CheckKeyLength()) + if (_driver.Options != null && !_driver.Options.CheckKeyLength()) { CMDResult Res = new CMDResult(Enums.ErrorCodes.InvalidkeyLength, "Invalid Key length. All Security Keys must be a 32 character hexadecimal string (representing 16 bytes)", false); Result.SetResult(Res); return Result.Task; } - - Driver.Callbacks.Add(ID, (JO) => - { - CMDResult Res = new CMDResult(JO); - Result.SetResult(Res); - }); + + _driver.Callbacks.Add(ID, (JO) => + { + CMDResult Res = new CMDResult(JO); + Result.SetResult(Res); + }); Dictionary _Options = new Dictionary(); _Options.Add("strategy", (int)Options.strategy); @@ -394,21 +659,22 @@ public Task ReplaceFailedNode(int NodeID, InclusionOptions Options) Request.Add("options", _Options); string RequestPL = Newtonsoft.Json.JsonConvert.SerializeObject(Request); - Driver.Client.SendAsync(RequestPL); + _driver.ClientWebSocket.SendInstant(RequestPL); return Result.Task; } + // CHECKED public Task RemoveFailedNode(int NodeID) { Guid ID = Guid.NewGuid(); TaskCompletionSource Result = new TaskCompletionSource(); - Driver.Callbacks.Add(ID, (JO) => - { - CMDResult RES = new CMDResult(JO); - Result.SetResult(RES); - }); + _driver.Callbacks.Add(ID, (JO) => + { + CMDResult RES = new CMDResult(JO); + Result.SetResult(RES); + }); Dictionary Request = new Dictionary(); @@ -417,89 +683,104 @@ public Task RemoveFailedNode(int NodeID) Request.Add("nodeId", NodeID); string RequestPL = Newtonsoft.Json.JsonConvert.SerializeObject(Request); - Driver.Client.SendAsync(RequestPL); + _driver.ClientWebSocket.SendInstant(RequestPL); return Result.Task; } - public Task HealNode(int NodeID) + // CHECKED + public Task RebuildNodeRoutes(int NodeID) { Guid ID = Guid.NewGuid(); TaskCompletionSource Result = new TaskCompletionSource(); - Driver.Callbacks.Add(ID, (JO) => - { - CMDResult Res = new CMDResult(JO); - Result.SetResult(Res); - }); + _driver.Callbacks.Add(ID, (JO) => + { + CMDResult Res = new CMDResult(JO); + if (Res.Success) + { + bool Success = JO.SelectToken("result.success").ToObject(); + Res.SetPayload(Success); + } + Result.SetResult(Res); + }); Dictionary Request = new Dictionary(); Request.Add("messageId", ID); - Request.Add("command", Enums.Commands.HealNode); + Request.Add("command", Enums.Commands.RebuildNodeRoutes); Request.Add("nodeId", NodeID); string RequestPL = Newtonsoft.Json.JsonConvert.SerializeObject(Request); - Driver.Client.SendAsync(RequestPL); + _driver.ClientWebSocket.SendInstant(RequestPL); return Result.Task; } - public Task BeginHealingNetwork() + // CHECKED + public Task BeginRebuildingRoutes(RebuildRoutesOptions Options) { Guid ID = Guid.NewGuid(); TaskCompletionSource Result = new TaskCompletionSource(); - Driver.Callbacks.Add(ID, (JO) => - { - CMDResult Res = new CMDResult(JO); - if (Res.Success) - { - this.isHealNetworkActive = true; - } - - Result.SetResult(Res); - }); + _driver.Callbacks.Add(ID, (JO) => + { + CMDResult Res = new CMDResult(JO); + if (Res.Success) + { + if (Res.Success) + { + bool Success = JO.SelectToken("result.success").ToObject(); + Res.SetPayload(Success); + this.isRebuildingRoutes = Success; + } + + } + Result.SetResult(Res); + }); Dictionary Request = new Dictionary(); Request.Add("messageId", ID); - Request.Add("command", Enums.Commands.BeginHealingNetwork); + Request.Add("command", Enums.Commands.BeginRebuildingRoutes); + Request.Add("options", Options); string RequestPL = Newtonsoft.Json.JsonConvert.SerializeObject(Request); - Driver.Client.SendAsync(RequestPL); + _driver.ClientWebSocket.SendInstant(RequestPL); return Result.Task; } - public Task StopHealingNetwork() + // CHECKED + public Task StopRebuildingRoutes() { - + Guid ID = Guid.NewGuid(); TaskCompletionSource Result = new TaskCompletionSource(); - Driver.Callbacks.Add(ID, (JO) => - { - CMDResult Res = new CMDResult(JO); - if (Res.Success) - { - this.isHealNetworkActive = false; - } + _driver.Callbacks.Add(ID, (JO) => + { + CMDResult Res = new CMDResult(JO); + if (Res.Success) + { + this.isRebuildingRoutes = false; + } - Result.SetResult(Res); - }); + Result.SetResult(Res); + }); Dictionary Request = new Dictionary(); Request.Add("messageId", ID); - Request.Add("command", Enums.Commands.StopHealingNetwork); + Request.Add("command", Enums.Commands.StopRebuildingRoutes); string RequestPL = Newtonsoft.Json.JsonConvert.SerializeObject(Request); - Driver.Client.SendAsync(RequestPL); + _driver.ClientWebSocket.SendInstant(RequestPL); return Result.Task; } + // CHECKED public Task BeginInclusion(InclusionOptions Options) { ValidateDSKAndEnterPINSub = null; @@ -518,7 +799,7 @@ public Task BeginInclusion(InclusionOptions Options) AbortSub = Options.userCallbacks?.abort ?? null; break; } - + if (Options.strategy == Enums.InclusionStrategy.Default) { @@ -529,7 +810,7 @@ public Task BeginInclusion(InclusionOptions Options) return Result.Task; } - if (_Driver.Options != null && _Driver.Options.MissingKeys(true, true)) + if (_driver.Options != null && _driver.Options.MissingKeys(true, true)) { CMDResult Res = new CMDResult(Enums.ErrorCodes.MissingKeys, "Missing Security Keys in Options", false); Result.SetResult(Res); @@ -547,7 +828,7 @@ public Task BeginInclusion(InclusionOptions Options) return Result.Task; } - if (_Driver.Options != null && _Driver.Options.MissingKeys(true, false)) + if (_driver.Options != null && _driver.Options.MissingKeys(true, false)) { CMDResult Res = new CMDResult(Enums.ErrorCodes.MissingKeys, "Missing Security Keys in Options", false); Result.SetResult(Res); @@ -557,7 +838,7 @@ public Task BeginInclusion(InclusionOptions Options) if (Options.strategy == Enums.InclusionStrategy.Security_S0) { - if (_Driver.Options != null && _Driver.Options.MissingKeys(false, true)) + if (_driver.Options != null && _driver.Options.MissingKeys(false, true)) { CMDResult Res = new CMDResult(Enums.ErrorCodes.MissingKeys, "Missing Security Keys in Options", false); Result.SetResult(Res); @@ -567,18 +848,18 @@ public Task BeginInclusion(InclusionOptions Options) - if (_Driver.Options != null && !_Driver.Options.CheckKeyLength()) + if (_driver.Options != null && !_driver.Options.CheckKeyLength()) { CMDResult Res = new CMDResult(Enums.ErrorCodes.InvalidkeyLength, "Invalid Key length. All Security Keys must be a 32 character hexadecimal string (representing 16 bytes)", false); Result.SetResult(Res); return Result.Task; } - Driver.Callbacks.Add(ID, (JO) => - { - CMDResult Res = new CMDResult(JO); - Result.SetResult(Res); - }); + _driver.Callbacks.Add(ID, (JO) => + { + CMDResult Res = new CMDResult(JO); + Result.SetResult(Res); + }); Dictionary _Options = new Dictionary(); _Options.Add("strategy", (int)Options.strategy); @@ -590,52 +871,56 @@ public Task BeginInclusion(InclusionOptions Options) Request.Add("options", _Options); string RequestPL = Newtonsoft.Json.JsonConvert.SerializeObject(Request); - Driver.Client.SendAsync(RequestPL); + _driver.ClientWebSocket.SendInstant(RequestPL); return Result.Task; } + // CHECKED public Task StopInclusion() { Guid ID = Guid.NewGuid(); TaskCompletionSource Result = new TaskCompletionSource(); - Driver.Callbacks.Add(ID, (JO) => - { - CMDResult Res = new CMDResult(JO); - Result.SetResult(Res); - }); + _driver.Callbacks.Add(ID, (JO) => + { + CMDResult Res = new CMDResult(JO); + Result.SetResult(Res); + }); Dictionary Request = new Dictionary(); Request.Add("messageId", ID); Request.Add("command", Enums.Commands.StopInclusion); string RequestPL = Newtonsoft.Json.JsonConvert.SerializeObject(Request); - Driver.Client.SendAsync(RequestPL); + _driver.ClientWebSocket.SendInstant(RequestPL); return Result.Task; } + // LOCAL public Task UnprovisionSmartStartNode(int NodeID) { return _UnprovisionSmartStartNode(NodeID); } + // LOCAL public Task UnprovisionSmartStartNode(string DSK) { return _UnprovisionSmartStartNode(DSK); } + // CHECKED private Task _UnprovisionSmartStartNode(object dskOrNodeId) { Guid ID = Guid.NewGuid(); TaskCompletionSource Result = new TaskCompletionSource(); - Driver.Callbacks.Add(ID, (JO) => - { - CMDResult Res = new CMDResult(JO); - Result.SetResult(Res); - }); + _driver.Callbacks.Add(ID, (JO) => + { + CMDResult Res = new CMDResult(JO); + Result.SetResult(Res); + }); Dictionary Request = new Dictionary(); @@ -644,32 +929,50 @@ private Task _UnprovisionSmartStartNode(object dskOrNodeId) Request.Add("dskOrNodeId", dskOrNodeId); string RequestPL = Newtonsoft.Json.JsonConvert.SerializeObject(Request); - Driver.Client.SendAsync(RequestPL); + _driver.ClientWebSocket.SendInstant(RequestPL); return Result.Task; } - - public Task ProvisionSmartStartNode(string QRCode) + // CHECKED + public Task ProvisionSmartStartNode(QRProvisioningInformation ProvisioningInformation) { Guid ID = Guid.NewGuid(); TaskCompletionSource Result = new TaskCompletionSource(); - if(_Driver.Options != null && _Driver.Options.MissingKeys(true,true)) + if (_driver.Options != null && _driver.Options.MissingKeys(true, true)) { CMDResult Res = new CMDResult(Enums.ErrorCodes.MissingKeys, "Missing Security Keys in Options", false); Result.SetResult(Res); return Result.Task; } - if (_Driver.Options != null && !_Driver.Options.CheckKeyLength()) + if (_driver.Options != null && !_driver.Options.CheckKeyLength()) { CMDResult Res = new CMDResult(Enums.ErrorCodes.InvalidkeyLength, "Invalid Key length. All Security Keys must be a 32 character hexadecimal string (representing 16 bytes)", false); Result.SetResult(Res); return Result.Task; } - Driver.Callbacks.Add(ID, (JO) => + if (ProvisioningInformation.supportedProtocols.Contains(Protocols.ZWaveLongRange)) + { + if (_driver.Options != null && _driver.Options.MissingLRKeys()) + { + CMDResult Res = new CMDResult(Enums.ErrorCodes.MissingKeys, "Missing Security Keys in Options", false); + Result.SetResult(Res); + return Result.Task; + } + + + if (_driver.Options != null && !_driver.Options.CheckKeyLengthLR()) + { + CMDResult Res = new CMDResult(Enums.ErrorCodes.InvalidkeyLength, "Invalid Key length. All Security Keys must be a 32 character hexadecimal string (representing 16 bytes)", false); + Result.SetResult(Res); + return Result.Task; + } + } + + _driver.Callbacks.Add(ID, (JO) => { CMDResult Res = new CMDResult(JO); Result.SetResult(Res); @@ -679,21 +982,53 @@ public Task ProvisionSmartStartNode(string QRCode) Request.Add("messageId", ID); Request.Add("command", Enums.Commands.ProvisionSmartStartNode); - Request.Add("entry", QRCode); + Request.Add("entry", ProvisioningInformation); string RequestPL = Newtonsoft.Json.JsonConvert.SerializeObject(Request); - Driver.Client.SendAsync(RequestPL); + _driver.ClientWebSocket.SendInstant(RequestPL); return Result.Task; } - public Task BeginExclusion(bool unprovision = false) + // CHECKED + public Task ProvisionSmartStartNode(SmartStartProvisioningEntry ProvisioningInformation) { Guid ID = Guid.NewGuid(); - TaskCompletionSource Result = new TaskCompletionSource(); - Driver.Callbacks.Add(ID, (JO) => + if (_driver.Options != null && _driver.Options.MissingKeys(true, true)) + { + CMDResult Res = new CMDResult(Enums.ErrorCodes.MissingKeys, "Missing Security Keys in Options", false); + Result.SetResult(Res); + return Result.Task; + } + + if (_driver.Options != null && !_driver.Options.CheckKeyLength()) + { + CMDResult Res = new CMDResult(Enums.ErrorCodes.InvalidkeyLength, "Invalid Key length. All Security Keys must be a 32 character hexadecimal string (representing 16 bytes)", false); + Result.SetResult(Res); + return Result.Task; + } + + if (ProvisioningInformation.protocol == Protocols.ZWaveLongRange) + { + if (_driver.Options != null && _driver.Options.MissingLRKeys()) + { + CMDResult Res = new CMDResult(Enums.ErrorCodes.MissingKeys, "Missing LR Security Keys in Options", false); + Result.SetResult(Res); + return Result.Task; + } + + + if (_driver.Options != null && !_driver.Options.CheckKeyLengthLR()) + { + CMDResult Res = new CMDResult(Enums.ErrorCodes.InvalidkeyLength, "Invalid Key length. All Security Keys must be a 32 character hexadecimal string (representing 16 bytes)", false); + Result.SetResult(Res); + return Result.Task; + } + } + + _driver.Callbacks.Add(ID, (JO) => { CMDResult Res = new CMDResult(JO); Result.SetResult(Res); @@ -701,27 +1036,91 @@ public Task BeginExclusion(bool unprovision = false) Dictionary Request = new Dictionary(); + Request.Add("messageId", ID); + Request.Add("command", Enums.Commands.ProvisionSmartStartNode); + Request.Add("entry", ProvisioningInformation); + + string RequestPL = Newtonsoft.Json.JsonConvert.SerializeObject(Request); + _driver.ClientWebSocket.SendInstant(RequestPL); + + return Result.Task; + } + + // CHECKED + public Task ProvisionSmartStartNode(string QRCode) + { + Guid ID = Guid.NewGuid(); + TaskCompletionSource Result = new TaskCompletionSource(); + + if (_driver.Options != null && _driver.Options.MissingKeys(true, true)) + { + CMDResult Res = new CMDResult(Enums.ErrorCodes.MissingKeys, "Missing Security Keys in Options", false); + Result.SetResult(Res); + return Result.Task; + } + + if (_driver.Options != null && !_driver.Options.CheckKeyLength()) + { + CMDResult Res = new CMDResult(Enums.ErrorCodes.InvalidkeyLength, "Invalid Key length. All Security Keys must be a 32 character hexadecimal string (representing 16 bytes)", false); + Result.SetResult(Res); + return Result.Task; + } + + _driver.Callbacks.Add(ID, (JO) => + { + CMDResult Res = new CMDResult(JO); + Result.SetResult(Res); + }); + + Dictionary Request = new Dictionary(); + + Request.Add("messageId", ID); + Request.Add("command", Enums.Commands.ProvisionSmartStartNode); + Request.Add("entry", QRCode); + + string RequestPL = Newtonsoft.Json.JsonConvert.SerializeObject(Request); + _driver.ClientWebSocket.SendInstant(RequestPL); + + return Result.Task; + } + + // CHECKED + public Task BeginExclusion(ExclusionOptions Options) + { + Guid ID = Guid.NewGuid(); + + TaskCompletionSource Result = new TaskCompletionSource(); + + _driver.Callbacks.Add(ID, (JO) => + { + CMDResult Res = new CMDResult(JO); + Result.SetResult(Res); + }); + + Dictionary Request = new Dictionary(); + Request.Add("messageId", ID); Request.Add("command", Enums.Commands.BeginExclusion); - Request.Add("unprovision", unprovision); + Request.Add("options", Options); string RequestPL = Newtonsoft.Json.JsonConvert.SerializeObject(Request); - Driver.Client.SendAsync(RequestPL); + _driver.ClientWebSocket.SendInstant(RequestPL); return Result.Task; } + // CHECKED public Task StopExclusion() { Guid ID = Guid.NewGuid(); TaskCompletionSource Result = new TaskCompletionSource(); - Driver.Callbacks.Add(ID, (JO) => - { - CMDResult Res = new CMDResult(JO); - Result.SetResult(Res); - }); + _driver.Callbacks.Add(ID, (JO) => + { + CMDResult Res = new CMDResult(JO); + Result.SetResult(Res); + }); Dictionary Request = new Dictionary(); @@ -729,13 +1128,11 @@ public Task StopExclusion() Request.Add("command", Enums.Commands.StopExclusion); string RequestPL = Newtonsoft.Json.JsonConvert.SerializeObject(Request); - Driver.Client.SendAsync(RequestPL); + _driver.ClientWebSocket.SendInstant(RequestPL); return Result.Task; } - - public NodesCollection Nodes { get; internal set; } [Newtonsoft.Json.JsonProperty] @@ -773,10 +1170,14 @@ public Task StopExclusion() [Newtonsoft.Json.JsonProperty] public bool supportsTimers { get; internal set; } [Newtonsoft.Json.JsonProperty] - public bool isHealNetworkActive { get; internal set; } + public bool isRebuildingRoutes { get; internal set; } [Newtonsoft.Json.JsonProperty] public ControllerStatistics statistics { get; internal set; } - internal Driver _Driver; - + [Newtonsoft.Json.JsonProperty] + public DeviceConfig deviceConfig { get; internal set; } + [Newtonsoft.Json.JsonProperty] + public Enums.RFRegion? rfRegion { get; internal set; } + [Newtonsoft.Json.JsonProperty] + public bool supportsLongRange { get; internal set; } } } diff --git a/Visual Studio Projects/ZWaveJS.NET/ZWaveJS.NET/Driver.cs b/Visual Studio Projects/ZWaveJS.NET/ZWaveJS.NET/Driver.cs index e96e878..169d0af 100644 --- a/Visual Studio Projects/ZWaveJS.NET/ZWaveJS.NET/Driver.cs +++ b/Visual Studio Projects/ZWaveJS.NET/ZWaveJS.NET/Driver.cs @@ -1,34 +1,40 @@ using System; using Newtonsoft.Json; using Newtonsoft.Json.Linq; -using System.IO; using System.Net.WebSockets; using System.Collections.Generic; using System.Threading.Tasks; using System.Linq; - - +using Websocket.Client; namespace ZWaveJS.NET { public class Driver { - internal static WatsonWebsocket.WatsonWsClient Client; - internal static Dictionary> Callbacks; - internal static CustomBooleanJsonConverter BoolConverter; - internal static bool Inited = false; + // Global List of Socket Ports that are registered + internal static List UsedPorts = new List(); + + internal Websocket.Client.WebsocketClient ClientWebSocket; + internal Dictionary> Callbacks; + internal bool Inited = false; internal ZWaveOptions Options; + internal const string FWUSAPIKey = "921f8000486fcc2744721cfc747aab2db8fc025b5d487cbf2eba76e88ff6f79a064644bf"; private Dictionary> NodeEventMap; private Dictionary> ControllerEventMap; - private static int SchemaVersionID = 17; + private Dictionary> DriverEventMap; + private Semver.SemVersion SchemaVersionID = new Semver.SemVersion(1, 35, 0); private string SerialPort; + private bool RequestedExit = false; + private JsonSerializer _jsonSerializer; + private Uri WSAddress; private bool Host = true; + private Server _server; private string _ZWaveJSDriverVersion; - public string ZWaveJSDriverVersion + public string ZWJSS_DriverVersion { get { @@ -37,7 +43,7 @@ public string ZWaveJSDriverVersion } private string _ZWaveJSServerVersion; - public string ZWaveJSServerVersion + public string ZWJSS_ServerVersion { get { @@ -45,47 +51,72 @@ public string ZWaveJSServerVersion } } - public static int ServerCommunicationPort = 50001; + public int ServerCommunicationPort { get; private set; } + public int ServerErrorThrottleTime { get; private set; } + private DateTime LastError; + public Controller Controller { get; internal set; } + public Utils Utils { get; internal set; } + public delegate void DriverReadyEvent(); public event DriverReadyEvent DriverReady; - public delegate void StartupError(string Message); - public event StartupError StartupErrorEvent; + + public delegate void StartupErrorEvent(string Message); + public event StartupErrorEvent StartUpError; + + public delegate void ConnectionLostEvent(string Message); + public event ConnectionLostEvent ConnectionLost; + + + public delegate bool UnexpectedHostExitEvent(); + public event UnexpectedHostExitEvent UnexpectedHostExit; + + public delegate void LoggingEventDelegate(LoggingEventArgs args); + public event LoggingEventDelegate ZWJSS_LoggingEvent; + internal void Trigger_LoggingEvent(LoggingEventArgs args) + { + ZWJSS_LoggingEvent?.Invoke(args); + } private void MapNodeEvents() { NodeEventMap.Add("check lifeline health progress", (JO) => { - int NID = JO.SelectToken("event.nodeId").Value(); - int Round = JO.SelectToken("event.round").Value(); - int Total = JO.SelectToken("event.totalRounds").Value(); - int LastRating = JO.SelectToken("event.lastRating").Value(); + int NID = JO.SelectToken("event.nodeId").ToObject(); + int Round = JO.SelectToken("event.round").ToObject(); + int Total = JO.SelectToken("event.totalRounds").ToObject(); + int LastRating = JO.SelectToken("event.lastRating").ToObject(); ZWaveNode N = this.Controller.Nodes.Get(NID); - N.Trigger_LifelineHealthCheckProgress(Round, Total, LastRating); + + Task.Run(() => + { + N.Trigger_LifelineHealthCheckProgress(Round, Total, LastRating); + }); }); NodeEventMap.Add("statistics updated", (JO) => { int NID = JO.SelectToken("event.nodeId").Value(); - NodeStatistics NS = JsonConvert.DeserializeObject(JO.SelectToken("event.statistics").ToString()); + NodeStatisticsUpdatedArgs NS = JO.SelectToken("event.statistics").ToObject(); ZWaveNode N = this.Controller.Nodes.Get(NID); - N.Trigger_StatisticsUpdated(NS); + + Task.Run(() => + { + N.Trigger_StatisticsUpdated(NS); + }); }); NodeEventMap.Add("firmware update finished", (JO) => { int NID = JO.SelectToken("event.nodeId").Value(); - int Status = JO.SelectToken("event.status").Value(); - int Wait = 0; + NodeFirmwareUpdateResultArgs Result = JO.SelectToken("event.result").ToObject(); + ZWaveNode N = this.Controller.Nodes.Get(NID); - if (JO.SelectToken("event.waitTime") != null) + Task.Run(() => { - Wait = JO.SelectToken("event.waitTime").Value(); - } - - ZWaveNode N = this.Controller.Nodes.Get(NID); - N.Trigger_FirmwareUpdateFinished(Status, Wait); + N.Trigger_FirmwareUpdateFinished(Result); + }); }); @@ -93,213 +124,408 @@ private void MapNodeEvents() NodeEventMap.Add("firmware update progress", (JO) => { int NID = JO.SelectToken("event.nodeId").Value(); - int Sent = JO.SelectToken("event.sentFragments").Value(); - int Total = JO.SelectToken("event.totalFragments").Value(); + NodeFirmwareUpdateProgressArgs Progress = JO.SelectToken("event.progress").ToObject(); ZWaveNode N = this.Controller.Nodes.Get(NID); - N.Trigger_FirmwareUpdateProgress(Sent, Total); + + Task.Run(() => + { + N.Trigger_FirmwareUpdateProgress(Progress); + }); }); NodeEventMap.Add("value updated", (JO) => { int NID = JO.SelectToken("event.nodeId").Value(); - JObject IJO = JO.SelectToken("event.args").Value(); + ValueUpdatedArgs Args = JO.SelectToken("event.args").ToObject(); ZWaveNode N = this.Controller.Nodes.Get(NID); - N.Trigger_ValueUpdated(IJO); + + Task.Run(() => + { + N.Trigger_ValueUpdated(Args); + }); }); NodeEventMap.Add("value added", (JO) => { int NID = JO.SelectToken("event.nodeId").Value(); - JObject IJO = JO.SelectToken("event.args").Value(); + ValueAddedArgs Args = JO.SelectToken("event.args").ToObject(); + ZWaveNode N = this.Controller.Nodes.Get(NID); + + Task.Run(() => + { + N.Trigger_ValueAdded(Args); + }); + }); + + NodeEventMap.Add("value removed", (JO) => + { + int NID = JO.SelectToken("event.nodeId").Value(); + ValueRemovedArgs Args = JO.SelectToken("event.args").ToObject(); ZWaveNode N = this.Controller.Nodes.Get(NID); - N.Trigger_ValueUpdated(IJO); + + Task.Run(() => + { + N.Trigger_ValueRemoved(Args); + }); }); NodeEventMap.Add("value notification", (JO) => { int NID = JO.SelectToken("event.nodeId").Value(); - JObject IJO = JO.SelectToken("event.args").Value(); + ValueNotificationArgs Args = JO.SelectToken("event.args").ToObject(); ZWaveNode N = this.Controller.Nodes.Get(NID); - N.Trigger_ValueNotification(IJO); + + Task.Run(() => + { + N.Trigger_ValueNotification(Args); + }); }); NodeEventMap.Add("notification", (JO) => { - int NID = JO.SelectToken("event.nodeId").Value(); - int CCID = JO.SelectToken("event.ccId").Value(); - JObject IJO = JO.SelectToken("event.args").Value(); + int NID = JO.SelectToken("event.nodeId").ToObject(); + int CCID = JO.SelectToken("event.ccId").ToObject(); + JObject IJO = JO.SelectToken("event.args").ToObject(); + ZWaveNode N = this.Controller.Nodes.Get(NID); + + Task.Run(() => + { + N.Trigger_Notification(CCID, IJO); + }); + }); + + NodeEventMap.Add("alive", (JO) => + { + int NID = JO.SelectToken("event.nodeId").ToObject(); ZWaveNode N = this.Controller.Nodes.Get(NID); - N.Trigger_Notification(CCID, IJO); + + Task.Run(() => + { + N.Trigger_NodeAlive(); + }); }); NodeEventMap.Add("dead", (JO) => { - int NID = JO.SelectToken("event.nodeId").Value(); + int NID = JO.SelectToken("event.nodeId").ToObject(); ZWaveNode N = this.Controller.Nodes.Get(NID); - N.Trigger_NodeDead(); + + Task.Run(() => + { + N.Trigger_NodeDead(); + }); }); NodeEventMap.Add("wake up", (JO) => { - int NID = JO.SelectToken("event.nodeId").Value(); + int NID = JO.SelectToken("event.nodeId").ToObject(); ZWaveNode N = this.Controller.Nodes.Get(NID); - N.Trigger_NodeAwake(); + + Task.Run(() => + { + N.Trigger_NodeAwake(); + }); }); NodeEventMap.Add("sleep", (JO) => { - int NID = JO.SelectToken("event.nodeId").Value(); + int NID = JO.SelectToken("event.nodeId").ToObject(); ZWaveNode N = this.Controller.Nodes.Get(NID); - N.Trigger_NodeAsleep(); + + Task.Run(() => + { + N.Trigger_NodeAsleep(); + }); }); NodeEventMap.Add("ready", (JO) => { - int NID = JO.SelectToken("event.nodeId").Value(); - ZWaveNode NNI = JsonConvert.DeserializeObject(JO.SelectToken("event.nodeState").ToString(), BoolConverter); + int NID = JO.SelectToken("event.nodeId").ToObject(); + ZWaveNode NNI = JO.SelectToken("event.nodeState").ToObject(_jsonSerializer); ZWaveNode N = this.Controller.Nodes.Get(NID); this.Controller.Nodes.ReplaceInformation(NNI, N); - N.Trigger_NodeReady(); + + Task.Run(() => + { + N.Trigger_NodeReady(); + }); }); NodeEventMap.Add("interview started", (JO) => { - int NID = JO.SelectToken("event.nodeId").Value(); + int NID = JO.SelectToken("event.nodeId").ToObject(); ZWaveNode N = this.Controller.Nodes.Get(NID); - N.Trigger_NodeInterviewStarted(); + + Task.Run(() => + { + N.Trigger_NodeInterviewStarted(); + }); }); NodeEventMap.Add("interview completed", (JO) => { - int NID = JO.SelectToken("event.nodeId").Value(); + int NID = JO.SelectToken("event.nodeId").ToObject(); ZWaveNode N = this.Controller.Nodes.Get(NID); - N.Trigger_NodeInterviewCompleted(); + + Task.Run(() => + { + N.Trigger_NodeInterviewCompleted(); + }); }); NodeEventMap.Add("interview failed", (JO) => { int NID = JO.SelectToken("event.nodeId").Value(); - NodeInterviewFailedEventArgs FII = JsonConvert.DeserializeObject(JO.SelectToken("event.args").ToString()); + NodeInterviewFailedEventArgs FII = JO.SelectToken("event.args").ToObject(); ZWaveNode N = this.Controller.Nodes.Get(NID); - N.Trigger_NodeInterviewFailed(FII); + + Task.Run(() => + { + N.Trigger_NodeInterviewFailed(FII); + }); }); } private void MapControllerEvents() { + ControllerEventMap.Add("firmware update finished", (JO) => + { + ControllerFirmwareUpdateResultArgs Result = JO.SelectToken("event.result").ToObject(); + + Task.Run(() => + { + this.Controller.Trigger_FirmwareUpdateFinished(Result); + }); + + }); + + + ControllerEventMap.Add("firmware update progress", (JO) => + { + ControllerFirmwareUpdateProgressArgs Progress = JO.SelectToken("event.progress").ToObject(); + + Task.Run(() => + { + this.Controller.Trigger_FirmwareUpdateProgress(Progress); + }); + }); + ControllerEventMap.Add("nvm backup progress", (JO) => { - int Read = JO.SelectToken("event.bytesRead").Value(); - int Total = JO.SelectToken("event.total").Value(); - this.Controller.Trigger_BackupNVMProgress(Read, Total); + int Read = JO.SelectToken("event.bytesRead").ToObject(); + int Total = JO.SelectToken("event.total").ToObject(); + + Task.Run(() => + { + this.Controller.Trigger_BackupNVMProgress(Read, Total); + }); }); ControllerEventMap.Add("nvm convert progress", (JO) => { - int Read = JO.SelectToken("event.bytesRead").Value(); - int Total = JO.SelectToken("event.total").Value(); - this.Controller.Trigger_ConvertRestoreNVMProgress(Read, Total); + int Read = JO.SelectToken("event.bytesRead").ToObject(); + int Total = JO.SelectToken("event.total").ToObject(); + + Task.Run(() => + { + this.Controller.Trigger_ConvertRestoreNVMProgress(Read, Total); + }); }); ControllerEventMap.Add("nvm restore progress", (JO) => { - int Written = JO.SelectToken("event.bytesWritten").Value(); - int Total = JO.SelectToken("event.total").Value(); - this.Controller.Trigger_RestoreNVMProgressSub(Written, Total); + int Written = JO.SelectToken("event.bytesWritten").ToObject(); + int Total = JO.SelectToken("event.total").ToObject(); + + Task.Run(() => + { + this.Controller.Trigger_RestoreNVMProgressSub(Written, Total); + }); }); ControllerEventMap.Add("statistics updated", (JO) => { - ControllerStatistics CS = JsonConvert.DeserializeObject(JO.SelectToken("event.statistics").ToString()); - this.Controller.Trigger_StatisticsUpdated(CS); + ControllerStatisticsUpdatedArgs CS = JO.SelectToken("event.statistics").ToObject(); + + Task.Run(() => + { + this.Controller.Trigger_StatisticsUpdated(CS); + }); }); ControllerEventMap.Add("inclusion aborted", (JO) => { - this.Controller.Trigger_InclusionAborted(); + Task.Run(() => + { + this.Controller.Trigger_InclusionAborted(); + }); }); ControllerEventMap.Add("inclusion started", (JO) => { - bool Secure = JO.SelectToken("event.secure").Value(); - this.Controller.Trigger_InclusionStarted(Secure); + bool Secure = JO.SelectToken("event.secure").ToObject(); + + Task.Run(() => + { + this.Controller.Trigger_InclusionStarted(Secure); + }); }); ControllerEventMap.Add("inclusion stopped", (JO) => { - this.Controller.Trigger_InclusionStopped(); + Task.Run(() => + { + this.Controller.Trigger_InclusionStopped(); + }); }); ControllerEventMap.Add("exclusion started", (JO) => { - this.Controller.Trigger_ExclusionStarted(); + Task.Run(() => + { + this.Controller.Trigger_ExclusionStarted(); + }); }); ControllerEventMap.Add("exclusion stopped", (JO) => { - this.Controller.Trigger_ExclusionStopped(); + Task.Run(() => + { + this.Controller.Trigger_ExclusionStopped(); + }); }); ControllerEventMap.Add("node removed", (JO) => { - int NID = JO.SelectToken("event.node.nodeId").Value(); + int NID = JO.SelectToken("event.node.nodeId").ToObject(); + Enums.RemoveNodeReason Reason = JO.SelectToken("event.reason").ToObject(); + ZWaveNode N = this.Controller.Nodes.Get(NID); - this.Controller.Trigger_NodeRemoved(N); - this.Controller.Nodes.RemoveNodeFromCollection(NID); + + Task.Run(() => + { + this.Controller.Trigger_NodeRemoved(N, Reason); + }); + + }); ControllerEventMap.Add("node added", (JO) => { - int NID = JO.SelectToken("event.node.nodeId").Value(); - InclusionResult IR = JsonConvert.DeserializeObject(JO.SelectToken("event.result").ToString()); + int NID = JO.SelectToken("event.node.nodeId").ToObject(); + InclusionResultArgs IR = JO.SelectToken("event.result").ToObject(); - ZWaveNode NN = new ZWaveNode(); + ZWaveNode NN = new ZWaveNode(this); NN.id = NID; this.Controller.Nodes.AddNodeToCollection(NN); - this.Controller.Trigger_NodeAdded(NN, IR); + + Task.Run(() => + { + this.Controller.Trigger_NodeAdded(NN, IR); + }); + }); - ControllerEventMap.Add("grant security classes", (JO) => + ControllerEventMap.Add("node found", (JO) => { - InclusionGrant RIG = JsonConvert.DeserializeObject(JO.SelectToken("event.requested").ToString()); - InclusionGrant SIG = this.Controller.Trigger_GrantSecurityClasses(RIG); + int NID = JO.SelectToken("event.node.nodeId").ToObject(); - Dictionary Request = new Dictionary(); - Request.Add("messageId", Guid.NewGuid().ToString()); - Request.Add("command", Enums.Commands.GrantSecurityClasses); - Request.Add("inclusionGrant", SIG); + Task.Run(() => + { + this.Controller.Trigger_NodeFound(NID); + }); - string RequestPL = Newtonsoft.Json.JsonConvert.SerializeObject(Request); - Client.SendAsync(RequestPL); }); - ControllerEventMap.Add("validate dsk and enter pin", (JO) => + ControllerEventMap.Add("grant security classes", (JO) => { - string DSK = this.Controller.Trigger_ValidateDSK(JO.SelectToken("event.dsk").Value()); + Task.Run(() => + { + InclusionGrant RIG = JO.SelectToken("event.requested").ToObject(); + InclusionGrant SIG = this.Controller.Trigger_GrantSecurityClasses(RIG); - Dictionary Request = new Dictionary(); - Request.Add("messageId", Guid.NewGuid().ToString()); - Request.Add("command", Enums.Commands.ValidateDSK); - Request.Add("pin", DSK); + Dictionary Request = new Dictionary(); + Request.Add("messageId", Guid.NewGuid().ToString()); + Request.Add("command", Enums.Commands.GrantSecurityClasses); + Request.Add("inclusionGrant", SIG); - string RequestPL = Newtonsoft.Json.JsonConvert.SerializeObject(Request); - Client.SendAsync(RequestPL); + string RequestPL = Newtonsoft.Json.JsonConvert.SerializeObject(Request); + ClientWebSocket.SendInstant(RequestPL); + }); + + }); + + ControllerEventMap.Add("validate dsk and enter pin", (JO) => + { + Task.Run(() => + { + string DSK = this.Controller.Trigger_ValidateDSK(JO.SelectToken("event.dsk").ToObject()); + + Dictionary Request = new Dictionary(); + Request.Add("messageId", Guid.NewGuid().ToString()); + Request.Add("command", Enums.Commands.ValidateDSK); + Request.Add("pin", DSK); + + string RequestPL = Newtonsoft.Json.JsonConvert.SerializeObject(Request); + ClientWebSocket.SendInstant(RequestPL); + }); + }); + + ControllerEventMap.Add("rebuild routes progress", (JO) => + { + Dictionary Progress = JO.SelectToken("event.progress").ToObject>(); + + var Pending = Progress.Where((D) => D.Value.Equals("pending")); + var Done = Progress.Where((D) => D.Value.Equals("done")); + var Skipped = Progress.Where((D) => D.Value.Equals("skipped")); + var Failed = Progress.Where((D) => D.Value.Equals("failed")); + + RebuildRoutesProgressArgs Args = new RebuildRoutesProgressArgs(); + Args.HealedNodes = Done.Select(x => Convert.ToInt32(x.Key)).ToArray(); + Args.FailedNodes = Failed.Select(x => Convert.ToInt32(x.Key)).ToArray(); + Args.SkippedNodes = Skipped.Select(x => Convert.ToInt32(x.Key)).ToArray(); + Args.PendingNodes = Pending.Select(x => Convert.ToInt32(x.Key)).ToArray(); + + Task.Run(() => + { + this.Controller.Trigger_RebuildRoutesProgress(Args); + }); }); - ControllerEventMap.Add("heal network progress", (JO) => + ControllerEventMap.Add("rebuild routes done", (JO) => { - Dictionary Progress = Newtonsoft.Json.JsonConvert.DeserializeObject>(JO.SelectToken("event.progress").ToString()); - this.Controller.Trigger_HealNetworkProgress(Progress); + Dictionary Result = JO.SelectToken("event.result").ToObject>(); + + var Done = Result.Where((D) => D.Value.Equals("done")); + var Skipped = Result.Where((D) => D.Value.Equals("skipped")); + var Failed = Result.Where((D) => D.Value.Equals("failed")); + + RebuildRoutesDoneArgs Args = new RebuildRoutesDoneArgs(); + Args.HealedNodes = Done.Select(x => Convert.ToInt32(x.Key)).ToArray(); + Args.FailedNodes = Failed.Select(x => Convert.ToInt32(x.Key)).ToArray(); + Args.SkippedNodes = Skipped.Select(x => Convert.ToInt32(x.Key)).ToArray(); + + Task.Run(() => + { + this.Controller.Trigger_RebuildRoutesDone(Args); + }); + }); + } - ControllerEventMap.Add("heal network done", (JO) => + private void MapServerEvents() + { + DriverEventMap.Add("logging", (JO) => { - Dictionary Result = Newtonsoft.Json.JsonConvert.DeserializeObject>(JO.SelectToken("event.result").ToString()); - this.Controller.Trigger_HealNetworkDone(Result); + LoggingEventArgs Args = JO.SelectToken("event").ToObject(); + Task.Run(() => + { + Trigger_LoggingEvent(Args); + }); }); } @@ -310,167 +536,209 @@ private void MapEvents() ControllerEventMap = new Dictionary>(); MapControllerEvents(); - } - - + DriverEventMap = new Dictionary>(); + MapServerEvents(); + } + // Client Mode - public Driver(Uri Server, int SchemaVersion = 0) + public Driver(Uri Server, int SchemaVersion = 0, int ServerErrorThrottleTime = 10000) { + Newtonsoft.Json.JsonConvert.DefaultSettings = () => new JsonSerializerSettings + { + NullValueHandling = NullValueHandling.Ignore + }; + + var settings = new JsonSerializerSettings + { + NullValueHandling = NullValueHandling.Ignore + }; + settings.Converters.Add(new ZWJSSJsonConverter(this)); + _jsonSerializer = JsonSerializer.Create(settings); + if (SchemaVersion > 0) { - SchemaVersionID = SchemaVersion; + SchemaVersionID = new Semver.SemVersion(1, SchemaVersion, 0); } Callbacks = new Dictionary>(); MapEvents(); - BoolConverter = new CustomBooleanJsonConverter(); - - + this.WSAddress = Server; this.Host = false; + this.ServerErrorThrottleTime = ServerErrorThrottleTime; InternalPrep(); - } // Host Mode - public Driver(string SerialPort, ZWaveOptions Options) + public Driver(string SerialPort, ZWaveOptions Options, int ServerCommunicationPort = 50001, int ServerErrorThrottleTime = 10000) { - Callbacks = new Dictionary>(); - MapEvents(); - BoolConverter = new CustomBooleanJsonConverter(); + if (UsedPorts.Contains(ServerCommunicationPort)) + { + throw new Exception(string.Format("Web Socket Port: {0} already in use", ServerCommunicationPort)); + } + + UsedPorts.Add(ServerCommunicationPort); + + Newtonsoft.Json.JsonConvert.DefaultSettings = () => new JsonSerializerSettings + { + NullValueHandling = NullValueHandling.Ignore + }; - Server.FatalError += Server_FatalError; + var settings = new JsonSerializerSettings + { + NullValueHandling = NullValueHandling.Ignore + }; + settings.Converters.Add(new ZWJSSJsonConverter(this)); + _jsonSerializer = JsonSerializer.Create(settings); + Callbacks = new Dictionary>(); + MapEvents(); + this.SerialPort = SerialPort; this.Options = Options; - this.WSAddress = new Uri("ws://127.0.0.1:" + ServerCommunicationPort); + this.ServerCommunicationPort = ServerCommunicationPort; + this.WSAddress = new Uri("ws://localhost:" + ServerCommunicationPort); this.Host = true; + this.ServerErrorThrottleTime = ServerErrorThrottleTime; + this._server = new Server(); InternalPrep(); - } - - - // Proces Message - private void WebsocketClient_MessageReceived(object sender, WatsonWebsocket.MessageReceivedEventArgs e) + // Prep + private void InternalPrep() { - if (e.MessageType == WebSocketMessageType.Text) + if (this.Host) { - string Content = System.Text.Encoding.UTF8.GetString(e.Data); - if (System.Diagnostics.Debugger.IsAttached) - { - System.Diagnostics.Debug.WriteLine(Content); - } + _server.Start(SerialPort, Options, ServerCommunicationPort); + _server.Exited += Server_Exited; + _server.FatalError += Server_FatalError; + } - JObject JO = JObject.Parse(Content); + var Factory = new Func(() => new ClientWebSocket + { + Options = { KeepAliveInterval = TimeSpan.FromSeconds(5) } + }); - string Type = JO.Value("type"); - Guid MessageID = JO.ContainsKey("messageId") ? Guid.Parse(JO.Value("messageId")) : Guid.Empty; + ClientWebSocket = new Websocket.Client.WebsocketClient(this.WSAddress, Factory); + - if (MessageID != Guid.Empty) + ClientWebSocket.MessageReceived.Subscribe((Message) => + { + WebsocketClient_MessageReceived(ClientWebSocket, Message); + }); + + ClientWebSocket.DisconnectionHappened.Subscribe((DisconnectionInfo) => + { + if (!RequestedExit) { - if (Callbacks.ContainsKey(MessageID)) + if (LastError == DateTime.MinValue || (DateTime.Now - LastError).TotalMilliseconds > ServerErrorThrottleTime) { - // Guard against race condition - try + LastError = DateTime.Now; + + if (!Inited) { - Callbacks[MessageID].Invoke(JO); - Callbacks.Remove(MessageID); + StartUpError?.Invoke($"Could not connect to the server, Connection will continue to try: {DisconnectionInfo?.Exception?.Message}"); + } + else + { + ConnectionLost?.Invoke($"Connection to the server was lost. Connection will attempt to be restored: {DisconnectionInfo?.Exception?.Message}"); } - catch (Exception Error) { } - } - - return; } + - if (Type == "version") - { - _ZWaveJSDriverVersion = JO.Value("driverVersion"); - _ZWaveJSServerVersion = JO.Value("serverVersion"); - - Guid CBID = Guid.NewGuid(); - Callbacks.Add(CBID, SetAPIVersionCB); - - Dictionary Request = new Dictionary(); - Request.Add("messageId", CBID.ToString()); - Request.Add("command", Enums.Commands.SetAPIVersion); - Request.Add("schemaVersion", SchemaVersionID); + }); - string RequestPL = Newtonsoft.Json.JsonConvert.SerializeObject(Request); + ClientWebSocket.ReconnectTimeout = null; + ClientWebSocket.ErrorReconnectTimeout = TimeSpan.FromSeconds(1); - Client.SendAsync(RequestPL); + } - return; - } + // OBSOLETE + // Server Process Exit + private void Server_Exited() + { - if (Type == "event") + if (!RequestedExit) + { + Inited = false; + Controller.Nodes = null; + Controller = null; + + DestroySocket(); + SettleCallbacksError(); + + if(UnexpectedHostExit != null) { - string _Source = JO.SelectToken("event.source").Value(); - string _Event = JO.SelectToken("event.event").Value(); - - switch (_Source) + if (UnexpectedHostExit.Invoke()) { - case "node": - if (NodeEventMap.ContainsKey(_Event)) - { - NodeEventMap[_Event].Invoke(JO); - } - break; - - case "controller": - if (ControllerEventMap.ContainsKey(_Event)) - { - ControllerEventMap[_Event].Invoke(JO); - } - break; - + Restart(); } - return; } + + } } + + // Start Driver + public void Start() + { + RequestedExit = false; + ClientWebSocket.Start(); + } - public void Destroy() + private void DestroySocket() { - if (Client != null) + if (ClientWebSocket != null) { - Client.MessageReceived -= WebsocketClient_MessageReceived; - Client.ServerDisconnected -= Client_ServerDisconnected; - if (Client.Connected) + if (ClientWebSocket.IsRunning) { - Client.Stop(); + ClientWebSocket.Stop(WebSocketCloseStatus.NormalClosure, "Destroy"); } - Client.Dispose(); - Client = null; - } - - Server.Terminate(); + if (Host) + { + UsedPorts.Remove(WSAddress.Port); + } + ClientWebSocket.Dispose(); + ClientWebSocket = null; + } + } + private void DestroyServer() + { + _server?.Terminate(); } - private void InternalPrep() + public void Destroy() { - if (this.Host) + RequestedExit = true; + Inited = false; + if(Controller != null) { - Server.Start(SerialPort, Options, ServerCommunicationPort); + Controller.Nodes = null; // Is this necessary? + Controller = null; } + + DestroySocket(); + DestroyServer(); + } - Client = new WatsonWebsocket.WatsonWsClient(this.WSAddress); - Client.KeepAliveInterval = 15; - Client.MessageReceived += WebsocketClient_MessageReceived; - Client.ServerDisconnected += Client_ServerDisconnected; - Client.EnableStatistics = false; + async internal void Restart() + { + Destroy(); + await Task.Delay(5000); + InternalPrep(); + Start(); } - private void Client_ServerDisconnected(object sender, EventArgs e) + private void SettleCallbacksError() { // Signal waiting callbacks Guid[] Keys = Callbacks.Keys.ToArray(); @@ -479,7 +747,7 @@ private void Client_ServerDisconnected(object sender, EventArgs e) JObject JO = new JObject(); JO.Add("success", false); JO.Add("zwaveErrorCode", Enums.ErrorCodes.WSConnectionError); - JO.Add("zwaveErrorMessage", "The Connection to the Server was interrupted. It is unknown if the command was successfull, assuming false. The connection will be restored."); + JO.Add("zwaveErrorMessage", "The Server process unexpectedly terminted. It is unknown if the command was successfull, assuming false. Subscribe to the 'UnexpectedHostExit' event of the driver to restart the Driver Runtime"); // Guard against race condition try @@ -487,42 +755,25 @@ private void Client_ServerDisconnected(object sender, EventArgs e) Callbacks[ID].Invoke(JO); Callbacks.Remove(ID); } - catch(Exception Error) + catch (Exception Error) { continue; } } - Restart(); - - } - - // Start Driver - public async void Start() - { - await Client.StartWithTimeoutAsync(60); - } - - async internal void Restart() - { - Destroy(); - - await Task.Delay(5000); - InternalPrep(); - Start(); } - + private void Server_FatalError() { - Destroy(); - StartupErrorEvent?.Invoke("Fatal ZWave Server Error."); + RequestedExit = true; + Inited = false; + Controller.Nodes = null; + Controller = null; + DestroySocket(); + DestroyServer(); + StartUpError?.Invoke("Fatal ZWave Server Error."); } - - - - - - + private void SetAPIVersionCB(JObject JO) { if (JO.Value("success")) @@ -536,7 +787,7 @@ private void SetAPIVersionCB(JObject JO) string RequestPL = Newtonsoft.Json.JsonConvert.SerializeObject(Request); - Client.SendAsync(RequestPL); + ClientWebSocket.SendInstant(RequestPL); } else { @@ -544,7 +795,10 @@ private void SetAPIVersionCB(JObject JO) switch (ErrorCode) { case "schema_incompatible": - StartupErrorEvent?.Invoke("Client and Server schema mismatch"); + RequestedExit = true; + DestroySocket(); + DestroyServer(); + StartUpError?.Invoke("Client and Server schema mismatch"); break; } @@ -558,9 +812,11 @@ private void StartListetningCB(JObject JO) { if (JO.Value("success")) { - Controller C = JsonConvert.DeserializeObject(JO.SelectToken("result.state.controller").ToString()); - C._Driver = this; - ZWaveNode[] Nodes = JsonConvert.DeserializeObject(JO.SelectToken("result.state.nodes").ToString(), BoolConverter); + Controller C = JO.SelectToken("result.state.controller").ToObject(_jsonSerializer); + + + ZWaveNode[] Nodes = JO.SelectToken("result.state.nodes").ToObject(_jsonSerializer); + C.deviceConfig = Nodes.FirstOrDefault((N) => N.isControllerNode).deviceConfig; Nodes = Nodes.Where((N) => !N.isControllerNode).ToArray(); this.Controller = C; @@ -568,9 +824,210 @@ private void StartListetningCB(JObject JO) Inited = true; + this.Utils = new Utils(this); + DriverReady?.Invoke(); } } } + + public Task ZWJSS_StartListeningLogs() + { + Guid ID = Guid.NewGuid(); + + TaskCompletionSource Result = new TaskCompletionSource(); + + Callbacks.Add(ID, (JO) => + { + CMDResult Res = new CMDResult(JO); + Result.SetResult(Res); + }); + + Dictionary Request = new Dictionary(); + + Request.Add("messageId", ID); + Request.Add("command", Enums.Commands.StartListeningLogs); + + string RequestPL = Newtonsoft.Json.JsonConvert.SerializeObject(Request); + ClientWebSocket.SendInstant(RequestPL); + + return Result.Task; + } + + public Task ZWJSS_StopListeningLogs() + { + Guid ID = Guid.NewGuid(); + + TaskCompletionSource Result = new TaskCompletionSource(); + + Callbacks.Add(ID, (JO) => + { + CMDResult Res = new CMDResult(JO); + Result.SetResult(Res); + }); + + Dictionary Request = new Dictionary(); + + Request.Add("messageId", ID); + Request.Add("command", Enums.Commands.StopListeningLogs); + + string RequestPL = Newtonsoft.Json.JsonConvert.SerializeObject(Request); + ClientWebSocket.SendInstant(RequestPL); + + return Result.Task; + } + + public Task HardReset() + { + Guid ID = Guid.NewGuid(); + + TaskCompletionSource Result = new TaskCompletionSource(); + + Callbacks.Add(ID, (JO) => + { + CMDResult Res = new CMDResult(JO); + Result.SetResult(Res); + + Restart(); + }); + + Dictionary Request = new Dictionary(); + + Request.Add("messageId", ID); + Request.Add("command", Enums.Commands.HardReset); + + string RequestPL = Newtonsoft.Json.JsonConvert.SerializeObject(Request); + ClientWebSocket.SendInstant(RequestPL); + + return Result.Task; + } + + public Task SoftReset() + { + Guid ID = Guid.NewGuid(); + + TaskCompletionSource Result = new TaskCompletionSource(); + + Callbacks.Add(ID, (JO) => + { + CMDResult Res = new CMDResult(JO); + Result.SetResult(Res); + }); + + Dictionary Request = new Dictionary(); + + Request.Add("messageId", ID); + Request.Add("command", Enums.Commands.SoftReset); + + string RequestPL = Newtonsoft.Json.JsonConvert.SerializeObject(Request); + ClientWebSocket.SendInstant(RequestPL); + + return Result.Task; + } + + // Proces Message + private void WebsocketClient_MessageReceived(object sender, ResponseMessage Message) + { + + + if (System.Diagnostics.Debugger.IsAttached) + { + System.Diagnostics.Debug.WriteLine(Message.Text); + + } + + if (Message.MessageType == WebSocketMessageType.Text) + { + string Content = Message.Text; + + JObject JO = JObject.Parse(Content); + + string Type = JO.Value("type"); + Guid MessageID = JO.ContainsKey("messageId") ? Guid.Parse(JO.Value("messageId")) : Guid.Empty; + + if (MessageID != Guid.Empty) + { + if (Callbacks.ContainsKey(MessageID)) + { + // Guard against race condition + try + { + Callbacks[MessageID].Invoke(JO); + Callbacks.Remove(MessageID); + } + catch (Exception Error) { } + + } + + return; + } + + if (Type == "version") + { + _ZWaveJSDriverVersion = JO.Value("driverVersion"); + _ZWaveJSServerVersion = JO.Value("serverVersion"); + + if (Semver.SemVersion.Parse(_ZWaveJSServerVersion, Semver.SemVersionStyles.Strict).Major != SchemaVersionID.Major) + { + StartUpError?.Invoke("The Server Schema version is not compatible with the library version"); + return; + } + + if (Semver.SemVersion.Parse(_ZWaveJSServerVersion, Semver.SemVersionStyles.Strict).ComparePrecedenceTo(SchemaVersionID) < 0) + { + StartUpError?.Invoke("The Server Schema version is lower than what was requested by the library"); + return; + + } + + Guid CBID = Guid.NewGuid(); + Callbacks.Add(CBID, SetAPIVersionCB); + + Dictionary Request = new Dictionary(); + Request.Add("messageId", CBID.ToString()); + Request.Add("command", Enums.Commands.SetAPIVersion); + Request.Add("schemaVersion", SchemaVersionID.Minor); + + string RequestPL = Newtonsoft.Json.JsonConvert.SerializeObject(Request); + + ClientWebSocket.SendInstant(RequestPL); + + return; + } + + if (Type == "event") + { + string _Source = JO.SelectToken("event.source").Value(); + string _Event = JO.SelectToken("event.event").Value(); + + switch (_Source) + { + case "node": + if (NodeEventMap.ContainsKey(_Event)) + { + NodeEventMap[_Event].Invoke(JO); + } + break; + + case "controller": + if (ControllerEventMap.ContainsKey(_Event)) + { + ControllerEventMap[_Event].Invoke(JO); + } + break; + + case "driver": + if (DriverEventMap.ContainsKey(_Event)) + { + DriverEventMap[_Event].Invoke(JO); + } + break; + + } + return; + } + } + } + } } diff --git a/Visual Studio Projects/ZWaveJS.NET/ZWaveJS.NET/Endpoint.cs b/Visual Studio Projects/ZWaveJS.NET/ZWaveJS.NET/Endpoint.cs index 644992a..45bc3b0 100644 --- a/Visual Studio Projects/ZWaveJS.NET/ZWaveJS.NET/Endpoint.cs +++ b/Visual Studio Projects/ZWaveJS.NET/ZWaveJS.NET/Endpoint.cs @@ -8,20 +8,24 @@ namespace ZWaveJS.NET { public class Endpoint { - internal Endpoint() { } - + private Driver _driver; + internal Endpoint(Driver driver = null) + { + _driver = driver; + } + // CHECKED public Task SupportsCCAPI(int CommandClass) { Guid ID = Guid.NewGuid(); TaskCompletionSource Result = new TaskCompletionSource(); - Driver.Callbacks.Add(ID, (JO) => + _driver.Callbacks.Add(ID, (JO) => { CMDResult Res = new CMDResult(JO); if (Res.Success) { - Res.SetPayload(JO.SelectToken("result.supported").Value()); + Res.SetPayload(JO.SelectToken("result.supported").ToObject()); } Result.SetResult(Res); @@ -36,22 +40,24 @@ public Task SupportsCCAPI(int CommandClass) Request.Add("commandClass", CommandClass); string RequestPL = JsonConvert.SerializeObject(Request); - Driver.Client.SendAsync(RequestPL); + _driver.ClientWebSocket.SendInstant(RequestPL); return Result.Task; } + + // CHECKED public Task InvokeCCAPI(int CommandClass, string Method, params object[] Params) { Guid ID = Guid.NewGuid(); TaskCompletionSource Result = new TaskCompletionSource(); - Driver.Callbacks.Add(ID, (JO) => + _driver.Callbacks.Add(ID, (JO) => { CMDResult Res = new CMDResult(JO); if (Res.Success) { - Res.SetPayload(JsonConvert.DeserializeObject(JO.SelectToken("result").ToString())); + Res.SetPayload(JO.SelectToken("result").ToObject()); } Result.SetResult(Res); @@ -69,7 +75,7 @@ public Task InvokeCCAPI(int CommandClass, string Method, params objec string RequestPL = JsonConvert.SerializeObject(Request); - Driver.Client.SendAsync(RequestPL); + _driver.ClientWebSocket.SendInstant(RequestPL); return Result.Task; } @@ -86,5 +92,7 @@ public Task InvokeCCAPI(int CommandClass, string Method, params objec public DeviceClass deviceClass { get; internal set; } [Newtonsoft.Json.JsonProperty] public CommandClass[] commandClasses { get; internal set; } + [Newtonsoft.Json.JsonProperty] + public string endpointLabel { get; internal set; } } } diff --git a/Visual Studio Projects/ZWaveJS.NET/ZWaveJS.NET/Enums.cs b/Visual Studio Projects/ZWaveJS.NET/ZWaveJS.NET/Enums.cs index 842a6d0..e12247d 100644 --- a/Visual Studio Projects/ZWaveJS.NET/ZWaveJS.NET/Enums.cs +++ b/Visual Studio Projects/ZWaveJS.NET/ZWaveJS.NET/Enums.cs @@ -1,19 +1,112 @@ -using System; -using System.Collections.Generic; -using System.Text; - -namespace ZWaveJS.NET +namespace ZWaveJS.NET { public class Enums { - internal enum Platform + public enum ProvisioningEntryStatus + { + Active = 0, + Inactive = 1, + } + public enum QRCodeVersion + { + S2 = 0, + SmartStart = 1, + } + + public enum Protocols + { + ZWave = 0, + ZWaveLongRange = 1, + } + + public enum ConfigValueFormat + { + SignedInteger = 0x00, + UnsignedInteger = 0x01, + Enumerated = 0x02, + BitField = 0x03 + } + + public enum SetValueStatus + { + + NoDeviceSupport = 0x00, + Working = 0x01, + Fail = 0x02, + EndpointNotFound = 0x03, + NotImplemented = 0x04, + InvalidValue = 0x05, + SuccessUnsupervised = 0xfe, + Success = 0xff + } + + + public enum UsageEnvironment + { + Non_Commercial, + Commercial + + } + + public enum RFRegion + { + Europe = 0x00, + USA = 0x01, + Australia_NewZealand = 0x02, + Hong_Kong = 0x03, + India = 0x05, + Israel = 0x06, + Russia = 0x07, + China = 0x08, + USA_Long_Range = 0x09, + Japan = 0x20, + Korea = 0x21, + Unknown = 0xfe, + EU = 0xff, + } + + public enum NodeFirmwareUpdateStatus + { + Error_Timeout = -1, + Error_Checksum = 0, + Error_TransmissionFailed = 1, + Error_InvalidManufacturerID = 2, + Error_InvalidFirmwareID = 3, + Error_InvalidFirmwareTarget = 4, + Error_InvalidHeaderInformation = 5, + Error_InvalidHeaderFormat = 6, + Error_InsufficientMemory = 7, + Error_InvalidHardwareVersion = 8, + OK_WaitingForActivation = 0xfd, + OK_NoRestart = 0xfe, + OK_RestartPending = 0xff, + } + + public enum ControllerFirmwareUpdateStatus + { + Error_Timeout = 0, + Error_RetryLimitReached, + Error_Aborted, + Error_NotSupported, + OK = 0xff + } + + public enum SecurityBootstrapFailure { - Windows, - Linux, - LinuxARM, - Mac + UserCanceled, + NoKeysConfigured, + S2NoUserCallbacks, + Timeout, + ParameterMismatch, + NodeCanceled, + S2IncorrectPIN, + S2WrongSecurityLevel, + S0Downgrade, + Unknown } + + internal class ErrorCodes { public const string MissingS2Callbacks = "ZWJS.NET.ERR.001"; @@ -21,11 +114,13 @@ internal class ErrorCodes public const string MissingKeys = "ZWJS.NET.ERR.003"; public const string InvalidkeyLength = "ZWJS.NET.ERR.004"; public const string WSConnectionError = "ZWJS.NET.ERR.005"; + public const string CommercialAPIKey = "ZWJS.NET.ERR.006"; + public const string WrongOverride = "ZWJS.NET.ERR.007"; } internal class Commands { - + public const string RemoveAssociations = "controller.remove_associations"; public const string AddAssociations = "controller.add_associations"; public const string GetAssociationGroups = "controller.get_association_groups"; @@ -38,6 +133,9 @@ internal class Commands public const string SetValue = "node.set_value"; public const string GetValue = "node.get_value"; public const string PollValue = "node.poll_value"; + public const string SetRawConfigParameterValue = "node.set_raw_config_parameter_value"; + public const string RefreshValues = "node.refresh_values"; + public const string RefreshCCValues = "node.refresh_cc_values"; public const string GetDefinedValueIDs = "node.get_defined_value_ids"; public const string GetValueMetadata = "node.get_value_metadata"; public const string BeginInclusion = "controller.begin_inclusion"; @@ -49,15 +147,15 @@ internal class Commands public const string GrantSecurityClasses = "controller.grant_security_classes"; public const string ValidateDSK = "controller.validate_dsk_and_enter_pin"; public const string RefreshInfo = "node.refresh_info"; - public const string BeginHealingNetwork = "controller.begin_healing_network"; - public const string StopHealingNetwork = "controller.stop_healing_network"; - public const string HealNode = "controller.heal_node"; + public const string BeginRebuildingRoutes = "controller.begin_rebuilding_routes"; + public const string StopRebuildingRoutes = "controller.stop_rebuilding_routes"; + public const string RebuildNodeRoutes = "controller.rebuild_node_routes"; public const string SetName = "node.set_name"; public const string SetLocation = "node.set_location"; public const string KeepNodeAwake = "node.set_keep_awake"; public const string RemoveFailedNode = "controller.remove_failed_node"; public const string ReplaceFailedNode = "controller.replace_failed_node"; - public const string BeginFirmwareUpdate = "node.begin_firmware_update"; + public const string UpdateFirmware = "node.update_firmware"; public const string AbortFirmwareUpdate = "node.abort_firmware_update"; public const string HasSecurityClass = "node.has_security_class"; public const string GetHighestSecurityClass = "node.get_highest_security_class"; @@ -70,6 +168,21 @@ internal class Commands public const string MCGetDefinedValueIDs = "multicast_group.get_defined_value_ids"; public const string MCSupportsCCAPI = "multicast_group.supports_cc_api"; public const string MCInvokeCCAPI = "multicast_group.invoke_cc_api"; + public const string StartListeningLogs = "start_listening_logs"; + public const string StopListeningLogs = "stop_listening_logs"; + public const string WaitForWakeUp = "node.wait_for_wakeup"; + public const string Interview = "node.interview"; + public const string FirmwareUpdateOTW = "controller.firmware_update_otw"; + public const string SetRFRegion = "controller.set_rf_region"; + public const string GetRFRegion = "controller.get_rf_region"; + public const string SetPowerlevel = "controller.set_powerlevel"; + public const string GetPowerlevel = "controller.get_powerlevel"; + public const string Ping = "node.ping"; + public const string GetAvailableFirmwareUpdates = "controller.get_available_firmware_updates"; + public const string FirmwareUpdateOTA = "controller.firmware_update_ota"; + public const string HardReset = "driver.hard_reset"; + public const string SoftReset = "driver.soft_reset"; + public const string ParseQRCodeString = "utils.parse_qr_code_string"; } public enum SecurityClass @@ -101,6 +214,24 @@ public enum NodeStatus Alive } + public enum RemoveNodeReason + { + Excluded, + ProxyExcluded, + RemoveFailed, + Replaced, + ProxyReplaced, + Reset, + SmartStartFailed, + } + + public enum ExclusionStrategy + { + ExcludeOnly, + DisableProvisioningEntry, + Unprovision + } + public enum InclusionStrategy { Default = 0, diff --git a/Visual Studio Projects/ZWaveJS.NET/ZWaveJS.NET/Helpers.cs b/Visual Studio Projects/ZWaveJS.NET/ZWaveJS.NET/Helpers.cs deleted file mode 100644 index ebf4afe..0000000 --- a/Visual Studio Projects/ZWaveJS.NET/ZWaveJS.NET/Helpers.cs +++ /dev/null @@ -1,93 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Text; -using System.IO; -using System.Threading.Tasks; -using System.Net; -using System.Reflection; - -namespace ZWaveJS.NET -{ - public class Helpers - { - private const string MacOSBinary = "server-macos.psi"; - private const string WinBinary = "server-win.psi"; - private const string UnixBinary = "server-ubuntu.psi"; - private const string UnixBinaryARM = "server-debian-arm.psi"; - - internal static Enums.Platform RunningPlatform() - { - switch (Environment.OSVersion.Platform) - { - case PlatformID.Unix: - if (Directory.Exists("/Applications") && Directory.Exists("/System") && Directory.Exists("/Users") && Directory.Exists("/Library")) - { - return Enums.Platform.Mac; - } - else if (typeof(string).Assembly.GetName().ProcessorArchitecture == ProcessorArchitecture.Arm) - { - return Enums.Platform.LinuxARM; - } - else - { - return Enums.Platform.Linux; - } - - case PlatformID.MacOSX: - return Enums.Platform.Mac; - - default: - return Enums.Platform.Windows; - } - } - - - - public static Task DownloadPSI(bool Force = false) - { - ServicePointManager.SecurityProtocol = SecurityProtocolType.Tls12; - - TaskCompletionSource Result = new TaskCompletionSource(); - if (!File.Exists("server.psi") || Force) - { - Version V = Assembly.GetExecutingAssembly().GetName().Version; - string URI = "https://github.com/zwave-js/ZWaveJS.NET/releases/download/{VER}/{FN}"; - URI = URI.Replace("{VER}", string.Format("v{0}.{1}.{2}",V.Major,V.Minor,V.Build)); - switch (RunningPlatform()) - { - case Enums.Platform.Windows: - URI = URI.Replace("{FN}", WinBinary); - break; - - case Enums.Platform.Mac: - URI = URI.Replace("{FN}", MacOSBinary); - break; - - case Enums.Platform.Linux: - URI = URI.Replace("{FN}", UnixBinary); - break; - - case Enums.Platform.LinuxARM: - URI = URI.Replace("{FN}", UnixBinaryARM); - break; - } - - using (WebClient WC = new WebClient()) - { - WC.DownloadFileCompleted += (s, e) => - { - Result.SetResult(true); - }; - WC.DownloadFileAsync(new Uri(URI), "server.psi"); - } - - } - else - { - Result.SetResult(true); - } - - return Result.Task; - } - } -} diff --git a/Visual Studio Projects/ZWaveJS.NET/ZWaveJS.NET/MethodFactory.cs b/Visual Studio Projects/ZWaveJS.NET/ZWaveJS.NET/MethodFactory.cs new file mode 100644 index 0000000..378d7ce --- /dev/null +++ b/Visual Studio Projects/ZWaveJS.NET/ZWaveJS.NET/MethodFactory.cs @@ -0,0 +1,113 @@ +using Newtonsoft.Json; +using Newtonsoft.Json.Linq; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace ZWaveJS.NET +{ + public class MethodFactory + { + public static Func, Task> CreateVOID(Driver Runtime, string ServerMethod) + { + return (x) => Execute(Runtime, ServerMethod, x); + } + + public static Func, Task> CreatePRIMITIVE(Driver Runtime, string ServerMethod, string ObjectPath) + { + return (x) => Execute(Runtime, ServerMethod, x, ObjectPath); + } + + public static Func, Task> CreateCLASS(Driver Runtime, string ServerMethod, Type MappedClass, string ObjectPath) + { + return (x) => Execute(Runtime, ServerMethod, x,MappedClass, ObjectPath); + } + + private static Task Execute(Driver Runtime, string ServerMethod, Dictionary Args, string ObjectPath) + { + Guid ID = Guid.NewGuid(); + + TaskCompletionSource Result = new TaskCompletionSource(); + + Runtime.Callbacks.Add(ID, (JO) => + { + CMDResult Res = new CMDResult(JO); + if (Res.Success) + { + object Obj = JO.SelectToken(ObjectPath).ToObject(); + Res.SetPayload(Obj); + } + Result.SetResult(Res); + + }); + + Args.Remove("messageId"); + Args.Remove("command"); + + Args.Add("messageId", ID); + Args.Add("command", ServerMethod); + + string RequestPL = Newtonsoft.Json.JsonConvert.SerializeObject(Args); + Runtime.ClientWebSocket.SendInstant(RequestPL); + + return Result.Task; + } + + private static Task Execute(Driver Runtime, string ServerMethod, Dictionary Args, Type MappedClass, string ObjectPath) + { + Guid ID = Guid.NewGuid(); + + TaskCompletionSource Result = new TaskCompletionSource(); + + Runtime.Callbacks.Add(ID, (JO) => + { + CMDResult Res = new CMDResult(JO); + if (Res.Success) + { + object Obj = JO.SelectToken(ObjectPath).ToObject(MappedClass); + Res.SetPayload(Obj); + } + Result.SetResult(Res); + + }); + + Args.Remove("messageId"); + Args.Remove("command"); + + Args.Add("messageId", ID); + Args.Add("command", ServerMethod); + + string RequestPL = Newtonsoft.Json.JsonConvert.SerializeObject(Args); + Runtime.ClientWebSocket.SendInstant(RequestPL); + + return Result.Task; + } + + private static Task Execute(Driver Runtime, string ServerMethod, Dictionary Args) + { + Guid ID = Guid.NewGuid(); + + TaskCompletionSource Result = new TaskCompletionSource(); + + Runtime.Callbacks.Add(ID, (JO) => + { + CMDResult Res = new CMDResult(JO); + Result.SetResult(Res); + + }); + + Args.Remove("messageId"); + Args.Remove("command"); + + Args.Add("messageId", ID); + Args.Add("command", ServerMethod); + + string RequestPL = Newtonsoft.Json.JsonConvert.SerializeObject(Args); + Runtime.ClientWebSocket.SendInstant(RequestPL); + + return Result.Task; + } + } +} diff --git a/Visual Studio Projects/ZWaveJS.NET/ZWaveJS.NET/NodesCollection.cs b/Visual Studio Projects/ZWaveJS.NET/ZWaveJS.NET/NodesCollection.cs index f2e5ab2..5efd233 100644 --- a/Visual Studio Projects/ZWaveJS.NET/ZWaveJS.NET/NodesCollection.cs +++ b/Visual Studio Projects/ZWaveJS.NET/ZWaveJS.NET/NodesCollection.cs @@ -1,7 +1,7 @@ -using System; -using System.Linq; +using System.Linq; using System.Collections.Generic; using System.Reflection; + namespace ZWaveJS.NET { public class NodesCollection diff --git a/Visual Studio Projects/ZWaveJS.NET/ZWaveJS.NET/Server.cs b/Visual Studio Projects/ZWaveJS.NET/ZWaveJS.NET/Server.cs index 11c3ba1..eb648b4 100644 --- a/Visual Studio Projects/ZWaveJS.NET/ZWaveJS.NET/Server.cs +++ b/Visual Studio Projects/ZWaveJS.NET/ZWaveJS.NET/Server.cs @@ -1,34 +1,54 @@ using System; using System.Diagnostics; using System.IO; -using System.Reflection; -using System.Threading.Tasks; +using System.Net.Sockets; using Newtonsoft.Json; + namespace ZWaveJS.NET { internal class Server { - private static Process ServerProcess; + + + private Process ServerProcess; + + internal delegate void FatalErrorEvent(); + internal event FatalErrorEvent FatalError; - public delegate void FatalErrorEvent(); - public static event FatalErrorEvent FatalError; + internal delegate void ProcessdExitedEvent(); + internal event ProcessdExitedEvent Exited; - internal static void Terminate() + internal void Terminate() { if (ServerProcess != null && !ServerProcess.HasExited) { ServerProcess.StandardInput.WriteLine("KILL"); + ServerProcess.Dispose(); } } - internal static void Start(string SerialPort, ZWaveOptions Config, int WSPort) + internal void Start(string SerialPort, ZWaveOptions Config, int WSPort) { + + + string ProcessName = string.Format("server.{0}.psi", WSPort); + + Process[] Zombies = Process.GetProcessesByName(ProcessName); + foreach(Process Zombie in Zombies) + { + Zombie.Kill(); + Zombie.WaitForExit(); + File.Delete(ProcessName); + } + if (!File.Exists("server.psi")) { - throw new FileNotFoundException("No Platform Snapshot Image found (server.psi)"); + throw new FileNotFoundException("No Platform Snapshot Image (server.psi) found"); } + File.Copy("server.psi",ProcessName, true); + JsonSerializerSettings JSS = new JsonSerializerSettings(); JSS.NullValueHandling = NullValueHandling.Ignore; string _Config = JsonConvert.SerializeObject(Config, JSS); @@ -36,26 +56,35 @@ internal static void Start(string SerialPort, ZWaveOptions Config, int WSPort) ProcessStartInfo PSI = new ProcessStartInfo(); PSI.RedirectStandardError = true; PSI.RedirectStandardInput = true; - + PSI.EnvironmentVariables.Add("CONFIG", _Config); PSI.EnvironmentVariables.Add("SERIAL_PORT", SerialPort); PSI.EnvironmentVariables.Add("WS_PORT", WSPort.ToString()); - - PSI.FileName = "server.psi"; + PSI.EnvironmentVariables.Add("NODE_ENV", "production"); + + PSI.FileName = ProcessName; PSI.UseShellExecute = false; +#if !DEBUG PSI.WindowStyle = ProcessWindowStyle.Hidden; PSI.CreateNoWindow = true; +#endif ServerProcess = new Process(); ServerProcess.EnableRaisingEvents = true; ServerProcess.ErrorDataReceived += ServerProcess_ErrorDataReceived; + ServerProcess.Exited += ServerProcess_Exited; + ServerProcess.StartInfo = PSI; ServerProcess.Start(); ServerProcess.BeginErrorReadLine(); } + private void ServerProcess_Exited(object sender, EventArgs e) + { + // Exited?.Invoke(); I think this will be indirectly handled by the socket client now + ServerProcess.Dispose(); + } - - private static void ServerProcess_ErrorDataReceived(object sender, DataReceivedEventArgs e) + private void ServerProcess_ErrorDataReceived(object sender, DataReceivedEventArgs e) { int Code; if (int.TryParse(e.Data, out Code)) @@ -67,8 +96,6 @@ private static void ServerProcess_ErrorDataReceived(object sender, DataReceivedE break; } } - - } } } diff --git a/Visual Studio Projects/ZWaveJS.NET/ZWaveJS.NET/Statistics.cs b/Visual Studio Projects/ZWaveJS.NET/ZWaveJS.NET/Statistics.cs index 35f7c7f..3a3e084 100644 --- a/Visual Studio Projects/ZWaveJS.NET/ZWaveJS.NET/Statistics.cs +++ b/Visual Studio Projects/ZWaveJS.NET/ZWaveJS.NET/Statistics.cs @@ -1,7 +1,13 @@ using System; + namespace ZWaveJS.NET { - public class NodeStatistics + public class NodeStatisticsUpdatedArgs : NodeStatistics + { + internal NodeStatisticsUpdatedArgs() { } + } + + public class NodeStatistics { internal NodeStatistics() { } @@ -23,7 +29,13 @@ internal NodeStatistics() { } public RouteStatisctics lwr { get; internal set; } [Newtonsoft.Json.JsonProperty] public RouteStatisctics nlwr { get; internal set; } + [Newtonsoft.Json.JsonProperty] + public DateTime? lastSeen { get; internal set; } + } + public class ControllerStatisticsUpdatedArgs : ControllerStatistics + { + internal ControllerStatisticsUpdatedArgs() { } } public class ControllerStatistics diff --git a/Visual Studio Projects/ZWaveJS.NET/ZWaveJS.NET/Structures.cs b/Visual Studio Projects/ZWaveJS.NET/ZWaveJS.NET/Structures.cs index f6f51f5..b3514f0 100644 --- a/Visual Studio Projects/ZWaveJS.NET/ZWaveJS.NET/Structures.cs +++ b/Visual Studio Projects/ZWaveJS.NET/ZWaveJS.NET/Structures.cs @@ -1,65 +1,247 @@ using System; using System.Collections.Generic; +using System.Dynamic; +using System.IO; using Newtonsoft.Json; +using static ZWaveJS.NET.Enums; + namespace ZWaveJS.NET { - class CustomBooleanJsonConverter : JsonConverter + public class QRProvisioningInformation { - public override bool ReadJson(JsonReader reader, Type objectType, bool existingValue, bool hasExistingValue, JsonSerializer serializer) - { - if (reader.ValueType == typeof(string) && reader.Value.ToString().Equals("unknown")) - { - return false; - } - else - { - return Convert.ToBoolean(reader.Value); - } - } - public override void WriteJson(JsonWriter writer, bool value, JsonSerializer serializer) - { - serializer.Serialize(writer, value); - } + internal QRProvisioningInformation() { } + + [Newtonsoft.Json.JsonProperty] + public QRCodeVersion version { get; internal set; } + [Newtonsoft.Json.JsonProperty] + public SecurityClass[] securityClasses { get; internal set; } + [Newtonsoft.Json.JsonProperty] + public string dsk { get; internal set; } + [Newtonsoft.Json.JsonProperty] + public int genericDeviceClass { get; internal set; } + [Newtonsoft.Json.JsonProperty] + public int specificDeviceClass { get; internal set; } + [Newtonsoft.Json.JsonProperty] + public int installerIconType { get; internal set; } + [Newtonsoft.Json.JsonProperty] + public int manufacturerId { get; internal set; } + [Newtonsoft.Json.JsonProperty] + public int productType { get; internal set; } + [Newtonsoft.Json.JsonProperty] + public int productId { get; internal set; } + [Newtonsoft.Json.JsonProperty] + public string applicationVersion { get; internal set; } + [Newtonsoft.Json.JsonProperty] + public int? maxInclusionRequestInterval { get; internal set; } + [Newtonsoft.Json.JsonProperty] + public string uuid { get; internal set; } + [Newtonsoft.Json.JsonProperty] + public Protocols[] supportedProtocols { get; internal set; } } - public class SmartStartProvisioningEntry + public class SetValueResult { - internal SmartStartProvisioningEntry() { } + internal SetValueResult() { } [Newtonsoft.Json.JsonProperty] - public string dsk { get; private set; } + public Enums.SetValueStatus status { get; internal set; } [Newtonsoft.Json.JsonProperty] - public int[] securityClasses { get; private set; } - public int version { get; private set; } + public string remainingDuration { get; internal set; } [Newtonsoft.Json.JsonProperty] - public int[] requestedSecurityClasses { get; private set; } + public string message { get; internal set; } + } + + + + public class FirmwareUpdateFileInfo + { + internal FirmwareUpdateFileInfo() { } + + [Newtonsoft.Json.JsonProperty] + public int target { get; internal set; } + [Newtonsoft.Json.JsonProperty] + public string url { get; internal set; } + [Newtonsoft.Json.JsonProperty] + public string integrity { get; internal set; } + } + + public class FirmwareUpdateDeviceID + { + internal FirmwareUpdateDeviceID() { } + + [Newtonsoft.Json.JsonProperty] + public int manufacturerId { get; internal set; } + [Newtonsoft.Json.JsonProperty] + public int productType { get; internal set; } + [Newtonsoft.Json.JsonProperty] + public int productId { get; internal set; } + [Newtonsoft.Json.JsonProperty] + public string firmwareVersion { get; internal set; } [Newtonsoft.Json.JsonProperty] - public int genericDeviceClass { get; private set; } + public Enums.RFRegion? rfRegion { get; internal set; } + } + + + public class FirmwareUpdateInfo + { + internal FirmwareUpdateInfo() { } + [Newtonsoft.Json.JsonProperty] - public int specificDeviceClass { get; private set; } + public FirmwareUpdateDeviceID device { get; internal set; } [Newtonsoft.Json.JsonProperty] - public int installerIconType { get; private set; } + public string version { get; internal set; } [Newtonsoft.Json.JsonProperty] - public int manufacturerId { get; private set; } + public string changelog { get; internal set; } [Newtonsoft.Json.JsonProperty] - public int productType { get; private set; } + public string channel { get; internal set; } [Newtonsoft.Json.JsonProperty] - public int productId { get; private set; } + public FirmwareUpdateFileInfo[] files { get; internal set; } [Newtonsoft.Json.JsonProperty] - public decimal applicationVersion { get; private set; } + public bool downgrade { get; internal set; } + [Newtonsoft.Json.JsonProperty] + public string normalizedVersion { get; internal set; } + } + public class PowerLevel + { + internal PowerLevel() { } + [Newtonsoft.Json.JsonProperty] + public decimal powerlevel { get; internal set; } + [Newtonsoft.Json.JsonProperty] + public decimal measured0dBm { get; internal set; } } - public class AssociationAddress + public class FirmwareUpdateProgress { + internal FirmwareUpdateProgress() { } + + [Newtonsoft.Json.JsonProperty] + public int sentFragments { get; internal set; } + [Newtonsoft.Json.JsonProperty] + public int totalFragments { get; internal set; } + [Newtonsoft.Json.JsonProperty] + public decimal progress { get; internal set; } + } + + public class ControllerFirmwareUpdateResultArgs + { + internal ControllerFirmwareUpdateResultArgs() { } + + [Newtonsoft.Json.JsonProperty] + public bool success { get; internal set; } [Newtonsoft.Json.JsonProperty] - public int nodeId { get; set; } + public Enums.ControllerFirmwareUpdateStatus status { get; internal set; } + } + + public class NodeFirmwareUpdateResultArgs + { + internal NodeFirmwareUpdateResultArgs() { } + + [Newtonsoft.Json.JsonProperty] + public Enums.NodeFirmwareUpdateStatus status { get; internal set; } [Newtonsoft.Json.JsonProperty] + public bool success { get; internal set; } + [Newtonsoft.Json.JsonProperty] + public int? waitTime { get; internal set; } + [Newtonsoft.Json.JsonProperty] + public bool reInterview { get; internal set; } + } + + public class ControllerFirmwareUpdateProgressArgs : FirmwareUpdateProgress + { + internal ControllerFirmwareUpdateProgressArgs() { } + } + + public class NodeFirmwareUpdateProgressArgs : FirmwareUpdateProgress + { + internal NodeFirmwareUpdateProgressArgs() { } + + [Newtonsoft.Json.JsonProperty] + public int currentFile { get; internal set; } + [Newtonsoft.Json.JsonProperty] + public int totalFiles { get; internal set; } + } + + public class SmartStartProvisioningEntry + { + internal SmartStartProvisioningEntry() { } + + public SmartStartProvisioningEntry(string dsk, SecurityClass[] securityClasses, Protocols protocol = Protocols.ZWave) + { + this.dsk = dsk; + this.securityClasses = securityClasses; + this.requestedSecurityClasses = securityClasses; + this.protocol = protocol; + this.supportedProtocols = new Protocols[1] { protocol }; + } + + [Newtonsoft.Json.JsonProperty] + public ProvisioningEntryStatus status { get; internal set; } + [Newtonsoft.Json.JsonProperty] + public string dsk { get; internal set; } + [Newtonsoft.Json.JsonProperty] + public Protocols? protocol { get; internal set; } + [Newtonsoft.Json.JsonProperty] + public Protocols[] supportedProtocols { get; internal set; } + [Newtonsoft.Json.JsonProperty] + public SecurityClass[] securityClasses { get; internal set; } + [Newtonsoft.Json.JsonProperty] + public SecurityClass[] requestedSecurityClasses { get; internal set; } + [Newtonsoft.Json.JsonProperty] + public int version { get; internal set; } + [Newtonsoft.Json.JsonProperty] + public int genericDeviceClass { get; internal set; } + [Newtonsoft.Json.JsonProperty] + public int specificDeviceClass { get; internal set; } + [Newtonsoft.Json.JsonProperty] + public int installerIconType { get; internal set; } + [Newtonsoft.Json.JsonProperty] + public int manufacturerId { get; internal set; } + [Newtonsoft.Json.JsonProperty] + public int productType { get; internal set; } + [Newtonsoft.Json.JsonProperty] + public int productId { get; internal set; } + [Newtonsoft.Json.JsonProperty] + public decimal applicationVersion { get; internal set; } + [Newtonsoft.Json.JsonProperty] + public int nodeId { get; internal set; } + } + + public class RebuildRoutesOptions + { + public bool includeSleeping { get; set; } + } + + + public class AssociationAddress + { + public int nodeId { get; set; } public int? endpoint { get; set; } } + public class RebuildRouteStats + { + internal RebuildRouteStats() { } + + public int[] HealedNodes { get; internal set; } + public int[] SkippedNodes { get; internal set; } + public int[] FailedNodes { get; internal set; } + } + + public class RebuildRoutesDoneArgs : RebuildRouteStats + { + internal RebuildRoutesDoneArgs() { } + } + + public class RebuildRoutesProgressArgs : RebuildRouteStats + { + internal RebuildRoutesProgressArgs() { } + + public int[] PendingNodes { get; internal set; } + } + public class AssociationGroup { @@ -67,10 +249,8 @@ internal AssociationGroup() { } [Newtonsoft.Json.JsonProperty] public int maxNodes { get; internal set; } - [Newtonsoft.Json.JsonProperty] public bool isLifeline { get; internal set; } - [Newtonsoft.Json.JsonProperty] public string label { get; internal set; } } @@ -96,13 +276,27 @@ internal ValueMetadata() { } [Newtonsoft.Json.JsonProperty] public string description { get; internal set; } [Newtonsoft.Json.JsonProperty] - public int @default { get; internal set; } + public int? @default { get; internal set; } + [Newtonsoft.Json.JsonProperty] + public int? min { get; internal set; } [Newtonsoft.Json.JsonProperty] - public int min { get; internal set; } + public int? max { get; internal set; } [Newtonsoft.Json.JsonProperty] - public int max { get; internal set; } + public int? steps { get; internal set; } + [Newtonsoft.Json.JsonProperty] + public string unit { get; internal set; } [Newtonsoft.Json.JsonProperty] public Dictionary states { get; internal set; } + [Newtonsoft.Json.JsonProperty] + public Dictionary ccSpecific { get; internal set; } + [Newtonsoft.Json.JsonProperty] + public int? valueSize { get; internal set; } + [Newtonsoft.Json.JsonProperty] + public ConfigValueFormat? format { get; internal set; } + [Newtonsoft.Json.JsonProperty] + public bool? allowManualEntry { get; internal set; } + [Newtonsoft.Json.JsonProperty] + public bool? isFromConfig { get; internal set; } } public class DeviceClass @@ -185,18 +379,7 @@ internal Device() { } public int productId { get; internal set; } } - public class ValueID - { - public int commandClass { get; set; } - public int endpoint { get; set; } - public object property { get; set; } - public object propertyKey { get; set; } - public string commandClassName { get; set; } - public string propertyName { get; set; } - public string propertyKeyName { get; set; } - } - - public class SetValueAPIOptions + public class SetValueAPIOptions { public string transitionDuration { get; set; } public int volume { get; set; } @@ -248,17 +431,25 @@ internal LifelineHealthCheckResult() { } public int rating { get; internal set; } } - public class InclusionResult + public class InclusionResultArgs { - internal InclusionResult() { } + internal InclusionResultArgs() { } + [Newtonsoft.Json.JsonProperty] public bool lowSecurity { get; internal set; } + [Newtonsoft.Json.JsonProperty] + public Enums.SecurityBootstrapFailure lowSecurityReason { get; internal set; } } public delegate string ValidateDSKAndEnterPIN(string dsk); public delegate InclusionGrant GrantSecurityClasses(InclusionGrant requested); public delegate void Abort(); + public class ExclusionOptions + { + public Enums.ExclusionStrategy strategy { get; set; } + } + public class InclusionOptions { public Enums.InclusionStrategy strategy { get; set; } @@ -272,4 +463,111 @@ public class InclusionUserCallbacks public GrantSecurityClasses grantSecurityClasses { get; set; } public Abort abort { get; set; } } + + public class LoggingEventArgs + { + internal LoggingEventArgs() { } + + [Newtonsoft.Json.JsonProperty] + public string formattedMessage { get; internal set; } + [Newtonsoft.Json.JsonProperty] + public string direction { get; internal set; } + [Newtonsoft.Json.JsonProperty] + public string primaryTags { get; internal set; } + [Newtonsoft.Json.JsonProperty] + public string secondaryTags { get; internal set; } + [Newtonsoft.Json.JsonProperty] + public int? secondaryTagPadding { get; internal set; } + [Newtonsoft.Json.JsonProperty] + public bool? multiline { get; internal set; } + [Newtonsoft.Json.JsonProperty] + public string timestamp { get; internal set; } + [Newtonsoft.Json.JsonProperty] + public string label { get; internal set; } + [Newtonsoft.Json.JsonProperty] + public string message { get; internal set; } + [Newtonsoft.Json.JsonProperty] + public string level { get; internal set; } + } + + public class ValueID + { + public int commandClass { get; set; } + public int endpoint { get; set; } + public object property { get; set; } + public object propertyKey { get; set; } + public string commandClassName { get; set; } + public string propertyName { get; set; } + public string propertyKeyName { get; set; } + } + + public class ValueUpdatedArgs : ValueID + { + internal ValueUpdatedArgs() { } + + [Newtonsoft.Json.JsonProperty] + public object prevValue { get; internal set; } + [Newtonsoft.Json.JsonProperty] + public object newValue { get; internal set; } + } + + public class ValueAddedArgs : ValueID + { + internal ValueAddedArgs() { } + + [Newtonsoft.Json.JsonProperty] + public object newValue { get; internal set; } + } + + public class ValueRemovedArgs : ValueID + { + internal ValueRemovedArgs() { } + + [Newtonsoft.Json.JsonProperty] + public object prevValue { get; internal set; } + } + + public class ValueNotificationArgs : ValueID + { + internal ValueNotificationArgs() { } + + [Newtonsoft.Json.JsonProperty] + public object value { get; internal set; } + } + + public class RefreshInfoOptions + { + public bool resetSecurityClasses { get; set; } + public bool waitForWakeup { get; set; } + } + + public class FirmwareUpdate + { + public static FirmwareUpdate Create(string Filename) + { + FirmwareUpdate U = new FirmwareUpdate(); + U.data = File.ReadAllBytes(Filename); + U.filename = new FileInfo(Filename).Name; + + return U; + } + + + public static FirmwareUpdate Create(string Filename, int Target) + { + FirmwareUpdate U = new FirmwareUpdate(); + U.firmwareTarget = Target; + U.data = File.ReadAllBytes(Filename); + U.filename = new FileInfo(Filename).Name; + + return U; + } + + internal FirmwareUpdate() { } + + [Newtonsoft.Json.JsonProperty(PropertyName = "file")] + public byte[] data { get; internal set; } + public string filename { get; internal set; } + public int? firmwareTarget { get; internal set; } + } } diff --git a/Visual Studio Projects/ZWaveJS.NET/ZWaveJS.NET/Utils.cs b/Visual Studio Projects/ZWaveJS.NET/ZWaveJS.NET/Utils.cs new file mode 100644 index 0000000..92f42df --- /dev/null +++ b/Visual Studio Projects/ZWaveJS.NET/ZWaveJS.NET/Utils.cs @@ -0,0 +1,52 @@ +using System; +using System.IO; +using System.Threading.Tasks; +using System.Net; +using System.Reflection; +using System.Collections.Generic; + +namespace ZWaveJS.NET +{ + + public class Utils + { + private Driver _driver; + internal Utils(Driver Driver) + { + _driver = Driver; + } + + // CHECKED + public Task ParseQRCodeString(string qr) + { + Guid ID = Guid.NewGuid(); + + TaskCompletionSource Result = new TaskCompletionSource(); + + _driver.Callbacks.Add(ID, (JO) => + { + CMDResult Res = new CMDResult(JO); + if (Res.Success) + { + QRProvisioningInformation PQR = JO.SelectToken("result.qrProvisioningInformation").ToObject(); + Res.SetPayload(PQR); + } + + + Result.SetResult(Res); + + }); + + Dictionary Request = new Dictionary(); + Request.Add("messageId", ID); + Request.Add("command", Enums.Commands.ParseQRCodeString); + Request.Add("qr", qr); + + + string RequestPL = Newtonsoft.Json.JsonConvert.SerializeObject(Request); + _driver.ClientWebSocket.SendInstant(RequestPL); + + return Result.Task; + } + } +} diff --git a/Visual Studio Projects/ZWaveJS.NET/ZWaveJS.NET/VirtualNode.cs b/Visual Studio Projects/ZWaveJS.NET/ZWaveJS.NET/VirtualNode.cs index 3b37293..febf21a 100644 --- a/Visual Studio Projects/ZWaveJS.NET/ZWaveJS.NET/VirtualNode.cs +++ b/Visual Studio Projects/ZWaveJS.NET/ZWaveJS.NET/VirtualNode.cs @@ -1,7 +1,5 @@ using System; using System.Collections.Generic; -using System.Linq; -using System.Text; using System.Threading.Tasks; using Newtonsoft.Json.Linq; using Newtonsoft.Json; @@ -10,9 +8,9 @@ namespace ZWaveJS.NET { public class VirtualNode { - - internal VirtualNode(int[] Nodes) + internal VirtualNode(Driver driver, int[] Nodes) { + _driver = driver; this.Nodes = Nodes; } @@ -22,12 +20,12 @@ public Task GetEndpointCount() TaskCompletionSource Result = new TaskCompletionSource(); - Driver.Callbacks.Add(ID, (JO) => + _driver.Callbacks.Add(ID, (JO) => { CMDResult Res = new CMDResult(JO); if (Res.Success) { - Res.SetPayload(JO.SelectToken("result.count").Value()); + Res.SetPayload(JO.SelectToken("result.count").ToObject()); } Result.SetResult(Res); }); @@ -38,7 +36,7 @@ public Task GetEndpointCount() Request.Add("nodeIDs", this.Nodes); string RequestPL = JsonConvert.SerializeObject(Request); - Driver.Client.SendAsync(RequestPL); + _driver.ClientWebSocket.SendInstant(RequestPL); return Result.Task; } @@ -48,7 +46,7 @@ public Task SetValue(ValueID ValueID, object Value, SetValueAPIOption Guid ID = Guid.NewGuid(); TaskCompletionSource Result = new TaskCompletionSource(); - Driver.Callbacks.Add(ID, (JO) => + _driver.Callbacks.Add(ID, (JO) => { CMDResult Res = new CMDResult(JO); Result.SetResult(Res); @@ -67,7 +65,7 @@ public Task SetValue(ValueID ValueID, object Value, SetValueAPIOption } string RequestPL = Newtonsoft.Json.JsonConvert.SerializeObject(Request); - Driver.Client.SendAsync(RequestPL); + _driver.ClientWebSocket.SendInstant(RequestPL); return Result.Task; } @@ -77,12 +75,12 @@ public Task GetDefinedValueIDs() Guid ID = Guid.NewGuid(); TaskCompletionSource Result = new TaskCompletionSource(); - Driver.Callbacks.Add(ID, (JO) => + _driver.Callbacks.Add(ID, (JO) => { CMDResult Res = new CMDResult(JO); if (Res.Success) { - Res.SetPayload(JsonConvert.DeserializeObject(JO.SelectToken("result.valueIDs").ToString())); + Res.SetPayload(JO.SelectToken("result.valueIDs").ToObject()); } Result.SetResult(Res); @@ -95,7 +93,7 @@ public Task GetDefinedValueIDs() string RequestPL = JsonConvert.SerializeObject(Request); - Driver.Client.SendAsync(RequestPL); + _driver.ClientWebSocket.SendInstant(RequestPL); return Result.Task; } @@ -105,12 +103,12 @@ public Task SupportsCCAPI(int CommandClass) Guid ID = Guid.NewGuid(); TaskCompletionSource Result = new TaskCompletionSource(); - Driver.Callbacks.Add(ID, (JO) => + _driver.Callbacks.Add(ID, (JO) => { CMDResult Res = new CMDResult(JO); if (Res.Success) { - Res.SetPayload(JO.SelectToken("result.supported").Value()); + Res.SetPayload(JO.SelectToken("result.supported").ToObject()); } Result.SetResult(Res); @@ -123,7 +121,7 @@ public Task SupportsCCAPI(int CommandClass) Request.Add("commandClass", CommandClass); string RequestPL = JsonConvert.SerializeObject(Request); - Driver.Client.SendAsync(RequestPL); + _driver.ClientWebSocket.SendInstant(RequestPL); return Result.Task; } @@ -133,12 +131,12 @@ public Task InvokeCCAPI(int CommandClass, string Method, params objec Guid ID = Guid.NewGuid(); TaskCompletionSource Result = new TaskCompletionSource(); - Driver.Callbacks.Add(ID, (JO) => + _driver.Callbacks.Add(ID, (JO) => { CMDResult Res = new CMDResult(JO); if (Res.Success) { - Res.SetPayload(JsonConvert.DeserializeObject(JO.SelectToken("result").ToString())); + Res.SetPayload(JO.SelectToken("result").ToObject()); } Result.SetResult(Res); @@ -153,12 +151,13 @@ public Task InvokeCCAPI(int CommandClass, string Method, params objec Request.Add("args", Params); string RequestPL = JsonConvert.SerializeObject(Request); - Driver.Client.SendAsync(RequestPL); + _driver.ClientWebSocket.SendInstant(RequestPL); return Result.Task; } private int[] Nodes { get; set; } + private Driver _driver { get; set; } } diff --git a/Visual Studio Projects/ZWaveJS.NET/ZWaveJS.NET/WSClientClass/MessageReceivedEventArgs.cs b/Visual Studio Projects/ZWaveJS.NET/ZWaveJS.NET/WSClientClass/MessageReceivedEventArgs.cs deleted file mode 100644 index 3965f6d..0000000 --- a/Visual Studio Projects/ZWaveJS.NET/ZWaveJS.NET/WSClientClass/MessageReceivedEventArgs.cs +++ /dev/null @@ -1,56 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Text; -using System.Net; -using System.Net.WebSockets; - -namespace WatsonWebsocket -{ - /// - /// Event arguments for when a message is received. - /// - public class MessageReceivedEventArgs : EventArgs - { - #region Public-Members - - /// - /// The IP:port of the sender. - /// - public string IpPort { get; } = null; - - /// - /// The data received. - /// - public byte[] Data { get; } = null; - - /// - /// The type of payload included in the message (Binary or Text). - /// - public WebSocketMessageType MessageType = WebSocketMessageType.Binary; - - #endregion - - #region Private-Members - - #endregion - - #region Constructors-and-Factories - - internal MessageReceivedEventArgs(string ipPort, byte[] data, WebSocketMessageType messageType) - { - IpPort = ipPort; - Data = data; - MessageType = messageType; - } - - #endregion - - #region Public-Methods - - #endregion - - #region Private-Methods - - #endregion - } -} \ No newline at end of file diff --git a/Visual Studio Projects/ZWaveJS.NET/ZWaveJS.NET/WSClientClass/Statistics.cs b/Visual Studio Projects/ZWaveJS.NET/ZWaveJS.NET/WSClientClass/Statistics.cs deleted file mode 100644 index 96e01d1..0000000 --- a/Visual Studio Projects/ZWaveJS.NET/ZWaveJS.NET/WSClientClass/Statistics.cs +++ /dev/null @@ -1,205 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Text; -using System.Threading; - -namespace WatsonWebsocket -{ - /// - /// WatsonWebsocket statistics. - /// - public class Statistics - { - #region Public-Members - - /// - /// The time at which the client or server was started. - /// - public DateTime StartTime - { - get - { - return _StartTime; - } - } - - /// - /// The amount of time which the client or server has been up. - /// - public TimeSpan UpTime - { - get - { - return DateTime.Now.ToUniversalTime() - _StartTime; - } - } - - /// - /// The number of bytes received. - /// - public long ReceivedBytes - { - get - { - return _ReceivedBytes; - } - } - - /// - /// The number of messages received. - /// - public long ReceivedMessages - { - get - { - return _ReceivedMessages; - } - } - - /// - /// Average received message size in bytes. - /// - public int ReceivedMessageSizeAverage - { - get - { - if (_ReceivedBytes > 0 && _ReceivedMessages > 0) - { - return (int)(_ReceivedBytes / _ReceivedMessages); - } - else - { - return 0; - } - } - } - - /// - /// The number of bytes sent. - /// - public long SentBytes - { - get - { - return _SentBytes; - } - } - - /// - /// The number of messages sent. - /// - public long SentMessages - { - get - { - return _SentMessages; - } - } - - /// - /// Average sent message size in bytes. - /// - public decimal SentMessageSizeAverage - { - get - { - if (_SentBytes > 0 && _SentMessages > 0) - { - return (int)(_SentBytes / _SentMessages); - } - else - { - return 0; - } - } - } - - #endregion - - #region Private-Members - - private DateTime _StartTime = DateTime.Now.ToUniversalTime(); - private long _ReceivedBytes = 0; - private long _ReceivedMessages = 0; - private long _SentBytes = 0; - private long _SentMessages = 0; - - #endregion - - #region Constructors-and-Factories - - /// - /// Initialize the statistics object. - /// - public Statistics() - { - - } - - #endregion - - #region Public-Methods - - /// - /// Return human-readable version of the object. - /// - /// - public override string ToString() - { - string ret = - "--- Statistics ---" + Environment.NewLine + - " Started : " + _StartTime.ToString() + Environment.NewLine + - " Uptime : " + UpTime.ToString() + Environment.NewLine + - " Received : " + Environment.NewLine + - " Bytes : " + ReceivedBytes + Environment.NewLine + - " Messages : " + ReceivedMessages + Environment.NewLine + - " Average : " + ReceivedMessageSizeAverage + " bytes" + Environment.NewLine + - " Sent : " + Environment.NewLine + - " Bytes : " + SentBytes + Environment.NewLine + - " Messages : " + SentMessages + Environment.NewLine + - " Average : " + SentMessageSizeAverage + " bytes" + Environment.NewLine; - return ret; - } - - /// - /// Reset statistics other than StartTime and UpTime. - /// - public void Reset() - { - _ReceivedBytes = 0; - _ReceivedMessages = 0; - _SentBytes = 0; - _SentMessages = 0; - } - - #endregion - - #region Internal-Methods - - internal void IncrementReceivedMessages() - { - _ReceivedMessages = Interlocked.Increment(ref _ReceivedMessages); - } - - internal void IncrementSentMessages() - { - _SentMessages = Interlocked.Increment(ref _SentMessages); - } - - internal void AddReceivedBytes(long bytes) - { - _ReceivedBytes = Interlocked.Add(ref _ReceivedBytes, bytes); - } - - internal void AddSentBytes(long bytes) - { - _SentBytes = Interlocked.Add(ref _SentBytes, bytes); - } - - #endregion - - #region Private-Methods - - #endregion - } -} diff --git a/Visual Studio Projects/ZWaveJS.NET/ZWaveJS.NET/WSClientClass/WatsonWsClient.cs b/Visual Studio Projects/ZWaveJS.NET/ZWaveJS.NET/WSClientClass/WatsonWsClient.cs deleted file mode 100644 index 7838cd6..0000000 --- a/Visual Studio Projects/ZWaveJS.NET/ZWaveJS.NET/WSClientClass/WatsonWsClient.cs +++ /dev/null @@ -1,728 +0,0 @@ -using System; -using System.IO; -using System.Net; -using System.Net.Sockets; -using System.Net.WebSockets; -using System.Text; -using System.Diagnostics; -using System.Threading; -using System.Threading.Tasks; - -namespace WatsonWebsocket -{ - /// - /// Watson websocket client. - /// - public class WatsonWsClient : IDisposable - { - #region Public-Members - - /// - /// Indicates whether or not the client is connected to the server. - /// - public bool Connected - { - get - { - if (_ClientWs != null) - { - if (_ClientWs.State == WebSocketState.Open) return true; - } - - return false; - } - } - - /// - /// Enable or disable statistics. - /// - public bool EnableStatistics { get; set; } = true; - - /// - /// Set KeepAlive to Connection Options. - /// - public int KeepAliveInterval - { - get - { - return _KeepAliveIntervalSeconds; - } - set - { - if (value < 1) throw new ArgumentException("ConnectTimeoutSeconds must be greater than zero."); - _KeepAliveIntervalSeconds = value; - } - } - - /// - /// Event fired when a message is received. - /// - public event EventHandler MessageReceived; - - /// - /// Event fired when the client connects successfully to the server. - /// - public event EventHandler ServerConnected; - - /// - /// Event fired when the client disconnects from the server. - /// - public event EventHandler ServerDisconnected; - - /// - /// Method to invoke when sending a log message. - /// - public Action Logger = null; - - /// - /// Statistics. - /// - public Statistics Stats - { - get - { - return _Stats; - } - } - - #endregion - - #region Private-Members - - private string _Header = "[WatsonWsClient] "; - private bool _AcceptInvalidCertificates = true; - private Uri _ServerUri = null; - private string _ServerIp = null; - private int _ServerPort = 0; - private string _ServerIpPort = null; - private string _Url = null; - private int _KeepAliveIntervalSeconds = 30; - private ClientWebSocket _ClientWs = null; - private CookieContainer _Cookies = new CookieContainer(); - private Action _PreConfigureOptions; - - private event EventHandler _AwaitingSyncResponseEvent; - - private readonly SemaphoreSlim _SendLock = new SemaphoreSlim(1); - private readonly SemaphoreSlim _AwaitingSyncResposeLock = new SemaphoreSlim(1); - - private CancellationTokenSource _TokenSource = new CancellationTokenSource(); - private CancellationToken _Token; - private Statistics _Stats = new Statistics(); - - #endregion - - #region Constructors-and-Factories - - /// - /// Initializes the Watson websocket client. - /// Be sure to call 'Start()' to start the client and connect to the server. - /// - /// IP address of the server. - /// TCP port of the server. - /// Enable or disable SSL. - public WatsonWsClient( - string serverIp, - int serverPort, - bool ssl) - { - if (String.IsNullOrEmpty(serverIp)) throw new ArgumentNullException(nameof(serverIp)); - if (serverPort < 1) throw new ArgumentOutOfRangeException(nameof(serverPort)); - - _ServerIp = serverIp; - _ServerPort = serverPort; - _ServerIpPort = serverIp + ":" + serverPort; - - if (ssl) _Url = "wss://" + _ServerIp + ":" + _ServerPort; - else _Url = "ws://" + _ServerIp + ":" + _ServerPort; - _ServerUri = new Uri(_Url); - _Token = _TokenSource.Token; - - _ClientWs = new ClientWebSocket(); - } - - /// - /// Initializes the Watson websocket client. - /// Be sure to call 'Start()' to start the client and connect to the server. - /// - /// The URI of the server endpoint. - public WatsonWsClient(Uri uri) - { - _ServerUri = uri; - _ServerIp = uri.Host; - _ServerPort = uri.Port; - _ServerIpPort = uri.Host + ":" + uri.Port; - _Token = _TokenSource.Token; - - _ClientWs = new ClientWebSocket(); - } - - #endregion - - #region Public-Methods - - /// - /// Tear down the client and dispose of background workers. - /// - public void Dispose() - { - Dispose(true); - GC.SuppressFinalize(this); - } - - /// - /// Pre-configure websocket client options prior to connecting to the server. - /// - /// WatsonWsClient. - public WatsonWsClient ConfigureOptions(Action options) - { - if (!Connected) - { - _PreConfigureOptions = options; - } - - return this; - } - - /// - /// Add a cookie prior to connecting to the server. - /// - public void AddCookie(Cookie cookie) => _Cookies.Add(cookie); - - /// - /// Start the client and connect to the server. - /// - public void Start() - { - _Stats = new Statistics(); - - - _ClientWs.Options.Cookies = _Cookies; - _ClientWs.Options.KeepAliveInterval = TimeSpan.FromSeconds(_KeepAliveIntervalSeconds); - - if (_PreConfigureOptions != null) - { - _PreConfigureOptions(_ClientWs.Options); - } - - _ClientWs.ConnectAsync(_ServerUri, _Token).ContinueWith(AfterConnect).Wait(); - } - - /// - /// Start the client and connect to the server. - /// - /// Task. - public Task StartAsync() - { - _Stats = new Statistics(); - - - _ClientWs.Options.Cookies = _Cookies; - _ClientWs.Options.KeepAliveInterval = TimeSpan.FromSeconds(_KeepAliveIntervalSeconds); - - if (_PreConfigureOptions != null) - { - _PreConfigureOptions(_ClientWs.Options); - } - - // Connect - return _ClientWs.ConnectAsync(_ServerUri, _Token).ContinueWith(AfterConnect); - } - - /// - /// Start the client and attempt to connect to the server until the timeout is reached. - /// - /// Timeout in seconds. - /// Cancellation token to terminate connection attempts. - /// Boolean indicating if the connection was successful. - public bool StartWithTimeout(int timeout = 30, CancellationToken token = default) - { - if (timeout < 1) throw new ArgumentException("Timeout must be greater than zero seconds."); - - _Stats = new Statistics(); - - - Stopwatch sw = new Stopwatch(); - TimeSpan timeOut = TimeSpan.FromSeconds(timeout); - sw.Start(); - - try - { - while (sw.Elapsed < timeOut) - { - if (token.IsCancellationRequested) break; - _ClientWs = new ClientWebSocket(); - - _ClientWs.Options.Cookies = _Cookies; - _ClientWs.Options.KeepAliveInterval = TimeSpan.FromSeconds(_KeepAliveIntervalSeconds); - if (_PreConfigureOptions != null) - { - _PreConfigureOptions(_ClientWs.Options); - } - - try - { - _ClientWs.ConnectAsync(_ServerUri, token).ContinueWith(AfterConnect).Wait(); - } - catch (TaskCanceledException) - { - return false; - } - catch (OperationCanceledException) - { - return false; - } - catch (WebSocketException) - { - // do nothing, continue - } - - Task.Delay(100).Wait(); - - // Check if connected - if (_ClientWs.State == WebSocketState.Open) - { - return true; - } - } - } - catch (TaskCanceledException) - { - - } - catch (OperationCanceledException) - { - - } - - return false; - } - - /// - /// Start the client and attempt to connect to the server until the timeout is reached. - /// - /// Timeout in seconds. - /// Cancellation token to terminate connection attempts. - /// Task returning Boolean indicating if the connection was successful. - public async Task StartWithTimeoutAsync(int timeout = 30, CancellationToken token = default) - { - if (timeout < 1) throw new ArgumentException("Timeout must be greater than zero seconds."); - - _Stats = new Statistics(); - - - Stopwatch sw = new Stopwatch(); - TimeSpan timeOut = TimeSpan.FromSeconds(timeout); - sw.Start(); - - try - { - while (sw.Elapsed < timeOut) - { - if (token.IsCancellationRequested) break; - _ClientWs = new ClientWebSocket(); - - _ClientWs.Options.Cookies = _Cookies; - _ClientWs.Options.KeepAliveInterval = TimeSpan.FromSeconds(_KeepAliveIntervalSeconds); - if (_PreConfigureOptions != null) - { - _PreConfigureOptions(_ClientWs.Options); - } - - try - { - await _ClientWs.ConnectAsync(_ServerUri, token).ContinueWith(AfterConnect); - } - catch (TaskCanceledException) - { - return false; - } - catch (OperationCanceledException) - { - return false; - } - catch (WebSocketException) - { - // do nothing - } - - await Task.Delay(100); - - // Check if connected - if (_ClientWs.State == WebSocketState.Open) - { - return true; - } - } - } - catch (TaskCanceledException) - { - - } - catch (OperationCanceledException) - { - - } - - return false; - } - - /// - /// Disconnect the client. - /// - public void Stop() - { - _ClientWs.CloseOutputAsync(WebSocketCloseStatus.NormalClosure, _ClientWs.CloseStatusDescription, _Token).Wait(); - } - - /// - /// Disconnect the client. - /// - public async Task StopAsync() - { - await _ClientWs.CloseOutputAsync(WebSocketCloseStatus.NormalClosure, _ClientWs.CloseStatusDescription, _Token).ConfigureAwait(false); - } - - /// - /// Send text data to the server asynchronously. - /// - /// String data. - /// Message type. - /// Cancellation token allowing for termination of this request. - /// Task with Boolean indicating if the message was sent successfully. - public async Task SendAsync(string data, WebSocketMessageType msgType = WebSocketMessageType.Text, CancellationToken token = default) - { - if (string.IsNullOrEmpty(data)) throw new ArgumentNullException(nameof(data)); - else return await MessageWriteAsync(Encoding.UTF8.GetBytes(data), msgType, token); - } - - /// - /// Send binary data to the server asynchronously. - /// - /// Byte array containing data. - /// Message type. - /// Cancellation token allowing for termination of this request. - /// Task with Boolean indicating if the message was sent successfully. - public async Task SendAsync(byte[] data, WebSocketMessageType msgType = WebSocketMessageType.Binary, CancellationToken token = default) - { - if (data == null || data.Length < 1) throw new ArgumentNullException(nameof(data)); - return await MessageWriteAsync(data, msgType, token); - } - - /// - /// Send text data to the server and wait for a response. - /// - /// String data. - /// Timeout, in seconds. - /// Cancellation token. - /// String from response. - public async Task SendAndWaitAsync(string data, int timeout = 30, CancellationToken token = default) - { - if (String.IsNullOrEmpty(data)) throw new ArgumentNullException(nameof(data)); - if (timeout < 1) throw new ArgumentException("Timeout must be greater than zero seconds.", nameof(data)); - string result = null; - - var receivedEvent = new ManualResetEvent(false); - await _AwaitingSyncResposeLock.WaitAsync(_Token); - - await Task.Run(async () => - { - _AwaitingSyncResponseEvent += (s, e) => - { - result = Encoding.UTF8.GetString(e.Data); - receivedEvent.Set(); - }; - - await MessageWriteAsync(Encoding.UTF8.GetBytes(data), WebSocketMessageType.Text, token); - receivedEvent.WaitOne(TimeSpan.FromSeconds(timeout)); - - _AwaitingSyncResponseEvent = null; - _AwaitingSyncResposeLock.Release(); - }); - - return result; - } - - /// - /// Send binary data to the server and wait for a response. - /// - /// Byte array containing data. - /// Timeout, in seconds. - /// Cancellation token. - /// Byte array from response. - public async Task SendAndWaitAsync(byte[] data, int timeout = 30, CancellationToken token = default) - { - if (data == null || data.Length < 1) throw new ArgumentNullException(nameof(data)); - if (timeout < 1) throw new ArgumentException("Timeout must be zero or greater.", nameof(data)); - byte[] result = null; - - var receivedEvent = new ManualResetEvent(false); - await _AwaitingSyncResposeLock.WaitAsync(_Token); - - await Task.Run(async () => - { - _AwaitingSyncResponseEvent += (s, e) => - { - result = e.Data; - receivedEvent.Set(); - }; - - await MessageWriteAsync(data, WebSocketMessageType.Binary, token); - receivedEvent.WaitOne(TimeSpan.FromSeconds(timeout)); - - _AwaitingSyncResponseEvent = null; - _AwaitingSyncResposeLock.Release(); - }); - - return result; - } - - #endregion - - #region Private-Methods - - /// - /// Tear down the client and dispose of background workers. - /// - /// Disposing. - protected virtual void Dispose(bool disposing) - { - if (disposing) - { - if (_ClientWs != null) - { - // see https://mcguirev10.com/2019/08/17/how-to-close-websocket-correctly.html - - if (_ClientWs.State == WebSocketState.Open) - { - Stop(); - _ClientWs.Dispose(); - } - } - - _TokenSource.Cancel(); - - Logger?.Invoke(_Header + "dispose complete"); - } - } - - - - private void AfterConnect(Task task) - { - if (task.IsCompleted) - { - if (_ClientWs.State == WebSocketState.Open) - { - Task.Run(() => - { - Task.Run(() => DataReceiver(), _Token); - ServerConnected?.Invoke(this, EventArgs.Empty); - }, _Token); - } - } - } - - private async Task DataReceiver() - { - try - { - while (true) - { - if (_Token.IsCancellationRequested) break; - MessageReceivedEventArgs msg = await MessageReadAsync(); - - if (msg != null) - { - if (EnableStatistics) - { - _Stats.IncrementReceivedMessages(); - _Stats.AddReceivedBytes(msg.Data.Length); - } - - if (msg.MessageType != WebSocketMessageType.Close) - { - if (_AwaitingSyncResponseEvent != null) - { - _AwaitingSyncResponseEvent?.Invoke(this, msg); - } - else - { - MessageReceived?.Invoke(this, msg); - } - } - } - } - } - catch (OperationCanceledException) - { - Logger?.Invoke(_Header + "data receiver canceled"); - } - catch (WebSocketException) - { - Logger?.Invoke(_Header + "websocket disconnected"); - } - catch (Exception e) - { - Logger?.Invoke(_Header + "exception: " + Environment.NewLine + e.ToString()); - } - - ServerDisconnected?.Invoke(this, EventArgs.Empty); - } - - private async Task MessageReadAsync() - { - // Do not catch exceptions, let them get caught by the data reader to destroy the connection - - if (_ClientWs == null) return null; - byte[] buffer = new byte[65536]; - byte[] data = null; - - WebSocketReceiveResult result = null; - - using (MemoryStream dataMs = new MemoryStream()) - { - buffer = new byte[buffer.Length]; - ArraySegment bufferSegment = new ArraySegment(buffer); - - if (_ClientWs.State == WebSocketState.CloseReceived - || _ClientWs.State == WebSocketState.Closed) - { - throw new WebSocketException("Websocket close received"); - } - - while (_ClientWs.State == WebSocketState.Open) - { - result = await _ClientWs.ReceiveAsync(bufferSegment, _Token); - if (result.Count > 0) - { - await dataMs.WriteAsync(buffer, 0, result.Count); - } - - if (result.EndOfMessage) - { - data = dataMs.ToArray(); - break; - } - } - } - - return new MessageReceivedEventArgs(_ServerIpPort, data, result.MessageType); - } - - private async Task MessageWriteAsync(byte[] data, WebSocketMessageType msgType, CancellationToken token) - { - bool disconnectDetected = false; - - using (CancellationTokenSource linkedCts = CancellationTokenSource.CreateLinkedTokenSource(_Token, token)) - { - try - { - if (_ClientWs == null || _ClientWs.State != WebSocketState.Open) - { - Logger?.Invoke(_Header + "not connected"); - disconnectDetected = true; - return false; - } - - await _SendLock.WaitAsync(_Token).ConfigureAwait(false); - - try - { - await _ClientWs.SendAsync(new ArraySegment(data, 0, data.Length), msgType, true, token).ConfigureAwait(false); - } - catch - { - - } - finally - { - _SendLock.Release(); - } - - if (EnableStatistics) - { - _Stats.IncrementSentMessages(); - _Stats.AddSentBytes(data.Length); - } - - return true; - } - catch (TaskCanceledException) - { - if (_Token.IsCancellationRequested) - { - Logger?.Invoke(_Header + "canceled"); - disconnectDetected = true; - } - else if (token.IsCancellationRequested) - { - Logger?.Invoke(_Header + "message send canceled"); - } - - return false; - } - catch (OperationCanceledException) - { - if (_Token.IsCancellationRequested) - { - Logger?.Invoke(_Header + "canceled"); - disconnectDetected = true; - } - else if (token.IsCancellationRequested) - { - Logger?.Invoke(_Header + "message send canceled"); - } - - return false; - } - catch (WebSocketException) - { - Logger?.Invoke(_Header + "websocket disconnected"); - disconnectDetected = true; - return false; - } - catch (ObjectDisposedException) - { - Logger?.Invoke(_Header + "disposed"); - disconnectDetected = true; - return false; - } - catch (SocketException) - { - Logger?.Invoke(_Header + "socket disconnected"); - disconnectDetected = true; - return false; - } - catch (InvalidOperationException) - { - Logger?.Invoke(_Header + "disconnected due to invalid operation"); - disconnectDetected = true; - return false; - } - catch (IOException) - { - Logger?.Invoke(_Header + "IO disconnected"); - disconnectDetected = true; - return false; - } - catch (Exception e) - { - Logger?.Invoke(_Header + "exception: " + Environment.NewLine + e.ToString()); - disconnectDetected = true; - return false; - } - finally - { - if (disconnectDetected) - { - Dispose(); - ServerDisconnected?.Invoke(this, EventArgs.Empty); - } - } - } - } - - #endregion - } -} diff --git a/Visual Studio Projects/ZWaveJS.NET/ZWaveJS.NET/Websocket.Client/Exceptions/WebsocketBadInputException.cs b/Visual Studio Projects/ZWaveJS.NET/ZWaveJS.NET/Websocket.Client/Exceptions/WebsocketBadInputException.cs new file mode 100644 index 0000000..1e8fc12 --- /dev/null +++ b/Visual Studio Projects/ZWaveJS.NET/ZWaveJS.NET/Websocket.Client/Exceptions/WebsocketBadInputException.cs @@ -0,0 +1,25 @@ +using System; + +namespace Websocket.Client.Exceptions +{ + /// + /// Custom exception that indicates bad user/client input + /// + public class WebsocketBadInputException : WebsocketException + { + /// + public WebsocketBadInputException() + { + } + + /// + public WebsocketBadInputException(string message) : base(message) + { + } + + /// + public WebsocketBadInputException(string message, Exception innerException) : base(message, innerException) + { + } + } +} diff --git a/Visual Studio Projects/ZWaveJS.NET/ZWaveJS.NET/Websocket.Client/Exceptions/WebsocketException.cs b/Visual Studio Projects/ZWaveJS.NET/ZWaveJS.NET/Websocket.Client/Exceptions/WebsocketException.cs new file mode 100644 index 0000000..327a27b --- /dev/null +++ b/Visual Studio Projects/ZWaveJS.NET/ZWaveJS.NET/Websocket.Client/Exceptions/WebsocketException.cs @@ -0,0 +1,26 @@ +using System; + +namespace Websocket.Client.Exceptions +{ + /// + /// Custom exception related to WebsocketClient + /// + public class WebsocketException : Exception + { + /// + public WebsocketException() + { + } + + /// + public WebsocketException(string message) + : base(message) + { + } + + /// + public WebsocketException(string message, Exception innerException) : base(message, innerException) + { + } + } +} diff --git a/Visual Studio Projects/ZWaveJS.NET/ZWaveJS.NET/Websocket.Client/IWebsocketClient.cs b/Visual Studio Projects/ZWaveJS.NET/ZWaveJS.NET/Websocket.Client/IWebsocketClient.cs new file mode 100644 index 0000000..b1c9da9 --- /dev/null +++ b/Visual Studio Projects/ZWaveJS.NET/ZWaveJS.NET/Websocket.Client/IWebsocketClient.cs @@ -0,0 +1,182 @@ +#nullable enable +using System; +using System.Net.WebSockets; +using System.Text; +using System.Threading.Tasks; + +namespace Websocket.Client +{ + /// + /// A simple websocket client with built-in reconnection and error handling + /// + public interface IWebsocketClient : IDisposable + { + /// + /// Get or set target websocket url + /// + Uri Url { get; set; } + + /// + /// Stream with received message (raw format) + /// + IObservable MessageReceived { get; } + + /// + /// Stream for reconnection event (triggered after the new connection) + /// + IObservable ReconnectionHappened { get; } + + /// + /// Stream for disconnection event (triggered after the connection was lost) + /// + IObservable DisconnectionHappened { get; } + + /// + /// Time range for how long to wait before reconnecting if no message comes from server. + /// Set null to disable this feature. + /// Default: 1 minute. + /// + TimeSpan? ReconnectTimeout { get; set; } + + /// + /// Time range for how long to wait before reconnecting if last reconnection failed. + /// Set null to disable this feature. + /// Default: 1 minute. + /// + TimeSpan? ErrorReconnectTimeout { get; set; } + + /// + /// Time range for how long to wait before reconnecting if connection is lost with a transient error. + /// Set null to disable this feature. + /// Default: null/disabled (immediately) + /// + TimeSpan? LostReconnectTimeout { get; set; } + + /// + /// Get or set the name of the current websocket client instance. + /// For logging purpose (in case you use more parallel websocket clients and want to distinguish between them) + /// + string? Name { get; set; } + + /// + /// Returns true if Start() method was called at least once. False if not started or disposed + /// + bool IsStarted { get; } + + /// + /// Returns true if client is running and connected to the server + /// + bool IsRunning { get; } + + /// + /// Enable or disable reconnection functionality (enabled by default) + /// + bool IsReconnectionEnabled { get; set; } + + /// + /// Enable or disable text message conversion from binary to string (via 'MessageEncoding' property). + /// Default: true + /// + bool IsTextMessageConversionEnabled { get; set; } + + /// + /// Returns currently used native websocket client. + /// Use with caution, on every reconnection there will be a new instance. + /// + ClientWebSocket? NativeClient { get; } + + /// + /// Sets used encoding for sending and receiving text messages. + /// Default: UTF8 + /// + Encoding? MessageEncoding { get; set; } + + /// + /// Start listening to the websocket stream on the background thread. + /// In case of connection error it doesn't throw an exception. + /// Only streams a message via 'DisconnectionHappened' and logs it. + /// + Task Start(); + + /// + /// Start listening to the websocket stream on the background thread. + /// In case of connection error it throws an exception. + /// Fail fast approach. + /// + Task StartOrFail(); + + /// + /// Stop/close websocket connection with custom close code. + /// Method doesn't throw exception, only logs it and mark client as closed. + /// + /// Returns true if close was initiated successfully + Task Stop(WebSocketCloseStatus status, string statusDescription); + + /// + /// Stop/close websocket connection with custom close code. + /// Method could throw exceptions, but client is marked as closed anyway. + /// + /// Returns true if close was initiated successfully + Task StopOrFail(WebSocketCloseStatus status, string statusDescription); + + /// + /// Send message to the websocket channel. + /// It inserts the message to the queue and actual sending is done on an other thread + /// + /// Message to be sent + void Send(string message); + + /// + /// Send binary message to the websocket channel. + /// It inserts the message to the queue and actual sending is done on an other thread + /// + /// Binary message to be sent + void Send(byte[] message); + + /// + /// Send binary message to the websocket channel. + /// It inserts the message to the queue and actual sending is done on an other thread + /// + /// Binary message to be sent + void Send(ArraySegment message); + + /// + /// Send message to the websocket channel. + /// It doesn't use a sending queue, + /// beware of issue while sending two messages in the exact same time + /// on the full .NET Framework platform + /// + /// Message to be sent + Task SendInstant(string message); + + /// + /// Send binary message to the websocket channel. + /// It doesn't use a sending queue, + /// beware of issue while sending two messages in the exact same time + /// on the full .NET Framework platform + /// + /// Message to be sent + Task SendInstant(byte[] message); + + /// + /// Force reconnection. + /// Closes current websocket stream and perform a new connection to the server. + /// In case of connection error it doesn't throw an exception, but tries to reconnect indefinitely. + /// + Task Reconnect(); + + /// + /// Force reconnection. + /// Closes current websocket stream and perform a new connection to the server. + /// In case of connection error it throws an exception and doesn't perform any other reconnection try. + /// + Task ReconnectOrFail(); + + /// + /// Stream/publish fake message (via 'MessageReceived' observable). + /// Use for testing purposes to simulate a server message. + /// + /// Message to be stream + void StreamFakeMessage(ResponseMessage message); + } +} \ No newline at end of file diff --git a/Visual Studio Projects/ZWaveJS.NET/ZWaveJS.NET/Websocket.Client/Models/DisconnectionInfo.cs b/Visual Studio Projects/ZWaveJS.NET/ZWaveJS.NET/Websocket.Client/Models/DisconnectionInfo.cs new file mode 100644 index 0000000..3f6e8b4 --- /dev/null +++ b/Visual Studio Projects/ZWaveJS.NET/ZWaveJS.NET/Websocket.Client/Models/DisconnectionInfo.cs @@ -0,0 +1,72 @@ +#nullable enable +using System; +using System.Net.WebSockets; + +// ReSharper disable once CheckNamespace +namespace Websocket.Client +{ + /// + /// Info about happened disconnection + /// + public class DisconnectionInfo + { + /// + /// Info about happened disconnection + /// + public DisconnectionInfo(DisconnectionType type, WebSocketCloseStatus? closeStatus, + string? closeStatusDescription, string? subProtocol, Exception? exception) + { + Type = type; + CloseStatus = closeStatus; + CloseStatusDescription = closeStatusDescription; + SubProtocol = subProtocol; + Exception = exception; + } + + /// + /// Disconnection reason + /// + public DisconnectionType Type { get; } + + /// + /// Indicates the reason why the remote endpoint initiated the close handshake + /// + public WebSocketCloseStatus? CloseStatus { get; } + + /// + /// Allows the remote endpoint to describe the reason why the connection was closed + /// + public string? CloseStatusDescription { get; } + + /// + /// The subprotocol that was negotiated during the opening handshake + /// + public string? SubProtocol { get; } + + /// + /// Exception that cause disconnection, can be null + /// + public Exception? Exception { get; } + + + /// + /// Set to true if you want to cancel ongoing reconnection + /// + public bool CancelReconnection { get; set; } + + /// + /// Set to true if you want to cancel ongoing connection close (only when Type = ByServer) + /// + public bool CancelClosing { get; set; } + + + /// + /// Simple factory method + /// + public static DisconnectionInfo Create(DisconnectionType type, WebSocket? client, Exception? exception) + { + return new DisconnectionInfo(type, client?.CloseStatus, client?.CloseStatusDescription, + client?.SubProtocol, exception); + } + } +} diff --git a/Visual Studio Projects/ZWaveJS.NET/ZWaveJS.NET/Websocket.Client/Models/DisconnectionType.cs b/Visual Studio Projects/ZWaveJS.NET/ZWaveJS.NET/Websocket.Client/Models/DisconnectionType.cs new file mode 100644 index 0000000..c6bfb2f --- /dev/null +++ b/Visual Studio Projects/ZWaveJS.NET/ZWaveJS.NET/Websocket.Client/Models/DisconnectionType.cs @@ -0,0 +1,40 @@ +// ReSharper disable once CheckNamespace +namespace Websocket.Client +{ + /// + /// Type that specify happened disconnection + /// + public enum DisconnectionType + { + /// + /// Type used for exit event, disposing of the websocket client + /// + Exit = 0, + + /// + /// Type used when connection to websocket was lost in meantime + /// + Lost = 1, + + /// + /// Type used when connection to websocket was lost by not receiving any message in given time-range + /// + NoMessageReceived = 2, + + /// + /// Type used when connection or reconnection returned error + /// + Error = 3, + + /// + /// Type used when disconnection was requested by user + /// + ByUser = 4, + + + /// + /// Type used when disconnection was requested by server + /// + ByServer = 5 + } +} diff --git a/Visual Studio Projects/ZWaveJS.NET/ZWaveJS.NET/Websocket.Client/Models/ReconnectionInfo.cs b/Visual Studio Projects/ZWaveJS.NET/ZWaveJS.NET/Websocket.Client/Models/ReconnectionInfo.cs new file mode 100644 index 0000000..c3a76ec --- /dev/null +++ b/Visual Studio Projects/ZWaveJS.NET/ZWaveJS.NET/Websocket.Client/Models/ReconnectionInfo.cs @@ -0,0 +1,30 @@ +// ReSharper disable once CheckNamespace +namespace Websocket.Client +{ + /// + /// Info about happened reconnection + /// + public class ReconnectionInfo + { + /// + /// Info about happened reconnection + /// + public ReconnectionInfo(ReconnectionType type) + { + Type = type; + } + + /// + /// Reconnection reason + /// + public ReconnectionType Type { get; } + + /// + /// Simple factory method + /// + public static ReconnectionInfo Create(ReconnectionType type) + { + return new ReconnectionInfo(type); + } + } +} diff --git a/Visual Studio Projects/ZWaveJS.NET/ZWaveJS.NET/Websocket.Client/Models/ReconnectionType.cs b/Visual Studio Projects/ZWaveJS.NET/ZWaveJS.NET/Websocket.Client/Models/ReconnectionType.cs new file mode 100644 index 0000000..356743c --- /dev/null +++ b/Visual Studio Projects/ZWaveJS.NET/ZWaveJS.NET/Websocket.Client/Models/ReconnectionType.cs @@ -0,0 +1,39 @@ +// ReSharper disable once CheckNamespace +namespace Websocket.Client +{ + /// + /// Type that specify happened reconnection + /// + public enum ReconnectionType + { + /// + /// Type used for initial connection to websocket stream + /// + Initial = 0, + + /// + /// Type used when connection to websocket was lost in meantime + /// + Lost = 1, + + /// + /// Type used when connection to websocket was lost by not receiving any message in given time-range + /// + NoMessageReceived = 2, + + /// + /// Type used after unsuccessful previous reconnection + /// + Error = 3, + + /// + /// Type used when reconnection was requested by user + /// + ByUser = 4, + + /// + /// Type used when reconnection was requested by server + /// + ByServer = 5 + } +} diff --git a/Visual Studio Projects/ZWaveJS.NET/ZWaveJS.NET/Websocket.Client/ResponseMessage.cs b/Visual Studio Projects/ZWaveJS.NET/ZWaveJS.NET/Websocket.Client/ResponseMessage.cs new file mode 100644 index 0000000..ad7e9b1 --- /dev/null +++ b/Visual Studio Projects/ZWaveJS.NET/ZWaveJS.NET/Websocket.Client/ResponseMessage.cs @@ -0,0 +1,62 @@ +#nullable enable +using System.Net.WebSockets; + +namespace Websocket.Client +{ + /// + /// Received message, could be Text or Binary + /// + public class ResponseMessage + { + private ResponseMessage(byte[]? binary, string? text, WebSocketMessageType messageType) + { + Binary = binary; + Text = text; + MessageType = messageType; + } + + /// + /// Received text message (only if type = WebSocketMessageType.Text) + /// + public string? Text { get; } + + /// + /// Received text message (only if type = WebSocketMessageType.Binary) + /// + public byte[]? Binary { get; } + + /// + /// Current message type (Text or Binary) + /// + public WebSocketMessageType MessageType { get; } + + /// + /// Return string info about the message + /// + public override string ToString() + { + if (MessageType == WebSocketMessageType.Text) + { + return Text ?? string.Empty; + } + + return $"Type binary, length: {Binary?.Length}"; + } + + /// + /// Create text response message + /// + public static ResponseMessage TextMessage(string? data) + { + return new ResponseMessage(null, data, WebSocketMessageType.Text); + } + + /// + /// Create binary response message + /// + public static ResponseMessage BinaryMessage(byte[]? data) + { + return new ResponseMessage(data, null, WebSocketMessageType.Binary); + } + } +} \ No newline at end of file diff --git a/Visual Studio Projects/ZWaveJS.NET/ZWaveJS.NET/Websocket.Client/Threading/WebsocketAsyncLock.cs b/Visual Studio Projects/ZWaveJS.NET/ZWaveJS.NET/Websocket.Client/Threading/WebsocketAsyncLock.cs new file mode 100644 index 0000000..e443909 --- /dev/null +++ b/Visual Studio Projects/ZWaveJS.NET/ZWaveJS.NET/Websocket.Client/Threading/WebsocketAsyncLock.cs @@ -0,0 +1,74 @@ +using System; +using System.Threading; +using System.Threading.Tasks; + +namespace Websocket.Client.Threading +{ + /// + /// Class that wraps SemaphoreSlim and enables to use locking inside 'using' blocks easily + /// Don't need to bother with releasing and handling SemaphoreSlim correctly + /// Example: + /// + /// using(await _asyncLock.LockAsync()) + /// { + /// // do your synchronized work + /// } + /// + /// + public class WebsocketAsyncLock + { + private readonly Task _releaserTask; + private readonly SemaphoreSlim _semaphore = new SemaphoreSlim(1, 1); + private readonly IDisposable _releaser; + + /// + /// Class that wraps SemaphoreSlim and enables to use locking inside 'using' blocks easily + /// Don't need to bother with releasing and handling SemaphoreSlim correctly + /// + public WebsocketAsyncLock() + { + _releaser = new Releaser(_semaphore); + _releaserTask = Task.FromResult(_releaser); + } + + /// + /// Use inside 'using' block + /// + public IDisposable Lock() + { + _semaphore.Wait(); + return _releaser; + } + + /// + /// Use inside 'using' block with await + /// + public Task LockAsync() + { + var waitTask = _semaphore.WaitAsync(); + return waitTask.IsCompleted + ? _releaserTask + : waitTask.ContinueWith( + (_, releaser) => (IDisposable)releaser!, + _releaser, + CancellationToken.None, + TaskContinuationOptions.ExecuteSynchronously, + TaskScheduler.Default); + } + + private class Releaser : IDisposable + { + private readonly SemaphoreSlim _semaphore; + + public Releaser(SemaphoreSlim semaphore) + { + _semaphore = semaphore; + } + + public void Dispose() + { + _semaphore.Release(); + } + } + } +} diff --git a/Visual Studio Projects/ZWaveJS.NET/ZWaveJS.NET/Websocket.Client/Validations/Validations.cs b/Visual Studio Projects/ZWaveJS.NET/ZWaveJS.NET/Websocket.Client/Validations/Validations.cs new file mode 100644 index 0000000..d2ab633 --- /dev/null +++ b/Visual Studio Projects/ZWaveJS.NET/ZWaveJS.NET/Websocket.Client/Validations/Validations.cs @@ -0,0 +1,109 @@ +using System.Collections.Generic; +using System.Linq; +using Websocket.Client.Exceptions; + +namespace Websocket.Client.Validations +{ + internal static class Validations + { + /// + /// It throws if value is null or empty/white spaces + /// + /// The value to be validated + /// Input parameter name + public static void ValidateInput(string value, string name) + { + if (string.IsNullOrEmpty(value)) + { + throw new WebsocketBadInputException($"Input string parameter '{name}' is null or empty. Please correct it."); + } + } + + /// + /// It throws if value is null + /// + /// The value to be validated + /// Input parameter name + public static void ValidateInput(T value, string name) + { + if (Equals(value, default(T))) + { + throw new WebsocketBadInputException($"Input parameter '{name}' is null. Please correct it."); + } + } + + /// + /// It throws if collection is null or collection is empty + /// + /// The collection to be validated + /// Input parameter name + public static void ValidateInputCollection(IEnumerable collection, string name) + { + // ReSharper disable once PossibleMultipleEnumeration + ValidateInput(collection, name); + + // ReSharper disable once PossibleMultipleEnumeration + if (!collection.Any()) + { + throw new WebsocketBadInputException($"Input collection '{name}' is empty. Please correct it."); + } + } + + /// + /// It throws if value is not in specified range + /// + /// The value to be validated + /// Input parameter name + /// Minimal value of input + /// Maximum value of input + public static void ValidateInput(int value, string name, int minValue = int.MinValue, int maxValue = int.MaxValue) + { + if (value < minValue) + { + throw new WebsocketBadInputException($"Input parameter '{name}' is lower than {minValue}. Please correct it."); + } + if (value > maxValue) + { + throw new WebsocketBadInputException($"Input parameter '{name}' is higher than {maxValue}. Please correct it."); + } + } + + /// + /// It throws if value is not in specified range + /// + /// The value to be validated + /// Input parameter name + /// Minimal value of input + /// Maximum value of input + public static void ValidateInput(long value, string name, long minValue = long.MinValue, long maxValue = long.MaxValue) + { + if (value < minValue) + { + throw new WebsocketBadInputException($"Input parameter '{name}' is lower than {minValue}. Please correct it."); + } + if (value > maxValue) + { + throw new WebsocketBadInputException($"Input parameter '{name}' is higher than {maxValue}. Please correct it."); + } + } + + /// + /// It throws if value is not in specified range + /// + /// The value to be validated + /// Input parameter name + /// Minimal value of input + /// Maximum value of input + public static void ValidateInput(double value, string name, double minValue = double.MinValue, double maxValue = double.MaxValue) + { + if (value < minValue) + { + throw new WebsocketBadInputException($"Input parameter '{name}' is lower than {minValue}. Please correct it."); + } + if (value > maxValue) + { + throw new WebsocketBadInputException($"Input parameter '{name}' is higher than {maxValue}. Please correct it."); + } + } + } +} diff --git a/Visual Studio Projects/ZWaveJS.NET/ZWaveJS.NET/Websocket.Client/WebsocketClient.Reconnecting.cs b/Visual Studio Projects/ZWaveJS.NET/ZWaveJS.NET/Websocket.Client/WebsocketClient.Reconnecting.cs new file mode 100644 index 0000000..eabafc4 --- /dev/null +++ b/Visual Studio Projects/ZWaveJS.NET/ZWaveJS.NET/Websocket.Client/WebsocketClient.Reconnecting.cs @@ -0,0 +1,138 @@ +#nullable enable +using System; +using System.Threading; +using System.Threading.Tasks; +using Microsoft.Extensions.Logging; + +namespace Websocket.Client +{ + public partial class WebsocketClient + { + + /// + /// Force reconnection. + /// Closes current websocket stream and perform a new connection to the server. + /// In case of connection error it doesn't throw an exception, but tries to reconnect indefinitely. + /// + public Task Reconnect() + { + return ReconnectInternal(false); + } + + /// + /// Force reconnection. + /// Closes current websocket stream and perform a new connection to the server. + /// In case of connection error it throws an exception and doesn't perform any other reconnection try. + /// + public Task ReconnectOrFail() + { + return ReconnectInternal(true); + } + + private async Task ReconnectInternal(bool failFast) + { + if (!IsStarted) + { + _logger.LogDebug(L("Client not started, ignoring reconnection.."), Name); + return; + } + + try + { + await ReconnectSynchronized(ReconnectionType.ByUser, failFast, null).ConfigureAwait(false); + } + finally + { + _reconnecting = false; + } + } + + private async Task ReconnectSynchronized(ReconnectionType type, bool failFast, Exception? causedException) + { + using (await _locker.LockAsync()) + { + await Reconnect(type, failFast, causedException); + } + } + + private async Task Reconnect(ReconnectionType type, bool failFast, Exception? causedException) + { + IsRunning = false; + if (_disposing || !IsStarted) + { + // client already disposed or stopped manually + return; + } + + _reconnecting = true; + + var disType = TranslateTypeToDisconnection(type); + var disInfo = DisconnectionInfo.Create(disType, _client, causedException); + if (type != ReconnectionType.Error) + { + _disconnectedSubject.OnNext(disInfo); + if (disInfo.CancelReconnection) + { + // reconnection canceled by user, do nothing + _logger.LogInformation(L("Reconnecting canceled by user, exiting."), Name); + } + } + + _cancellation?.Cancel(); + try + { + _client?.Abort(); + } + catch (Exception e) + { + _logger.LogError(e, L("Exception while aborting client. Error: '{error}'"), Name, e.Message); + } + _client?.Dispose(); + + if (!IsReconnectionEnabled || disInfo.CancelReconnection) + { + // reconnection disabled, do nothing + IsStarted = false; + _reconnecting = false; + return; + } + + _logger.LogDebug(L("Reconnecting..."), Name); + _cancellation = new CancellationTokenSource(); + await StartClient(_url, _cancellation.Token, type, failFast).ConfigureAwait(false); + _reconnecting = false; + } + + private void ActivateLastChance() + { + var timerMs = 1000 * 1; + _lastChanceTimer = new Timer(LastChance, null, timerMs, timerMs); + } + + private void DeactivateLastChance() + { + _lastChanceTimer?.Dispose(); + _lastChanceTimer = null; + } + + private void LastChance(object? state) + { + if (!IsReconnectionEnabled || ReconnectTimeout == null) + { + // reconnection disabled, do nothing + DeactivateLastChance(); + return; + } + + var timeoutMs = Math.Abs(ReconnectTimeout.Value.TotalMilliseconds); + var diffMs = Math.Abs(DateTime.UtcNow.Subtract(_lastReceivedMsg).TotalMilliseconds); + if (diffMs > timeoutMs) + { + _logger.LogDebug(L("Last message received more than {timeoutMs} ms ago. Hard restart.."), Name, timeoutMs.ToString("F")); + + DeactivateLastChance(); + _ = ReconnectSynchronized(ReconnectionType.NoMessageReceived, false, null); + } + } + } +} diff --git a/Visual Studio Projects/ZWaveJS.NET/ZWaveJS.NET/Websocket.Client/WebsocketClient.Sending.cs b/Visual Studio Projects/ZWaveJS.NET/ZWaveJS.NET/Websocket.Client/WebsocketClient.Sending.cs new file mode 100644 index 0000000..1967941 --- /dev/null +++ b/Visual Studio Projects/ZWaveJS.NET/ZWaveJS.NET/Websocket.Client/WebsocketClient.Sending.cs @@ -0,0 +1,239 @@ +#nullable enable +using System; +using System.Net.WebSockets; +using System.Threading; +using System.Threading.Channels; +using System.Threading.Tasks; +using Microsoft.Extensions.Logging; + +namespace Websocket.Client +{ + public partial class WebsocketClient + { + private readonly Channel _messagesTextToSendQueue = Channel.CreateUnbounded(new UnboundedChannelOptions() + { + SingleReader = true, + SingleWriter = false + }); + private readonly Channel> _messagesBinaryToSendQueue = Channel.CreateUnbounded>(new UnboundedChannelOptions() + { + SingleReader = true, + SingleWriter = false + }); + + + /// + /// Send text message to the websocket channel. + /// It inserts the message to the queue and actual sending is done on an other thread + /// + /// Text message to be sent + public void Send(string message) + { + Validations.Validations.ValidateInput(message, nameof(message)); + + _messagesTextToSendQueue.Writer.TryWrite(message); + } + + /// + /// Send binary message to the websocket channel. + /// It inserts the message to the queue and actual sending is done on an other thread + /// + /// Binary message to be sent + public void Send(byte[] message) + { + Validations.Validations.ValidateInput(message, nameof(message)); + + _messagesBinaryToSendQueue.Writer.TryWrite(new ArraySegment(message)); + } + + /// + /// Send binary message to the websocket channel. + /// It inserts the message to the queue and actual sending is done on an other thread + /// + /// Binary message to be sent + public void Send(ArraySegment message) + { + Validations.Validations.ValidateInput(message, nameof(message)); + + _messagesBinaryToSendQueue.Writer.TryWrite(message); + } + + /// + /// Send text message to the websocket channel. + /// It doesn't use a sending queue, + /// beware of issue while sending two messages in the exact same time + /// on the full .NET Framework platform + /// + /// Message to be sent + public Task SendInstant(string message) + { + Validations.Validations.ValidateInput(message, nameof(message)); + + return SendInternalSynchronized(message); + } + + /// + /// Send binary message to the websocket channel. + /// It doesn't use a sending queue, + /// beware of issue while sending two messages in the exact same time + /// on the full .NET Framework platform + /// + /// Message to be sent + public Task SendInstant(byte[] message) + { + return SendInternalSynchronized(new ArraySegment(message)); + } + + /// + /// Stream/publish fake message (via 'MessageReceived' observable). + /// Use for testing purposes to simulate a server message. + /// + /// Message to be stream + public void StreamFakeMessage(ResponseMessage message) + { + Validations.Validations.ValidateInput(message, nameof(message)); + + _messageReceivedSubject.OnNext(message); + } + + + private async Task SendTextFromQueue() + { + try + { + while (await _messagesTextToSendQueue.Reader.WaitToReadAsync()) + { + while (_messagesTextToSendQueue.Reader.TryRead(out var message)) + { + try + { + await SendInternalSynchronized(message).ConfigureAwait(false); + } + catch (Exception e) + { + _logger.LogError(e, L("Failed to send text message: '{message}'. Error: {error}"), Name, message, e.Message); + } + } + } + } + catch (TaskCanceledException) + { + // task was canceled, ignore + } + catch (OperationCanceledException) + { + // operation was canceled, ignore + } + catch (Exception e) + { + if (_cancellationTotal?.IsCancellationRequested == true || _disposing) + { + // disposing/canceling, do nothing and exit + return; + } + + _logger.LogTrace(L("Sending text thread failed, error: {error}. Creating a new sending thread."), Name, e.Message); + StartBackgroundThreadForSendingText(); + } + + } + + private async Task SendBinaryFromQueue() + { + try + { + while (await _messagesBinaryToSendQueue.Reader.WaitToReadAsync()) + { + while (_messagesBinaryToSendQueue.Reader.TryRead(out var message)) + { + try + { + await SendInternalSynchronized(message).ConfigureAwait(false); + } + catch (Exception e) + { + _logger.LogError(e, L("Failed to send binary message: '{message}'. Error: {error}"), Name, message, e.Message); + } + } + } + } + catch (TaskCanceledException) + { + // task was canceled, ignore + } + catch (OperationCanceledException) + { + // operation was canceled, ignore + } + catch (Exception e) + { + if (_cancellationTotal?.IsCancellationRequested == true || _disposing) + { + // disposing/canceling, do nothing and exit + return; + } + + _logger.LogTrace(L("Sending binary thread failed, error: {error}. Creating a new sending thread."), Name, e.Message); + StartBackgroundThreadForSendingBinary(); + } + + } + + private void StartBackgroundThreadForSendingText() + { + _ = Task.Factory.StartNew(_ => SendTextFromQueue(), TaskCreationOptions.LongRunning, _cancellationTotal?.Token ?? CancellationToken.None); + } + + private void StartBackgroundThreadForSendingBinary() + { + _ = Task.Factory.StartNew(_ => SendBinaryFromQueue(), TaskCreationOptions.LongRunning, _cancellationTotal?.Token ?? CancellationToken.None); + } + + private async Task SendInternalSynchronized(string message) + { + using (await _locker.LockAsync()) + { + await SendInternal(message); + } + } + + private async Task SendInternal(string message) + { + if (!IsClientConnected()) + { + _logger.LogDebug(L("Client is not connected to server, cannot send: {message}"), Name, message); + return; + } + + _logger.LogTrace(L("Sending: {message}"), Name, message); + var buffer = GetEncoding().GetBytes(message); + var messageSegment = new ArraySegment(buffer); + await _client! + .SendAsync(messageSegment, WebSocketMessageType.Text, true, _cancellation?.Token ?? CancellationToken.None) + .ConfigureAwait(false); + } + + private async Task SendInternalSynchronized(ArraySegment message) + { + using (await _locker.LockAsync()) + { + await SendInternal(message); + } + } + + private async Task SendInternal(ArraySegment message) + { + if (!IsClientConnected()) + { + _logger.LogDebug(L("Client is not connected to server, cannot send binary, length: {length}"), Name, message.Count); + return; + } + + _logger.LogTrace(L("Sending binary, length: {length}"), Name, message.Count); + + await _client! + .SendAsync(message, WebSocketMessageType.Binary, true, _cancellation?.Token ?? CancellationToken.None) + .ConfigureAwait(false); + } + } +} diff --git a/Visual Studio Projects/ZWaveJS.NET/ZWaveJS.NET/Websocket.Client/WebsocketClient.cs b/Visual Studio Projects/ZWaveJS.NET/ZWaveJS.NET/Websocket.Client/WebsocketClient.cs new file mode 100644 index 0000000..d4b6fbd --- /dev/null +++ b/Visual Studio Projects/ZWaveJS.NET/ZWaveJS.NET/Websocket.Client/WebsocketClient.cs @@ -0,0 +1,649 @@ +#nullable enable +using Microsoft.Extensions.Logging; +using System; +using System.IO; +using System.Linq; +using System.Net.WebSockets; +using System.Reactive.Linq; +using System.Reactive.Subjects; +using System.Text; +using System.Threading; +using System.Threading.Tasks; +using Microsoft.Extensions.Logging.Abstractions; +using Websocket.Client.Exceptions; +using Websocket.Client.Threading; + +namespace Websocket.Client +{ + /// + /// A simple websocket client with built-in reconnection and error handling + /// + public partial class WebsocketClient : IWebsocketClient + { + private readonly ILogger _logger; + private readonly WebsocketAsyncLock _locker = new WebsocketAsyncLock(); + private readonly Func> _connectionFactory; + + private Uri _url; + private Timer? _lastChanceTimer; + private DateTime _lastReceivedMsg = DateTime.UtcNow; + + private Timer? _errorReconnectTimer; + + private bool _disposing; + private bool _reconnecting; + private bool _stopping; + private bool _isReconnectionEnabled = true; + private WebSocket? _client; + private CancellationTokenSource? _cancellation; + private CancellationTokenSource? _cancellationTotal; + + private readonly Subject _messageReceivedSubject = new Subject(); + private readonly Subject _reconnectionSubject = new Subject(); + private readonly Subject _disconnectedSubject = new Subject(); + + /// + /// A simple websocket client with built-in reconnection and error handling + /// + /// Target websocket url (wss://) + /// Optional factory for native ClientWebSocket, use it whenever you need some custom features (proxy, settings, etc) + public WebsocketClient(Uri url, Func? clientFactory = null) + : this(url, null, GetClientFactory(clientFactory)) + { + } + + /// + /// A simple websocket client with built-in reconnection and error handling + /// + /// Target websocket url (wss://) + /// Logger instance, can be null + /// Optional factory for native ClientWebSocket, use it whenever you need some custom features (proxy, settings, etc) + public WebsocketClient(Uri url, ILogger? logger, Func? clientFactory = null) + : this(url, logger, GetClientFactory(clientFactory)) + { + } + + /// + /// A simple websocket client with built-in reconnection and error handling + /// + /// Target websocket url (wss://) + /// Logger instance, can be null + /// Optional factory for native creating and connecting to a websocket. The method should return a which is connected. Use it whenever you need some custom features (proxy, settings, etc) + public WebsocketClient(Uri url, ILogger? logger, Func>? connectionFactory) + { + Validations.Validations.ValidateInput(url, nameof(url)); + + _logger = logger ?? NullLogger.Instance; + _url = url; + _connectionFactory = connectionFactory ?? (async (uri, token) => + { + //var client = new ClientWebSocket + //{ + // Options = { KeepAliveInterval = new TimeSpan(0, 0, 5, 0) } + //}; + var client = new ClientWebSocket(); + await client.ConnectAsync(uri, token).ConfigureAwait(false); + return client; + }); + } + + /// + public Uri Url + { + get => _url; + set + { + Validations.Validations.ValidateInput(value, nameof(Url)); + _url = value; + } + } + + /// + /// Stream with received message (raw format) + /// + public IObservable MessageReceived => _messageReceivedSubject.AsObservable(); + + /// + /// Stream for reconnection event (triggered after the new connection) + /// + public IObservable ReconnectionHappened => _reconnectionSubject.AsObservable(); + + /// + /// Stream for disconnection event (triggered after the connection was lost) + /// + public IObservable DisconnectionHappened => _disconnectedSubject.AsObservable(); + + /// + /// Time range for how long to wait before reconnecting if no message comes from server. + /// Set null to disable this feature. + /// Default: 1 minute + /// + public TimeSpan? ReconnectTimeout { get; set; } = TimeSpan.FromMinutes(1); + + /// + /// Time range for how long to wait before reconnecting if last reconnection failed. + /// Set null to disable this feature. + /// Default: 1 minute + /// + public TimeSpan? ErrorReconnectTimeout { get; set; } = TimeSpan.FromMinutes(1); + + /// + /// Time range for how long to wait before reconnecting if connection is lost with a transient error. + /// Set null to disable this feature. + /// Default: null/disabled (immediately) + /// + public TimeSpan? LostReconnectTimeout { get; set; } + + /// + /// Enable or disable reconnection functionality (enabled by default) + /// + public bool IsReconnectionEnabled + { + get => _isReconnectionEnabled; + set + { + _isReconnectionEnabled = value; + + if (IsStarted) + { + if (_isReconnectionEnabled) + { + ActivateLastChance(); + } + else + { + DeactivateLastChance(); + } + } + } + } + + /// + /// Get or set the name of the current websocket client instance. + /// For logging purpose (in case you use more parallel websocket clients and want to distinguish between them) + /// + public string? Name { get; set; } + + /// + /// Returns true if Start() method was called at least once. False if not started or disposed + /// + public bool IsStarted { get; private set; } + + /// + /// Returns true if client is running and connected to the server + /// + public bool IsRunning { get; private set; } + + /// + /// Enable or disable text message conversion from binary to string (via 'MessageEncoding' property). + /// Default: true + /// + public bool IsTextMessageConversionEnabled { get; set; } = true; + + /// + public Encoding? MessageEncoding { get; set; } + + /// + public ClientWebSocket? NativeClient => GetSpecificOrThrow(_client); + + /// + /// Terminate the websocket connection and cleanup everything + /// + public void Dispose() + { + _disposing = true; + _logger.LogDebug(L("Disposing.."), Name); + try + { + _messagesTextToSendQueue.Writer.Complete(); + _messagesBinaryToSendQueue.Writer.Complete(); + _lastChanceTimer?.Dispose(); + _errorReconnectTimer?.Dispose(); + _cancellation?.Cancel(); + _cancellationTotal?.Cancel(); + _client?.Abort(); + _client?.Dispose(); + _cancellation?.Dispose(); + _cancellationTotal?.Dispose(); + _messageReceivedSubject.OnCompleted(); + _reconnectionSubject.OnCompleted(); + } + catch (Exception e) + { + _logger.LogError(e, L("Failed to dispose client, error: {error}"), Name, e.Message); + } + + if (IsRunning) + { + _disconnectedSubject.OnNext(DisconnectionInfo.Create(DisconnectionType.Exit, _client, null)); + } + + IsRunning = false; + IsStarted = false; + _disconnectedSubject.OnCompleted(); + } + + /// + /// Start listening to the websocket stream on the background thread. + /// In case of connection error it doesn't throw an exception. + /// Only streams a message via 'DisconnectionHappened' and logs it. + /// + public Task Start() + { + return StartInternal(false); + } + + /// + /// Start listening to the websocket stream on the background thread. + /// In case of connection error it throws an exception. + /// Fail fast approach. + /// + public Task StartOrFail() + { + return StartInternal(true); + } + + /// + /// Stop/close websocket connection with custom close code. + /// Method doesn't throw exception, only logs it and mark client as closed. + /// + /// Returns true if close was initiated successfully + public async Task Stop(WebSocketCloseStatus status, string statusDescription) + { + var result = await StopInternal( + _client, + status, + statusDescription, + null, + false, + false).ConfigureAwait(false); + _disconnectedSubject.OnNext(DisconnectionInfo.Create(DisconnectionType.ByUser, _client, null)); + return result; + } + + /// + /// Stop/close websocket connection with custom close code. + /// Method could throw exceptions, but client is marked as closed anyway. + /// + /// Returns true if close was initiated successfully + public async Task StopOrFail(WebSocketCloseStatus status, string statusDescription) + { + var result = await StopInternal( + _client, + status, + statusDescription, + null, + true, + false).ConfigureAwait(false); + _disconnectedSubject.OnNext(DisconnectionInfo.Create(DisconnectionType.ByUser, _client, null)); + return result; + } + + private static Func>? GetClientFactory(Func? clientFactory) + { + if (clientFactory == null) + return null; + + return (async (uri, token) => + { + var client = clientFactory(); + await client.ConnectAsync(uri, token).ConfigureAwait(false); + return client; + }); + } + + private async Task StartInternal(bool failFast) + { + if (_disposing) + { + throw new WebsocketException($"Client {Name} is already disposed, starting not possible"); + } + + if (IsStarted) + { + _logger.LogDebug(L("Client already started, ignoring.."), Name); + return; + } + + IsStarted = true; + + _logger.LogDebug(L("Starting.."), Name); + _cancellation = new CancellationTokenSource(); + _cancellationTotal = new CancellationTokenSource(); + + await StartClient(_url, _cancellation.Token, ReconnectionType.Initial, failFast).ConfigureAwait(false); + + StartBackgroundThreadForSendingText(); + StartBackgroundThreadForSendingBinary(); + } + + private async Task StopInternal(WebSocket? client, WebSocketCloseStatus status, string statusDescription, + CancellationToken? cancellation, bool failFast, bool byServer) + { + if (_disposing) + { + throw new WebsocketException($"Client {Name} is already disposed, stopping not possible"); + } + + DeactivateLastChance(); + + if (client == null) + { + IsStarted = false; + IsRunning = false; + return false; + } + + if (!IsRunning) + { + _logger.LogInformation(L("Client is already stopped"), Name); + IsStarted = false; + return false; + } + + var result = false; + try + { + var cancellationToken = cancellation ?? CancellationToken.None; + _stopping = true; + if (byServer) + await client.CloseOutputAsync(status, statusDescription, cancellationToken); + else + await client.CloseAsync(status, statusDescription, cancellationToken); + result = true; + } + catch (Exception e) + { + _logger.LogError(e, L("Error while stopping client, message: '{error}'"), Name, e.Message); + + if (failFast) + { + // fail fast, propagate exception + throw new WebsocketException($"Failed to stop Websocket client {Name}, error: '{e.Message}'", e); + } + } + finally + { + IsRunning = false; + _stopping = false; + + if (!byServer || !IsReconnectionEnabled) + { + // stopped manually or no reconnection, mark client as non-started + IsStarted = false; + } + } + + return result; + } + + private async Task StartClient(Uri uri, CancellationToken token, ReconnectionType type, bool failFast) + { + DeactivateLastChance(); + + try + { + _client = await _connectionFactory(uri, token).ConfigureAwait(false); + _ = Listen(_client, token); + IsRunning = true; + IsStarted = true; + _reconnectionSubject.OnNext(ReconnectionInfo.Create(type)); + _lastReceivedMsg = DateTime.UtcNow; + ActivateLastChance(); + } + catch (Exception e) + { + var info = DisconnectionInfo.Create(DisconnectionType.Error, _client, e); + _disconnectedSubject.OnNext(info); + + if (info.CancelReconnection) + { + // reconnection canceled by user, do nothing + _logger.LogError(e, L("Exception while connecting. " + + "Reconnecting canceled by user, exiting. Error: '{error}'"), Name, e.Message); + return; + } + + if (failFast) + { + // fail fast, propagate exception + // do not reconnect + throw new WebsocketException($"Failed to start Websocket client {Name}, error: '{e.Message}'", e); + } + + if (ErrorReconnectTimeout == null) + { + _logger.LogError(e, L("Exception while connecting. " + + "Reconnecting disabled, exiting. Error: '{error}'"), Name, e.Message); + return; + } + + var timeout = ErrorReconnectTimeout.Value; + _logger.LogError(e, L("Exception while connecting. " + + "Waiting {timeout} sec before next reconnection try. Error: '{error}'"), Name, timeout.TotalSeconds, e.Message); + _errorReconnectTimer?.Dispose(); + _errorReconnectTimer = new Timer(ReconnectOnError, e, timeout, Timeout.InfiniteTimeSpan); + } + } + + private void ReconnectOnError(object? state) + { + // await Task.Delay(timeout, token).ConfigureAwait(false); + _ = Reconnect(ReconnectionType.Error, false, state as Exception).ConfigureAwait(false); + } + + private bool IsClientConnected() + { + return _client?.State == WebSocketState.Open; + } + + private async Task Listen(WebSocket client, CancellationToken token) + { + Exception? causedException = null; + try + { + // define buffer here and reuse, to avoid more allocation + const int chunkSize = 1024 * 4; + var buffer = new ArraySegment(new byte[chunkSize]); + + do + { + WebSocketReceiveResult result; + byte[]? resultArrayWithTrailing = null; + var resultArraySize = 0; + var isResultArrayCloned = false; + MemoryStream? ms = null; + + while (true) + { + result = await client.ReceiveAsync(buffer, token); + var currentChunk = buffer.Array; + var currentChunkSize = result.Count; + + var isFirstChunk = resultArrayWithTrailing == null; + if (isFirstChunk) + { + // first chunk, use buffer as reference, do not allocate anything + resultArraySize += currentChunkSize; + resultArrayWithTrailing = currentChunk; + isResultArrayCloned = false; + } + else if (currentChunk == null) + { + // weird chunk, do nothing + } + else + { + // received more chunks, lets merge them via memory stream + if (ms == null) + { + // create memory stream and insert first chunk + ms = new MemoryStream(); + ms.Write(resultArrayWithTrailing!, 0, resultArraySize); + } + + // insert current chunk + ms.Write(currentChunk, buffer.Offset, currentChunkSize); + } + + if (result.EndOfMessage) + { + break; + } + + if (isResultArrayCloned) + continue; + + // we got more chunks incoming, need to clone first chunk + resultArrayWithTrailing = resultArrayWithTrailing?.ToArray(); + isResultArrayCloned = true; + } + + ms?.Seek(0, SeekOrigin.Begin); + + ResponseMessage message; + if (result.MessageType == WebSocketMessageType.Text && IsTextMessageConversionEnabled) + { + var data = ms != null ? + GetEncoding().GetString(ms.ToArray()) : + resultArrayWithTrailing != null ? + GetEncoding().GetString(resultArrayWithTrailing, 0, resultArraySize) : + null; + + message = ResponseMessage.TextMessage(data); + } + else if (result.MessageType == WebSocketMessageType.Close) + { + _logger.LogTrace(L("Received close message"), Name); + + if (!IsStarted || _stopping) + { + return; + } + + var info = DisconnectionInfo.Create(DisconnectionType.ByServer, client, null); + _disconnectedSubject.OnNext(info); + + if (info.CancelClosing) + { + // closing canceled, reconnect if enabled + if (IsReconnectionEnabled) + { + throw new OperationCanceledException($"Websocket connection was closed by server (client: {Name})"); + } + + continue; + } + + await StopInternal(client, WebSocketCloseStatus.NormalClosure, "Closing", + token, false, true); + + // reconnect if enabled + if (IsReconnectionEnabled && !ShouldIgnoreReconnection(client)) + { + _ = ReconnectSynchronized(ReconnectionType.Lost, false, null); + } + + return; + } + else + { + if (ms != null) + { + message = ResponseMessage.BinaryMessage(ms.ToArray()); + } + else + { + Array.Resize(ref resultArrayWithTrailing, resultArraySize); + message = ResponseMessage.BinaryMessage(resultArrayWithTrailing); + } + } + + ms?.Dispose(); + + _logger.LogTrace(L("Received: {message}"), Name, message); + _lastReceivedMsg = DateTime.UtcNow; + _messageReceivedSubject.OnNext(message); + + } while (client.State == WebSocketState.Open && !token.IsCancellationRequested); + } + catch (TaskCanceledException e) + { + // task was canceled, ignore + causedException = e; + } + catch (OperationCanceledException e) + { + // operation was canceled, ignore + causedException = e; + } + catch (ObjectDisposedException e) + { + // client was disposed, ignore + causedException = e; + } + catch (Exception e) + { + _logger.LogError(e, L("Error while listening to websocket stream, error: '{error}'"), Name, e.Message); + causedException = e; + } + + if (ShouldIgnoreReconnection(client) || !IsStarted) + { + // reconnection already in progress or client stopped/disposed, do nothing + return; + } + + if (LostReconnectTimeout.HasValue) + { + var timeout = LostReconnectTimeout.Value; + _logger.LogWarning(L("Listening websocket stream is lost. " + + "Waiting {timeout} sec before next reconnection try."), Name, timeout.TotalSeconds); + await Task.Delay(timeout, token).ConfigureAwait(false); + } + + // listening thread is lost, we have to reconnect + _ = ReconnectSynchronized(ReconnectionType.Lost, false, causedException); + } + + private bool ShouldIgnoreReconnection(WebSocket client) + { + // reconnection already in progress or client stopped/ disposed, + var inProgress = _disposing || _reconnecting || _stopping; + + // already reconnected + var differentClient = client != _client; + + return inProgress || differentClient; + } + + private Encoding GetEncoding() + { + if (MessageEncoding == null) + MessageEncoding = Encoding.UTF8; + return MessageEncoding; + } + + private ClientWebSocket? GetSpecificOrThrow(WebSocket? client) + { + if (client == null) + return null; + var specific = client as ClientWebSocket; + if (specific == null) + throw new WebsocketException("Cannot cast 'WebSocket' client to 'ClientWebSocket', " + + "provide correct type via factory or don't use this property at all."); + return specific; + } + + private string L(string msg) + { + return $"[WEBSOCKET {{name}}] {msg}"; + } + + private DisconnectionType TranslateTypeToDisconnection(ReconnectionType type) + { + // beware enum indexes must correspond to each other + return (DisconnectionType)type; + } + } +} diff --git a/Visual Studio Projects/ZWaveJS.NET/ZWaveJS.NET/ZWJSSJsonConverter.cs b/Visual Studio Projects/ZWaveJS.NET/ZWaveJS.NET/ZWJSSJsonConverter.cs new file mode 100644 index 0000000..8edef5c --- /dev/null +++ b/Visual Studio Projects/ZWaveJS.NET/ZWaveJS.NET/ZWJSSJsonConverter.cs @@ -0,0 +1,53 @@ +using Newtonsoft.Json; +using Newtonsoft.Json.Linq; +using System; +using System.Reflection; + +namespace ZWaveJS.NET +{ + + internal class ZWJSSJsonConverter : JsonConverter + { + private Driver _driver; + + public ZWJSSJsonConverter(Driver driver) : + base() + { + _driver = driver; + } + public override bool CanConvert(Type objectType) + { + return typeof(ZWaveNode).IsAssignableFrom(objectType) || + typeof(Endpoint).IsAssignableFrom(objectType) || + typeof(Controller).IsAssignableFrom(objectType); + } + + public override bool CanWrite + { + get { return false; } + } + + public override object ReadJson(JsonReader reader, + Type objectType, + object existingValue, + JsonSerializer serializer) + { + // Load JObject from stream + JObject jObject = JObject.Load(reader); + + // Create target object based on JObject + object target = Activator.CreateInstance(objectType, BindingFlags.Public | BindingFlags.NonPublic | BindingFlags.Instance, + null, new object[] { _driver }, null); + + // Populate the object properties + serializer.Populate(jObject.CreateReader(), target); + + return target; + } + + public override void WriteJson(JsonWriter writer, object value, JsonSerializer serializer) + { + throw new NotImplementedException(); + } + } +} diff --git a/Visual Studio Projects/ZWaveJS.NET/ZWaveJS.NET/ZWaveJS.NET.csproj b/Visual Studio Projects/ZWaveJS.NET/ZWaveJS.NET/ZWaveJS.NET.csproj index d5701ac..1c5b285 100644 --- a/Visual Studio Projects/ZWaveJS.NET/ZWaveJS.NET/ZWaveJS.NET.csproj +++ b/Visual Studio Projects/ZWaveJS.NET/ZWaveJS.NET/ZWaveJS.NET.csproj @@ -1,8 +1,8 @@ - net45;net48;net5.0;netstandard2.0;netstandard2.1;netcoreapp3.1 - 3.1.0 + net48;net6.0;net7.0;net8.0;netstandard2.0;netstandard2.1 + 4.0.0 Marcus Davies true ZWave JS @@ -13,10 +13,16 @@ MIT Logo.png + d23bfce5-76f4-45a1-820d-7afd4ac2a291 + Debug;Release + 8.0 - - + + + + + diff --git a/Visual Studio Projects/ZWaveJS.NET/ZWaveJS.NET/ZWaveJS.NET.csproj.user b/Visual Studio Projects/ZWaveJS.NET/ZWaveJS.NET/ZWaveJS.NET.csproj.user index 7035d5c..13d1c29 100644 --- a/Visual Studio Projects/ZWaveJS.NET/ZWaveJS.NET/ZWaveJS.NET.csproj.user +++ b/Visual Studio Projects/ZWaveJS.NET/ZWaveJS.NET/ZWaveJS.NET.csproj.user @@ -1,6 +1,6 @@  - netstandard2.1 + net48 \ No newline at end of file diff --git a/Visual Studio Projects/ZWaveJS.NET/ZWaveJS.NET/ZWaveNode.cs b/Visual Studio Projects/ZWaveJS.NET/ZWaveJS.NET/ZWaveNode.cs index 0bfea21..8ddfd07 100644 --- a/Visual Studio Projects/ZWaveJS.NET/ZWaveJS.NET/ZWaveNode.cs +++ b/Visual Studio Projects/ZWaveJS.NET/ZWaveJS.NET/ZWaveNode.cs @@ -4,16 +4,18 @@ using System.Collections.Generic; using Newtonsoft.Json; using System.Linq; -using System.IO; +using static ZWaveJS.NET.Enums; + namespace ZWaveJS.NET { public class ZWaveNode { - internal ZWaveNode() + private Driver _driver; + internal ZWaveNode(Driver driver = null) { - + _driver = driver; } - + public delegate void LifelineHealthCheckProgress(int Round, int TotalRounds, int LastRating); private LifelineHealthCheckProgress LifelineHealthCheckProgressSub; internal void Trigger_LifelineHealthCheckProgress(int Round, int TotalRounds, int LastRating) @@ -21,42 +23,56 @@ internal void Trigger_LifelineHealthCheckProgress(int Round, int TotalRounds, in LifelineHealthCheckProgressSub?.Invoke(Round, TotalRounds, LastRating); } - public delegate void StatisticsUpdatedEvent(ZWaveNode Node, NodeStatistics Statistics); + public delegate void StatisticsUpdatedEvent(ZWaveNode Node, NodeStatisticsUpdatedArgs Args); public event StatisticsUpdatedEvent StatisticsUpdated; - internal void Trigger_StatisticsUpdated(NodeStatistics Statistics) + internal void Trigger_StatisticsUpdated(NodeStatisticsUpdatedArgs Args) { - this.statistics = Statistics; - StatisticsUpdated?.Invoke(this, Statistics); + this.statistics = Args; + StatisticsUpdated?.Invoke(this, Args); } - public delegate void FirmwareUpdateFinishedEvent(ZWaveNode Node, int Status, int WaitTime); + public delegate void FirmwareUpdateFinishedEvent(ZWaveNode Node, NodeFirmwareUpdateResultArgs Args); public event FirmwareUpdateFinishedEvent FirmwareUpdateFinished; - internal void Trigger_FirmwareUpdateFinished(int Status, int Time) + internal void Trigger_FirmwareUpdateFinished(NodeFirmwareUpdateResultArgs Args) { - FirmwareUpdateFinished?.Invoke(this, Status, Time); + FirmwareUpdateFinished?.Invoke(this, Args); } - public delegate void FirmwareUpdateProgressEvent(ZWaveNode Node, int SentFragments, int TotalFragments); + public delegate void FirmwareUpdateProgressEvent(ZWaveNode Node, NodeFirmwareUpdateProgressArgs Args); public event FirmwareUpdateProgressEvent FirmwareUpdateProgress; - internal void Trigger_FirmwareUpdateProgress(int SentFragments, int TotalFragments) + internal void Trigger_FirmwareUpdateProgress(NodeFirmwareUpdateProgressArgs Args) { - FirmwareUpdateProgress?.Invoke(this, SentFragments, TotalFragments); + FirmwareUpdateProgress?.Invoke(this, Args); } - public delegate void ValueNotificationEvent(ZWaveNode Node, JObject Args); + public delegate void ValueNotificationEvent(ZWaveNode Node, ValueNotificationArgs Args); public event ValueNotificationEvent ValueNotification; - internal void Trigger_ValueNotification(JObject Args) + internal void Trigger_ValueNotification(ValueNotificationArgs Args) { ValueNotification?.Invoke(this, Args); } - public delegate void ValueUpdatedEvent(ZWaveNode Node, JObject Args); + public delegate void ValueUpdatedEvent(ZWaveNode Node, ValueUpdatedArgs Args); public event ValueUpdatedEvent ValueUpdated; - internal void Trigger_ValueUpdated(JObject Args) + internal void Trigger_ValueUpdated(ValueUpdatedArgs Args) { ValueUpdated?.Invoke(this, Args); } + public delegate void ValueAddedEvent(ZWaveNode Node, ValueAddedArgs Args); + public event ValueAddedEvent ValueAdded; + internal void Trigger_ValueAdded(ValueAddedArgs Args) + { + ValueAdded?.Invoke(this, Args); + } + + public delegate void ValueRemovedEvent(ZWaveNode Node, ValueRemovedArgs Args); + public event ValueRemovedEvent ValueRemoved; + internal void Trigger_ValueRemoved(ValueRemovedArgs Args) + { + ValueRemoved?.Invoke(this, Args); + } + public delegate void NotificationEvent(ZWaveNode Node, int ccId, JObject Args); public event NotificationEvent Notification; internal void Trigger_Notification(int CCID, JObject Args) @@ -64,6 +80,14 @@ internal void Trigger_Notification(int CCID, JObject Args) Notification?.Invoke(this, CCID, Args); } + public delegate void NodeAliveEvent(ZWaveNode Node); + public event NodeAliveEvent NodeAlive; + internal void Trigger_NodeAlive() + { + this.status = Enums.NodeStatus.Alive; + NodeAlive?.Invoke(this); + } + public delegate void NodeDeadEvent(ZWaveNode Node); public event NodeDeadEvent NodeDead; internal void Trigger_NodeDead() @@ -117,6 +141,60 @@ internal void Trigger_NodeInterviewFailed(NodeInterviewFailedEventArgs Args) NodeInterviewFailed?.Invoke(this, Args); } + // CHECKED + public Task Ping() + { + Guid ID = Guid.NewGuid(); + + TaskCompletionSource Result = new TaskCompletionSource(); + _driver.Callbacks.Add(ID, (JO) => + { + CMDResult Res = new CMDResult(JO); + if (Res.Success) + { + Res.SetPayload(JO.SelectToken("result.responded").ToObject()); + } + + Result.SetResult(Res); + }); + + Dictionary Request = new Dictionary(); + Request.Add("messageId", ID); + Request.Add("command", Enums.Commands.Ping); + Request.Add("nodeId", this.id); + + + string RequestPL = Newtonsoft.Json.JsonConvert.SerializeObject(Request); + _driver.ClientWebSocket.SendInstant(RequestPL); + + return Result.Task; + } + + // CHECKED + public Task Interview() + { + Guid ID = Guid.NewGuid(); + + TaskCompletionSource Result = new TaskCompletionSource(); + _driver.Callbacks.Add(ID, (JO) => + { + CMDResult Res = new CMDResult(JO); + Result.SetResult(Res); + }); + + Dictionary Request = new Dictionary(); + Request.Add("messageId", ID); + Request.Add("command", Enums.Commands.Interview); + Request.Add("nodeId", this.id); + + + string RequestPL = Newtonsoft.Json.JsonConvert.SerializeObject(Request); + _driver.ClientWebSocket.SendInstant(RequestPL); + + return Result.Task; + } + + // CHECKED public Task CheckLifelineHealth(int Rounds, LifelineHealthCheckProgress OnProgress = null) { LifelineHealthCheckProgressSub = OnProgress; @@ -124,12 +202,12 @@ public Task CheckLifelineHealth(int Rounds, LifelineHealthCheckProgre Guid ID = Guid.NewGuid(); TaskCompletionSource Result = new TaskCompletionSource(); - Driver.Callbacks.Add(ID, (JO) => + _driver.Callbacks.Add(ID, (JO) => { CMDResult Res = new CMDResult(JO); if (Res.Success) { - LifelineHealthCheckSummary LLHCS = JsonConvert.DeserializeObject(JO.SelectToken("result.summary").ToString()); + LifelineHealthCheckSummary LLHCS = JO.SelectToken("result.summary").ToObject(); Res.SetPayload(LLHCS); } @@ -144,17 +222,18 @@ public Task CheckLifelineHealth(int Rounds, LifelineHealthCheckProgre string RequestPL = Newtonsoft.Json.JsonConvert.SerializeObject(Request); - Driver.Client.SendAsync(RequestPL); + _driver.ClientWebSocket.SendInstant(RequestPL); return Result.Task; } + // CHECKED public Task AbortFirmwareUpdate() { Guid ID = Guid.NewGuid(); TaskCompletionSource Result = new TaskCompletionSource(); - Driver.Callbacks.Add(ID, (JO) => + _driver.Callbacks.Add(ID, (JO) => { CMDResult Res = new CMDResult(JO); Result.SetResult(Res); @@ -167,44 +246,59 @@ public Task AbortFirmwareUpdate() string RequestPL = Newtonsoft.Json.JsonConvert.SerializeObject(Request); - Driver.Client.SendAsync(RequestPL); + _driver.ClientWebSocket.SendInstant(RequestPL); return Result.Task; } - public Task BeginFirmwareUpdate(string FileName) + // CHECKED + public Task UpdateFirmware(FirmwareUpdate[] Updates) { + + foreach(FirmwareUpdate FWU in Updates) + { + if(FWU.firmwareTarget == null) + { + TaskCompletionSource Fail = new TaskCompletionSource(); + CMDResult Res = new CMDResult(Enums.ErrorCodes.WrongOverride, "Please use the override that includes 'firmwareTarget'", false); + Fail.SetResult(Res); + + return Fail.Task; + } + } + Guid ID = Guid.NewGuid(); TaskCompletionSource Result = new TaskCompletionSource(); - Driver.Callbacks.Add(ID, (JO) => + _driver.Callbacks.Add(ID, (JO) => { CMDResult Res = new CMDResult(JO); + if(JO.ContainsKey("result")) + { + Res.SetPayload(JO.SelectToken("result.result").ToObject()); + } Result.SetResult(Res); }); - - FileInfo FI = new FileInfo(FileName); - byte[] FileData = File.ReadAllBytes(FileName); - + Dictionary Request = new Dictionary(); Request.Add("messageId", ID); - Request.Add("command", Enums.Commands.BeginFirmwareUpdate); + Request.Add("command", Enums.Commands.UpdateFirmware); Request.Add("nodeId", this.id); - Request.Add("firmwareFile", FileData); - Request.Add("firmwareFilename", FI.Name); - + Request.Add("updates", Updates); + string RequestPL = Newtonsoft.Json.JsonConvert.SerializeObject(Request); - Driver.Client.SendAsync(RequestPL); + _driver.ClientWebSocket.SendInstant(RequestPL); return Result.Task; } - public Task RefreshInfo() + // CHECKED + public Task RefreshInfo(RefreshInfoOptions Options = null) { Guid ID = Guid.NewGuid(); TaskCompletionSource Result = new TaskCompletionSource(); - Driver.Callbacks.Add(ID, (JO) => + _driver.Callbacks.Add(ID, (JO) => { CMDResult Res = new CMDResult(JO); Result.SetResult(Res); @@ -215,23 +309,27 @@ public Task RefreshInfo() Request.Add("command", Enums.Commands.RefreshInfo); Request.Add("nodeId", this.id); + if(Options != null) + Request.Add("options", Options); + string RequestPL = Newtonsoft.Json.JsonConvert.SerializeObject(Request); - Driver.Client.SendAsync(RequestPL); + _driver.ClientWebSocket.SendInstant(RequestPL); return Result.Task; } + // CHECKED public Task GetValue(ValueID ValueID) { Guid ID = Guid.NewGuid(); TaskCompletionSource Result = new TaskCompletionSource(); - Driver.Callbacks.Add(ID, (JO) => + _driver.Callbacks.Add(ID, (JO) => { CMDResult Res = new CMDResult(JO); if (Res.Success) { - Res.SetPayload(JO.Value("result")); + Res.SetPayload(JO.SelectToken("result").ToObject()); } Result.SetResult(Res); @@ -245,19 +343,25 @@ public Task GetValue(ValueID ValueID) Request.Add("nodeId", this.id); string RequestPL = Newtonsoft.Json.JsonConvert.SerializeObject(Request); - Driver.Client.SendAsync(RequestPL); + _driver.ClientWebSocket.SendInstant(RequestPL); return Result.Task; } + // CHEKCED public Task SetValue(ValueID ValueID, object Value, SetValueAPIOptions Options = null) { Guid ID = Guid.NewGuid(); TaskCompletionSource Result = new TaskCompletionSource(); - Driver.Callbacks.Add(ID, (JO) => + _driver.Callbacks.Add(ID, (JO) => { CMDResult Res = new CMDResult(JO); + if (Res.Success) + { + SetValueResult SVR = JO.SelectToken("result").ToObject(); + Res.SetPayload(SVR); + } Result.SetResult(Res); }); @@ -274,22 +378,23 @@ public Task SetValue(ValueID ValueID, object Value, SetValueAPIOption } string RequestPL = Newtonsoft.Json.JsonConvert.SerializeObject(Request); - Driver.Client.SendAsync(RequestPL); + _driver.ClientWebSocket.SendInstant(RequestPL); return Result.Task; } + // CHECKED public Task PollValue(ValueID ValueID) { Guid ID = Guid.NewGuid(); TaskCompletionSource Result = new TaskCompletionSource(); - Driver.Callbacks.Add(ID, (JO) => + _driver.Callbacks.Add(ID, (JO) => { CMDResult Res = new CMDResult(JO); if (Res.Success) { - Res.SetPayload(JO.Value("result")); + Res.SetPayload(JO.SelectToken("result").ToObject()); } Result.SetResult(Res); @@ -302,28 +407,156 @@ public Task PollValue(ValueID ValueID) Request.Add("valueId", ValueID); string RequestPL = Newtonsoft.Json.JsonConvert.SerializeObject(Request); - Driver.Client.SendAsync(RequestPL); + _driver.ClientWebSocket.SendInstant(RequestPL); return Result.Task; } + // CHECKED - Variant 1: Normal parameter, defined in a config file + public Task ZWJSS_SetRawConfigParameterValue(int Parameter, int Value) + { + Guid ID = Guid.NewGuid(); + + TaskCompletionSource Result = new TaskCompletionSource(); + _driver.Callbacks.Add(ID, (JO) => + { + CMDResult Res = new CMDResult(JO); + Result.SetResult(Res); + }); + + Dictionary Request = new Dictionary(); + Request.Add("messageId", ID); + Request.Add("command", Enums.Commands.SetRawConfigParameterValue); + Request.Add("nodeId", this.id); + Request.Add("parameter", Parameter); + Request.Add("value", Value); + + + string RequestPL = Newtonsoft.Json.JsonConvert.SerializeObject(Request); + _driver.ClientWebSocket.SendInstant(RequestPL); + + return Result.Task; + } + + // CHECKED - Variant 2: Normal parameter, not defined in a config file + public Task ZWJSS_SetRawConfigParameterValue(int Parameter, int Value, int ValueSize, Enums.ConfigValueFormat ValueFormat) + { + Guid ID = Guid.NewGuid(); + + TaskCompletionSource Result = new TaskCompletionSource(); + _driver.Callbacks.Add(ID, (JO) => + { + CMDResult Res = new CMDResult(JO); + Result.SetResult(Res); + }); + + Dictionary Request = new Dictionary(); + Request.Add("messageId", ID); + Request.Add("command", Enums.Commands.SetRawConfigParameterValue); + Request.Add("nodeId", this.id); + Request.Add("parameter", Parameter); + Request.Add("value", Value); + Request.Add("valueSize", ValueSize); + Request.Add("valueFormat", ValueFormat); + + + string RequestPL = Newtonsoft.Json.JsonConvert.SerializeObject(Request); + _driver.ClientWebSocket.SendInstant(RequestPL); + + return Result.Task; + } + + // CHECKED - Variant 3: Partial parameter, must be defined in a config file + public Task ZWJSS_SetRawConfigParameterValue(int Parameter, int Bitmask, int Value) + { + Guid ID = Guid.NewGuid(); + + TaskCompletionSource Result = new TaskCompletionSource(); + _driver.Callbacks.Add(ID, (JO) => + { + CMDResult Res = new CMDResult(JO); + Result.SetResult(Res); + }); + + Dictionary Request = new Dictionary(); + Request.Add("messageId", ID); + Request.Add("command", Enums.Commands.SetRawConfigParameterValue); + Request.Add("nodeId", this.id); + Request.Add("parameter", Parameter); + Request.Add("bitMask", Bitmask); + Request.Add("value", Value); + + + string RequestPL = Newtonsoft.Json.JsonConvert.SerializeObject(Request); + _driver.ClientWebSocket.SendInstant(RequestPL); + + return Result.Task; + } + + // CHECKED + public Task RefreshValues() + { + Guid ID = Guid.NewGuid(); + + TaskCompletionSource Result = new TaskCompletionSource(); + _driver.Callbacks.Add(ID, (JO) => + { + CMDResult Res = new CMDResult(JO); + Result.SetResult(Res); + }); + + Dictionary Request = new Dictionary(); + Request.Add("messageId", ID); + Request.Add("command", Enums.Commands.RefreshValues); + Request.Add("nodeId", this.id); + + + string RequestPL = JsonConvert.SerializeObject(Request); + _driver.ClientWebSocket.SendInstant(RequestPL); + + return Result.Task; + } + + // CHECKED + public Task RefreshCCValues(int CommandClass) + { + Guid ID = Guid.NewGuid(); + + TaskCompletionSource Result = new TaskCompletionSource(); + _driver.Callbacks.Add(ID, (JO) => + { + CMDResult Res = new CMDResult(JO); + Result.SetResult(Res); + }); + + Dictionary Request = new Dictionary(); + Request.Add("messageId", ID); + Request.Add("command", Enums.Commands.RefreshCCValues); + Request.Add("commandClass", CommandClass); + Request.Add("nodeId", this.id); + + + string RequestPL = JsonConvert.SerializeObject(Request); + _driver.ClientWebSocket.SendInstant(RequestPL); + + return Result.Task; + } + + // CHEKCED public Task GetDefinedValueIDs() { Guid ID = Guid.NewGuid(); TaskCompletionSource Result = new TaskCompletionSource(); - Driver.Callbacks.Add(ID, (JO) => + _driver.Callbacks.Add(ID, (JO) => { CMDResult Res = new CMDResult(JO); if (Res.Success) { - Res.SetPayload(JsonConvert.DeserializeObject(JO.SelectToken("result.valueIds").ToString())); + Res.SetPayload(JO.SelectToken("result.valueIds").ToObject()); } Result.SetResult(Res); - - - }); Dictionary Request = new Dictionary(); @@ -333,22 +566,23 @@ public Task GetDefinedValueIDs() string RequestPL = JsonConvert.SerializeObject(Request); - Driver.Client.SendAsync(RequestPL); + _driver.ClientWebSocket.SendInstant(RequestPL); return Result.Task; } + // CHECKED public Task GetValueMetadata(ValueID VID) { Guid ID = Guid.NewGuid(); TaskCompletionSource Result = new TaskCompletionSource(); - Driver.Callbacks.Add(ID, (JO) => + _driver.Callbacks.Add(ID, (JO) => { CMDResult Res = new CMDResult(JO); if (Res.Success) { - Res.SetPayload(JsonConvert.DeserializeObject(JO.SelectToken("result").ToString())); + Res.SetPayload(JO.SelectToken("result").ToObject()); } Result.SetResult(Res); @@ -363,22 +597,23 @@ public Task GetValueMetadata(ValueID VID) string RequestPL = JsonConvert.SerializeObject(Request); - Driver.Client.SendAsync(RequestPL); + _driver.ClientWebSocket.SendInstant(RequestPL); return Result.Task; } + // CHECKED public Task SupportsCCAPI(int CommandClass) { Guid ID = Guid.NewGuid(); TaskCompletionSource Result = new TaskCompletionSource(); - Driver.Callbacks.Add(ID, (JO) => + _driver.Callbacks.Add(ID, (JO) => { CMDResult Res = new CMDResult(JO); if (Res.Success) { - Res.SetPayload(JO.SelectToken("result.supported").Value()); + Res.SetPayload(JO.SelectToken("result.supported").ToObject()); } Result.SetResult(Res); @@ -391,22 +626,23 @@ public Task SupportsCCAPI(int CommandClass) Request.Add("commandClass", CommandClass); string RequestPL = JsonConvert.SerializeObject(Request); - Driver.Client.SendAsync(RequestPL); + _driver.ClientWebSocket.SendInstant(RequestPL); return Result.Task; } + // CHECKED public Task InvokeCCAPI(int CommandClass, string Method, params object[] Params) { Guid ID = Guid.NewGuid(); TaskCompletionSource Result = new TaskCompletionSource(); - Driver.Callbacks.Add(ID, (JO) => + _driver.Callbacks.Add(ID, (JO) => { CMDResult Res = new CMDResult(JO); if (Res.Success) { - Res.SetPayload(JsonConvert.DeserializeObject(JO.SelectToken("result").ToString())); + Res.SetPayload(JO.SelectToken("result").ToObject()); } Result.SetResult(Res); @@ -421,34 +657,31 @@ public Task InvokeCCAPI(int CommandClass, string Method, params objec Request.Add("args", Params); string RequestPL = JsonConvert.SerializeObject(Request); - Driver.Client.SendAsync(RequestPL); + _driver.ClientWebSocket.SendInstant(RequestPL); return Result.Task; } + // LOCAL public Endpoint GetEndpoint(int Index) { Endpoint EP = this.endpoints.FirstOrDefault((E) => E.index.Equals(Index)); return EP; } - public Endpoint[] GetAllEndpoints() - { - return endpoints; - } - + // CHECKED public Task GetEndpointCount() { Guid ID = Guid.NewGuid(); TaskCompletionSource Result = new TaskCompletionSource(); - Driver.Callbacks.Add(ID, (JO) => + _driver.Callbacks.Add(ID, (JO) => { CMDResult Res = new CMDResult(JO); if (Res.Success) { - Res.SetPayload(JO.SelectToken("result.count").Value()); + Res.SetPayload(JO.SelectToken("result.count").ToObject()); } Result.SetResult(Res); }); @@ -459,24 +692,25 @@ public Task GetEndpointCount() Request.Add("nodeId", this.id); string RequestPL = JsonConvert.SerializeObject(Request); - Driver.Client.SendAsync(RequestPL); + _driver.ClientWebSocket.SendInstant(RequestPL); return Result.Task; } + // CHECKED public Task GetHighestSecurityClass() { Guid ID = Guid.NewGuid(); TaskCompletionSource Result = new TaskCompletionSource(); - Driver.Callbacks.Add(ID, (JO) => + _driver.Callbacks.Add(ID, (JO) => { CMDResult Res = new CMDResult(JO); if (Res.Success) { - int Value = JO.SelectToken("result.highestSecurityClass").Value(); - Res.SetPayload((Enums.SecurityClass)Value); + Enums.SecurityClass Value = JO.SelectToken("result.highestSecurityClass").ToObject(); + Res.SetPayload(Value); } Result.SetResult(Res); @@ -489,23 +723,24 @@ public Task GetHighestSecurityClass() Request.Add("nodeId", this.id); string RequestPL = JsonConvert.SerializeObject(Request); - Driver.Client.SendAsync(RequestPL); + _driver.ClientWebSocket.SendInstant(RequestPL); return Result.Task; } + // CHECKED public Task HasSecurityClass(Enums.SecurityClass Class) { Guid ID = Guid.NewGuid(); TaskCompletionSource Result = new TaskCompletionSource(); - Driver.Callbacks.Add(ID, (JO) => + _driver.Callbacks.Add(ID, (JO) => { CMDResult Res = new CMDResult(JO); if (Res.Success) { - Res.SetPayload(JO.SelectToken("result.hasSecurityClass").Value()); + Res.SetPayload(JO.SelectToken("result.hasSecurityClass").ToObject()); } Result.SetResult(Res); @@ -518,19 +753,40 @@ public Task HasSecurityClass(Enums.SecurityClass Class) Request.Add("securityClass", Class); string RequestPL = JsonConvert.SerializeObject(Request); - Driver.Client.SendAsync(RequestPL); + _driver.ClientWebSocket.SendInstant(RequestPL); return Result.Task; } - + // CHECKED + public Task WaitForWakeup() + { + Guid ID = Guid.NewGuid(); + + TaskCompletionSource Result = new TaskCompletionSource(); - [Newtonsoft.Json.JsonProperty] - internal Endpoint[] endpoints { get; set; } + _driver.Callbacks.Add(ID, (JO) => + { + CMDResult Res = new CMDResult(JO); + Result.SetResult(Res); + + }); + + Dictionary Request = new Dictionary(); + Request.Add("messageId", ID); + Request.Add("command", Enums.Commands.WaitForWakeUp); + Request.Add("nodeId", this.id); + string RequestPL = JsonConvert.SerializeObject(Request); + _driver.ClientWebSocket.SendInstant(RequestPL); + + return Result.Task; + } + + [Newtonsoft.Json.JsonProperty] + public Endpoint[] endpoints { get; internal set; } [Newtonsoft.Json.JsonProperty] public bool isControllerNode { get; internal set; } - [Newtonsoft.Json.JsonProperty] public Enums.NodeStatus status { get; internal set; } [Newtonsoft.Json.JsonProperty] @@ -585,91 +841,108 @@ public Task HasSecurityClass(Enums.SecurityClass Class) public CommandClass[] commandClasses { get; internal set; } [Newtonsoft.Json.JsonProperty] public NodeStatistics statistics { get; internal set; } + [Newtonsoft.Json.JsonProperty] + public DateTime? lastSeen { get; internal set; } + [Newtonsoft.Json.JsonProperty] + public Protocols protocol { get; internal set; } [Newtonsoft.Json.JsonProperty(PropertyName = "nodeId")] public int id { get; internal set; } - - private bool _KeepAwake; + [Newtonsoft.Json.JsonProperty] - public bool keepAwake + public bool keepAwake { get; internal set; } + public Task SetKeepAwake(bool Option) { - get - { - return _KeepAwake; - } - set + Guid ID = Guid.NewGuid(); + + TaskCompletionSource Result = new TaskCompletionSource(); + + _driver.Callbacks.Add(ID, (JO) => { - _KeepAwake = value; - if (Driver.Inited) + CMDResult Res = new CMDResult(JO); + if (Res.Success) { - Guid ID = Guid.NewGuid(); + this.keepAwake = Option; + } + Result.SetResult(Res); - Dictionary Request = new Dictionary(); - Request.Add("messageId", ID); - Request.Add("command", Enums.Commands.KeepNodeAwake); - Request.Add("nodeId", this.id); - Request.Add("keepAwake", _KeepAwake); + }); - string RequestPL = JsonConvert.SerializeObject(Request); - Driver.Client.SendAsync(RequestPL); - } - } + Dictionary Request = new Dictionary(); + Request.Add("messageId", ID); + Request.Add("command", Enums.Commands.KeepNodeAwake); + Request.Add("nodeId", this.id); + Request.Add("keepAwake", Option); + + string RequestPL = JsonConvert.SerializeObject(Request); + _driver.ClientWebSocket.SendInstant(RequestPL); + + return Result.Task; } - private string _Name; [Newtonsoft.Json.JsonProperty] - public string name + public string name { get; internal set; } + public Task SetName(string Name, bool UpdateCC = true) { - get - { - return _Name; - } - set + Guid ID = Guid.NewGuid(); + + TaskCompletionSource Result = new TaskCompletionSource(); + + _driver.Callbacks.Add(ID, (JO) => { - _Name = value; - if (Driver.Inited) + CMDResult Res = new CMDResult(JO); + if (Res.Success) { - Guid ID = Guid.NewGuid(); + this.name = Name; + } + Result.SetResult(Res); - Dictionary Request = new Dictionary(); - Request.Add("messageId", ID); - Request.Add("command", Enums.Commands.SetName); - Request.Add("nodeId", this.id); - Request.Add("name", _Name); + }); - string RequestPL = JsonConvert.SerializeObject(Request); - Driver.Client.SendAsync(RequestPL); - } - - } + Dictionary Request = new Dictionary(); + Request.Add("messageId", ID); + Request.Add("command", Enums.Commands.SetName); + Request.Add("nodeId", this.id); + Request.Add("name", Name); + Request.Add("updateCC", UpdateCC); + + string RequestPL = JsonConvert.SerializeObject(Request); + _driver.ClientWebSocket.SendInstant(RequestPL); + + return Result.Task; } - private string _Location; [Newtonsoft.Json.JsonProperty] - public string location + public string location { get; internal set; } + public Task SetLocation(string Location, bool UpdateCC = true) { - get - { - return _Location; - } - set + Guid ID = Guid.NewGuid(); + + TaskCompletionSource Result = new TaskCompletionSource(); + + _driver.Callbacks.Add(ID, (JO) => { - _Location = value; - if (Driver.Inited) + CMDResult Res = new CMDResult(JO); + if (Res.Success) { - - Guid ID = Guid.NewGuid(); + this.location = Location; + } + Result.SetResult(Res); - Dictionary Request = new Dictionary(); - Request.Add("messageId", ID); - Request.Add("command", Enums.Commands.SetLocation); - Request.Add("nodeId", this.id); - Request.Add("location", _Location); + }); - string RequestPL = JsonConvert.SerializeObject(Request); - Driver.Client.SendAsync(RequestPL); - } - } + Dictionary Request = new Dictionary(); + Request.Add("messageId", ID); + Request.Add("command", Enums.Commands.SetLocation); + Request.Add("nodeId", this.id); + Request.Add("location", Location); + Request.Add("updateCC", UpdateCC); + + string RequestPL = JsonConvert.SerializeObject(Request); + _driver.ClientWebSocket.SendInstant(RequestPL); + + return Result.Task; } + } } diff --git a/Visual Studio Projects/ZWaveJS.NET/ZWaveJS.NET/ZWaveOptions.cs b/Visual Studio Projects/ZWaveJS.NET/ZWaveJS.NET/ZWaveOptions.cs index 2d2296a..f3c47a4 100644 --- a/Visual Studio Projects/ZWaveJS.NET/ZWaveJS.NET/ZWaveOptions.cs +++ b/Visual Studio Projects/ZWaveJS.NET/ZWaveJS.NET/ZWaveOptions.cs @@ -1,6 +1,5 @@ -using System; -using System.IO; -using Newtonsoft.Json; +using System.IO; + namespace ZWaveJS.NET { @@ -12,8 +11,9 @@ public ZWaveOptions() this.interview = new CFGInterview(); this.storage = new CFGStorage(); this.securityKeys = new CFGSecurityKeys(); + this.securityKeysLongRange = new CFGSecurityKeysLR(); this.timeouts = new CFGTimeouts(); - this.enableSoftReset = false; + this.enableSoftReset = true; this.disableOptimisticValueUpdate = false; this.emitValueUpdateAfterSetValue = false; } @@ -22,11 +22,28 @@ public ZWaveOptions() public CFGLogConfig logConfig { get; set; } public CFGStorage storage { get; set; } public CFGSecurityKeys securityKeys { get; set; } + public CFGSecurityKeysLR securityKeysLongRange { get; set; } public CFGInterview interview { get; set; } public bool enableSoftReset { get; set; } public bool disableOptimisticValueUpdate { get; set; } public bool emitValueUpdateAfterSetValue { get; set; } + internal bool MissingLRKeys() + { + if (this.securityKeysLongRange == null) + return true; + + if (this.securityKeysLongRange.S2_AccessControl == null) + return true; + + if (this.securityKeysLongRange.S2_Authenticated == null) + return true; + + + + return false; + } + internal bool MissingKeys(bool IncludeS2, bool IncludeS0) { if(this.securityKeys == null) @@ -48,6 +65,18 @@ internal bool MissingKeys(bool IncludeS2, bool IncludeS0) } + internal bool CheckKeyLengthLR() + { + if (this.securityKeysLongRange != null && this.securityKeysLongRange.S2_AccessControl != null && this.securityKeysLongRange.S2_AccessControl.Length != 32) + return false; + + if (this.securityKeysLongRange != null && this.securityKeysLongRange.S2_Authenticated != null && this.securityKeysLongRange.S2_Authenticated.Length != 32) + return false; + + return true; + + } + internal bool CheckKeyLength() { if (this.securityKeys != null && this.securityKeys.S0_Legacy != null && this.securityKeys.S0_Legacy.Length != 32) @@ -64,7 +93,6 @@ internal bool CheckKeyLength() return true; - } } @@ -73,9 +101,11 @@ public class CFGInterview public CFGInterview() { this.queryAllUserCodes = false; + this.disableOnNodeAdded = false; } public bool queryAllUserCodes { get; set; } + public bool disableOnNodeAdded { get; set; } } public class CFGTimeouts @@ -126,4 +156,10 @@ public class CFGSecurityKeys public string S2_AccessControl { get; set; } public string S0_Legacy { get; set; } } + + public class CFGSecurityKeysLR + { + public string S2_Authenticated { get; set; } + public string S2_AccessControl { get; set; } + } }