@@ -42,8 +42,7 @@ import { InstallWithProgress } from './grpc-installable';
42
42
@injectable ( )
43
43
export class BoardsServiceImpl
44
44
extends CoreClientAware
45
- implements BoardsService
46
- {
45
+ implements BoardsService {
47
46
@inject ( ILogger )
48
47
protected logger : ILogger ;
49
48
@@ -75,6 +74,7 @@ export class BoardsServiceImpl
75
74
async getBoardDetails ( options : {
76
75
fqbn : string ;
77
76
} ) : Promise < BoardDetails | undefined > {
77
+ await this . coreClientProvider . initialized ;
78
78
const coreClient = await this . coreClient ( ) ;
79
79
const { client, instance } = coreClient ;
80
80
const { fqbn } = options ;
@@ -165,13 +165,13 @@ export class BoardsServiceImpl
165
165
166
166
let VID = 'N/A' ;
167
167
let PID = 'N/A' ;
168
- const usbId = detailsResp
169
- . getIdentificationPrefsList ( )
170
- . map ( ( item ) => item . getUsbId ( ) )
168
+ const prop = detailsResp
169
+ . getIdentificationPropertiesList ( )
170
+ . map ( ( item ) => item . getPropertiesMap ( ) )
171
171
. find ( notEmpty ) ;
172
- if ( usbId ) {
173
- VID = usbId . getVid ( ) ;
174
- PID = usbId . getPid ( ) ;
172
+ if ( prop ) {
173
+ VID = prop . get ( 'vid' ) || '' ;
174
+ PID = prop . get ( 'pid' ) || '' ;
175
175
}
176
176
177
177
return {
@@ -214,6 +214,7 @@ export class BoardsServiceImpl
214
214
} : {
215
215
query ?: string ;
216
216
} ) : Promise < BoardWithPackage [ ] > {
217
+ await this . coreClientProvider . initialized ;
217
218
const { instance, client } = await this . coreClient ( ) ;
218
219
const req = new BoardSearchRequest ( ) ;
219
220
req . setSearchArgs ( query || '' ) ;
@@ -244,6 +245,7 @@ export class BoardsServiceImpl
244
245
}
245
246
246
247
async search ( options : { query ?: string } ) : Promise < BoardsPackage [ ] > {
248
+ await this . coreClientProvider . initialized ;
247
249
const coreClient = await this . coreClient ( ) ;
248
250
const { client, instance } = coreClient ;
249
251
@@ -361,6 +363,7 @@ export class BoardsServiceImpl
361
363
const version = ! ! options . version
362
364
? options . version
363
365
: item . availableVersions [ 0 ] ;
366
+ await this . coreClientProvider . initialized ;
364
367
const coreClient = await this . coreClient ( ) ;
365
368
const { client, instance } = coreClient ;
366
369
@@ -382,7 +385,10 @@ export class BoardsServiceImpl
382
385
} )
383
386
) ;
384
387
await new Promise < void > ( ( resolve , reject ) => {
385
- resp . on ( 'end' , resolve ) ;
388
+ resp . on ( 'end' , ( ) => {
389
+ this . boardDiscovery . startBoardListWatch ( coreClient )
390
+ resolve ( ) ;
391
+ } ) ;
386
392
resp . on ( 'error' , ( error ) => {
387
393
this . responseService . appendToOutput ( {
388
394
chunk : `Failed to install platform: ${ item . id } .\n` ,
@@ -406,6 +412,7 @@ export class BoardsServiceImpl
406
412
progressId ?: string ;
407
413
} ) : Promise < void > {
408
414
const { item, progressId } = options ;
415
+ await this . coreClientProvider . initialized ;
409
416
const coreClient = await this . coreClient ( ) ;
410
417
const { client, instance } = coreClient ;
411
418
@@ -426,7 +433,10 @@ export class BoardsServiceImpl
426
433
} )
427
434
) ;
428
435
await new Promise < void > ( ( resolve , reject ) => {
429
- resp . on ( 'end' , resolve ) ;
436
+ resp . on ( 'end' , ( ) => {
437
+ this . boardDiscovery . startBoardListWatch ( coreClient )
438
+ resolve ( ) ;
439
+ } ) ;
430
440
resp . on ( 'error' , reject ) ;
431
441
} ) ;
432
442
0 commit comments