@moddable/typings 6.1.0 → 7.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/display.d.ts +68 -0
- package/dns/parser.d.ts +61 -6
- package/dns/serializer.d.ts +3 -2
- package/embedded/RTC.d.ts +42 -0
- package/embedded/display.d.ts +68 -0
- package/embedded/storage/files.d.ts +75 -0
- package/embedded/storage/flash.d.ts +56 -0
- package/embedded/storage/key-value.d.ts +49 -0
- package/embedded_io/ble/_common.d.ts +14 -0
- package/embedded_io/ble/{client.d.ts → central.d.ts} +11 -24
- package/embedded_io/ble/peripheral.d.ts +92 -0
- package/embedded_io/digital.d.ts +8 -6
- package/embedded_io/digitalbank.d.ts +8 -6
- package/embedded_network/interface/ethernet.d.ts +42 -0
- package/embedded_network/interface/wifi.d.ts +60 -0
- package/embedded_network/mqtt/client.d.ts +2 -1
- package/embedded_network/ntp/client.d.ts +43 -0
- package/neopixel.d.ts +43 -0
- package/neostrand.d.ts +173 -0
- package/package.json +1 -1
- /package/{deflate.ts → deflate.d.ts} +0 -0
package/display.d.ts
ADDED
|
@@ -0,0 +1,68 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Copyright (c) 2025 Moddable Tech, Inc.
|
|
3
|
+
*
|
|
4
|
+
* This file is part of the Moddable SDK Runtime.
|
|
5
|
+
*
|
|
6
|
+
* The Moddable SDK Runtime is free software: you can redistribute it and/or modify
|
|
7
|
+
* it under the terms of the GNU Lesser General Public License as published by
|
|
8
|
+
* the Free Software Foundation, either version 3 of the License, or
|
|
9
|
+
* (at your option) any later version.
|
|
10
|
+
*
|
|
11
|
+
* The Moddable SDK Runtime is distributed in the hope that it will be useful,
|
|
12
|
+
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
13
|
+
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
14
|
+
* GNU Lesser General Public License for more details.
|
|
15
|
+
*
|
|
16
|
+
* You should have received a copy of the GNU Lesser General Public License
|
|
17
|
+
* along with the Moddable SDK Runtime. If not, see <http://www.gnu.org/licenses/>.
|
|
18
|
+
*
|
|
19
|
+
*/
|
|
20
|
+
|
|
21
|
+
declare module "embedded:display" {
|
|
22
|
+
export interface DisplayConstructorOptions {
|
|
23
|
+
format?: number;
|
|
24
|
+
rotation?: number;
|
|
25
|
+
brightness?: number;
|
|
26
|
+
flip?: "h" | "v" | "hv";
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
export interface DisplayConfigureOptions {
|
|
30
|
+
brightness?: number;
|
|
31
|
+
format?: number;
|
|
32
|
+
rotation?: number;
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
export interface DisplayConfiguration {
|
|
36
|
+
brightness?: number;
|
|
37
|
+
format?: number;
|
|
38
|
+
rotation?: number;
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
export interface DisplayBeginOptions {
|
|
42
|
+
x: number;
|
|
43
|
+
y: number;
|
|
44
|
+
width: number;
|
|
45
|
+
height: number;
|
|
46
|
+
continue?: boolean;
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
export interface DisplayRectangle {
|
|
50
|
+
x: number;
|
|
51
|
+
y: number;
|
|
52
|
+
width: number;
|
|
53
|
+
height: number;
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
export default class Display {
|
|
57
|
+
constructor(options: DisplayConstructorOptions);
|
|
58
|
+
close(): void;
|
|
59
|
+
configure(options: DisplayConfigureOptions): void;
|
|
60
|
+
get configuration(): DisplayConfiguration;
|
|
61
|
+
begin(options?: DisplayBeginOptions): void;
|
|
62
|
+
send(buffer: BufferLike): void;
|
|
63
|
+
end(): void;
|
|
64
|
+
adapInvalid(options: DisplayRectangle): void;
|
|
65
|
+
get width(): number;
|
|
66
|
+
get height(): number;
|
|
67
|
+
}
|
|
68
|
+
}
|
package/dns/parser.d.ts
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
/*
|
|
2
2
|
* Copyright (c) 2019-2020 Bradley Farias
|
|
3
|
+
* Copyright (c) 2026 Moddable Tech, Inc.
|
|
3
4
|
*
|
|
4
5
|
* This file is part of the Moddable SDK Tools.
|
|
5
6
|
*
|
|
@@ -19,19 +20,73 @@
|
|
|
19
20
|
*/
|
|
20
21
|
|
|
21
22
|
declare module "dns/parser" {
|
|
23
|
+
interface DNSQuestion {
|
|
24
|
+
qname: string[];
|
|
25
|
+
qtype: number;
|
|
26
|
+
qclass: number;
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
interface DNSSRVData {
|
|
30
|
+
priority: number;
|
|
31
|
+
weight: number;
|
|
32
|
+
port: number;
|
|
33
|
+
target: string[];
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
interface DNSAnswerA {
|
|
37
|
+
qname: string[];
|
|
38
|
+
qtype: 0x0001;
|
|
39
|
+
qclass: number;
|
|
40
|
+
ttl: number;
|
|
41
|
+
rdata: string;
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
interface DNSAnswerPTR {
|
|
45
|
+
qname: string[];
|
|
46
|
+
qtype: 0x000C;
|
|
47
|
+
qclass: number;
|
|
48
|
+
ttl: number;
|
|
49
|
+
rdata: string[];
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
interface DNSAnswerTXT {
|
|
53
|
+
qname: string[];
|
|
54
|
+
qtype: 0x0010;
|
|
55
|
+
qclass: number;
|
|
56
|
+
ttl: number;
|
|
57
|
+
rdata: string[];
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
interface DNSAnswerSRV {
|
|
61
|
+
qname: string[];
|
|
62
|
+
qtype: 0x0021;
|
|
63
|
+
qclass: number;
|
|
64
|
+
ttl: number;
|
|
65
|
+
rdata: DNSSRVData;
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
interface DNSAnswerOther {
|
|
69
|
+
qname: string[];
|
|
70
|
+
qtype: number;
|
|
71
|
+
qclass: number;
|
|
72
|
+
ttl: number;
|
|
73
|
+
rdata: "UNHANDLED";
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
type DNSAnswer = DNSAnswerA | DNSAnswerPTR | DNSAnswerTXT | DNSAnswerSRV | DNSAnswerOther;
|
|
77
|
+
|
|
22
78
|
class Parser {
|
|
23
|
-
constructor(buffer:
|
|
79
|
+
constructor(buffer: BufferLike);
|
|
24
80
|
get id(): number;
|
|
25
81
|
get flags(): number;
|
|
26
82
|
get questions(): number;
|
|
27
83
|
get answers(): number;
|
|
28
84
|
get authorities(): number;
|
|
29
85
|
get additionals(): number;
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
additional(index: number): unknown;
|
|
86
|
+
question(index: number): DNSQuestion;
|
|
87
|
+
answer(index: number): DNSAnswer;
|
|
88
|
+
authority(index: number): DNSAnswer;
|
|
89
|
+
additional(index: number): DNSAnswer;
|
|
35
90
|
}
|
|
36
91
|
export {Parser as default};
|
|
37
92
|
}
|
package/dns/serializer.d.ts
CHANGED
|
@@ -25,14 +25,15 @@ declare module "dns/serializer" {
|
|
|
25
25
|
opcode?: (typeof DNS.OPCODE)[keyof (typeof DNS.OPCODE)],
|
|
26
26
|
query?: boolean,
|
|
27
27
|
authoritative?: boolean,
|
|
28
|
-
id?: number
|
|
28
|
+
id?: number,
|
|
29
|
+
recursionDesired?: boolean,
|
|
29
30
|
});
|
|
30
31
|
add(
|
|
31
32
|
section: (typeof DNS.SECTION)[keyof (typeof DNS.SECTION)],
|
|
32
33
|
name: string,
|
|
33
34
|
type: (typeof DNS.RR)[keyof (typeof DNS.RR)],
|
|
34
35
|
classType: (typeof DNS.CLASS)[keyof (typeof DNS.CLASS)],
|
|
35
|
-
ttl
|
|
36
|
+
ttl?: number,
|
|
36
37
|
data?: ArrayBuffer
|
|
37
38
|
): void;
|
|
38
39
|
build(): ArrayBuffer;
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Copyright (c) 2025 Moddable Tech, Inc.
|
|
3
|
+
*
|
|
4
|
+
* This file is part of the Moddable SDK Tools.
|
|
5
|
+
*
|
|
6
|
+
* The Moddable SDK Tools is free software: you can redistribute it and/or modify
|
|
7
|
+
* it under the terms of the GNU General Public License as published by
|
|
8
|
+
* the Free Software Foundation, either version 3 of the License, or
|
|
9
|
+
* (at your option) any later version.
|
|
10
|
+
*
|
|
11
|
+
* The Moddable SDK Tools is distributed in the hope that it will be useful,
|
|
12
|
+
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
13
|
+
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
14
|
+
* GNU General Public License for more details.
|
|
15
|
+
*
|
|
16
|
+
* You should have received a copy of the GNU General Public License
|
|
17
|
+
* along with the Moddable SDK Tools. If not, see <http://www.gnu.org/licenses/>.
|
|
18
|
+
*
|
|
19
|
+
*/
|
|
20
|
+
|
|
21
|
+
declare module "embedded:RTC" {
|
|
22
|
+
import type {PortSpecifier} from "embedded:io/_common";
|
|
23
|
+
|
|
24
|
+
export interface RTCOptions {
|
|
25
|
+
target?: any;
|
|
26
|
+
port?: PortSpecifier;
|
|
27
|
+
onAlarm?: () => void;
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
export interface RTCConfigureOptions {
|
|
31
|
+
alarm?: number;
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
export class RTC {
|
|
35
|
+
constructor(options: RTCOptions);
|
|
36
|
+
close(): void;
|
|
37
|
+
time: number;
|
|
38
|
+
configure(options: RTCConfigureOptions): void;
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
export default RTC;
|
|
42
|
+
}
|
|
@@ -0,0 +1,68 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Copyright (c) 2025 Moddable Tech, Inc.
|
|
3
|
+
*
|
|
4
|
+
* This file is part of the Moddable SDK Runtime.
|
|
5
|
+
*
|
|
6
|
+
* The Moddable SDK Runtime is free software: you can redistribute it and/or modify
|
|
7
|
+
* it under the terms of the GNU Lesser General Public License as published by
|
|
8
|
+
* the Free Software Foundation, either version 3 of the License, or
|
|
9
|
+
* (at your option) any later version.
|
|
10
|
+
*
|
|
11
|
+
* The Moddable SDK Runtime is distributed in the hope that it will be useful,
|
|
12
|
+
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
13
|
+
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
14
|
+
* GNU Lesser General Public License for more details.
|
|
15
|
+
*
|
|
16
|
+
* You should have received a copy of the GNU Lesser General Public License
|
|
17
|
+
* along with the Moddable SDK Runtime. If not, see <http://www.gnu.org/licenses/>.
|
|
18
|
+
*
|
|
19
|
+
*/
|
|
20
|
+
|
|
21
|
+
declare module "embedded:display" {
|
|
22
|
+
import type Bitmap from "commodetto/Bitmap";
|
|
23
|
+
import type { Rectangle } from "commodetto/Poco";
|
|
24
|
+
|
|
25
|
+
export interface DisplayConstructorOptions {
|
|
26
|
+
port: string;
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
export interface DisplayConfigureOptions {
|
|
30
|
+
brightness?: number; // 0-1 range
|
|
31
|
+
rotation?: 0 | 90 | 180 | 270;
|
|
32
|
+
format?: typeof Bitmap.RGB565LE | typeof Bitmap.RGB24 | typeof Bitmap.Gray256;
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
export interface DisplayConfiguration {
|
|
36
|
+
brightness: number; // 0-1 range
|
|
37
|
+
rotation: 0 | 90 | 180 | 270;
|
|
38
|
+
format: typeof Bitmap.RGB565LE | typeof Bitmap.RGB24 | typeof Bitmap.Gray256;
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
export interface DisplayBeginOptions {
|
|
42
|
+
x: number;
|
|
43
|
+
y: number;
|
|
44
|
+
width: number;
|
|
45
|
+
height: number;
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
class Display {
|
|
49
|
+
constructor(options: DisplayConstructorOptions);
|
|
50
|
+
close(): void;
|
|
51
|
+
|
|
52
|
+
configure(options: DisplayConfigureOptions): void;
|
|
53
|
+
get configuration(): DisplayConfiguration;
|
|
54
|
+
|
|
55
|
+
begin(options: DisplayBeginOptions): void;
|
|
56
|
+
begin(): void;
|
|
57
|
+
send(buffer: BufferLike): void;
|
|
58
|
+
send(buffer: BufferLike, offset: number, length: number): void;
|
|
59
|
+
end(): void;
|
|
60
|
+
|
|
61
|
+
adapInvalid(rectangle: Rectangle): void;
|
|
62
|
+
|
|
63
|
+
get width(): number;
|
|
64
|
+
get height(): number;
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
export default Display;
|
|
68
|
+
}
|
|
@@ -0,0 +1,75 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Copyright (c) 2024-2025 Moddable Tech, Inc.
|
|
3
|
+
*
|
|
4
|
+
* This file is part of the Moddable SDK Runtime.
|
|
5
|
+
*
|
|
6
|
+
* The Moddable SDK Runtime is free software: you can redistribute it and/or modify
|
|
7
|
+
* it under the terms of the GNU Lesser General Public License as published by
|
|
8
|
+
* the Free Software Foundation, either version 3 of the License, or
|
|
9
|
+
* (at your option) any later version.
|
|
10
|
+
*
|
|
11
|
+
* The Moddable SDK Runtime is distributed in the hope that it will be useful,
|
|
12
|
+
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
13
|
+
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
14
|
+
* GNU Lesser General Public License for more details.
|
|
15
|
+
*
|
|
16
|
+
* You should have received a copy of the GNU Lesser General Public License
|
|
17
|
+
* along with the Moddable SDK Runtime. If not, see <http://www.gnu.org/licenses/>.
|
|
18
|
+
*
|
|
19
|
+
*/
|
|
20
|
+
|
|
21
|
+
declare module "embedded:storage/files" {
|
|
22
|
+
export class Status {
|
|
23
|
+
size: number;
|
|
24
|
+
mode: number;
|
|
25
|
+
isFile(): boolean;
|
|
26
|
+
isDirectory(): boolean;
|
|
27
|
+
isSymbolicLink(): boolean;
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
export class File {
|
|
31
|
+
// Use Directory.openFile() to create File instances
|
|
32
|
+
close(): void;
|
|
33
|
+
|
|
34
|
+
read(count: number, position: number): ArrayBuffer;
|
|
35
|
+
read(buffer: BufferLike, position: number): number;
|
|
36
|
+
write(buffer: BufferLike, position: number): void;
|
|
37
|
+
|
|
38
|
+
status(): Status;
|
|
39
|
+
setSize(length: number): void;
|
|
40
|
+
flush(): void;
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
export interface DirectoryOpenFileOptions {
|
|
44
|
+
path: string;
|
|
45
|
+
mode?: "r" | "r+" | "w" | "w+";
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
export interface DirectoryOpenDirectoryOptions {
|
|
49
|
+
path: string;
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
export interface DirectoryStatusOptions {
|
|
53
|
+
resolveTarget?: boolean;
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
export class Directory {
|
|
57
|
+
// use device.files to access file system root
|
|
58
|
+
close(): void;
|
|
59
|
+
|
|
60
|
+
openFile(options: DirectoryOpenFileOptions): File;
|
|
61
|
+
openDirectory(options: DirectoryOpenDirectoryOptions): Directory;
|
|
62
|
+
|
|
63
|
+
delete(path: string): boolean;
|
|
64
|
+
move(from: string, to: string, toDirectory?: Directory): void;
|
|
65
|
+
|
|
66
|
+
status(path: string, options?: DirectoryStatusOptions): Status;
|
|
67
|
+
|
|
68
|
+
createDirectory(path: string): boolean;
|
|
69
|
+
createLink(path: string, target: string): void;
|
|
70
|
+
readLink(path: string): string;
|
|
71
|
+
|
|
72
|
+
scan(path?: string): IterableIterator<string>;
|
|
73
|
+
[Symbol.iterator](): IterableIterator<string>;
|
|
74
|
+
}
|
|
75
|
+
}
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Copyright (c) 2025 Moddable Tech, Inc.
|
|
3
|
+
*
|
|
4
|
+
* This file is part of the Moddable SDK Runtime.
|
|
5
|
+
*
|
|
6
|
+
* The Moddable SDK Runtime is free software: you can redistribute it and/or modify
|
|
7
|
+
* it under the terms of the GNU Lesser General Public License as published by
|
|
8
|
+
* the Free Software Foundation, either version 3 of the License, or
|
|
9
|
+
* (at your option) any later version.
|
|
10
|
+
*
|
|
11
|
+
* The Moddable SDK Runtime is distributed in the hope that it will be useful,
|
|
12
|
+
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
13
|
+
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
14
|
+
* GNU Lesser General Public License for more details.
|
|
15
|
+
*
|
|
16
|
+
* You should have received a copy of the GNU Lesser General Public License
|
|
17
|
+
* along with the Moddable SDK Runtime. If not, see <http://www.gnu.org/licenses/>.
|
|
18
|
+
*
|
|
19
|
+
*/
|
|
20
|
+
|
|
21
|
+
declare module "embedded:storage/flash" {
|
|
22
|
+
export interface FlashOpenOptions {
|
|
23
|
+
path: string;
|
|
24
|
+
mode?: "r" | "r+";
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
export interface FlashStatus {
|
|
28
|
+
size: number;
|
|
29
|
+
blockLength: number;
|
|
30
|
+
blocks: number;
|
|
31
|
+
writeAlign: number;
|
|
32
|
+
eraseValue: number;
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
export class Flash {
|
|
36
|
+
// Use the default export's open() method to create Flash instances
|
|
37
|
+
close(): void;
|
|
38
|
+
|
|
39
|
+
eraseBlock(start: number, end?: number): void;
|
|
40
|
+
|
|
41
|
+
read(byteLength: number, byteOffset: number): ArrayBuffer;
|
|
42
|
+
read(buffer: BufferLike, byteOffset: number): number;
|
|
43
|
+
write(buffer: BufferLike, byteOffset: number): void;
|
|
44
|
+
|
|
45
|
+
status(): FlashStatus;
|
|
46
|
+
|
|
47
|
+
format: "buffer";
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
const FlashStorage: {
|
|
51
|
+
open(options: FlashOpenOptions): Flash;
|
|
52
|
+
[Symbol.iterator](): IterableIterator<string>;
|
|
53
|
+
};
|
|
54
|
+
|
|
55
|
+
export default FlashStorage;
|
|
56
|
+
}
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Copyright (c) 2024-2025 Moddable Tech, Inc.
|
|
3
|
+
*
|
|
4
|
+
* This file is part of the Moddable SDK Runtime.
|
|
5
|
+
*
|
|
6
|
+
* The Moddable SDK Runtime is free software: you can redistribute it and/or modify
|
|
7
|
+
* it under the terms of the GNU Lesser General Public License as published by
|
|
8
|
+
* the Free Software Foundation, either version 3 of the License, or
|
|
9
|
+
* (at your option) any later version.
|
|
10
|
+
*
|
|
11
|
+
* The Moddable SDK Runtime is distributed in the hope that it will be useful,
|
|
12
|
+
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
13
|
+
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
14
|
+
* GNU Lesser General Public License for more details.
|
|
15
|
+
*
|
|
16
|
+
* You should have received a copy of the GNU Lesser General Public License
|
|
17
|
+
* along with the Moddable SDK Runtime. If not, see <http://www.gnu.org/licenses/>.
|
|
18
|
+
*
|
|
19
|
+
*/
|
|
20
|
+
|
|
21
|
+
declare module "embedded:storage/key-value" {
|
|
22
|
+
export interface StorageOpenOptions {
|
|
23
|
+
path: string;
|
|
24
|
+
mode?: "r" | "r+";
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
export type StorageFormat = "buffer" | "string" | "uint8" | "int8" | "uint16" | "int16" | "uint32" | "int32" | "uint64" | "int64";
|
|
28
|
+
|
|
29
|
+
export class Storage {
|
|
30
|
+
// Use the default export's open() method to create Storage instances
|
|
31
|
+
close(): void;
|
|
32
|
+
|
|
33
|
+
delete(key: string): void;
|
|
34
|
+
|
|
35
|
+
read(key: string): ArrayBuffer | string | number | bigint;
|
|
36
|
+
read(key: string, buffer: BufferLike): number;
|
|
37
|
+
write(key: string, value: BufferLike | string | number | bigint): void;
|
|
38
|
+
|
|
39
|
+
[Symbol.iterator](): IterableIterator<string>;
|
|
40
|
+
|
|
41
|
+
format: StorageFormat;
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
const KeyValueStorage: {
|
|
45
|
+
open(options: StorageOpenOptions): Storage;
|
|
46
|
+
};
|
|
47
|
+
|
|
48
|
+
export default KeyValueStorage;
|
|
49
|
+
}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
declare module "embedded:io/bluetoothle/_common" {
|
|
2
|
+
export interface GATTSecurityOptions {
|
|
3
|
+
bond?: boolean,
|
|
4
|
+
authenticate?: boolean,
|
|
5
|
+
ioCapabilities?: "none" | "display" | "numbers" | "display+numbers" | "display+confirm",
|
|
6
|
+
immediate?: boolean
|
|
7
|
+
}
|
|
8
|
+
export interface GATTSecurityState {
|
|
9
|
+
encrypted: boolean,
|
|
10
|
+
authenticated: boolean,
|
|
11
|
+
bonded: boolean,
|
|
12
|
+
keySize: number
|
|
13
|
+
}
|
|
14
|
+
}
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
declare module "embedded:io/bluetoothle/central" {
|
|
2
|
-
|
|
2
|
+
import type { Buffer } from "embedded:io/_common";
|
|
3
|
+
import type { GATTSecurityOptions, GATTSecurityState } from "embedded:io/bluetoothle/_common";
|
|
3
4
|
|
|
4
5
|
interface Advertisement {
|
|
5
6
|
address: string;
|
|
@@ -32,25 +33,11 @@ declare module "embedded:io/bluetoothle/central" {
|
|
|
32
33
|
response?: boolean
|
|
33
34
|
}
|
|
34
35
|
|
|
35
|
-
interface GATTSecurityOptions {
|
|
36
|
-
bond?: boolean,
|
|
37
|
-
authenticate?: boolean,
|
|
38
|
-
ioCapabilities?: "none" | "display" | "numbers" | "display+numbers" | "display+confirm",
|
|
39
|
-
immediate?: boolean
|
|
40
|
-
}
|
|
41
|
-
|
|
42
|
-
interface GATTSecurityState {
|
|
43
|
-
encrypted: boolean,
|
|
44
|
-
authenticated: boolean,
|
|
45
|
-
bonded: boolean,
|
|
46
|
-
keySize: number
|
|
47
|
-
}
|
|
48
|
-
|
|
49
36
|
interface GATTClientOptions {
|
|
50
37
|
address: string,
|
|
51
38
|
target?: any;
|
|
52
39
|
security?: GATTSecurityOptions;
|
|
53
|
-
onReady?: (this: GATTClient,
|
|
40
|
+
onReady?: (this: GATTClient,) => void;
|
|
54
41
|
onPasskey?: (this: GATTClient, action: string, data: number | ArrayBuffer | undefined) => void;
|
|
55
42
|
onSecured?: (this: GATTClient, state: GATTSecurityState) => void;
|
|
56
43
|
onError?: (this: GATTClient, error: Error) => void;
|
|
@@ -88,20 +75,20 @@ declare module "embedded:io/bluetoothle/central" {
|
|
|
88
75
|
|
|
89
76
|
read(what: GATTClientCharacteristic | GATTClientDescriptor, callback: (error: Error | null, value: ArrayBuffer) => void): void;
|
|
90
77
|
read(what: GATTClientCharacteristic | GATTClientDescriptor, options: object, callback: (error: Error | null, value: ArrayBuffer) => void): void;
|
|
91
|
-
read()
|
|
78
|
+
read(): undefined | GATTClientNotifiedValue;
|
|
92
79
|
|
|
93
|
-
write(what: GATTClientCharacteristic | GATTClientDescriptor, value:
|
|
94
|
-
write(what: GATTClientCharacteristic | GATTClientDescriptor, value:
|
|
80
|
+
write(what: GATTClientCharacteristic | GATTClientDescriptor, value: BufferLike, callback?: (error: Error | null) => void): void;
|
|
81
|
+
write(what: GATTClientCharacteristic | GATTClientDescriptor, value: BufferLike, options: GATTClientWriteOptions, callback?: (error: Error | null) => void): void;
|
|
95
82
|
|
|
96
|
-
subscribe(characteristic: GATTClientCharacteristic, callback?: (error?: Error) => void)
|
|
97
|
-
unsubscribe(characteristic: GATTClientCharacteristic, callback?: (error?: Error) => void)
|
|
83
|
+
subscribe(characteristic: GATTClientCharacteristic, callback?: (error?: Error) => void): void;
|
|
84
|
+
unsubscribe(characteristic: GATTClientCharacteristic, callback?: (error?: Error) => void): void;
|
|
98
85
|
|
|
99
|
-
replyToPasskey(action: string, data?: number | ArrayBuffer)
|
|
86
|
+
replyToPasskey(action: string, data?: number | ArrayBuffer): void;
|
|
100
87
|
|
|
101
88
|
get maximumWrite(): number;
|
|
102
89
|
|
|
103
90
|
store(item: GATTClientService | GATTClientCharacteristic | GATTClientDescriptor): ArrayBuffer;
|
|
104
|
-
restore(item:
|
|
91
|
+
restore(item: BufferLike): GATTClientService | GATTClientCharacteristic | GATTClientDescriptor;
|
|
105
92
|
|
|
106
93
|
static readonly properties: {
|
|
107
94
|
authenticatedSignedWrites: 64;
|
|
@@ -116,4 +103,4 @@ declare module "embedded:io/bluetoothle/central" {
|
|
|
116
103
|
}
|
|
117
104
|
|
|
118
105
|
export { GATTClient, GAPClient };
|
|
119
|
-
}
|
|
106
|
+
}
|
|
@@ -0,0 +1,92 @@
|
|
|
1
|
+
declare module "embedded:io/bluetoothle/peripheral" {
|
|
2
|
+
import type { Buffer } from "embedded:io/_common";
|
|
3
|
+
import type { GATTSecurityOptions, GATTSecurityState } from "embedded:io/bluetoothle/_common";
|
|
4
|
+
|
|
5
|
+
interface GATTServerOptions {
|
|
6
|
+
mtu?: number;
|
|
7
|
+
services: GATTServerService[];
|
|
8
|
+
security?: GATTSecurityOptions;
|
|
9
|
+
onReady?(this: GATTServer): void;
|
|
10
|
+
onConnect?(this: GATTServer, connection: GATTServerConnection): void;
|
|
11
|
+
onDisconnect?(this: GATTServer, connection: GATTServerConnection): void;
|
|
12
|
+
onPasskey?(this: GATTServer, connection: GATTServerConnection, action: "input" | "display" | "compareNumber" | "outOfBand", data?: number | ArrayBuffer): void;
|
|
13
|
+
onSecured?(this: GATTServer, connection: GATTServerConnection, state: GATTSecurityState): void;
|
|
14
|
+
onWarning?(this: GATTServer, message: string): void;
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
interface GATTServerConnection {
|
|
18
|
+
close(): void;
|
|
19
|
+
notify(characteristic: GATTServerCharacteristic, value: ArrayBuffer, callback?: (error?: Error) => void): void;
|
|
20
|
+
replyToPasskey(action: "input" | "compareNumber" | "outOfBand", value: number | boolean | ArrayBuffer): void;
|
|
21
|
+
get maxinumWrite(): number;
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
interface GATTServerService {
|
|
25
|
+
uuid: string;
|
|
26
|
+
characteristics?: GATTServerCharacteristic[];
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
interface GATTServerCharacteristic {
|
|
30
|
+
uuid: string;
|
|
31
|
+
properties?: number;
|
|
32
|
+
value?: Buffer;
|
|
33
|
+
descriptors?: GATTServerDescriptor[];
|
|
34
|
+
|
|
35
|
+
onRead?(this: GATTServerCharacteristic, connection: GATTServerConnection): Buffer;
|
|
36
|
+
onWrite?(this: GATTServerCharacteristic, value: ArrayBuffer, connection: GATTServerConnection): void;
|
|
37
|
+
onSubscribe?(this: GATTServerCharacteristic, connection: GATTServerConnection): void;
|
|
38
|
+
onUnsubscribe?(cthis: GATTServerCharacteristic, onnection: GATTServerConnection): void;
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
interface GATTServerDescriptor {
|
|
42
|
+
uuid: string;
|
|
43
|
+
value?: Buffer;
|
|
44
|
+
|
|
45
|
+
onRead?(connection: GATTServerConnection): Buffer;
|
|
46
|
+
onWrite?(value: ArrayBuffer, connection: GATTServerConnection): void;
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
interface GATTServerAdvertisingRecords {
|
|
50
|
+
name?: string;
|
|
51
|
+
services?: string[];
|
|
52
|
+
manufacturerData?: { manufacturer: number, data: Buffer };
|
|
53
|
+
flags?: number;
|
|
54
|
+
[ADType: number]: Buffer;
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
class GATTServer {
|
|
58
|
+
constructor(options: GATTServerOptions);
|
|
59
|
+
|
|
60
|
+
close?(): void;
|
|
61
|
+
addService(service: GATTServerService): void;
|
|
62
|
+
deleteService(service: GATTServerService): void;
|
|
63
|
+
startAdvertising(scan: GATTServerAdvertisingRecords, response?: GATTServerAdvertisingRecords): void;
|
|
64
|
+
stopAdvertising(): void;
|
|
65
|
+
|
|
66
|
+
static readonly properties: {
|
|
67
|
+
authenticatedSignedWrites: 64;
|
|
68
|
+
broadcast: 1;
|
|
69
|
+
indicate: 32;
|
|
70
|
+
notify: 16;
|
|
71
|
+
read: 2;
|
|
72
|
+
readAuthenticated: 1026;
|
|
73
|
+
readEncrypted: 514;
|
|
74
|
+
reliableWrite: 128;
|
|
75
|
+
subscribeAuthenticated: 65552;
|
|
76
|
+
subscribeEncrypted: 32784;
|
|
77
|
+
write: 8;
|
|
78
|
+
writeAuthenticated: 8200;
|
|
79
|
+
writeEncrypted: 4104;
|
|
80
|
+
writeWithOutResponse: 4;
|
|
81
|
+
};
|
|
82
|
+
static readonly advertise: {
|
|
83
|
+
limitedDiscoverable: 1;
|
|
84
|
+
generalDiscoverable: 2;
|
|
85
|
+
bleOnly: 4;
|
|
86
|
+
dualModeController: 8;
|
|
87
|
+
dualModeHost: 16;
|
|
88
|
+
}
|
|
89
|
+
}
|
|
90
|
+
|
|
91
|
+
export { GATTServer };
|
|
92
|
+
}
|
package/embedded_io/digital.d.ts
CHANGED
|
@@ -30,14 +30,16 @@ declare module "embedded:io/digital" {
|
|
|
30
30
|
| typeof Digital.InputPullUpDown
|
|
31
31
|
| typeof Digital.Output
|
|
32
32
|
| typeof Digital.OutputOpenDrain
|
|
33
|
+
| typeof Digital.ActiveLow
|
|
33
34
|
|
|
34
35
|
class Digital {
|
|
35
|
-
static readonly Input:
|
|
36
|
-
static readonly InputPullUp:
|
|
37
|
-
static readonly InputPullDown:
|
|
38
|
-
static readonly InputPullUpDown:
|
|
39
|
-
static readonly Output:
|
|
40
|
-
static readonly OutputOpenDrain:
|
|
36
|
+
static readonly Input: number
|
|
37
|
+
static readonly InputPullUp: number
|
|
38
|
+
static readonly InputPullDown: number
|
|
39
|
+
static readonly InputPullUpDown: number
|
|
40
|
+
static readonly Output: number
|
|
41
|
+
static readonly OutputOpenDrain: number
|
|
42
|
+
static readonly ActiveLow: number
|
|
41
43
|
static readonly Rising: Edge;
|
|
42
44
|
static readonly Falling: Edge;
|
|
43
45
|
|
|
@@ -26,14 +26,16 @@ declare module "embedded:io/digitalbank" {
|
|
|
26
26
|
| typeof DigitalBank.InputPullUpDown
|
|
27
27
|
| typeof DigitalBank.Output
|
|
28
28
|
| typeof DigitalBank.OutputOpenDrain
|
|
29
|
+
| typeof DigitalBank.ActiveLow
|
|
29
30
|
|
|
30
31
|
class DigitalBank {
|
|
31
|
-
static readonly Input:
|
|
32
|
-
static readonly InputPullUp:
|
|
33
|
-
static readonly InputPullDown:
|
|
34
|
-
static readonly InputPullUpDown:
|
|
35
|
-
static readonly Output:
|
|
36
|
-
static readonly OutputOpenDrain:
|
|
32
|
+
static readonly Input: number
|
|
33
|
+
static readonly InputPullUp: number
|
|
34
|
+
static readonly InputPullDown: number
|
|
35
|
+
static readonly InputPullUpDown: number
|
|
36
|
+
static readonly Output: number
|
|
37
|
+
static readonly OutputOpenDrain: number
|
|
38
|
+
static readonly ActiveLow: number
|
|
37
39
|
|
|
38
40
|
constructor(dictionary: {
|
|
39
41
|
pins: number;
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Copyright (c) 2025 Moddable Tech, Inc.
|
|
3
|
+
*
|
|
4
|
+
* This file is part of the Moddable SDK Runtime.
|
|
5
|
+
*
|
|
6
|
+
* The Moddable SDK Runtime is free software: you can redistribute it and/or modify
|
|
7
|
+
* it under the terms of the GNU Lesser General Public License as published by
|
|
8
|
+
* the Free Software Foundation, either version 3 of the License, or
|
|
9
|
+
* (at your option) any later version.
|
|
10
|
+
*
|
|
11
|
+
* The Moddable SDK Runtime is distributed in the hope that it will be useful,
|
|
12
|
+
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
13
|
+
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
14
|
+
* GNU Lesser General Public License for more details.
|
|
15
|
+
*
|
|
16
|
+
* You should have received a copy of the GNU Lesser General Public License
|
|
17
|
+
* along with the Moddable SDK Runtime. If not, see <http://www.gnu.org/licenses/>.
|
|
18
|
+
*
|
|
19
|
+
*/
|
|
20
|
+
|
|
21
|
+
declare module "embedded:network/interface/ethernet" {
|
|
22
|
+
import type {PortSpecifier} from "embedded:io/_common";
|
|
23
|
+
|
|
24
|
+
export interface EthernetConstructorOptions {
|
|
25
|
+
port?: PortSpecifier;
|
|
26
|
+
onChanged?: () => void;
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
class Ethernet {
|
|
30
|
+
constructor(options: EthernetConstructorOptions);
|
|
31
|
+
|
|
32
|
+
close(): void;
|
|
33
|
+
connect(options: {}): void;
|
|
34
|
+
disconnect(): void;
|
|
35
|
+
|
|
36
|
+
readonly connection: number;
|
|
37
|
+
readonly address: string | undefined;
|
|
38
|
+
readonly MAC: string | undefined;
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
export default Ethernet;
|
|
42
|
+
}
|
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Copyright (c) 2025 Moddable Tech, Inc.
|
|
3
|
+
*
|
|
4
|
+
* This file is part of the Moddable SDK Runtime.
|
|
5
|
+
*
|
|
6
|
+
* The Moddable SDK Runtime is free software: you can redistribute it and/or modify
|
|
7
|
+
* it under the terms of the GNU Lesser General Public License as published by
|
|
8
|
+
* the Free Software Foundation, either version 3 of the License, or
|
|
9
|
+
* (at your option) any later version.
|
|
10
|
+
*
|
|
11
|
+
* The Moddable SDK Runtime is distributed in the hope that it will be useful,
|
|
12
|
+
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
13
|
+
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
14
|
+
* GNU Lesser General Public License for more details.
|
|
15
|
+
*
|
|
16
|
+
* You should have received a copy of the GNU Lesser General Public License
|
|
17
|
+
* along with the Moddable SDK Runtime. If not, see <http://www.gnu.org/licenses/>.
|
|
18
|
+
*
|
|
19
|
+
*/
|
|
20
|
+
|
|
21
|
+
declare module "embedded:network/interface/wifi" {
|
|
22
|
+
import type {PortSpecifier} from "embedded:io/_common";
|
|
23
|
+
|
|
24
|
+
export interface WiFiConstructorOptions {
|
|
25
|
+
port?: PortSpecifier;
|
|
26
|
+
onChanged?: () => void;
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
export interface WiFiScanResult {
|
|
30
|
+
SSID: string;
|
|
31
|
+
channel: number;
|
|
32
|
+
RSSI: number;
|
|
33
|
+
BSSID?: ArrayBuffer;
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
export interface WiFiScanOptions {
|
|
37
|
+
onFound?: (result: WiFiScanResult) => void;
|
|
38
|
+
onComplete?: () => void;
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
export interface WiFiConnectOptions {
|
|
42
|
+
SSID: string;
|
|
43
|
+
password?: string;
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
class WiFi {
|
|
47
|
+
constructor(options: WiFiConstructorOptions);
|
|
48
|
+
|
|
49
|
+
close(): void;
|
|
50
|
+
scan(options: WiFiScanOptions): void;
|
|
51
|
+
connect(options: WiFiConnectOptions): void;
|
|
52
|
+
disconnect(): void;
|
|
53
|
+
|
|
54
|
+
readonly connection: number;
|
|
55
|
+
readonly address: string | undefined;
|
|
56
|
+
readonly MAC: string | undefined;
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
export default WiFi;
|
|
60
|
+
}
|
|
@@ -53,7 +53,8 @@ declare module "embedded:network/mqtt/client" {
|
|
|
53
53
|
export default class MQTTClient {
|
|
54
54
|
constructor(options: Options)
|
|
55
55
|
read(count: number): ArrayBuffer
|
|
56
|
-
|
|
56
|
+
read(buffer: BufferLike): number
|
|
57
|
+
write(data: BufferLike, options: WriteOptions): number
|
|
57
58
|
close(): void
|
|
58
59
|
|
|
59
60
|
static CONNECT: 1
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Copyright (c) 2025 Moddable Tech, Inc.
|
|
3
|
+
*
|
|
4
|
+
* This file is part of the Moddable SDK Runtime.
|
|
5
|
+
*
|
|
6
|
+
* The Moddable SDK Runtime is free software: you can redistribute it and/or modify
|
|
7
|
+
* it under the terms of the GNU Lesser General Public License as published by
|
|
8
|
+
* the Free Software Foundation, either version 3 of the License, or
|
|
9
|
+
* (at your option) any later version.
|
|
10
|
+
*
|
|
11
|
+
* The Moddable SDK Runtime is distributed in the hope that it will be useful,
|
|
12
|
+
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
13
|
+
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
14
|
+
* GNU Lesser General Public License for more details.
|
|
15
|
+
*
|
|
16
|
+
* You should have received a copy of the GNU Lesser General Public License
|
|
17
|
+
* along with the Moddable SDK Runtime. If not, see <http://www.gnu.org/licenses/>.
|
|
18
|
+
*
|
|
19
|
+
*/
|
|
20
|
+
|
|
21
|
+
declare module "embedded:network/ntp/client" {
|
|
22
|
+
import type UDP from "embedded:io/socket/udp";
|
|
23
|
+
import type Resolver from "embedded:network/dns/resolver/udp";
|
|
24
|
+
|
|
25
|
+
export interface NTPOptions<T = any> {
|
|
26
|
+
servers: string[];
|
|
27
|
+
socket: { io: typeof UDP };
|
|
28
|
+
dns: { io: typeof Resolver };
|
|
29
|
+
target?: T;
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
export interface NTPCallback {
|
|
33
|
+
(error: null, time: number): void;
|
|
34
|
+
(error: Error): void;
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
export default class NTP<T = any> {
|
|
38
|
+
target?: T;
|
|
39
|
+
constructor(options: NTPOptions<T>);
|
|
40
|
+
close(): void;
|
|
41
|
+
getTime(callback: NTPCallback): void;
|
|
42
|
+
}
|
|
43
|
+
}
|
package/neopixel.d.ts
ADDED
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Copyright (c) 2025 Satoshi Tanaka
|
|
3
|
+
*
|
|
4
|
+
* This file is part of the Moddable SDK Tools.
|
|
5
|
+
*
|
|
6
|
+
* The Moddable SDK Tools is free software: you can redistribute it and/or modify
|
|
7
|
+
* it under the terms of the GNU General Public License as published by
|
|
8
|
+
* the Free Software Foundation, either version 3 of the License, or
|
|
9
|
+
* (at your option) any later version.
|
|
10
|
+
*
|
|
11
|
+
* The Moddable SDK Tools is distributed in the hope that it will be useful,
|
|
12
|
+
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
13
|
+
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
14
|
+
* GNU General Public License for more details.
|
|
15
|
+
*
|
|
16
|
+
* You should have received a copy of the GNU General Public License
|
|
17
|
+
* along with the Moddable SDK Tools. If not, see <http://www.gnu.org/licenses/>.
|
|
18
|
+
*
|
|
19
|
+
*/
|
|
20
|
+
|
|
21
|
+
declare module "neopixel" {
|
|
22
|
+
class NeoPixel extends HostBuffer {
|
|
23
|
+
constructor(options?: {
|
|
24
|
+
pin?: number,
|
|
25
|
+
length?: number,
|
|
26
|
+
order?: string
|
|
27
|
+
});
|
|
28
|
+
|
|
29
|
+
close(): void;
|
|
30
|
+
update(): void;
|
|
31
|
+
|
|
32
|
+
makeRGB(r: number, g: number, b: number): number;
|
|
33
|
+
makeHSB(h: number, s: number, b: number): number;
|
|
34
|
+
setPixel(index: number, color: number): void;
|
|
35
|
+
fill(color: number, index?: number, count?: number): void;
|
|
36
|
+
getPixel(index: number): number;
|
|
37
|
+
|
|
38
|
+
get brightness(): number;
|
|
39
|
+
set brightness(value: number);
|
|
40
|
+
get length(): number;
|
|
41
|
+
}
|
|
42
|
+
export default NeoPixel;
|
|
43
|
+
}
|
package/neostrand.d.ts
ADDED
|
@@ -0,0 +1,173 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Copyright (c) 2025 Satoshi Tanaka
|
|
3
|
+
*
|
|
4
|
+
* This file is part of the Moddable SDK Tools.
|
|
5
|
+
*
|
|
6
|
+
* The Moddable SDK Tools is free software: you can redistribute it and/or modify
|
|
7
|
+
* it under the terms of the GNU General Public License as published by
|
|
8
|
+
* the Free Software Foundation, either version 3 of the License, or
|
|
9
|
+
* (at your option) any later version.
|
|
10
|
+
*
|
|
11
|
+
* The Moddable SDK Tools is distributed in the hope that it will be useful,
|
|
12
|
+
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
13
|
+
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
14
|
+
* GNU General Public License for more details.
|
|
15
|
+
*
|
|
16
|
+
* You should have received a copy of the GNU General Public License
|
|
17
|
+
* along with the Moddable SDK Tools. If not, see <http://www.gnu.org/licenses/>.
|
|
18
|
+
*
|
|
19
|
+
*/
|
|
20
|
+
|
|
21
|
+
declare module "neostrand" {
|
|
22
|
+
import type NeoPixel from "neopixel";
|
|
23
|
+
import type Timeline from "piu/Timeline";
|
|
24
|
+
|
|
25
|
+
export type NeoStrandEffectDictionary = {
|
|
26
|
+
strand: NeoStrand;
|
|
27
|
+
start?: number;
|
|
28
|
+
end?: number;
|
|
29
|
+
reverse?: 0 | 1;
|
|
30
|
+
duration?: number;
|
|
31
|
+
position?: number;
|
|
32
|
+
speed?: number;
|
|
33
|
+
size?: number;
|
|
34
|
+
loop?: 0 | 1;
|
|
35
|
+
tickle?: number;
|
|
36
|
+
|
|
37
|
+
onComplete?: (effect: NeoStrandEffect) => void;
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
export class NeoStrandEffect {
|
|
41
|
+
name: string;
|
|
42
|
+
strand: NeoStrand;
|
|
43
|
+
start: number;
|
|
44
|
+
end: number
|
|
45
|
+
size: number;
|
|
46
|
+
dur: number;
|
|
47
|
+
reverse: 0 | 1;
|
|
48
|
+
loop: 0 | 1;
|
|
49
|
+
timeline: Timeline;
|
|
50
|
+
constructor(dictionary: NeoStrandEffectDictionary);
|
|
51
|
+
|
|
52
|
+
reset(effect: NeoStrandEffect): void;
|
|
53
|
+
loopPrepare(effect: NeoStrandEffect): void;
|
|
54
|
+
activate(effect: NeoStrandEffect): void;
|
|
55
|
+
idle(effect: NeoStrandEffect, ticks: number): void;
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
class HueSpan extends NeoStrandEffect {
|
|
59
|
+
constructor(dictionary: NeoStrandEffectDictionary & {
|
|
60
|
+
position?: number;
|
|
61
|
+
saturation?: number;
|
|
62
|
+
value?: number;
|
|
63
|
+
});
|
|
64
|
+
|
|
65
|
+
set hue(h: number);
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
class Sine extends NeoStrandEffect {
|
|
69
|
+
constructor(dictionary: NeoStrandEffectDictionary & {
|
|
70
|
+
amplitude?: number;
|
|
71
|
+
offset?: number;
|
|
72
|
+
vary?: "r" | "g" | "b" | "h" | "s" | "v";
|
|
73
|
+
});
|
|
74
|
+
|
|
75
|
+
set effectValue(value: number);
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
interface rgb {
|
|
79
|
+
r: number;
|
|
80
|
+
g: number;
|
|
81
|
+
b: number;
|
|
82
|
+
}
|
|
83
|
+
class Marquee extends NeoStrandEffect {
|
|
84
|
+
constructor(dictionary: NeoStrandEffectDictionary & {
|
|
85
|
+
sizeA?: number;
|
|
86
|
+
sizeB?: number;
|
|
87
|
+
rgbA?: rgb;
|
|
88
|
+
rgbB?: rgb;
|
|
89
|
+
});
|
|
90
|
+
|
|
91
|
+
set steps(s: number);
|
|
92
|
+
}
|
|
93
|
+
|
|
94
|
+
class Pulse extends NeoStrandEffect {
|
|
95
|
+
constructor(dictionary: NeoStrandEffectDictionary & {
|
|
96
|
+
dir?: number;
|
|
97
|
+
mode?: -1 | 0 | 1;
|
|
98
|
+
fade?: number;
|
|
99
|
+
size?: number;
|
|
100
|
+
duration?: number;
|
|
101
|
+
position?: "random" | number;
|
|
102
|
+
rgb?: rgb;
|
|
103
|
+
});
|
|
104
|
+
|
|
105
|
+
loopPrepare(effect: NeoStrandEffect): void;
|
|
106
|
+
set pulseLoc(px: number);
|
|
107
|
+
}
|
|
108
|
+
|
|
109
|
+
class Pattern extends NeoStrandEffect {
|
|
110
|
+
constructor(dictionary: NeoStrandEffectDictionary & {
|
|
111
|
+
pattern?: number[];
|
|
112
|
+
mode?: -1 | 0 | 1;
|
|
113
|
+
});
|
|
114
|
+
|
|
115
|
+
loopPrepare(effect: NeoStrandEffect): void;
|
|
116
|
+
set effectValue(value: number);
|
|
117
|
+
}
|
|
118
|
+
|
|
119
|
+
class Dim extends NeoStrandEffect {
|
|
120
|
+
constructor(dictionary: NeoStrandEffectDictionary & {
|
|
121
|
+
rgb?: rgb;
|
|
122
|
+
});
|
|
123
|
+
}
|
|
124
|
+
|
|
125
|
+
class Ease extends NeoStrandEffect {
|
|
126
|
+
constructor(dictionary: NeoStrandEffectDictionary & {
|
|
127
|
+
easing?: number;
|
|
128
|
+
size?: number;
|
|
129
|
+
rgb?: rgb;
|
|
130
|
+
});
|
|
131
|
+
|
|
132
|
+
set steps(s: number);
|
|
133
|
+
}
|
|
134
|
+
|
|
135
|
+
interface PulseTiming {
|
|
136
|
+
level0: 0 | 1;
|
|
137
|
+
duration0: number;
|
|
138
|
+
level1: 0 | 1;
|
|
139
|
+
duration1: number;
|
|
140
|
+
}
|
|
141
|
+
|
|
142
|
+
export class NeoStrand extends NeoPixel {
|
|
143
|
+
constructor(options?: {
|
|
144
|
+
pin?: number,
|
|
145
|
+
length?: number,
|
|
146
|
+
order?: string,
|
|
147
|
+
timing?: {
|
|
148
|
+
mark: PulseTiming,
|
|
149
|
+
space: PulseTiming,
|
|
150
|
+
reset: PulseTiming
|
|
151
|
+
}
|
|
152
|
+
});
|
|
153
|
+
|
|
154
|
+
set(idx: number, color: number, start?: number, end?: number): void;
|
|
155
|
+
add(idx: number, color: number, start?: number, end?: number): void;
|
|
156
|
+
sub(idx: number, color: number, start?: number, end?: number): void;
|
|
157
|
+
op(idx: number, rgb: number, mode: number, start: number, end: number): void;
|
|
158
|
+
setScheme(scheme: NeoStrandEffect[]): void;
|
|
159
|
+
start(ms?: number): void;
|
|
160
|
+
stop(): void;
|
|
161
|
+
hsvToRgb(h: number, s: number, v: number): number;
|
|
162
|
+
rgbToHsv(r: number, g: number, b: number): { h: number; s: number; v: number };
|
|
163
|
+
|
|
164
|
+
static HueSpan: typeof HueSpan;
|
|
165
|
+
static Sine: typeof Sine;
|
|
166
|
+
static Marquee: typeof Marquee;
|
|
167
|
+
static Pulse: typeof Pulse;
|
|
168
|
+
static Pattern: typeof Pattern;
|
|
169
|
+
static Dim: typeof Dim;
|
|
170
|
+
static Ease: typeof Ease;
|
|
171
|
+
}
|
|
172
|
+
|
|
173
|
+
}
|
package/package.json
CHANGED
|
File without changes
|