Skip to content

Commit 9a55bd2

Browse files
chore: adapt WoTImpl
1 parent 48aafa8 commit 9a55bd2

3 files changed

Lines changed: 20 additions & 110 deletions

File tree

package-lock.json

Lines changed: 8 additions & 62 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -77,6 +77,6 @@
7777
"tslint": "5.12.1",
7878
"typescript": "4.7.4",
7979
"typescript-standard": "^0.3.36",
80-
"wot-typescript-definitions": "0.8.0-SNAPSHOT.27"
80+
"wot-typescript-definitions": "0.8.0-SNAPSHOT.29"
8181
}
8282
}

packages/core/src/wot-impl.ts

Lines changed: 11 additions & 47 deletions
Original file line numberDiff line numberDiff line change
@@ -23,60 +23,24 @@ import { createLoggers } from "./logger";
2323

2424
const { debug } = createLoggers("core", "wot-impl");
2525

26-
export class ThingDiscoveryImpl implements WoT.ThingDiscovery {
27-
filter?: WoT.ThingFilter;
28-
active: boolean;
29-
done: boolean;
30-
error?: Error;
31-
constructor(filter?: WoT.ThingFilter) {
32-
this.filter = filter;
33-
this.active = false;
34-
this.done = false;
35-
this.error = new Error("not implemented");
36-
}
37-
38-
start(): void {
39-
this.active = true;
40-
}
41-
42-
next(): Promise<WoT.ThingDescription> {
43-
return new Promise<WoT.ThingDescription>((resolve, reject) => {
44-
reject(this.error); // not implemented
45-
});
46-
}
47-
48-
stop(): void {
49-
this.active = false;
50-
this.done = false;
51-
}
52-
}
53-
/**
54-
* wot-type-definitions does not contain a implementation of Discovery method enums
55-
* so we need to create them here. Sadly, we should keep this enum in sync with
56-
* WoT.DiscoveryMethod
57-
*/
58-
export enum DiscoveryMethod {
59-
/** does not provide any restriction */
60-
"any",
61-
/** for discovering Things defined in the same device */
62-
"local",
63-
/** for discovery based on a service provided by a directory or repository of Things */
64-
"directory",
65-
/** for discovering Things in the device's network by using a supported multicast protocol */
66-
"multicast",
67-
}
6826
export default class WoTImpl {
6927
private srv: Servient;
70-
DiscoveryMethod: typeof WoT.DiscoveryMethod;
7128
constructor(srv: Servient) {
7229
this.srv = srv;
73-
// force casting cause tsc does not allow to use DiscoveryMethod as WoT.DiscoveryMethod even if they are the same
74-
this.DiscoveryMethod = DiscoveryMethod as unknown as typeof WoT.DiscoveryMethod;
7530
}
7631

7732
/** @inheritDoc */
78-
discover(filter?: WoT.ThingFilter): WoT.ThingDiscovery {
79-
return new ThingDiscoveryImpl(filter);
33+
async discover(filter?: WoT.ThingFilter): Promise<WoT.ThingDiscoveryProcess> {
34+
throw new Error("not implemented");
35+
}
36+
37+
/** @inheritDoc */
38+
async exploreDirectory(url: string, filter?: WoT.ThingFilter): Promise<WoT.ThingDiscoveryProcess> {
39+
throw new Error("not implemented");
40+
}
41+
42+
async requestThingDescription(url: string): Promise<WoT.ThingDescription> {
43+
throw new Error("not implemented");
8044
}
8145

8246
/** @inheritDoc */

0 commit comments

Comments
 (0)