@moddable/typings 9.0.0 → 9.5.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/captiveportal.d.ts +71 -0
- package/data/location/nmea.d.ts +103 -0
- package/data/location/ubx.d.ts +78 -0
- package/embedded/sensor/Location/GPS.d.ts +96 -0
- package/embedded/sensor/Location/IP.d.ts +67 -0
- package/embedded_io/smbus.d.ts +1 -1
- package/embedded_io/system.d.ts +1 -7
- package/embedded_network/http/client.d.ts +2 -1
- package/embedded_network/http/server.d.ts +1 -0
- package/embedded_network/interface/wifi/accesspoint.d.ts +65 -0
- package/embedded_network/websocket/client.d.ts +2 -1
- package/package.json +1 -1
- package/pebble/location.d.ts +2 -2
- package/xs.d.ts +104 -0
- package/embedded/sensor/Location/fixed.d.ts +0 -39
- package/embedded/sensor/Location/ip.d.ts +0 -44
- package/embedded/sensor/Location/location.d.ts +0 -56
- package/embedded/sensor/RFID/mfrc522-spi.d.ts +0 -64
- package/embedded/sensor/RFID/mfrc522.d.ts +0 -50
|
@@ -0,0 +1,71 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Copyright (c) 2026 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 "captiveportal" {
|
|
22
|
+
export type CaptivePortalPhase = "initializing" | "ready" | "connected" | "waiting" |
|
|
23
|
+
"connecting" | "provisioned" | "failed";
|
|
24
|
+
|
|
25
|
+
export interface CaptivePortalAccess {
|
|
26
|
+
SSID: string;
|
|
27
|
+
password?: string;
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
export interface CaptivePortalCredentials {
|
|
31
|
+
SSID: string;
|
|
32
|
+
password?: string;
|
|
33
|
+
channel?: number;
|
|
34
|
+
secure?: boolean;
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
export interface CaptivePortalNetwork {
|
|
38
|
+
SSID: string;
|
|
39
|
+
RSSI: number;
|
|
40
|
+
channel: number;
|
|
41
|
+
security?: string;
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
export interface CaptivePortalPage {
|
|
45
|
+
content: string | ArrayBuffer | HostBuffer;
|
|
46
|
+
mimeType: string;
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
export interface CaptivePortalOptions {
|
|
50
|
+
onPage: (this: void, path: string) => CaptivePortalPage | undefined;
|
|
51
|
+
|
|
52
|
+
onStatus?: (this: void, phase: CaptivePortalPhase, detail?: CaptivePortalAccess | CaptivePortalCredentials) => void;
|
|
53
|
+
onInfo?: (this: void, msg: any) => void;
|
|
54
|
+
onClose?: (this: void) => void;
|
|
55
|
+
onError?: (this: void, error: Error) => void;
|
|
56
|
+
|
|
57
|
+
SSID?: string;
|
|
58
|
+
password?: string;
|
|
59
|
+
channel?: number;
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
class CaptivePortal {
|
|
63
|
+
constructor(options: CaptivePortalOptions);
|
|
64
|
+
|
|
65
|
+
close(): void;
|
|
66
|
+
|
|
67
|
+
readonly SSID: string | undefined;
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
export default CaptivePortal;
|
|
71
|
+
}
|
|
@@ -0,0 +1,103 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Copyright (c) 2026 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 "data/location/nmea" {
|
|
22
|
+
interface NMEATalker {
|
|
23
|
+
readonly GP: "GPS";
|
|
24
|
+
readonly GN: "GNSS";
|
|
25
|
+
readonly GL: "GLONASS";
|
|
26
|
+
readonly GA: "Galileo";
|
|
27
|
+
readonly GB: "BeiDou";
|
|
28
|
+
readonly BD: "BeiDou";
|
|
29
|
+
readonly QZ: "QZSS";
|
|
30
|
+
readonly P: "Proprietary";
|
|
31
|
+
readonly [id: string]: string | undefined;
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
interface NMEASatellite {
|
|
35
|
+
prn: number;
|
|
36
|
+
elevation: number | null;
|
|
37
|
+
azimuth: number | null;
|
|
38
|
+
snr: number | null;
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
interface NMEASentence {
|
|
42
|
+
type: string;
|
|
43
|
+
talker: string;
|
|
44
|
+
system: string;
|
|
45
|
+
raw: string;
|
|
46
|
+
time?: string | null;
|
|
47
|
+
date?: string | null;
|
|
48
|
+
latitude?: number | null;
|
|
49
|
+
longitude?: number | null;
|
|
50
|
+
altitude?: number | null;
|
|
51
|
+
geoidSeparation?: number | null;
|
|
52
|
+
quality?: number;
|
|
53
|
+
satellites?: number | NMEASatellite[];
|
|
54
|
+
hdop?: number | null;
|
|
55
|
+
pdop?: number | null;
|
|
56
|
+
vdop?: number | null;
|
|
57
|
+
speed?: number | null;
|
|
58
|
+
course?: number | null;
|
|
59
|
+
status?: string | null;
|
|
60
|
+
mode?: string | null;
|
|
61
|
+
fix?: boolean;
|
|
62
|
+
fixType?: number;
|
|
63
|
+
satellitesUsed?: number[];
|
|
64
|
+
totalMessages?: number;
|
|
65
|
+
messageNumber?: number;
|
|
66
|
+
satellitesInView?: number;
|
|
67
|
+
day?: number | null;
|
|
68
|
+
month?: number | null;
|
|
69
|
+
year?: number | null;
|
|
70
|
+
fields?: string[];
|
|
71
|
+
[key: string]: unknown;
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
interface NMEALocationUpdate {
|
|
75
|
+
latitude?: number;
|
|
76
|
+
longitude?: number;
|
|
77
|
+
altitude?: number;
|
|
78
|
+
accuracy?: number;
|
|
79
|
+
heading?: number;
|
|
80
|
+
speed?: number;
|
|
81
|
+
fix?: boolean;
|
|
82
|
+
}
|
|
83
|
+
|
|
84
|
+
class NMEA {
|
|
85
|
+
constructor(onParsed?: (parsed: NMEASentence) => void);
|
|
86
|
+
push(data: number | ArrayBuffer | ArrayBufferView): NMEASentence | undefined;
|
|
87
|
+
|
|
88
|
+
static readonly Talker: NMEATalker;
|
|
89
|
+
static readonly identification: {
|
|
90
|
+
readonly model: string;
|
|
91
|
+
readonly classification: string;
|
|
92
|
+
readonly description: string;
|
|
93
|
+
};
|
|
94
|
+
static parse(sentence: string | ArrayBuffer | ArrayBufferView): NMEASentence | null;
|
|
95
|
+
static validateChecksum(sentence: string | ArrayBuffer | ArrayBufferView): Uint8Array | null;
|
|
96
|
+
static toDecimalDegrees(value: string, hemi: string): number | null;
|
|
97
|
+
static checksum(payload: string): string;
|
|
98
|
+
static format(payload: string): string;
|
|
99
|
+
static location(parsed: NMEASentence | null | undefined): NMEALocationUpdate | undefined;
|
|
100
|
+
}
|
|
101
|
+
|
|
102
|
+
export { NMEA as default, NMEA };
|
|
103
|
+
}
|
|
@@ -0,0 +1,78 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Copyright (c) 2026 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 "data/location/ubx" {
|
|
22
|
+
interface UBXMessage {
|
|
23
|
+
type: string;
|
|
24
|
+
class?: number;
|
|
25
|
+
id?: number;
|
|
26
|
+
payloadLength?: number;
|
|
27
|
+
latitude?: number;
|
|
28
|
+
longitude?: number;
|
|
29
|
+
altitude?: number;
|
|
30
|
+
accuracy?: number;
|
|
31
|
+
altitudeAccuracy?: number;
|
|
32
|
+
speed?: number;
|
|
33
|
+
course?: number;
|
|
34
|
+
pdop?: number;
|
|
35
|
+
satellites?: number;
|
|
36
|
+
fixType?: number;
|
|
37
|
+
fix?: boolean;
|
|
38
|
+
status?: string;
|
|
39
|
+
quality?: number;
|
|
40
|
+
[key: string]: unknown;
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
interface UBXLocationUpdate {
|
|
44
|
+
latitude?: number;
|
|
45
|
+
longitude?: number;
|
|
46
|
+
altitude?: number;
|
|
47
|
+
accuracy?: number;
|
|
48
|
+
altitudeAccuracy?: number;
|
|
49
|
+
heading?: number;
|
|
50
|
+
speed?: number;
|
|
51
|
+
fix: boolean;
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
class UBX {
|
|
55
|
+
constructor(onParsed?: (parsed: UBXMessage) => void);
|
|
56
|
+
push(data: number | ArrayBuffer | ArrayBufferView): UBXMessage | undefined;
|
|
57
|
+
|
|
58
|
+
static readonly SYNC1: 0xb5;
|
|
59
|
+
static readonly SYNC2: 0x62;
|
|
60
|
+
static readonly CLASS_NAV: 0x01;
|
|
61
|
+
static readonly ID_NAV_PVT: 0x07;
|
|
62
|
+
static readonly CLASS_CFG: 0x06;
|
|
63
|
+
static readonly ID_CFG_MSG: 0x01;
|
|
64
|
+
static readonly identification: {
|
|
65
|
+
readonly model: string;
|
|
66
|
+
readonly classification: string;
|
|
67
|
+
readonly description: string;
|
|
68
|
+
};
|
|
69
|
+
static checksum(bytes: Uint8Array, offset: number, length: number): [number, number];
|
|
70
|
+
static format(msgClass: number, msgId: number, payload?: ArrayBuffer | ArrayBufferView): ArrayBuffer;
|
|
71
|
+
static parse(frame: ArrayBuffer | ArrayBufferView): UBXMessage | null;
|
|
72
|
+
static parseNAVPVT(view: DataView): UBXMessage | null;
|
|
73
|
+
static location(parsed: UBXMessage | null | undefined): UBXLocationUpdate | undefined;
|
|
74
|
+
static setup(): ArrayBuffer[];
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
export { UBX as default, UBX };
|
|
78
|
+
}
|
|
@@ -0,0 +1,96 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Copyright (c) 2026 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:sensor/Location/GPS" {
|
|
22
|
+
interface GPSSensorIO {
|
|
23
|
+
write(value: ByteBuffer, stop?: boolean): void;
|
|
24
|
+
writeRead?(writeBuffer: ByteBuffer, readByteLength: number, stop?: boolean): ArrayBuffer;
|
|
25
|
+
read?(byteLength?: number): number | ArrayBuffer | undefined;
|
|
26
|
+
close(): void;
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
interface GPSSensorOptions {
|
|
30
|
+
io: new (options: object) => GPSSensorIO;
|
|
31
|
+
address?: number;
|
|
32
|
+
hz?: number;
|
|
33
|
+
data?: number | string;
|
|
34
|
+
clock?: number | string;
|
|
35
|
+
receive?: number | string;
|
|
36
|
+
transmit?: number | string;
|
|
37
|
+
baud?: number;
|
|
38
|
+
port?: number | string;
|
|
39
|
+
[key: string]: unknown;
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
interface GPSProtocol {
|
|
43
|
+
new (onParsed?: (parsed: object) => void): {
|
|
44
|
+
push(data: number | ArrayBuffer | ArrayBufferView): object | undefined;
|
|
45
|
+
};
|
|
46
|
+
location(parsed: object | null | undefined): object | undefined;
|
|
47
|
+
identification: {
|
|
48
|
+
model: string;
|
|
49
|
+
classification: string;
|
|
50
|
+
description: string;
|
|
51
|
+
};
|
|
52
|
+
setup?(): ArrayBuffer[];
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
interface GPSOptions {
|
|
56
|
+
sensor: GPSSensorOptions;
|
|
57
|
+
protocol: GPSProtocol;
|
|
58
|
+
onSample?: (this: GPS) => void;
|
|
59
|
+
onError?: (this: GPS, error: Error) => void;
|
|
60
|
+
target?: unknown;
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
/** enableHighAccuracy is accepted for Location API alignment; currently a no-op. */
|
|
64
|
+
interface GPSConfiguration {
|
|
65
|
+
enableHighAccuracy?: boolean;
|
|
66
|
+
timeout?: number;
|
|
67
|
+
maximumAge?: number;
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
interface GPSSample {
|
|
71
|
+
latitude: number;
|
|
72
|
+
longitude: number;
|
|
73
|
+
altitude?: number;
|
|
74
|
+
accuracy?: number;
|
|
75
|
+
altitudeAccuracy?: number;
|
|
76
|
+
heading?: number;
|
|
77
|
+
speed?: number;
|
|
78
|
+
timestamp?: number;
|
|
79
|
+
}
|
|
80
|
+
|
|
81
|
+
class GPS {
|
|
82
|
+
constructor(options: GPSOptions);
|
|
83
|
+
configure(options: GPSConfiguration): void;
|
|
84
|
+
sample(): GPSSample | undefined;
|
|
85
|
+
close(): void;
|
|
86
|
+
readonly identification: {
|
|
87
|
+
model: string;
|
|
88
|
+
classification: string;
|
|
89
|
+
description: string;
|
|
90
|
+
};
|
|
91
|
+
target?: unknown;
|
|
92
|
+
}
|
|
93
|
+
interface GPS extends Disposable {}
|
|
94
|
+
|
|
95
|
+
export { GPS as default, GPS };
|
|
96
|
+
}
|
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Copyright (c) 2026 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:sensor/Location/IP" {
|
|
22
|
+
interface IPHTTPOptions {
|
|
23
|
+
io: new (options: object) => {
|
|
24
|
+
request(options: object): {
|
|
25
|
+
read(byteLength?: number): ArrayBuffer | undefined;
|
|
26
|
+
};
|
|
27
|
+
close(): void;
|
|
28
|
+
};
|
|
29
|
+
host: string;
|
|
30
|
+
path?: string;
|
|
31
|
+
port?: number;
|
|
32
|
+
[key: string]: unknown;
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
interface IPOptions {
|
|
36
|
+
http?: IPHTTPOptions;
|
|
37
|
+
onSample?: (this: IP) => void;
|
|
38
|
+
onError?: (this: IP, error: Error) => void;
|
|
39
|
+
target?: unknown;
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
interface IPSample {
|
|
43
|
+
latitude: number;
|
|
44
|
+
longitude: number;
|
|
45
|
+
altitude?: number;
|
|
46
|
+
accuracy?: number;
|
|
47
|
+
timestamp?: number;
|
|
48
|
+
timezone?: number;
|
|
49
|
+
dst?: boolean;
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
class IP {
|
|
53
|
+
constructor(options: IPOptions);
|
|
54
|
+
configure(options?: object): void;
|
|
55
|
+
sample(): IPSample | undefined;
|
|
56
|
+
close(): void;
|
|
57
|
+
readonly identification: {
|
|
58
|
+
model: string;
|
|
59
|
+
classification: string;
|
|
60
|
+
description: string;
|
|
61
|
+
};
|
|
62
|
+
target?: unknown;
|
|
63
|
+
}
|
|
64
|
+
interface IP extends Disposable {}
|
|
65
|
+
|
|
66
|
+
export { IP as default, IP };
|
|
67
|
+
}
|
package/embedded_io/smbus.d.ts
CHANGED
|
@@ -22,7 +22,7 @@ declare module "embedded:io/smbus" {
|
|
|
22
22
|
import I2C from "embedded:io/i2c"
|
|
23
23
|
|
|
24
24
|
class SMBus extends I2C {
|
|
25
|
-
constructor(options: ConstructorParameters<typeof I2C> & {
|
|
25
|
+
constructor(options: ConstructorParameters<typeof I2C>[0] & {
|
|
26
26
|
stop?: boolean;
|
|
27
27
|
});
|
|
28
28
|
readUint8(register: number): number;
|
package/embedded_io/system.d.ts
CHANGED
|
@@ -19,18 +19,12 @@
|
|
|
19
19
|
*/
|
|
20
20
|
|
|
21
21
|
declare module "embedded:io/system" {
|
|
22
|
-
import Timer from "timer";
|
|
23
22
|
/**
|
|
24
|
-
* @
|
|
23
|
+
* @experimental
|
|
25
24
|
*/
|
|
26
25
|
class System {
|
|
27
26
|
static deepSleep(us: number, mode: number): void;
|
|
28
27
|
static restart(): void;
|
|
29
|
-
static resolve(name: string, callback: (name: string, ip: string) => void) : void;
|
|
30
|
-
static setTimeout: typeof Timer.set;
|
|
31
|
-
static clearTimeout: typeof Timer.clear;
|
|
32
|
-
static setInterval: typeof Timer.repeat;
|
|
33
|
-
static clearInterval: typeof Timer.clear;
|
|
34
28
|
}
|
|
35
29
|
export default System;
|
|
36
30
|
}
|
|
@@ -41,7 +41,8 @@ declare module "embedded:network/http/client" {
|
|
|
41
41
|
export interface HTTPRequest {
|
|
42
42
|
read(byteLength?: number): ArrayBuffer|undefined;
|
|
43
43
|
read(buffer: ByteBuffer): void;
|
|
44
|
-
write(
|
|
44
|
+
write(): number;
|
|
45
|
+
write(value: ByteBuffer|undefined): number;
|
|
45
46
|
}
|
|
46
47
|
|
|
47
48
|
class HTTPClient {
|
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Copyright (c) 2026 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/accesspoint" {
|
|
22
|
+
export type WiFiAccessPointChangedProperty = "connection";
|
|
23
|
+
|
|
24
|
+
export type WiFiAccessPointAuthentication = "none" | "wpa_psk" | "wpa2_psk" | "wpa_wpa2_psk" | "wpa3_psk" | "wpa2_wpa3_psk";
|
|
25
|
+
|
|
26
|
+
export interface WiFiAccessPointStation extends Disposable {
|
|
27
|
+
close(): void;
|
|
28
|
+
|
|
29
|
+
readonly MAC: string;
|
|
30
|
+
readonly address: string | undefined;
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
export interface WiFiAccessPointConstructorOptions {
|
|
34
|
+
SSID: string;
|
|
35
|
+
password?: string;
|
|
36
|
+
authentication?: WiFiAccessPointAuthentication;
|
|
37
|
+
channel?: number;
|
|
38
|
+
hidden?: boolean;
|
|
39
|
+
max?: number;
|
|
40
|
+
interval?: number;
|
|
41
|
+
onChanged?(this: WiFiAccessPoint, property: WiFiAccessPointChangedProperty): void;
|
|
42
|
+
onConnect?(this: WiFiAccessPoint, station: WiFiAccessPointStation): void;
|
|
43
|
+
onDisconnect?(this: WiFiAccessPoint, station: WiFiAccessPointStation): void;
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
export interface WiFiAccessPointConfigureOptions {
|
|
47
|
+
portal?: string;
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
class WiFiAccessPoint {
|
|
51
|
+
constructor(options: WiFiAccessPointConstructorOptions);
|
|
52
|
+
|
|
53
|
+
close(): void;
|
|
54
|
+
configure(options: WiFiAccessPointConfigureOptions): void;
|
|
55
|
+
|
|
56
|
+
readonly connection: number;
|
|
57
|
+
readonly address: string | undefined;
|
|
58
|
+
readonly MAC: string | undefined;
|
|
59
|
+
readonly SSID: string | undefined;
|
|
60
|
+
readonly channel: number | undefined;
|
|
61
|
+
}
|
|
62
|
+
interface WiFiAccessPoint extends Disposable {}
|
|
63
|
+
|
|
64
|
+
export default WiFiAccessPoint;
|
|
65
|
+
}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/*
|
|
2
|
-
* Copyright (c) 2025 Moddable Tech, Inc.
|
|
2
|
+
* Copyright (c) 2025-2026 Moddable Tech, Inc.
|
|
3
3
|
*
|
|
4
4
|
* This file is part of the Moddable SDK Tools.
|
|
5
5
|
*
|
|
@@ -61,6 +61,7 @@ declare module "embedded:network/websocket/client" {
|
|
|
61
61
|
read(buffer: ByteBuffer): number;
|
|
62
62
|
|
|
63
63
|
format: "buffer" | "number";
|
|
64
|
+
protocol: string | undefined;
|
|
64
65
|
target?: any;
|
|
65
66
|
|
|
66
67
|
static readonly text: 1;
|
package/package.json
CHANGED
package/pebble/location.d.ts
CHANGED
|
@@ -30,8 +30,8 @@ interface LocationSample {
|
|
|
30
30
|
}
|
|
31
31
|
|
|
32
32
|
interface LocationOptions {
|
|
33
|
-
onSample?: () => void;
|
|
34
|
-
onError?: (error: Error) => void;
|
|
33
|
+
onSample?: (this: Location) => void;
|
|
34
|
+
onError?: (this: Location, error: Error) => void;
|
|
35
35
|
}
|
|
36
36
|
|
|
37
37
|
interface LocationConfiguration {
|
package/xs.d.ts
ADDED
|
@@ -0,0 +1,104 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Copyright (c) 2020-2026 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
|
+
interface Trace {
|
|
22
|
+
(...log: (string | number | boolean)[]):void;
|
|
23
|
+
left(log: string | ArrayBufferLike, conversation?: string):void;
|
|
24
|
+
center(log: string | ArrayBufferLike, conversation?: string):void;
|
|
25
|
+
right(log: string | ArrayBufferLike, conversation?: string):void;
|
|
26
|
+
}
|
|
27
|
+
declare const trace:Trace;
|
|
28
|
+
|
|
29
|
+
declare class HostBuffer {
|
|
30
|
+
readonly byteLength: number
|
|
31
|
+
private brand: boolean;
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
interface ArrayBufferTypes {
|
|
35
|
+
HostBuffer: HostBuffer;
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
interface ByteBufferTypes extends ArrayBufferTypes {
|
|
39
|
+
Uint8Array: Uint8Array,
|
|
40
|
+
Uint8ClampedArray: Uint8ClampedArray,
|
|
41
|
+
Int8Array: Int8Array,
|
|
42
|
+
DataView: DataView
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
type ByteBuffer = ByteBufferTypes[keyof ByteBufferTypes];
|
|
46
|
+
|
|
47
|
+
interface ObjectConstructor {
|
|
48
|
+
freeze<T>(obj: T, freeze?: boolean | number): Readonly<T>;
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
interface JSON {
|
|
52
|
+
parse(text: string, reviver?: string[]): any;
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
interface StringConstructor {
|
|
56
|
+
fromArrayBuffer(buffer: ArrayBufferLike): string;
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
interface ArrayBufferConstructor {
|
|
60
|
+
fromString(string: string): ArrayBuffer;
|
|
61
|
+
fromBigInt(value: bigint): ArrayBuffer;
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
interface ArrayBuffer {
|
|
65
|
+
concat(...buffers: ArrayBufferLike[]): ArrayBuffer;
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
interface Uint8Array {
|
|
69
|
+
toHex(): string;
|
|
70
|
+
toBase64(): string
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
interface FromBase64Options {
|
|
74
|
+
alphabet?: "base64url" | "base64";
|
|
75
|
+
lastChunkHandling?: "stop-before-partial" | "strict" | "loose";
|
|
76
|
+
omitPadding?: boolean;
|
|
77
|
+
}
|
|
78
|
+
|
|
79
|
+
interface Uint8ArrayConstructor {
|
|
80
|
+
fromBase64(base64: string, options?: FromBase64Options): Uint8Array;
|
|
81
|
+
fromHex(string: string): Uint8Array;
|
|
82
|
+
}
|
|
83
|
+
|
|
84
|
+
interface BigIntConstructor {
|
|
85
|
+
bitLength(value: bigint): number
|
|
86
|
+
fromArrayBuffer(buffer: ArrayBufferLike): bigint
|
|
87
|
+
}
|
|
88
|
+
|
|
89
|
+
// integer math proposal
|
|
90
|
+
interface Math {
|
|
91
|
+
idiv(a: number, b: number): number
|
|
92
|
+
imod(a: number, b: number): number
|
|
93
|
+
imuldiv(a: number, b: number, c: number): number
|
|
94
|
+
irandom(min: number, max: number): number
|
|
95
|
+
irandom(max: number): number
|
|
96
|
+
irem(a: number, b: number): number
|
|
97
|
+
mod(a: number, b: number): number
|
|
98
|
+
}
|
|
99
|
+
|
|
100
|
+
// xs host objects, host functions
|
|
101
|
+
declare function Native(name: string): new (...args: any[]) => any;
|
|
102
|
+
declare function native(name: string): (...args: any[]) => any;
|
|
103
|
+
|
|
104
|
+
// Compartment?
|
|
@@ -1,39 +0,0 @@
|
|
|
1
|
-
/*
|
|
2
|
-
* Copyright (c) 2026 Moddable Tech, Inc.
|
|
3
|
-
*/
|
|
4
|
-
|
|
5
|
-
import type {
|
|
6
|
-
LocationConfiguration,
|
|
7
|
-
LocationOptions,
|
|
8
|
-
LocationSample,
|
|
9
|
-
LocationSensor
|
|
10
|
-
} from "./location";
|
|
11
|
-
|
|
12
|
-
export interface FixedOptions extends LocationOptions {
|
|
13
|
-
latitude: number;
|
|
14
|
-
longitude: number;
|
|
15
|
-
altitude?: number;
|
|
16
|
-
accuracy?: number;
|
|
17
|
-
}
|
|
18
|
-
|
|
19
|
-
export interface FixedConfiguration extends LocationConfiguration {
|
|
20
|
-
latitude?: number;
|
|
21
|
-
longitude?: number;
|
|
22
|
-
altitude?: number;
|
|
23
|
-
accuracy?: number;
|
|
24
|
-
}
|
|
25
|
-
|
|
26
|
-
declare class Fixed implements LocationSensor {
|
|
27
|
-
constructor(options: FixedOptions);
|
|
28
|
-
configure(options: FixedConfiguration): void;
|
|
29
|
-
sample(): LocationSample | undefined;
|
|
30
|
-
close(): void;
|
|
31
|
-
readonly identification: {
|
|
32
|
-
model: string;
|
|
33
|
-
classification: string;
|
|
34
|
-
description: string;
|
|
35
|
-
};
|
|
36
|
-
}
|
|
37
|
-
interface Fixed extends Disposable {}
|
|
38
|
-
|
|
39
|
-
export default Fixed;
|
|
@@ -1,44 +0,0 @@
|
|
|
1
|
-
/*
|
|
2
|
-
* Copyright (c) 2026 Moddable Tech, Inc.
|
|
3
|
-
*/
|
|
4
|
-
|
|
5
|
-
import type {
|
|
6
|
-
LocationConfiguration,
|
|
7
|
-
LocationOptions,
|
|
8
|
-
LocationSample,
|
|
9
|
-
LocationSensor
|
|
10
|
-
} from "./location";
|
|
11
|
-
|
|
12
|
-
export interface IPOptions extends LocationOptions {
|
|
13
|
-
endpoint?: string;
|
|
14
|
-
host?: string;
|
|
15
|
-
path?: string;
|
|
16
|
-
port?: number;
|
|
17
|
-
headers?: Map<string, string> | Record<string, string>;
|
|
18
|
-
http?: object;
|
|
19
|
-
parse?: (json: unknown) => LocationSample | undefined;
|
|
20
|
-
defaultAccuracy?: number;
|
|
21
|
-
interval?: number;
|
|
22
|
-
}
|
|
23
|
-
|
|
24
|
-
export interface IPConfiguration extends LocationConfiguration {
|
|
25
|
-
endpoint?: string;
|
|
26
|
-
host?: string;
|
|
27
|
-
path?: string;
|
|
28
|
-
interval?: number;
|
|
29
|
-
}
|
|
30
|
-
|
|
31
|
-
declare class IP implements LocationSensor {
|
|
32
|
-
constructor(options: IPOptions);
|
|
33
|
-
configure(options: IPConfiguration): void;
|
|
34
|
-
sample(): LocationSample | undefined;
|
|
35
|
-
close(): void;
|
|
36
|
-
readonly identification: {
|
|
37
|
-
model: string;
|
|
38
|
-
classification: string;
|
|
39
|
-
description: string;
|
|
40
|
-
};
|
|
41
|
-
}
|
|
42
|
-
interface IP extends Disposable {}
|
|
43
|
-
|
|
44
|
-
export default IP;
|
|
@@ -1,56 +0,0 @@
|
|
|
1
|
-
/*
|
|
2
|
-
* Copyright (c) 2026 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
|
-
/** ECMA-419 Location sample (W3C Geolocation-shaped). */
|
|
22
|
-
export interface LocationSample {
|
|
23
|
-
latitude: number;
|
|
24
|
-
longitude: number;
|
|
25
|
-
altitude?: number;
|
|
26
|
-
accuracy?: number;
|
|
27
|
-
altitudeAccuracy?: number;
|
|
28
|
-
heading?: number;
|
|
29
|
-
speed?: number;
|
|
30
|
-
timestamp?: number;
|
|
31
|
-
}
|
|
32
|
-
|
|
33
|
-
export interface LocationIdentification {
|
|
34
|
-
model: string;
|
|
35
|
-
classification: string;
|
|
36
|
-
description: string;
|
|
37
|
-
}
|
|
38
|
-
|
|
39
|
-
export interface LocationConfiguration {
|
|
40
|
-
enableHighAccuracy?: boolean;
|
|
41
|
-
timeout?: number;
|
|
42
|
-
maximumAge?: number;
|
|
43
|
-
}
|
|
44
|
-
|
|
45
|
-
export interface LocationOptions {
|
|
46
|
-
onSample?: () => void;
|
|
47
|
-
onError?: (error: Error) => void;
|
|
48
|
-
target?: unknown;
|
|
49
|
-
}
|
|
50
|
-
|
|
51
|
-
export interface LocationSensor {
|
|
52
|
-
configure(options: LocationConfiguration): void;
|
|
53
|
-
sample(): LocationSample | undefined;
|
|
54
|
-
close(): void;
|
|
55
|
-
readonly identification: LocationIdentification;
|
|
56
|
-
}
|
|
@@ -1,64 +0,0 @@
|
|
|
1
|
-
/*
|
|
2
|
-
* Copyright (c) 2026 Moddable Tech, Inc.
|
|
3
|
-
*/
|
|
4
|
-
|
|
5
|
-
export interface RFIDSample {
|
|
6
|
-
present: boolean;
|
|
7
|
-
uid?: Uint8Array;
|
|
8
|
-
uidHex?: string;
|
|
9
|
-
sak?: number;
|
|
10
|
-
type?: string;
|
|
11
|
-
}
|
|
12
|
-
|
|
13
|
-
export interface MFRC522SPIOptions {
|
|
14
|
-
sensor: {
|
|
15
|
-
io: new (options: object) => object;
|
|
16
|
-
clock?: number;
|
|
17
|
-
in?: number;
|
|
18
|
-
out?: number;
|
|
19
|
-
port?: number;
|
|
20
|
-
hz?: number;
|
|
21
|
-
mode?: number;
|
|
22
|
-
[key: string]: unknown;
|
|
23
|
-
};
|
|
24
|
-
select: {
|
|
25
|
-
io: new (options: object) => { write(v: number): void; close(): void };
|
|
26
|
-
pin: number;
|
|
27
|
-
mode?: number;
|
|
28
|
-
[key: string]: unknown;
|
|
29
|
-
};
|
|
30
|
-
reset?: {
|
|
31
|
-
io: new (options: object) => { write(v: number): void; close(): void };
|
|
32
|
-
pin: number;
|
|
33
|
-
mode?: number;
|
|
34
|
-
[key: string]: unknown;
|
|
35
|
-
};
|
|
36
|
-
onSample?: () => void;
|
|
37
|
-
onError?: (error: Error) => void;
|
|
38
|
-
target?: unknown;
|
|
39
|
-
interval?: number;
|
|
40
|
-
}
|
|
41
|
-
|
|
42
|
-
export interface MFRC522SPIConfiguration {
|
|
43
|
-
interval?: number;
|
|
44
|
-
antenna?: boolean;
|
|
45
|
-
}
|
|
46
|
-
|
|
47
|
-
declare class MFRC522SPI {
|
|
48
|
-
constructor(options: MFRC522SPIOptions);
|
|
49
|
-
configure(options: MFRC522SPIConfiguration): void;
|
|
50
|
-
sample(): RFIDSample | undefined;
|
|
51
|
-
close(): void;
|
|
52
|
-
readonly identification: {
|
|
53
|
-
model: string;
|
|
54
|
-
classification: string;
|
|
55
|
-
description: string;
|
|
56
|
-
};
|
|
57
|
-
readonly version: number;
|
|
58
|
-
authenticate(): never;
|
|
59
|
-
readBlock(): never;
|
|
60
|
-
writeBlock(): never;
|
|
61
|
-
}
|
|
62
|
-
interface MFRC522SPI extends Disposable {}
|
|
63
|
-
|
|
64
|
-
export default MFRC522SPI;
|
|
@@ -1,50 +0,0 @@
|
|
|
1
|
-
/*
|
|
2
|
-
* Copyright (c) 2026 Moddable Tech, Inc.
|
|
3
|
-
*/
|
|
4
|
-
|
|
5
|
-
export interface RFIDSample {
|
|
6
|
-
present: boolean;
|
|
7
|
-
uid?: Uint8Array;
|
|
8
|
-
uidHex?: string;
|
|
9
|
-
sak?: number;
|
|
10
|
-
type?: string;
|
|
11
|
-
}
|
|
12
|
-
|
|
13
|
-
export interface MFRC522Options {
|
|
14
|
-
sensor: {
|
|
15
|
-
io: new (options: object) => object;
|
|
16
|
-
data?: number;
|
|
17
|
-
clock?: number;
|
|
18
|
-
address?: number;
|
|
19
|
-
hz?: number;
|
|
20
|
-
[key: string]: unknown;
|
|
21
|
-
};
|
|
22
|
-
onSample?: () => void;
|
|
23
|
-
onError?: (error: Error) => void;
|
|
24
|
-
target?: unknown;
|
|
25
|
-
interval?: number;
|
|
26
|
-
}
|
|
27
|
-
|
|
28
|
-
export interface MFRC522Configuration {
|
|
29
|
-
interval?: number;
|
|
30
|
-
antenna?: boolean;
|
|
31
|
-
}
|
|
32
|
-
|
|
33
|
-
declare class MFRC522 {
|
|
34
|
-
constructor(options: MFRC522Options);
|
|
35
|
-
configure(options: MFRC522Configuration): void;
|
|
36
|
-
sample(): RFIDSample | undefined;
|
|
37
|
-
close(): void;
|
|
38
|
-
readonly identification: {
|
|
39
|
-
model: string;
|
|
40
|
-
classification: string;
|
|
41
|
-
description: string;
|
|
42
|
-
};
|
|
43
|
-
readonly version: number;
|
|
44
|
-
authenticate(): never;
|
|
45
|
-
readBlock(): never;
|
|
46
|
-
writeBlock(): never;
|
|
47
|
-
}
|
|
48
|
-
interface MFRC522 extends Disposable {}
|
|
49
|
-
|
|
50
|
-
export default MFRC522;
|