@@ -212,18 +212,10 @@ export interface DeviceConnection
212212 /**
213213 * Get the board version.
214214 *
215- * @returns the board version or null if there is no connection.
215+ * @returns the board version or undefined if there is no connection.
216216 */
217217 getBoardVersion ( ) : BoardVersion | undefined ;
218218
219- /**
220- * Flash the micro:bit.
221- *
222- * @param dataSource The data to use.
223- * @param options Flash options and progress callback.
224- */
225- flash ?( dataSource : FlashDataSource , options : { } ) : Promise < void > ;
226-
227219 /**
228220 * Disconnect from the device.
229221 */
@@ -232,7 +224,7 @@ export interface DeviceConnection
232224 /**
233225 * Write serial data to the device.
234226 *
235- * Does nothting if there is no connection.
227+ * Does nothing if there is no connection.
236228 *
237229 * @param data The data to write.
238230 * @returns A promise that resolves when the write is complete.
@@ -242,5 +234,31 @@ export interface DeviceConnection
242234 /**
243235 * Clear device to enable chooseDevice.
244236 */
245- clearDevice ( ) : void ;
237+ clearDevice ( ) : Promise < void > | void ;
238+ }
239+
240+ export interface DeviceWebUSBConnection extends DeviceConnection {
241+ /**
242+ * Get the deviceId.
243+ *
244+ * @returns the device id or undefined if there is no connection.
245+ */
246+ getDeviceId ( ) : number | undefined ;
247+
248+ /**
249+ * Flash the micro:bit.
250+ *
251+ * @param dataSource The data to use.
252+ * @param options Flash options and progress callback.
253+ */
254+ flash ( dataSource : FlashDataSource , options : { } ) : Promise < void > ;
255+ }
256+
257+ export interface DeviceWebBluetoothConnection extends DeviceConnection {
258+ /**
259+ * Sets micro:bit name filter for device requesting.
260+ *
261+ * @param name The name of the micro:bit.
262+ */
263+ setNameFilter ( name : string ) : void ;
246264}
0 commit comments