@moddable/typings 7.0.0 → 7.2.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/ChatAudioIO.d.ts +2 -1
- package/base64.d.ts +1 -1
- package/commodetto/Bitmap.d.ts +5 -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.d.ts +1 -1
- package/display.d.ts +1 -1
- package/dns/parser.d.ts +1 -1
- package/embedded/display.d.ts +2 -2
- package/embedded/storage/files.d.ts +2 -2
- package/embedded/storage/flash.d.ts +2 -2
- package/embedded/storage/key-value.d.ts +4 -3
- 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/central.d.ts +3 -4
- package/embedded_io/ble/peripheral.d.ts +6 -7
- 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 +7 -8
- package/embedded_network/mqtt/client.d.ts +4 -6
- package/embedded_network/websocket/client.d.ts +74 -0
- package/flash.d.ts +1 -1
- package/global.d.ts +10 -7
- package/hex.d.ts +1 -1
- package/inflate.d.ts +1 -1
- package/package.json +1 -1
- package/pebble/accelerometer.d.ts +46 -0
- package/pebble/battery.d.ts +38 -0
- package/pebble/button.d.ts +40 -0
- package/pebble/compass.d.ts +40 -0
- package/pebble/device.d.ts +51 -0
- package/pebble/global.d.ts +128 -0
- package/pebble/location.d.ts +50 -0
- package/pebble/message.d.ts +46 -0
- package/pebble/piu.d.ts +97 -0
- package/pebble/poco.d.ts +79 -0
- package/pins/audioout.d.ts +1 -1
- package/piu/MC-types.d.ts +543 -0
- package/piu/MC.d.ts +78 -526
- package/qrcode.d.ts +6 -4
- package/securesocket.d.ts +1 -1
- package/socket.d.ts +1 -1
- package/web/fetch.d.ts +28 -0
- package/{url.d.ts → web/url.d.ts} +1 -1
- package/web/websocket.d.ts +62 -0
- package/web/webstorage.d.ts +11 -0
- package/xs.d.ts +3 -3
- package/zip.d.ts +1 -1
- /package/{headers.d.ts → web/headers.d.ts} +0 -0
- /package/{structuredClone.d.ts → web/structuredClone.d.ts} +0 -0
- /package/{worker.d.ts → web/worker.d.ts} +0 -0
package/ChatAudioIO.d.ts
CHANGED
|
@@ -20,9 +20,10 @@
|
|
|
20
20
|
|
|
21
21
|
declare module "ChatAudioIO" {
|
|
22
22
|
type ChatAudioIOOptions = {
|
|
23
|
-
specifier: "googleGeminiLive" | "openAIRealtime" | "humeAIEVI" | "elevenLabsAgent";
|
|
23
|
+
specifier: "googleGeminiLive" | "openAIRealtime" | "humeAIEVI" | "elevenLabsAgent" | "deepgramAgent";
|
|
24
24
|
voiceName?: string;
|
|
25
25
|
instructions?: string;
|
|
26
|
+
apiKey?: string;
|
|
26
27
|
|
|
27
28
|
onStateChanged?: (this: ChatAudioIO, state: number) => void;
|
|
28
29
|
onInputTranscript?: (this: ChatAudioIO, text: string, more: boolean) => void;
|
package/base64.d.ts
CHANGED
package/commodetto/Bitmap.d.ts
CHANGED
|
@@ -22,7 +22,7 @@ declare module "commodetto/Bitmap" {
|
|
|
22
22
|
type PixelFormat = number
|
|
23
23
|
|
|
24
24
|
class Bitmap {
|
|
25
|
-
constructor(width: number, height: number, format: PixelFormat, buffer:
|
|
25
|
+
constructor(width: number, height: number, format: PixelFormat, buffer: ByteBuffer, offset: number, byteLength?: number)
|
|
26
26
|
|
|
27
27
|
readonly pixelFormat: PixelFormat
|
|
28
28
|
readonly offset: number
|
|
@@ -45,6 +45,10 @@ declare module "commodetto/Bitmap" {
|
|
|
45
45
|
static readonly RGB444 = 13
|
|
46
46
|
static readonly JPEG = 14
|
|
47
47
|
static readonly PNG = 15
|
|
48
|
+
static readonly MonochromeAligned = 21
|
|
49
|
+
static readonly MonochromePebble = 22
|
|
50
|
+
static readonly MonochromeARGB2222 = 23
|
|
51
|
+
static readonly MonochromeGray4 = 24
|
|
48
52
|
|
|
49
53
|
static readonly RLE = 0x80
|
|
50
54
|
}
|
|
@@ -26,7 +26,7 @@ declare module "commodetto/BufferOut" {
|
|
|
26
26
|
width: number;
|
|
27
27
|
height: number;
|
|
28
28
|
pixelFormat: number;
|
|
29
|
-
buffer?:
|
|
29
|
+
buffer?: ByteBuffer;
|
|
30
30
|
}
|
|
31
31
|
|
|
32
32
|
class BufferOut {
|
|
@@ -35,7 +35,7 @@ declare module "commodetto/BufferOut" {
|
|
|
35
35
|
end(): void;
|
|
36
36
|
continue(x: number, y: number, width: number, height: number): void;
|
|
37
37
|
send(
|
|
38
|
-
pixels:
|
|
38
|
+
pixels: ByteBuffer,
|
|
39
39
|
offset: number,
|
|
40
40
|
count: number
|
|
41
41
|
): void;
|
package/commodetto/Convert.d.ts
CHANGED
|
@@ -20,9 +20,9 @@
|
|
|
20
20
|
|
|
21
21
|
declare module "commodetto/Convert" {
|
|
22
22
|
class Convert {
|
|
23
|
-
constructor(srcFormat: number, dstFormat: number, clut?:
|
|
24
|
-
process(src:
|
|
25
|
-
process(src:
|
|
23
|
+
constructor(srcFormat: number, dstFormat: number, clut?: ByteBuffer);
|
|
24
|
+
process(src: ByteBuffer, dst: ByteBuffer): void;
|
|
25
|
+
process(src: ByteBuffer, srcOffset: number, srcCount: number, dst: ByteBuffer, dstOffset: number, dstCount: number): void;
|
|
26
26
|
}
|
|
27
27
|
|
|
28
28
|
export {Convert as default};
|
package/commodetto/ReadGIF.d.ts
CHANGED
package/commodetto/ReadPNG.d.ts
CHANGED
|
@@ -32,9 +32,9 @@ declare module "commodetto/ReadPNG" {
|
|
|
32
32
|
}
|
|
33
33
|
|
|
34
34
|
interface ReadPNGConstructor {
|
|
35
|
-
new(buffer:
|
|
35
|
+
new(buffer: ByteBuffer, options?: { pixelFormat: number }): ReadPNG
|
|
36
36
|
|
|
37
|
-
decompress(data:
|
|
37
|
+
decompress(data: ByteBuffer, pixelFormat: number, alphaPixelFormat?: number): Bitmap;
|
|
38
38
|
}
|
|
39
39
|
|
|
40
40
|
const ReadPNG: ReadPNGConstructor
|
package/commodetto/loadJPEG.d.ts
CHANGED
|
@@ -21,5 +21,5 @@
|
|
|
21
21
|
declare module "commodetto/loadJPEG" {
|
|
22
22
|
import Bitmap from "commodetto/Bitmap"
|
|
23
23
|
|
|
24
|
-
export default function (data:
|
|
24
|
+
export default function (data: ByteBuffer, options?: {pixelFormat?: number}): Bitmap;
|
|
25
25
|
}
|
package/commodetto/parseBMF.d.ts
CHANGED
package/commodetto/readJPEG.d.ts
CHANGED
|
@@ -27,10 +27,10 @@ declare module "commodetto/readJPEG" {
|
|
|
27
27
|
}
|
|
28
28
|
|
|
29
29
|
class JPEG {
|
|
30
|
-
constructor(buffer?: (
|
|
30
|
+
constructor(buffer?: (ByteBuffer), options?: { pixelFormat: number })
|
|
31
31
|
|
|
32
32
|
read(): Block
|
|
33
|
-
push(buffer:
|
|
33
|
+
push(buffer: ByteBuffer): void
|
|
34
34
|
|
|
35
35
|
readonly ready: boolean
|
|
36
36
|
}
|
package/crc.d.ts
CHANGED
|
@@ -22,13 +22,13 @@ declare module "crc" {
|
|
|
22
22
|
class CRC8 {
|
|
23
23
|
constructor(polynomial: number, initial_value?: number, reflectInput?: boolean, reflectOutput?: boolean, xorOutput?: number)
|
|
24
24
|
close(): void
|
|
25
|
-
checksum(bytes:
|
|
25
|
+
checksum(bytes: ByteBuffer): number
|
|
26
26
|
reset(): this
|
|
27
27
|
}
|
|
28
28
|
class CRC16 {
|
|
29
29
|
constructor(polynomial: number, initial_value?: number, reflectInput?: boolean, reflectOutput?: boolean, xorOutput?: number)
|
|
30
30
|
close(): void
|
|
31
|
-
checksum(bytes:
|
|
31
|
+
checksum(bytes: ByteBuffer): number
|
|
32
32
|
reset(): this
|
|
33
33
|
}
|
|
34
34
|
export {CRC8 as default, CRC8, CRC16};
|
package/deflate.d.ts
CHANGED
|
@@ -24,7 +24,7 @@ declare module "deflate" {
|
|
|
24
24
|
constructor(options?: {windowBits?: number, level?: number, strategy?: number});
|
|
25
25
|
close(): void;
|
|
26
26
|
|
|
27
|
-
push(buffer:
|
|
27
|
+
push(buffer: ByteBuffer | string, end?: boolean): boolean;
|
|
28
28
|
|
|
29
29
|
onData: (data: ArrayBuffer) => void;
|
|
30
30
|
onEnd: (status: number) => void;
|
package/display.d.ts
CHANGED
|
@@ -59,7 +59,7 @@ declare module "embedded:display" {
|
|
|
59
59
|
configure(options: DisplayConfigureOptions): void;
|
|
60
60
|
get configuration(): DisplayConfiguration;
|
|
61
61
|
begin(options?: DisplayBeginOptions): void;
|
|
62
|
-
send(buffer:
|
|
62
|
+
send(buffer: ByteBuffer): void;
|
|
63
63
|
end(): void;
|
|
64
64
|
adapInvalid(options: DisplayRectangle): void;
|
|
65
65
|
get width(): number;
|
package/dns/parser.d.ts
CHANGED
|
@@ -76,7 +76,7 @@ declare module "dns/parser" {
|
|
|
76
76
|
type DNSAnswer = DNSAnswerA | DNSAnswerPTR | DNSAnswerTXT | DNSAnswerSRV | DNSAnswerOther;
|
|
77
77
|
|
|
78
78
|
class Parser {
|
|
79
|
-
constructor(buffer:
|
|
79
|
+
constructor(buffer: ByteBuffer);
|
|
80
80
|
get id(): number;
|
|
81
81
|
get flags(): number;
|
|
82
82
|
get questions(): number;
|
package/embedded/display.d.ts
CHANGED
|
@@ -54,8 +54,8 @@ declare module "embedded:display" {
|
|
|
54
54
|
|
|
55
55
|
begin(options: DisplayBeginOptions): void;
|
|
56
56
|
begin(): void;
|
|
57
|
-
send(buffer:
|
|
58
|
-
send(buffer:
|
|
57
|
+
send(buffer: ByteBuffer): void;
|
|
58
|
+
send(buffer: ByteBuffer, offset: number, length: number): void;
|
|
59
59
|
end(): void;
|
|
60
60
|
|
|
61
61
|
adapInvalid(rectangle: Rectangle): void;
|
|
@@ -32,8 +32,8 @@ declare module "embedded:storage/files" {
|
|
|
32
32
|
close(): void;
|
|
33
33
|
|
|
34
34
|
read(count: number, position: number): ArrayBuffer;
|
|
35
|
-
read(buffer:
|
|
36
|
-
write(buffer:
|
|
35
|
+
read(buffer: ByteBuffer, position: number): number;
|
|
36
|
+
write(buffer: ByteBuffer, position: number): void;
|
|
37
37
|
|
|
38
38
|
status(): Status;
|
|
39
39
|
setSize(length: number): void;
|
|
@@ -39,8 +39,8 @@ declare module "embedded:storage/flash" {
|
|
|
39
39
|
eraseBlock(start: number, end?: number): void;
|
|
40
40
|
|
|
41
41
|
read(byteLength: number, byteOffset: number): ArrayBuffer;
|
|
42
|
-
read(buffer:
|
|
43
|
-
write(buffer:
|
|
42
|
+
read(buffer: ByteBuffer, byteOffset: number): number;
|
|
43
|
+
write(buffer: ByteBuffer, byteOffset: number): void;
|
|
44
44
|
|
|
45
45
|
status(): FlashStatus;
|
|
46
46
|
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/*
|
|
2
|
-
* Copyright (c) 2024-
|
|
2
|
+
* Copyright (c) 2024-2026 Moddable Tech, Inc.
|
|
3
3
|
*
|
|
4
4
|
* This file is part of the Moddable SDK Runtime.
|
|
5
5
|
*
|
|
@@ -20,6 +20,7 @@
|
|
|
20
20
|
|
|
21
21
|
declare module "embedded:storage/key-value" {
|
|
22
22
|
export interface StorageOpenOptions {
|
|
23
|
+
format?: StorageFormat;
|
|
23
24
|
path: string;
|
|
24
25
|
mode?: "r" | "r+";
|
|
25
26
|
}
|
|
@@ -33,8 +34,8 @@ declare module "embedded:storage/key-value" {
|
|
|
33
34
|
delete(key: string): void;
|
|
34
35
|
|
|
35
36
|
read(key: string): ArrayBuffer | string | number | bigint;
|
|
36
|
-
read(key: string, buffer:
|
|
37
|
-
write(key: string, value:
|
|
37
|
+
read(key: string, buffer: ByteBuffer): number;
|
|
38
|
+
write(key: string, value: ByteBuffer | string | number | bigint): void;
|
|
38
39
|
|
|
39
40
|
[Symbol.iterator](): IterableIterator<string>;
|
|
40
41
|
|
package/embedded_io/_common.d.ts
CHANGED
|
@@ -23,5 +23,4 @@ declare module "embedded:io/_common" {
|
|
|
23
23
|
// This should be extended for future specification
|
|
24
24
|
export type PinSpecifier = number
|
|
25
25
|
export type PortSpecifier = number
|
|
26
|
-
export type Buffer = ArrayBuffer | HostBuffer | Uint8Array | Uint8ClampedArray | Int8Array | SharedArrayBuffer | DataView
|
|
27
26
|
}
|
|
@@ -18,8 +18,6 @@
|
|
|
18
18
|
*
|
|
19
19
|
*/
|
|
20
20
|
declare module "embedded:io/audio/in" {
|
|
21
|
-
import { Buffer } from "embedded:io/_common";
|
|
22
|
-
|
|
23
21
|
type AudioType = "LPCM";
|
|
24
22
|
|
|
25
23
|
interface AudioInOptions {
|
|
@@ -36,7 +34,7 @@ declare module "embedded:io/audio/in" {
|
|
|
36
34
|
onReadable?: (this: AudioIn, byteLength: number, sampleCount?: number) => void;
|
|
37
35
|
});
|
|
38
36
|
read(byteLength?: number): ArrayBuffer
|
|
39
|
-
read(buffer:
|
|
37
|
+
read(buffer: ByteBuffer): number
|
|
40
38
|
start(): void;
|
|
41
39
|
stop(options?: { flush?: boolean }): void
|
|
42
40
|
close(): void;
|
|
@@ -18,8 +18,6 @@
|
|
|
18
18
|
*
|
|
19
19
|
*/
|
|
20
20
|
declare module "embedded:io/audio/out" {
|
|
21
|
-
import { Buffer } from "embedded:io/_common";
|
|
22
|
-
|
|
23
21
|
type AudioType = "LPCM";
|
|
24
22
|
|
|
25
23
|
interface AudioOutOptions {
|
|
@@ -35,7 +33,7 @@ declare module "embedded:io/audio/out" {
|
|
|
35
33
|
constructor(options?: AudioOutOptions & {
|
|
36
34
|
onWritable?: (this: AudioOut, byteLength: number, sampleCount?: number) => void;
|
|
37
35
|
});
|
|
38
|
-
write(buffer:
|
|
36
|
+
write(buffer: ByteBuffer): void;
|
|
39
37
|
start(): void;
|
|
40
38
|
stop(options?: { flush?: boolean }): void;
|
|
41
39
|
|
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
declare module "embedded:io/bluetoothle/central" {
|
|
2
|
-
import type { Buffer } from "embedded:io/_common";
|
|
3
2
|
import type { GATTSecurityOptions, GATTSecurityState } from "embedded:io/bluetoothle/_common";
|
|
4
3
|
|
|
5
4
|
interface Advertisement {
|
|
@@ -77,8 +76,8 @@ declare module "embedded:io/bluetoothle/central" {
|
|
|
77
76
|
read(what: GATTClientCharacteristic | GATTClientDescriptor, options: object, callback: (error: Error | null, value: ArrayBuffer) => void): void;
|
|
78
77
|
read(): undefined | GATTClientNotifiedValue;
|
|
79
78
|
|
|
80
|
-
write(what: GATTClientCharacteristic | GATTClientDescriptor, value:
|
|
81
|
-
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;
|
|
82
81
|
|
|
83
82
|
subscribe(characteristic: GATTClientCharacteristic, callback?: (error?: Error) => void): void;
|
|
84
83
|
unsubscribe(characteristic: GATTClientCharacteristic, callback?: (error?: Error) => void): void;
|
|
@@ -88,7 +87,7 @@ declare module "embedded:io/bluetoothle/central" {
|
|
|
88
87
|
get maximumWrite(): number;
|
|
89
88
|
|
|
90
89
|
store(item: GATTClientService | GATTClientCharacteristic | GATTClientDescriptor): ArrayBuffer;
|
|
91
|
-
restore(item:
|
|
90
|
+
restore(item: ByteBuffer): GATTClientService | GATTClientCharacteristic | GATTClientDescriptor;
|
|
92
91
|
|
|
93
92
|
static readonly properties: {
|
|
94
93
|
authenticatedSignedWrites: 64;
|
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
declare module "embedded:io/bluetoothle/peripheral" {
|
|
2
|
-
import type { Buffer } from "embedded:io/_common";
|
|
3
2
|
import type { GATTSecurityOptions, GATTSecurityState } from "embedded:io/bluetoothle/_common";
|
|
4
3
|
|
|
5
4
|
interface GATTServerOptions {
|
|
@@ -29,10 +28,10 @@ declare module "embedded:io/bluetoothle/peripheral" {
|
|
|
29
28
|
interface GATTServerCharacteristic {
|
|
30
29
|
uuid: string;
|
|
31
30
|
properties?: number;
|
|
32
|
-
value?:
|
|
31
|
+
value?: ByteBuffer;
|
|
33
32
|
descriptors?: GATTServerDescriptor[];
|
|
34
33
|
|
|
35
|
-
onRead?(this: GATTServerCharacteristic, connection: GATTServerConnection):
|
|
34
|
+
onRead?(this: GATTServerCharacteristic, connection: GATTServerConnection): ByteBuffer;
|
|
36
35
|
onWrite?(this: GATTServerCharacteristic, value: ArrayBuffer, connection: GATTServerConnection): void;
|
|
37
36
|
onSubscribe?(this: GATTServerCharacteristic, connection: GATTServerConnection): void;
|
|
38
37
|
onUnsubscribe?(cthis: GATTServerCharacteristic, onnection: GATTServerConnection): void;
|
|
@@ -40,18 +39,18 @@ declare module "embedded:io/bluetoothle/peripheral" {
|
|
|
40
39
|
|
|
41
40
|
interface GATTServerDescriptor {
|
|
42
41
|
uuid: string;
|
|
43
|
-
value?:
|
|
42
|
+
value?: ByteBuffer;
|
|
44
43
|
|
|
45
|
-
onRead?(connection: GATTServerConnection):
|
|
44
|
+
onRead?(connection: GATTServerConnection): ByteBuffer;
|
|
46
45
|
onWrite?(value: ArrayBuffer, connection: GATTServerConnection): void;
|
|
47
46
|
}
|
|
48
47
|
|
|
49
48
|
interface GATTServerAdvertisingRecords {
|
|
50
49
|
name?: string;
|
|
51
50
|
services?: string[];
|
|
52
|
-
manufacturerData?: { manufacturer: number, data:
|
|
51
|
+
manufacturerData?: { manufacturer: number, data: ByteBuffer };
|
|
53
52
|
flags?: number;
|
|
54
|
-
[ADType: number]:
|
|
53
|
+
[ADType: number]: ByteBuffer;
|
|
55
54
|
}
|
|
56
55
|
|
|
57
56
|
class GATTServer {
|
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,13 +19,11 @@
|
|
|
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
|
-
socket
|
|
26
|
-
port?:number
|
|
23
|
+
socket?: any
|
|
24
|
+
port?: number
|
|
27
25
|
host: string
|
|
28
|
-
dns
|
|
26
|
+
dns?: any
|
|
29
27
|
onError?: (err:any)=>void
|
|
30
28
|
}
|
|
31
29
|
|
|
@@ -33,7 +31,8 @@ declare module "embedded:network/http/client" {
|
|
|
33
31
|
method?: string
|
|
34
32
|
path?: string
|
|
35
33
|
headers?: Map<string, string|string[]>
|
|
36
|
-
|
|
34
|
+
headersMask?: Array<string>
|
|
35
|
+
onHeaders?: (this: HTTPRequest, status:number, headers: Map<string, string>, statusText: string) => void
|
|
37
36
|
onReadable?: (this: HTTPRequest, count: number) => void
|
|
38
37
|
onWritable?: (this: HTTPRequest, count: number) => void
|
|
39
38
|
onDone?: (this: HTTPRequest, error: Error|null) => void // note: error is empty Error object
|
|
@@ -41,8 +40,8 @@ declare module "embedded:network/http/client" {
|
|
|
41
40
|
|
|
42
41
|
export interface HTTPRequest {
|
|
43
42
|
read(byteLength?: number): ArrayBuffer|undefined;
|
|
44
|
-
read(buffer:
|
|
45
|
-
write(value:
|
|
43
|
+
read(buffer: ByteBuffer): void;
|
|
44
|
+
write(value: ByteBuffer|undefined): void;
|
|
46
45
|
}
|
|
47
46
|
|
|
48
47
|
export default class HTTPClient {
|
|
@@ -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,8 +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
|
-
read(buffer:
|
|
57
|
-
write(data:
|
|
54
|
+
read(buffer: ByteBuffer): number
|
|
55
|
+
write(data: ByteBuffer, options: WriteOptions): number
|
|
58
56
|
close(): void
|
|
59
57
|
|
|
60
58
|
static CONNECT: 1
|
|
@@ -0,0 +1,74 @@
|
|
|
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
|
+
// websocketclient.d.ts
|
|
22
|
+
|
|
23
|
+
declare module "embedded:network/websocket/client" {
|
|
24
|
+
interface WebSocketClientOptions {
|
|
25
|
+
onReadable?: (this: WebSocketClient, count: number, options: { more: boolean; binary: boolean }) => void;
|
|
26
|
+
onWritable?: (this: WebSocketClient, count: number) => void;
|
|
27
|
+
onControl?: (this: WebSocketClient, opcode: number, data: ArrayBuffer) => void;
|
|
28
|
+
onClose?: (this: WebSocketClient) => void;
|
|
29
|
+
onError?: (this: WebSocketClient) => void;
|
|
30
|
+
format?: "buffer" | "number";
|
|
31
|
+
target?: any;
|
|
32
|
+
attach?: {
|
|
33
|
+
constructor: new (options: any) => any;
|
|
34
|
+
};
|
|
35
|
+
host?: string;
|
|
36
|
+
path?: string;
|
|
37
|
+
port?: number;
|
|
38
|
+
protocol?: string;
|
|
39
|
+
headers?: Map<string, string>;
|
|
40
|
+
dns?: {
|
|
41
|
+
io: new (options: any) => any;
|
|
42
|
+
};
|
|
43
|
+
socket?: {
|
|
44
|
+
io: new (options: any) => any;
|
|
45
|
+
};
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
interface WebSocketWriteOptions {
|
|
49
|
+
opcode?: number;
|
|
50
|
+
binary?: boolean;
|
|
51
|
+
more?: boolean;
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
class WebSocketClient {
|
|
55
|
+
constructor(options: WebSocketClientOptions);
|
|
56
|
+
|
|
57
|
+
close(): void;
|
|
58
|
+
write(data: ByteBuffer, options?: WebSocketWriteOptions): number;
|
|
59
|
+
read(): number | ArrayBuffer;
|
|
60
|
+
read(count: number): ArrayBuffer;
|
|
61
|
+
read(buffer: ByteBuffer): number;
|
|
62
|
+
|
|
63
|
+
format: "buffer" | "number";
|
|
64
|
+
target?: any;
|
|
65
|
+
|
|
66
|
+
static readonly text: 1;
|
|
67
|
+
static readonly binary: 2;
|
|
68
|
+
static readonly close: 8;
|
|
69
|
+
static readonly ping: 9;
|
|
70
|
+
static readonly pong: 10;
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
export default WebSocketClient;
|
|
74
|
+
}
|
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;
|