-
-
Notifications
You must be signed in to change notification settings - Fork 439
/
Copy pathboards-service.ts
43 lines (35 loc) · 1.17 KB
/
boards-service.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
import { ArduinoComponent } from "./arduino-component";
export const BoardsServicePath = '/services/boards-service';
export const BoardsService = Symbol('BoardsService');
export interface BoardsService {
getAttachedBoards(): Promise<{ boards: Board[] }>;
selectBoard(board: Board | AttachedSerialBoard | AttachedNetworkBoard): Promise<void>;
getSelectBoard(): Promise<Board | AttachedSerialBoard | AttachedNetworkBoard | undefined>;
search(options: { query?: string }): Promise<{ items: BoardPackage[] }>;
install(item: BoardPackage): Promise<void>;
}
export interface BoardPackage extends ArduinoComponent {
id: string;
boards: Board[];
}
export interface Board {
name: string
fqbn?: string
}
export interface AttachedSerialBoard extends Board {
port: string;
}
export namespace AttachedSerialBoard {
export function is(b: Board): b is AttachedSerialBoard {
return 'port' in b;
}
}
export interface AttachedNetworkBoard extends Board {
address: string;
port: string;
}
export namespace AttachedNetworkBoard {
export function is(b: Board): b is AttachedNetworkBoard {
return 'address' in b && 'port' in b;
}
}