@moddable/typings 5.10.1 → 5.12.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.
|
@@ -10,13 +10,9 @@ declare module "embedded:io/bluetoothle/central" {
|
|
|
10
10
|
get(adType: number): ArrayBuffer | undefined;
|
|
11
11
|
}
|
|
12
12
|
|
|
13
|
-
interface GAPClientFilters {
|
|
14
|
-
services?: string[]
|
|
15
|
-
}
|
|
16
|
-
|
|
17
13
|
interface GAPClientOptions {
|
|
18
14
|
target?: any;
|
|
19
|
-
|
|
15
|
+
services?: string[]
|
|
20
16
|
onError?: (this: GAPClient, error: Error) => void;
|
|
21
17
|
onReadable?: (this: GAPClient, count: number) => void;
|
|
22
18
|
}
|
|
@@ -36,10 +32,28 @@ declare module "embedded:io/bluetoothle/central" {
|
|
|
36
32
|
response?: boolean
|
|
37
33
|
}
|
|
38
34
|
|
|
35
|
+
interface GATTSecurityOptions {
|
|
36
|
+
bond?: boolean,
|
|
37
|
+
authenticate?: boolean,
|
|
38
|
+
keyboard?: boolean | "yes/no",
|
|
39
|
+
display?: boolean,
|
|
40
|
+
lazy?: boolean
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
interface GATTSecurityState {
|
|
44
|
+
encrypted: boolean,
|
|
45
|
+
authenticated: boolean,
|
|
46
|
+
bonded: boolean,
|
|
47
|
+
keySize: number
|
|
48
|
+
}
|
|
49
|
+
|
|
39
50
|
interface GATTClientOptions {
|
|
40
51
|
address: string,
|
|
41
52
|
target?: any;
|
|
53
|
+
security?: GATTSecurityOptions;
|
|
42
54
|
onReady?: (this: GATTClient, ) => void;
|
|
55
|
+
onPasskey?: (this: GATTClient, action: string, data: number | ArrayBuffer | undefined) => void;
|
|
56
|
+
onSecured?: (this: GATTClient, state: GATTSecurityState) => void;
|
|
43
57
|
onError?: (this: GATTClient, error: Error) => void;
|
|
44
58
|
onReadable?: (this: GATTClient, count: number) => void;
|
|
45
59
|
}
|
|
@@ -80,7 +94,10 @@ declare module "embedded:io/bluetoothle/central" {
|
|
|
80
94
|
write(what: GATTClientCharacteristic | GATTClientDescriptor, value: Buffer, callback?: (error: Error | null) => void): void;
|
|
81
95
|
write(what: GATTClientCharacteristic | GATTClientDescriptor, value: Buffer, options: GATTClientWriteOptions, callback?: (error: Error | null) => void): void;
|
|
82
96
|
|
|
83
|
-
|
|
97
|
+
subscribe(characteristic: GATTClientCharacteristic, callback?: (error?: Error) => void) : void;
|
|
98
|
+
unsubscribe(characteristic: GATTClientCharacteristic, callback?: (error?: Error) => void) : void;
|
|
99
|
+
|
|
100
|
+
replyToPasskey(action: string, data?: number | ArrayBuffer) : void;
|
|
84
101
|
|
|
85
102
|
get maximumWrite(): number;
|
|
86
103
|
|
|
@@ -0,0 +1,80 @@
|
|
|
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:network/mdns" {
|
|
22
|
+
export interface DNSSDOptions {
|
|
23
|
+
socket: {
|
|
24
|
+
io: any;
|
|
25
|
+
[key: string]: any;
|
|
26
|
+
};
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
export interface ClaimOptions {
|
|
30
|
+
host: string; // without .local suffix
|
|
31
|
+
onReady?: (this: ClaimInstance) => void;
|
|
32
|
+
onError?: (this: ClaimInstance, error?: any) => void;
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
export interface AdvertiseOptions {
|
|
36
|
+
serviceType: string; // e.g., "_http._tcp"
|
|
37
|
+
host: string;
|
|
38
|
+
port: number;
|
|
39
|
+
txt?: Map<string, string | undefined>;
|
|
40
|
+
instanceName?: string; // defaults to host if not provided
|
|
41
|
+
onError?: (this: AdvertiseInstance, error?: any) => void;
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
export interface DiscoverOptions {
|
|
45
|
+
serviceType: string; // e.g., "_http._tcp"
|
|
46
|
+
onFound?: (this: DiscoverInstance, service: DiscoveredService) => void;
|
|
47
|
+
onUpdate?: (this: DiscoverInstance, service: DiscoveredService) => void;
|
|
48
|
+
onLost?: (this: DiscoverInstance, service: DiscoveredService) => void;
|
|
49
|
+
onError?: (this: DiscoverInstance, error?: any) => void;
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
export interface DiscoveredService {
|
|
53
|
+
name: string;
|
|
54
|
+
host: string;
|
|
55
|
+
address: string;
|
|
56
|
+
port: number;
|
|
57
|
+
txt?: Map<string, string | undefined>;
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
export interface ClaimInstance {
|
|
61
|
+
close(): void;
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
export interface AdvertiseInstance {
|
|
65
|
+
close(): void;
|
|
66
|
+
updateTXT(txt?: Map<string, string | undefined>): void;
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
export interface DiscoverInstance {
|
|
70
|
+
close(): void;
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
export default class DNSSD {
|
|
74
|
+
constructor(options: DNSSDOptions);
|
|
75
|
+
close(): void;
|
|
76
|
+
claim(options: ClaimOptions): ClaimInstance;
|
|
77
|
+
advertise(options: AdvertiseOptions): AdvertiseInstance;
|
|
78
|
+
discover(options: DiscoverOptions): DiscoverInstance;
|
|
79
|
+
}
|
|
80
|
+
}
|