@@ -50,11 +50,11 @@ export class BluetoothDeviceWrapper {
5050
5151 constructor (
5252 public readonly device : BluetoothDevice ,
53- private logging : Logging = new NullLogging ( )
53+ private logging : Logging = new NullLogging ( ) ,
5454 ) {
5555 device . addEventListener (
5656 "gattserverdisconnected" ,
57- this . handleDisconnectEvent
57+ this . handleDisconnectEvent ,
5858 ) ;
5959 }
6060
@@ -65,7 +65,7 @@ export class BluetoothDeviceWrapper {
6565 } ) ;
6666 if ( this . duringExplicitConnectDisconnect ) {
6767 this . logging . log (
68- "Skipping connect attempt when one is already in progress"
68+ "Skipping connect attempt when one is already in progress" ,
6969 ) ;
7070 // Wait for the gattConnectPromise while showing a "connecting" dialog.
7171 // If the user clicks disconnect while the automatic reconnect is in progress,
@@ -76,7 +76,7 @@ export class BluetoothDeviceWrapper {
7676 this . duringExplicitConnectDisconnect ++ ;
7777 if ( this . device . gatt === undefined ) {
7878 throw new Error (
79- "BluetoothRemoteGATTServer for micro:bit device is undefined"
79+ "BluetoothRemoteGATTServer for micro:bit device is undefined" ,
8080 ) ;
8181 }
8282 try {
@@ -95,15 +95,15 @@ export class BluetoothDeviceWrapper {
9595 // Do we still want to be connected?
9696 if ( ! this . connecting ) {
9797 this . logging . log (
98- "Bluetooth GATT server connect after timeout, triggering disconnect"
98+ "Bluetooth GATT server connect after timeout, triggering disconnect" ,
9999 ) ;
100100 this . disconnectPromise = ( async ( ) => {
101101 await this . disconnectInternal ( false ) ;
102102 this . disconnectPromise = undefined ;
103103 } ) ( ) ;
104104 } else {
105105 this . logging . log (
106- "Bluetooth GATT server connected when connecting"
106+ "Bluetooth GATT server connected when connecting" ,
107107 ) ;
108108 }
109109 } )
@@ -114,7 +114,7 @@ export class BluetoothDeviceWrapper {
114114 } else {
115115 this . logging . error (
116116 "Bluetooth GATT server connect error after our timeout" ,
117- e
117+ e ,
118118 ) ;
119119 return undefined ;
120120 }
@@ -129,7 +129,7 @@ export class BluetoothDeviceWrapper {
129129 const gattConnectResult = await Promise . race ( [
130130 this . gattConnectPromise ,
131131 new Promise < "timeout" > ( ( resolve ) =>
132- setTimeout ( ( ) => resolve ( "timeout" ) , connectTimeoutDuration )
132+ setTimeout ( ( ) => resolve ( "timeout" ) , connectTimeoutDuration ) ,
133133 ) ,
134134 ] ) ;
135135 if ( gattConnectResult === "timeout" ) {
@@ -163,7 +163,7 @@ export class BluetoothDeviceWrapper {
163163
164164 private async disconnectInternal ( userTriggered : boolean ) : Promise < void > {
165165 this . logging . log (
166- `Bluetooth disconnect ${ userTriggered ? "(user triggered)" : "(programmatic)" } `
166+ `Bluetooth disconnect ${ userTriggered ? "(user triggered)" : "(programmatic)" } ` ,
167167 ) ;
168168 this . duringExplicitConnectDisconnect ++ ;
169169 try {
@@ -177,7 +177,7 @@ export class BluetoothDeviceWrapper {
177177 this . duringExplicitConnectDisconnect -- ;
178178 }
179179 this . reconnectReadyPromise = new Promise ( ( resolve ) =>
180- setTimeout ( resolve , 3_500 )
180+ setTimeout ( resolve , 3_500 ) ,
181181 ) ;
182182 }
183183
@@ -200,19 +200,19 @@ export class BluetoothDeviceWrapper {
200200 try {
201201 if ( ! this . duringExplicitConnectDisconnect ) {
202202 this . logging . log (
203- "Bluetooth GATT disconnected... automatically trying reconnect"
203+ "Bluetooth GATT disconnected... automatically trying reconnect" ,
204204 ) ;
205205 // stateOnReconnectionAttempt();
206206 await this . reconnect ( ) ;
207207 } else {
208208 this . logging . log (
209- "Bluetooth GATT disconnect ignored during explicit disconnect"
209+ "Bluetooth GATT disconnect ignored during explicit disconnect" ,
210210 ) ;
211211 }
212212 } catch ( e ) {
213213 this . logging . error (
214214 "Bluetooth connect triggered by disconnect listener failed" ,
215- e
215+ e ,
216216 ) ;
217217 }
218218 } ;
@@ -229,10 +229,10 @@ export class BluetoothDeviceWrapper {
229229 const serviceMeta = profile . deviceInformation ;
230230 try {
231231 const deviceInfo = await this . assertGattServer ( ) . getPrimaryService (
232- serviceMeta . id
232+ serviceMeta . id ,
233233 ) ;
234234 const characteristic = await deviceInfo . getCharacteristic (
235- serviceMeta . characteristics . modelNumber . id
235+ serviceMeta . characteristics . modelNumber . id ,
236236 ) ;
237237 const modelNumberBytes = await characteristic . readValue ( ) ;
238238 const modelNumber = new TextDecoder ( ) . decode ( modelNumberBytes ) ;
@@ -260,7 +260,7 @@ export class BluetoothDeviceWrapper {
260260
261261export const createBluetoothDeviceWrapper = async (
262262 device : BluetoothDevice ,
263- logging : Logging
263+ logging : Logging ,
264264) : Promise < BluetoothDeviceWrapper | undefined > => {
265265 try {
266266 // Reuse our connection objects for the same device as they
0 commit comments