@@ -58,7 +58,7 @@ export class MonitorManager extends CoreClientAware {
5858 * combination specified, false in all other cases.
5959 */
6060 isStarted ( board : Board , port : Port ) : boolean {
61- const monitorID = this . monitorID ( board , port ) ;
61+ const monitorID = this . monitorID ( board . fqbn , port ) ;
6262 const monitor = this . monitorServices . get ( monitorID ) ;
6363 if ( monitor ) {
6464 return monitor . isStarted ( ) ;
@@ -106,7 +106,7 @@ export class MonitorManager extends CoreClientAware {
106106 port : Port ,
107107 connectToClient : ( status : Status ) => void
108108 ) : Promise < void > {
109- const monitorID = this . monitorID ( board , port ) ;
109+ const monitorID = this . monitorID ( board . fqbn , port ) ;
110110
111111 let monitor = this . monitorServices . get ( monitorID ) ;
112112 if ( ! monitor ) {
@@ -138,7 +138,7 @@ export class MonitorManager extends CoreClientAware {
138138 * @param port port monitored
139139 */
140140 async stopMonitor ( board : Board , port : Port ) : Promise < void > {
141- const monitorID = this . monitorID ( board , port ) ;
141+ const monitorID = this . monitorID ( board . fqbn , port ) ;
142142 const monitor = this . monitorServices . get ( monitorID ) ;
143143 if ( ! monitor ) {
144144 // There's no monitor to stop, bail
@@ -155,7 +155,7 @@ export class MonitorManager extends CoreClientAware {
155155 * @returns port of the MonitorService's WebSocket
156156 */
157157 getWebsocketAddressPort ( board : Board , port : Port ) : number {
158- const monitorID = this . monitorID ( board , port ) ;
158+ const monitorID = this . monitorID ( board . fqbn , port ) ;
159159 const monitor = this . monitorServices . get ( monitorID ) ;
160160 if ( ! monitor ) {
161161 return - 1 ;
@@ -168,17 +168,17 @@ export class MonitorManager extends CoreClientAware {
168168 * that an upload process started on that exact board/port combination.
169169 * This must be done so that we can stop the monitor for the time being
170170 * until the upload process finished.
171- * @param board board connected to port
171+ * @param fqbn the FQBN of the board connected to port
172172 * @param port port to monitor
173173 */
174- async notifyUploadStarted ( board ?: Board , port ?: Port ) : Promise < void > {
175- if ( ! board || ! port ) {
174+ async notifyUploadStarted ( fqbn ?: string , port ?: Port ) : Promise < void > {
175+ if ( ! fqbn || ! port ) {
176176 // We have no way of knowing which monitor
177177 // to retrieve if we don't have this information.
178178 return ;
179179 }
180180
181- const monitorID = this . monitorID ( board , port ) ;
181+ const monitorID = this . monitorID ( fqbn , port ) ;
182182 this . addToMonitorIDsByUploadState ( 'uploadInProgress' , monitorID ) ;
183183
184184 const monitor = this . monitorServices . get ( monitorID ) ;
@@ -194,19 +194,22 @@ export class MonitorManager extends CoreClientAware {
194194 /**
195195 * Notifies the monitor service of that board/port combination
196196 * that an upload process started on that exact board/port combination.
197- * @param board board connected to port
197+ * @param fqbn the FQBN of the board connected to port
198198 * @param port port to monitor
199199 * @returns a Status object to know if the process has been
200200 * started or if there have been errors.
201201 */
202- async notifyUploadFinished ( board ?: Board , port ?: Port ) : Promise < Status > {
202+ async notifyUploadFinished (
203+ fqbn ?: string | undefined ,
204+ port ?: Port
205+ ) : Promise < Status > {
203206 let status : Status = Status . NOT_CONNECTED ;
204207 let portDidChangeOnUpload = false ;
205208
206209 // We have no way of knowing which monitor
207210 // to retrieve if we don't have this information.
208- if ( board && port ) {
209- const monitorID = this . monitorID ( board , port ) ;
211+ if ( fqbn && port ) {
212+ const monitorID = this . monitorID ( fqbn , port ) ;
210213 this . removeFromMonitorIDsByUploadState ( 'uploadInProgress' , monitorID ) ;
211214
212215 const monitor = this . monitorServices . get ( monitorID ) ;
@@ -277,7 +280,7 @@ export class MonitorManager extends CoreClientAware {
277280 port : Port ,
278281 settings : PluggableMonitorSettings
279282 ) {
280- const monitorID = this . monitorID ( board , port ) ;
283+ const monitorID = this . monitorID ( board . fqbn , port ) ;
281284 let monitor = this . monitorServices . get ( monitorID ) ;
282285 if ( ! monitor ) {
283286 monitor = this . createMonitor ( board , port ) ;
@@ -296,7 +299,7 @@ export class MonitorManager extends CoreClientAware {
296299 board : Board ,
297300 port : Port
298301 ) : Promise < MonitorSettings > {
299- const monitorID = this . monitorID ( board , port ) ;
302+ const monitorID = this . monitorID ( board . fqbn , port ) ;
300303 const monitor = this . monitorServices . get ( monitorID ) ;
301304 if ( ! monitor ) {
302305 return { } ;
@@ -312,7 +315,7 @@ export class MonitorManager extends CoreClientAware {
312315 * @returns a new instance of MonitorService ready to use.
313316 */
314317 private createMonitor ( board : Board , port : Port ) : MonitorService {
315- const monitorID = this . monitorID ( board , port ) ;
318+ const monitorID = this . monitorID ( board . fqbn , port ) ;
316319 const monitor = this . monitorServiceFactory ( {
317320 board,
318321 port,
@@ -341,12 +344,12 @@ export class MonitorManager extends CoreClientAware {
341344
342345 /**
343346 * Utility function to create a unique ID for a monitor service.
344- * @param board
347+ * @param fqbn
345348 * @param port
346349 * @returns a unique monitor ID
347350 */
348- private monitorID ( board : Board , port : Port ) : MonitorID {
349- const splitFqbn = board ?. fqbn ?. split ( ':' ) || [ ] ;
351+ private monitorID ( fqbn : string | undefined , port : Port ) : MonitorID {
352+ const splitFqbn = fqbn ?. split ( ':' ) || [ ] ;
350353 const shortenedFqbn = splitFqbn . slice ( 0 , 3 ) . join ( ':' ) || '' ;
351354 return `${ shortenedFqbn } -${ port . address } -${ port . protocol } ` ;
352355 }
0 commit comments