@moddable/typings 5.9.0 → 5.10.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/embedded_io/ble/client.d.ts +103 -0
- package/package.json +1 -1
- package/url.d.ts +1 -0
- package/xs.d.ts +16 -0
|
@@ -0,0 +1,103 @@
|
|
|
1
|
+
declare module "embedded:io/bluetoothle/central" {
|
|
2
|
+
import { Buffer } from "embedded:io/_common";
|
|
3
|
+
|
|
4
|
+
interface Advertisement {
|
|
5
|
+
address: string;
|
|
6
|
+
rssi?: number;
|
|
7
|
+
get name(): string | undefined;
|
|
8
|
+
get services(): string[] | undefined;
|
|
9
|
+
get manufacturerData(): { manufacturer: number, data: ArrayBuffer } | undefined;
|
|
10
|
+
get(adType: number): ArrayBuffer | undefined;
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
interface GAPClientFilters {
|
|
14
|
+
services?: string[]
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
interface GAPClientOptions {
|
|
18
|
+
target?: any;
|
|
19
|
+
filters?: GAPClientFilters;
|
|
20
|
+
onError?: (this: GAPClient, error: Error) => void;
|
|
21
|
+
onReadable?: (this: GAPClient, count: number) => void;
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
class GAPClient {
|
|
25
|
+
constructor(options: GAPClientOptions);
|
|
26
|
+
target: any;
|
|
27
|
+
close(): void;
|
|
28
|
+
read(): Advertisement;
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
interface GATTClientNotifiedValue extends ArrayBuffer {
|
|
32
|
+
handle: number
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
interface GATTClientWriteOptions {
|
|
36
|
+
response?: boolean
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
interface GATTClientOptions {
|
|
40
|
+
address: string,
|
|
41
|
+
target?: any;
|
|
42
|
+
onReady?: (this: GATTClient, ) => void;
|
|
43
|
+
onError?: (this: GATTClient, error: Error) => void;
|
|
44
|
+
onReadable?: (this: GATTClient, count: number) => void;
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
interface GATTClientService {
|
|
48
|
+
get uuid(): string;
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
interface GATTClientCharacteristic {
|
|
52
|
+
get uuid(): string;
|
|
53
|
+
get handle(): number;
|
|
54
|
+
get properties(): number;
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
interface GATTClientDescriptor {
|
|
58
|
+
get uuid(): string;
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
class GATTClient {
|
|
62
|
+
constructor(options: GATTClientOptions);
|
|
63
|
+
target: any;
|
|
64
|
+
|
|
65
|
+
close(callback?: (error?: Error) => void): void;
|
|
66
|
+
|
|
67
|
+
getPrimaryServices(callback: (error: Error | null, services: GATTClientService[]) => void): void;
|
|
68
|
+
getPrimaryServices(options: object, callback: (error: Error | null, services: GATTClientService[]) => void): void;
|
|
69
|
+
|
|
70
|
+
getCharacteristics(service: GATTClientService, callback: (error: Error | null, characteristics: GATTClientCharacteristic[]) => void): void;
|
|
71
|
+
getCharacteristics(service: GATTClientService, options: object, callback: (error: Error | null, characteristics: GATTClientCharacteristic[]) => void): void;
|
|
72
|
+
|
|
73
|
+
getDescriptors(characteristic: GATTClientCharacteristic, callback: (error: Error | null, descriptors: GATTClientDescriptor[]) => void): void;
|
|
74
|
+
getDescriptors(characteristic: GATTClientCharacteristic, options: object, callback: (error: Error | null, descriptors: GATTClientDescriptor[]) => void): void;
|
|
75
|
+
|
|
76
|
+
read(what: GATTClientCharacteristic | GATTClientDescriptor, callback: (error: Error | null, value: ArrayBuffer) => void): void;
|
|
77
|
+
read(what: GATTClientCharacteristic | GATTClientDescriptor, options: object, callback: (error: Error | null, value: ArrayBuffer) => void): void;
|
|
78
|
+
read() : undefined | GATTClientNotifiedValue;
|
|
79
|
+
|
|
80
|
+
write(what: GATTClientCharacteristic | GATTClientDescriptor, value: Buffer, callback?: (error: Error | null) => void): void;
|
|
81
|
+
write(what: GATTClientCharacteristic | GATTClientDescriptor, value: Buffer, options: GATTClientWriteOptions, callback?: (error: Error | null) => void): void;
|
|
82
|
+
|
|
83
|
+
enableNotifications(characteristic: GATTClientCharacteristic, enable: boolean, callback?: (error?: Error) => void): void;
|
|
84
|
+
|
|
85
|
+
get maximumWrite(): number;
|
|
86
|
+
|
|
87
|
+
store(item: GATTClientService | GATTClientCharacteristic | GATTClientDescriptor): ArrayBuffer;
|
|
88
|
+
restore(item: Buffer): GATTClientService | GATTClientCharacteristic | GATTClientDescriptor;
|
|
89
|
+
|
|
90
|
+
static readonly properties: {
|
|
91
|
+
authenticatedSignedWrites: 64;
|
|
92
|
+
broadcast: 1;
|
|
93
|
+
indicate: 32;
|
|
94
|
+
notify: 16;
|
|
95
|
+
read: 2;
|
|
96
|
+
reliableWrite: 128;
|
|
97
|
+
write: 8;
|
|
98
|
+
writeWithOutResponse: 4;
|
|
99
|
+
};
|
|
100
|
+
}
|
|
101
|
+
|
|
102
|
+
export { GATTClient, GAPClient };
|
|
103
|
+
}
|
package/package.json
CHANGED
package/url.d.ts
CHANGED
package/xs.d.ts
CHANGED
|
@@ -65,6 +65,22 @@ interface ArrayBuffer {
|
|
|
65
65
|
concat(...buffers: ArrayBufferLike[]): ArrayBuffer;
|
|
66
66
|
}
|
|
67
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
|
+
|
|
68
84
|
interface BigIntConstructor {
|
|
69
85
|
bitLength(value: BigInt): number
|
|
70
86
|
fromArrayBuffer(buffer: ArrayBufferLike): BigInt
|