Skip to content

Commit 8f9c4f5

Browse files
author
Huaqiao Zhang
committed
add part of code models with using ts, especially device , device service , command .etc.
Signed-off-by: Huaqiao Zhang <huaqiaoz@vmware.com>
1 parent f61e69e commit 8f9c4f5

File tree

11 files changed

+75
-4
lines changed

11 files changed

+75
-4
lines changed

web/src/app/contracts/action.ts

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
export interface Action {
2+
path?: string,
3+
responses?: Response[],
4+
url?: string,
5+
}
Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
import { Timestamps } from './timestamps';
2+
3+
export interface Addressable extends Timestamps {
4+
id: string,
5+
name: string,
6+
protocol?: string,
7+
method?: string,
8+
address?: string,
9+
port?: number,
10+
path?: string,
11+
publisher?: string,
12+
user?: string,
13+
password?: string,
14+
topic?: string
15+
}
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
export interface AutoEvent {
2+
frequency?: string,
3+
onChange?: boolean,
4+
resource?: string
5+
}

web/src/app/contracts/command.ts

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
import { Get } from './get';
2+
import { Put } from './put';
3+
import { Timestamps } from './timestamps';
4+
5+
export interface Command extends Timestamps {
6+
id: string,
7+
name: string,
8+
get?: Get,
9+
put?: Put
10+
}
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
import { Timestamps } from './timestamps';
2+
3+
export interface DeviceProfile extends Timestamps {
4+
id: string,
5+
name: string,
6+
description?: string,
7+
manufacturer?: string,
8+
model?: string,
9+
labels?: string[]
10+
// deviceResources
11+
// deviceCommands
12+
// coreCommands
13+
}
Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
1-
import { Timestamps } from './timestamps'
1+
import { Addressable } from './addressable';
2+
import { Timestamps } from './timestamps';
23

34
export interface DeviceService extends Timestamps {
45
id: string,
@@ -7,6 +8,7 @@ export interface DeviceService extends Timestamps {
78
adminState: string,
89
operatingState: string,
910
labels: string[],
11+
addressable: Addressable,
1012
lastConnected: number,
1113
lastReported: number
12-
}
14+
}

web/src/app/contracts/device.ts

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,19 @@
1+
import { AutoEvent } from './auto-event';
12
import { DeviceService } from './device-service';
23
import { Timestamps } from './timestamps';
34

45
export interface Device extends Timestamps {
56
id: string,
67
name: string,
7-
description: string,
8+
description?: string,
89
adminState: string,
910
operatingState: string,
1011
labels: string[],
1112
lastConnected: number,
1213
lastReported: number,
13-
deviceService: DeviceService
14+
deviceService: DeviceService,
15+
profile?: any,
16+
autoEvents?: AutoEvent,
17+
location?: any,
18+
protocols?: any
1419
}

web/src/app/contracts/get.ts

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
import { Action } from './action';
2+
3+
export interface Get extends Action {
4+
}
Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
export interface ProtocolProperties {
2+
}

web/src/app/contracts/put.ts

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
import { Action } from './action';
2+
3+
export interface Put extends Action {
4+
parameterNames?: string[]
5+
}

0 commit comments

Comments
 (0)