-
Notifications
You must be signed in to change notification settings - Fork 10
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #26 from mfucci/integration-test
Add an integration test and a bare-bone Matter controller
- Loading branch information
Showing
91 changed files
with
2,582 additions
and
972 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
#!/usr/bin/env node | ||
|
||
/** | ||
* @license | ||
* Copyright 2022 Marco Fucci di Napoli ([email protected]) | ||
* SPDX-License-Identifier: Apache-2.0 | ||
*/ | ||
|
||
import { MatterClient } from "./matter/MatterClient"; | ||
import { MdnsMatterScanner } from "./mdns/MdnsMatterScanner"; | ||
import { UdpInterface } from "./net/MatterUdpInterface"; | ||
import { Network } from "./net/Network"; | ||
import { NetworkNode } from "./net/node/NetworkNode"; | ||
import { getIntParameter, getParameter } from "./util/CommandLine"; | ||
import { singleton } from "./util/Singleton"; | ||
|
||
Network.get = singleton(() => new NetworkNode()); | ||
|
||
class Main { | ||
async start() { | ||
const ip = getParameter("ip"); | ||
if (ip === undefined) throw new Error("Please specify the IP of the device to commission with -ip"); | ||
const port = getIntParameter("port") ?? 5540; | ||
const discriminator = getIntParameter("discriminator") ?? 3840; | ||
const setupPin = getIntParameter("pin") ?? 20202021; | ||
const client = await MatterClient.create(await MdnsMatterScanner.create(), await UdpInterface.create(5540)); | ||
try { | ||
await client.commission(ip, port, discriminator, setupPin); | ||
} finally { | ||
client.close(); | ||
} | ||
} | ||
} | ||
|
||
new Main().start(); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,9 @@ | ||
/** | ||
* @license | ||
* Copyright 2022 Marco Fucci di Napoli ([email protected]) | ||
* SPDX-License-Identifier: Apache-2.0 | ||
*/ | ||
|
||
export const DEVICE = { | ||
ROOT: { name: "MA-rootdevice", code: 0x0016 }, | ||
ON_OFF_LIGHT: { name: "MA-onofflight", code: 0x0100 }, | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.