@@ -33,6 +33,7 @@ import {
33
33
BoardDetailsRequest ,
34
34
BoardDetailsResponse ,
35
35
BoardListAllRequest ,
36
+ BoardSearchRequest ,
36
37
} from './cli-protocol/cc/arduino/cli/commands/v1/board_pb' ;
37
38
import {
38
39
ListProgrammersAvailableForUploadRequest ,
@@ -195,9 +196,38 @@ export class BoardsServiceImpl
195
196
} : {
196
197
query ?: string ;
197
198
} ) : Promise < BoardWithPackage [ ] > {
199
+ const { instance, client } = await this . coreClient ;
200
+ const req = new BoardSearchRequest ( ) ;
201
+ req . setSearchArgs ( query || '' ) ;
202
+ req . setInstance ( instance ) ;
203
+ const boards = await new Promise < BoardWithPackage [ ] > ( ( resolve , reject ) => {
204
+ client . boardSearch ( req , ( error , resp ) => {
205
+ if ( error ) {
206
+ reject ( error ) ;
207
+ return ;
208
+ }
209
+ const boards : Array < BoardWithPackage > = [ ] ;
210
+ for ( const board of resp . getBoardsList ( ) ) {
211
+ const platform = board . getPlatform ( ) ;
212
+ if ( platform ) {
213
+ boards . push ( {
214
+ name : board . getName ( ) ,
215
+ fqbn : board . getFqbn ( ) ,
216
+ packageId : platform . getId ( ) ,
217
+ packageName : platform . getName ( ) ,
218
+ manuallyInstalled : platform . getManuallyInstalled ( ) ,
219
+ } ) ;
220
+ }
221
+ }
222
+ resolve ( boards ) ;
223
+ } ) ;
224
+ } ) ;
225
+ return boards ;
226
+ }
227
+
228
+ async getInstalledBoards ( ) : Promise < BoardWithPackage [ ] > {
198
229
const { instance, client } = await this . coreClient ;
199
230
const req = new BoardListAllRequest ( ) ;
200
- req . addSearchArgs ( query || '' ) ;
201
231
req . setInstance ( instance ) ;
202
232
const boards = await new Promise < BoardWithPackage [ ] > ( ( resolve , reject ) => {
203
233
client . boardListAll ( req , ( error , resp ) => {
0 commit comments