@moddable/typings 6.1.0 → 7.1.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/base64.d.ts +1 -1
- package/commodetto/Bitmap.d.ts +1 -1
- package/commodetto/BufferOut.d.ts +2 -2
- package/commodetto/Convert.d.ts +3 -3
- package/commodetto/ReadGIF.d.ts +1 -1
- package/commodetto/ReadPNG.d.ts +2 -2
- package/commodetto/loadJPEG.d.ts +1 -1
- package/commodetto/parseBMF.d.ts +1 -1
- package/commodetto/parseNFNT.d.ts +1 -1
- package/commodetto/readJPEG.d.ts +2 -2
- package/crc.d.ts +2 -2
- package/{deflate.ts → deflate.d.ts} +1 -1
- 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/_common.d.ts +0 -1
- package/embedded_io/audio/in.d.ts +1 -3
- package/embedded_io/audio/out.d.ts +1 -3
- package/embedded_io/ble/_common.d.ts +14 -0
- package/embedded_io/ble/{client.d.ts → central.d.ts} +10 -24
- package/embedded_io/ble/peripheral.d.ts +91 -0
- package/embedded_io/digital.d.ts +8 -6
- package/embedded_io/digitalbank.d.ts +8 -6
- package/embedded_io/i2c.d.ts +3 -3
- package/embedded_io/serial.d.ts +3 -3
- package/embedded_io/smbus.d.ts +2 -3
- package/embedded_io/socket/tcp.d.ts +2 -3
- package/embedded_io/socket/udp.d.ts +1 -2
- package/embedded_io/spi.d.ts +4 -4
- package/embedded_network/http/client.d.ts +2 -4
- 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 +4 -5
- package/embedded_network/ntp/client.d.ts +43 -0
- package/flash.d.ts +1 -1
- package/hex.d.ts +1 -1
- package/inflate.d.ts +1 -1
- package/neopixel.d.ts +43 -0
- package/neostrand.d.ts +173 -0
- package/package.json +1 -1
- package/pins/audioout.d.ts +1 -1
- package/qrcode.d.ts +1 -1
- package/securesocket.d.ts +1 -1
- package/socket.d.ts +1 -1
- package/xs.d.ts +3 -3
- package/zip.d.ts +1 -1
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
declare module "embedded:io/bluetoothle/central" {
|
|
2
|
-
|
|
2
|
+
import type { GATTSecurityOptions, GATTSecurityState } from "embedded:io/bluetoothle/_common";
|
|
3
3
|
|
|
4
4
|
interface Advertisement {
|
|
5
5
|
address: string;
|
|
@@ -32,25 +32,11 @@ declare module "embedded:io/bluetoothle/central" {
|
|
|
32
32
|
response?: boolean
|
|
33
33
|
}
|
|
34
34
|
|
|
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
35
|
interface GATTClientOptions {
|
|
50
36
|
address: string,
|
|
51
37
|
target?: any;
|
|
52
38
|
security?: GATTSecurityOptions;
|
|
53
|
-
onReady?: (this: GATTClient,
|
|
39
|
+
onReady?: (this: GATTClient,) => void;
|
|
54
40
|
onPasskey?: (this: GATTClient, action: string, data: number | ArrayBuffer | undefined) => void;
|
|
55
41
|
onSecured?: (this: GATTClient, state: GATTSecurityState) => void;
|
|
56
42
|
onError?: (this: GATTClient, error: Error) => void;
|
|
@@ -88,20 +74,20 @@ declare module "embedded:io/bluetoothle/central" {
|
|
|
88
74
|
|
|
89
75
|
read(what: GATTClientCharacteristic | GATTClientDescriptor, callback: (error: Error | null, value: ArrayBuffer) => void): void;
|
|
90
76
|
read(what: GATTClientCharacteristic | GATTClientDescriptor, options: object, callback: (error: Error | null, value: ArrayBuffer) => void): void;
|
|
91
|
-
read()
|
|
77
|
+
read(): undefined | GATTClientNotifiedValue;
|
|
92
78
|
|
|
93
|
-
write(what: GATTClientCharacteristic | GATTClientDescriptor, value:
|
|
94
|
-
write(what: GATTClientCharacteristic | GATTClientDescriptor, value:
|
|
79
|
+
write(what: GATTClientCharacteristic | GATTClientDescriptor, value: ByteBuffer, callback?: (error: Error | null) => void): void;
|
|
80
|
+
write(what: GATTClientCharacteristic | GATTClientDescriptor, value: ByteBuffer, options: GATTClientWriteOptions, callback?: (error: Error | null) => void): void;
|
|
95
81
|
|
|
96
|
-
subscribe(characteristic: GATTClientCharacteristic, callback?: (error?: Error) => void)
|
|
97
|
-
unsubscribe(characteristic: GATTClientCharacteristic, callback?: (error?: Error) => void)
|
|
82
|
+
subscribe(characteristic: GATTClientCharacteristic, callback?: (error?: Error) => void): void;
|
|
83
|
+
unsubscribe(characteristic: GATTClientCharacteristic, callback?: (error?: Error) => void): void;
|
|
98
84
|
|
|
99
|
-
replyToPasskey(action: string, data?: number | ArrayBuffer)
|
|
85
|
+
replyToPasskey(action: string, data?: number | ArrayBuffer): void;
|
|
100
86
|
|
|
101
87
|
get maximumWrite(): number;
|
|
102
88
|
|
|
103
89
|
store(item: GATTClientService | GATTClientCharacteristic | GATTClientDescriptor): ArrayBuffer;
|
|
104
|
-
restore(item:
|
|
90
|
+
restore(item: ByteBuffer): GATTClientService | GATTClientCharacteristic | GATTClientDescriptor;
|
|
105
91
|
|
|
106
92
|
static readonly properties: {
|
|
107
93
|
authenticatedSignedWrites: 64;
|
|
@@ -116,4 +102,4 @@ declare module "embedded:io/bluetoothle/central" {
|
|
|
116
102
|
}
|
|
117
103
|
|
|
118
104
|
export { GATTClient, GAPClient };
|
|
119
|
-
}
|
|
105
|
+
}
|
|
@@ -0,0 +1,91 @@
|
|
|
1
|
+
declare module "embedded:io/bluetoothle/peripheral" {
|
|
2
|
+
import type { GATTSecurityOptions, GATTSecurityState } from "embedded:io/bluetoothle/_common";
|
|
3
|
+
|
|
4
|
+
interface GATTServerOptions {
|
|
5
|
+
mtu?: number;
|
|
6
|
+
services: GATTServerService[];
|
|
7
|
+
security?: GATTSecurityOptions;
|
|
8
|
+
onReady?(this: GATTServer): void;
|
|
9
|
+
onConnect?(this: GATTServer, connection: GATTServerConnection): void;
|
|
10
|
+
onDisconnect?(this: GATTServer, connection: GATTServerConnection): void;
|
|
11
|
+
onPasskey?(this: GATTServer, connection: GATTServerConnection, action: "input" | "display" | "compareNumber" | "outOfBand", data?: number | ArrayBuffer): void;
|
|
12
|
+
onSecured?(this: GATTServer, connection: GATTServerConnection, state: GATTSecurityState): void;
|
|
13
|
+
onWarning?(this: GATTServer, message: string): void;
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
interface GATTServerConnection {
|
|
17
|
+
close(): void;
|
|
18
|
+
notify(characteristic: GATTServerCharacteristic, value: ArrayBuffer, callback?: (error?: Error) => void): void;
|
|
19
|
+
replyToPasskey(action: "input" | "compareNumber" | "outOfBand", value: number | boolean | ArrayBuffer): void;
|
|
20
|
+
get maxinumWrite(): number;
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
interface GATTServerService {
|
|
24
|
+
uuid: string;
|
|
25
|
+
characteristics?: GATTServerCharacteristic[];
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
interface GATTServerCharacteristic {
|
|
29
|
+
uuid: string;
|
|
30
|
+
properties?: number;
|
|
31
|
+
value?: ByteBuffer;
|
|
32
|
+
descriptors?: GATTServerDescriptor[];
|
|
33
|
+
|
|
34
|
+
onRead?(this: GATTServerCharacteristic, connection: GATTServerConnection): ByteBuffer;
|
|
35
|
+
onWrite?(this: GATTServerCharacteristic, value: ArrayBuffer, connection: GATTServerConnection): void;
|
|
36
|
+
onSubscribe?(this: GATTServerCharacteristic, connection: GATTServerConnection): void;
|
|
37
|
+
onUnsubscribe?(cthis: GATTServerCharacteristic, onnection: GATTServerConnection): void;
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
interface GATTServerDescriptor {
|
|
41
|
+
uuid: string;
|
|
42
|
+
value?: ByteBuffer;
|
|
43
|
+
|
|
44
|
+
onRead?(connection: GATTServerConnection): ByteBuffer;
|
|
45
|
+
onWrite?(value: ArrayBuffer, connection: GATTServerConnection): void;
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
interface GATTServerAdvertisingRecords {
|
|
49
|
+
name?: string;
|
|
50
|
+
services?: string[];
|
|
51
|
+
manufacturerData?: { manufacturer: number, data: ByteBuffer };
|
|
52
|
+
flags?: number;
|
|
53
|
+
[ADType: number]: ByteBuffer;
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
class GATTServer {
|
|
57
|
+
constructor(options: GATTServerOptions);
|
|
58
|
+
|
|
59
|
+
close?(): void;
|
|
60
|
+
addService(service: GATTServerService): void;
|
|
61
|
+
deleteService(service: GATTServerService): void;
|
|
62
|
+
startAdvertising(scan: GATTServerAdvertisingRecords, response?: GATTServerAdvertisingRecords): void;
|
|
63
|
+
stopAdvertising(): void;
|
|
64
|
+
|
|
65
|
+
static readonly properties: {
|
|
66
|
+
authenticatedSignedWrites: 64;
|
|
67
|
+
broadcast: 1;
|
|
68
|
+
indicate: 32;
|
|
69
|
+
notify: 16;
|
|
70
|
+
read: 2;
|
|
71
|
+
readAuthenticated: 1026;
|
|
72
|
+
readEncrypted: 514;
|
|
73
|
+
reliableWrite: 128;
|
|
74
|
+
subscribeAuthenticated: 65552;
|
|
75
|
+
subscribeEncrypted: 32784;
|
|
76
|
+
write: 8;
|
|
77
|
+
writeAuthenticated: 8200;
|
|
78
|
+
writeEncrypted: 4104;
|
|
79
|
+
writeWithOutResponse: 4;
|
|
80
|
+
};
|
|
81
|
+
static readonly advertise: {
|
|
82
|
+
limitedDiscoverable: 1;
|
|
83
|
+
generalDiscoverable: 2;
|
|
84
|
+
bleOnly: 4;
|
|
85
|
+
dualModeController: 8;
|
|
86
|
+
dualModeHost: 16;
|
|
87
|
+
}
|
|
88
|
+
}
|
|
89
|
+
|
|
90
|
+
export { GATTServer };
|
|
91
|
+
}
|
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;
|
package/embedded_io/i2c.d.ts
CHANGED
|
@@ -20,7 +20,7 @@
|
|
|
20
20
|
|
|
21
21
|
|
|
22
22
|
declare module "embedded:io/i2c" {
|
|
23
|
-
import {
|
|
23
|
+
import { PinSpecifier, PortSpecifier } from "embedded:io/_common";
|
|
24
24
|
class I2C {
|
|
25
25
|
constructor(options: {
|
|
26
26
|
data: PinSpecifier;
|
|
@@ -33,9 +33,9 @@ declare module "embedded:io/i2c" {
|
|
|
33
33
|
});
|
|
34
34
|
readonly resolution: number;
|
|
35
35
|
|
|
36
|
-
write(value:
|
|
36
|
+
write(value: ByteBuffer, stop?: boolean): void;
|
|
37
37
|
read(byteLength: number, stop?: boolean): ArrayBuffer;
|
|
38
|
-
read(buffer:
|
|
38
|
+
read(buffer: ByteBuffer, stop?: boolean): number;
|
|
39
39
|
get format(): "buffer"
|
|
40
40
|
set format(value: "buffer")
|
|
41
41
|
}
|
package/embedded_io/serial.d.ts
CHANGED
|
@@ -19,7 +19,7 @@
|
|
|
19
19
|
*/
|
|
20
20
|
|
|
21
21
|
declare module "embedded:io/serial" {
|
|
22
|
-
import {
|
|
22
|
+
import { PinSpecifier, PortSpecifier } from "embedded:io/_common";
|
|
23
23
|
class Serial {
|
|
24
24
|
constructor(options: ({
|
|
25
25
|
receive: PinSpecifier;
|
|
@@ -44,8 +44,8 @@ declare module "embedded:io/serial" {
|
|
|
44
44
|
close(): void;
|
|
45
45
|
read(): number | ArrayBuffer | undefined;
|
|
46
46
|
read(byteLength: number): ArrayBuffer | undefined;
|
|
47
|
-
read(buffer:
|
|
48
|
-
write(value: number |
|
|
47
|
+
read(buffer: ByteBuffer): number | undefined;
|
|
48
|
+
write(value: number | ByteBuffer): void;
|
|
49
49
|
flush(): void;
|
|
50
50
|
flush(input: number, output: number): void;
|
|
51
51
|
set(options: {
|
package/embedded_io/smbus.d.ts
CHANGED
|
@@ -20,7 +20,6 @@
|
|
|
20
20
|
|
|
21
21
|
declare module "embedded:io/smbus" {
|
|
22
22
|
import I2C from "embedded:io/i2c"
|
|
23
|
-
import { Buffer } from "embedded:io/_common";
|
|
24
23
|
|
|
25
24
|
class SMBus extends I2C {
|
|
26
25
|
constructor(options: ConstructorParameters<typeof I2C> & {
|
|
@@ -31,8 +30,8 @@ declare module "embedded:io/smbus" {
|
|
|
31
30
|
readUint16(register: number, bigEndian?: boolean): number;
|
|
32
31
|
writeUint16(register: number, value: number, bigEndian?: boolean): void;
|
|
33
32
|
readBuffer(register: number, byteLength: number): ArrayBuffer;
|
|
34
|
-
readBuffer(register: number, buffer:
|
|
35
|
-
writeBuffer(register: number, buffer:
|
|
33
|
+
readBuffer(register: number, buffer: ByteBuffer): void;
|
|
34
|
+
writeBuffer(register: number, buffer: ByteBuffer): void;
|
|
36
35
|
readQuick(): void;
|
|
37
36
|
writeQuick(): void;
|
|
38
37
|
receiveByte(): number;
|
|
@@ -19,7 +19,6 @@
|
|
|
19
19
|
*/
|
|
20
20
|
|
|
21
21
|
declare module "embedded:io/socket/tcp" {
|
|
22
|
-
import type { Buffer } from "embedded:io/_common";
|
|
23
22
|
export type Options = ((({
|
|
24
23
|
address: string;
|
|
25
24
|
} | {
|
|
@@ -42,8 +41,8 @@ declare module "embedded:io/socket/tcp" {
|
|
|
42
41
|
readonly remoteAddress: string | undefined;
|
|
43
42
|
readonly remotePort: number | undefined;
|
|
44
43
|
read(byteLength?: number): number | ArrayBuffer;
|
|
45
|
-
read(buffer:
|
|
46
|
-
write(value: number |
|
|
44
|
+
read(buffer: ByteBuffer): void;
|
|
45
|
+
write(value: number | ByteBuffer): void;
|
|
47
46
|
close(): void;
|
|
48
47
|
get format(): "number" | "buffer"
|
|
49
48
|
set format(value: "number" | "buffer")
|
|
@@ -19,7 +19,6 @@
|
|
|
19
19
|
*/
|
|
20
20
|
|
|
21
21
|
declare module "embedded:io/socket/udp" {
|
|
22
|
-
import type { Buffer } from "embedded:io/_common";
|
|
23
22
|
class UDP {
|
|
24
23
|
constructor(options: {
|
|
25
24
|
port?: number;
|
|
@@ -32,7 +31,7 @@ declare module "embedded:io/socket/udp" {
|
|
|
32
31
|
multicast: string;
|
|
33
32
|
timeToLive: number;
|
|
34
33
|
}))
|
|
35
|
-
write(buffer:
|
|
34
|
+
write(buffer: ByteBuffer, address: string, port: number): void;
|
|
36
35
|
read(): ArrayBuffer & {
|
|
37
36
|
address: string;
|
|
38
37
|
port: number;
|
package/embedded_io/spi.d.ts
CHANGED
|
@@ -19,7 +19,7 @@
|
|
|
19
19
|
*/
|
|
20
20
|
|
|
21
21
|
declare module "embedded:io/spi" {
|
|
22
|
-
import {
|
|
22
|
+
import { PinSpecifier, PortSpecifier } from "embedded:io/_common";
|
|
23
23
|
class SPI {
|
|
24
24
|
constructor(options: {
|
|
25
25
|
out?: PinSpecifier;
|
|
@@ -34,9 +34,9 @@ declare module "embedded:io/spi" {
|
|
|
34
34
|
target?: any;
|
|
35
35
|
})
|
|
36
36
|
read(byteLength: number): ArrayBuffer;
|
|
37
|
-
read(buffer:
|
|
38
|
-
write(buffer:
|
|
39
|
-
transfer(buffer:
|
|
37
|
+
read(buffer: ByteBuffer): void;
|
|
38
|
+
write(buffer: ByteBuffer): void;
|
|
39
|
+
transfer(buffer: ByteBuffer): void;
|
|
40
40
|
flush(deselect?: boolean): void;
|
|
41
41
|
get format(): "buffer";
|
|
42
42
|
set format(value: "buffer");
|
|
@@ -19,8 +19,6 @@
|
|
|
19
19
|
*/
|
|
20
20
|
|
|
21
21
|
declare module "embedded:network/http/client" {
|
|
22
|
-
import type { Buffer } from "embedded:io/_common"
|
|
23
|
-
|
|
24
22
|
export interface ClientOptions {
|
|
25
23
|
socket: any
|
|
26
24
|
port?:number
|
|
@@ -41,8 +39,8 @@ declare module "embedded:network/http/client" {
|
|
|
41
39
|
|
|
42
40
|
export interface HTTPRequest {
|
|
43
41
|
read(byteLength?: number): ArrayBuffer|undefined;
|
|
44
|
-
read(buffer:
|
|
45
|
-
write(value:
|
|
42
|
+
read(buffer: ByteBuffer): void;
|
|
43
|
+
write(value: ByteBuffer|undefined): void;
|
|
46
44
|
}
|
|
47
45
|
|
|
48
46
|
export default class HTTPClient {
|
|
@@ -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
|
+
}
|
|
@@ -1,6 +1,4 @@
|
|
|
1
1
|
declare module "embedded:network/mqtt/client" {
|
|
2
|
-
import type { Buffer } from "embedded:io/_common"
|
|
3
|
-
|
|
4
2
|
interface onReadableOptions {
|
|
5
3
|
more: boolean,
|
|
6
4
|
topic?: string,
|
|
@@ -11,12 +9,12 @@ declare module "embedded:network/mqtt/client" {
|
|
|
11
9
|
interface onControlMessage {
|
|
12
10
|
operation: number, // MQTTClient.CONNACK, etc...
|
|
13
11
|
id: number,
|
|
14
|
-
payload?:
|
|
12
|
+
payload?: ByteBuffer, // for SUBACK
|
|
15
13
|
}
|
|
16
14
|
|
|
17
15
|
interface Will {
|
|
18
16
|
topic?: string,
|
|
19
|
-
message?: string|
|
|
17
|
+
message?: string | ByteBuffer,
|
|
20
18
|
QoS?: number,
|
|
21
19
|
retain?: boolean,
|
|
22
20
|
}
|
|
@@ -53,7 +51,8 @@ declare module "embedded:network/mqtt/client" {
|
|
|
53
51
|
export default class MQTTClient {
|
|
54
52
|
constructor(options: Options)
|
|
55
53
|
read(count: number): ArrayBuffer
|
|
56
|
-
|
|
54
|
+
read(buffer: ByteBuffer): number
|
|
55
|
+
write(data: ByteBuffer, options: WriteOptions): number
|
|
57
56
|
close(): void
|
|
58
57
|
|
|
59
58
|
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/flash.d.ts
CHANGED
|
@@ -24,7 +24,7 @@ declare module "flash" {
|
|
|
24
24
|
constructor(offset: number, byteLength: number);
|
|
25
25
|
erase(sector: number): void;
|
|
26
26
|
read(offset: number, byteLength: number, useHostBuffer?: boolean): ArrayBuffer | HostBuffer;
|
|
27
|
-
write(offset: number, byteLength: number, buffer:
|
|
27
|
+
write(offset: number, byteLength: number, buffer: ByteBuffer): void;
|
|
28
28
|
readonly byteLength: number;
|
|
29
29
|
readonly blockSize: number;
|
|
30
30
|
map(): HostBuffer;
|
package/hex.d.ts
CHANGED
|
@@ -21,7 +21,7 @@
|
|
|
21
21
|
declare module "hex" {
|
|
22
22
|
var Hex: {
|
|
23
23
|
toBuffer: (str: string, separator?: string) => ArrayBuffer;
|
|
24
|
-
toString: (buffer:
|
|
24
|
+
toString: (buffer: ByteBuffer, separator?: string) => string;
|
|
25
25
|
}
|
|
26
26
|
export {Hex as default};
|
|
27
27
|
}
|
package/inflate.d.ts
CHANGED
|
@@ -24,7 +24,7 @@ declare module "inflate" {
|
|
|
24
24
|
constructor(options?: {windowBits?: number});
|
|
25
25
|
close(): void;
|
|
26
26
|
|
|
27
|
-
push(buffer:
|
|
27
|
+
push(buffer: ByteBuffer, end?: boolean): number;
|
|
28
28
|
|
|
29
29
|
onData: (data: ArrayBuffer) => void;
|
|
30
30
|
onEnd: (status: number) => void;
|
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
|
+
}
|