@@ -7,14 +7,14 @@ import {
7
7
BoardsPackage , Board , Port , BoardDetails , Tool , ConfigOption , ConfigValue , Programmer , OutputService , NotificationServiceServer , AvailablePorts , BoardWithPackage
8
8
} from '../common/protocol' ;
9
9
import {
10
- PlatformSearchReq , PlatformSearchResp , PlatformInstallReq , PlatformInstallResp , PlatformListReq ,
11
- PlatformListResp , PlatformUninstallResp , PlatformUninstallReq
12
- } from './cli-protocol/commands/core_pb' ;
13
- import { Platform } from './cli-protocol/commands/common_pb' ;
10
+ PlatformInstallRequest , PlatformInstallResponse , PlatformListRequest , PlatformListResponse , PlatformSearchRequest ,
11
+ PlatformSearchResponse , PlatformUninstallRequest , PlatformUninstallResponse
12
+ } from './cli-protocol/cc/arduino/cli/ commands/v1 /core_pb' ;
13
+ import { Platform } from './cli-protocol/cc/arduino/cli/ commands/v1 /common_pb' ;
14
14
import { BoardDiscovery } from './board-discovery' ;
15
15
import { CoreClientAware } from './core-client-provider' ;
16
- import { BoardDetailsReq , BoardDetailsResp , BoardSearchReq } from './cli-protocol/commands/board_pb' ;
17
- import { ListProgrammersAvailableForUploadReq , ListProgrammersAvailableForUploadResp } from './cli-protocol/commands/upload_pb' ;
16
+ import { BoardDetailsRequest , BoardDetailsResponse , BoardSearchRequest } from './cli-protocol/cc/arduino/cli/ commands/v1 /board_pb' ;
17
+ import { ListProgrammersAvailableForUploadRequest , ListProgrammersAvailableForUploadResponse } from './cli-protocol/cc/arduino/cli/ commands/v1 /upload_pb' ;
18
18
19
19
@injectable ( )
20
20
export class BoardsServiceImpl extends CoreClientAware implements BoardsService {
@@ -51,10 +51,10 @@ export class BoardsServiceImpl extends CoreClientAware implements BoardsService
51
51
const coreClient = await this . coreClient ( ) ;
52
52
const { client, instance } = coreClient ;
53
53
const { fqbn } = options ;
54
- const detailsReq = new BoardDetailsReq ( ) ;
54
+ const detailsReq = new BoardDetailsRequest ( ) ;
55
55
detailsReq . setInstance ( instance ) ;
56
56
detailsReq . setFqbn ( fqbn ) ;
57
- const detailsResp = await new Promise < BoardDetailsResp | undefined > ( ( resolve , reject ) => client . boardDetails ( detailsReq , ( err , resp ) => {
57
+ const detailsResp = await new Promise < BoardDetailsResponse | undefined > ( ( resolve , reject ) => client . boardDetails ( detailsReq , ( err , resp ) => {
58
58
if ( err ) {
59
59
// Required cores are not installed manually: https://github.com/arduino/arduino-cli/issues/954
60
60
if ( ( err . message . indexOf ( 'missing platform release' ) !== - 1 && err . message . indexOf ( 'referenced by board' ) !== - 1 )
@@ -75,7 +75,7 @@ export class BoardsServiceImpl extends CoreClientAware implements BoardsService
75
75
76
76
const debuggingSupported = detailsResp . getDebuggingSupported ( ) ;
77
77
78
- const requiredTools = detailsResp . getToolsdependenciesList ( ) . map ( t => < Tool > {
78
+ const requiredTools = detailsResp . getToolsDependenciesList ( ) . map ( t => < Tool > {
79
79
name : t . getName ( ) ,
80
80
packager : t . getPackager ( ) ,
81
81
version : t . getVersion ( )
@@ -91,10 +91,10 @@ export class BoardsServiceImpl extends CoreClientAware implements BoardsService
91
91
} )
92
92
} ) ;
93
93
94
- const listReq = new ListProgrammersAvailableForUploadReq ( ) ;
94
+ const listReq = new ListProgrammersAvailableForUploadRequest ( ) ;
95
95
listReq . setInstance ( instance ) ;
96
96
listReq . setFqbn ( fqbn ) ;
97
- const listResp = await new Promise < ListProgrammersAvailableForUploadResp > ( ( resolve , reject ) => client . listProgrammersAvailableForUpload ( listReq , ( err , resp ) => {
97
+ const listResp = await new Promise < ListProgrammersAvailableForUploadResponse > ( ( resolve , reject ) => client . listProgrammersAvailableForUpload ( listReq , ( err , resp ) => {
98
98
if ( err ) {
99
99
reject ( err ) ;
100
100
return ;
@@ -110,7 +110,7 @@ export class BoardsServiceImpl extends CoreClientAware implements BoardsService
110
110
111
111
let VID = 'N/A' ;
112
112
let PID = 'N/A' ;
113
- const usbId = detailsResp . getIdentificationPrefList ( ) . map ( item => item . getUsbid ( ) ) . find ( notEmpty ) ;
113
+ const usbId = detailsResp . getIdentificationPrefsList ( ) . map ( item => item . getUsbId ( ) ) . find ( notEmpty ) ;
114
114
if ( usbId ) {
115
115
VID = usbId . getVid ( ) ;
116
116
PID = usbId . getPid ( ) ;
@@ -147,7 +147,7 @@ export class BoardsServiceImpl extends CoreClientAware implements BoardsService
147
147
148
148
async searchBoards ( { query } : { query ?: string } ) : Promise < BoardWithPackage [ ] > {
149
149
const { instance, client } = await this . coreClient ( ) ;
150
- const req = new BoardSearchReq ( ) ;
150
+ const req = new BoardSearchRequest ( ) ;
151
151
req . setSearchArgs ( query || '' ) ;
152
152
req . setInstance ( instance ) ;
153
153
const boards = await new Promise < BoardWithPackage [ ] > ( ( resolve , reject ) => {
@@ -178,18 +178,18 @@ export class BoardsServiceImpl extends CoreClientAware implements BoardsService
178
178
const coreClient = await this . coreClient ( ) ;
179
179
const { client, instance } = coreClient ;
180
180
181
- const installedPlatformsReq = new PlatformListReq ( ) ;
181
+ const installedPlatformsReq = new PlatformListRequest ( ) ;
182
182
installedPlatformsReq . setInstance ( instance ) ;
183
- const installedPlatformsResp = await new Promise < PlatformListResp > ( ( resolve , reject ) =>
183
+ const installedPlatformsResp = await new Promise < PlatformListResponse > ( ( resolve , reject ) =>
184
184
client . platformList ( installedPlatformsReq , ( err , resp ) => ( ! ! err ? reject : resolve ) ( ! ! err ? err : resp ) )
185
185
) ;
186
- const installedPlatforms = installedPlatformsResp . getInstalledPlatformList ( ) ;
186
+ const installedPlatforms = installedPlatformsResp . getInstalledPlatformsList ( ) ;
187
187
188
- const req = new PlatformSearchReq ( ) ;
188
+ const req = new PlatformSearchRequest ( ) ;
189
189
req . setSearchArgs ( options . query || '' ) ;
190
190
req . setAllVersions ( true ) ;
191
191
req . setInstance ( instance ) ;
192
- const resp = await new Promise < PlatformSearchResp > ( ( resolve , reject ) => client . platformSearch ( req , ( err , resp ) => ( ! ! err ? reject : resolve ) ( ! ! err ? err : resp ) ) ) ;
192
+ const resp = await new Promise < PlatformSearchResponse > ( ( resolve , reject ) => client . platformSearch ( req , ( err , resp ) => ( ! ! err ? reject : resolve ) ( ! ! err ? err : resp ) ) ) ;
193
193
const packages = new Map < string , BoardsPackage > ( ) ;
194
194
const toPackage = ( platform : Platform ) => {
195
195
let installedVersion : string | undefined ;
@@ -262,15 +262,15 @@ export class BoardsServiceImpl extends CoreClientAware implements BoardsService
262
262
263
263
const [ platform , architecture ] = item . id . split ( ':' ) ;
264
264
265
- const req = new PlatformInstallReq ( ) ;
265
+ const req = new PlatformInstallRequest ( ) ;
266
266
req . setInstance ( instance ) ;
267
267
req . setArchitecture ( architecture ) ;
268
268
req . setPlatformPackage ( platform ) ;
269
269
req . setVersion ( version ) ;
270
270
271
271
console . info ( '>>> Starting boards package installation...' , item ) ;
272
272
const resp = client . platformInstall ( req ) ;
273
- resp . on ( 'data' , ( r : PlatformInstallResp ) => {
273
+ resp . on ( 'data' , ( r : PlatformInstallResponse ) => {
274
274
const prog = r . getProgress ( ) ;
275
275
if ( prog && prog . getFile ( ) ) {
276
276
this . outputService . append ( { chunk : `downloading ${ prog . getFile ( ) } \n` } ) ;
@@ -298,15 +298,15 @@ export class BoardsServiceImpl extends CoreClientAware implements BoardsService
298
298
299
299
const [ platform , architecture ] = item . id . split ( ':' ) ;
300
300
301
- const req = new PlatformUninstallReq ( ) ;
301
+ const req = new PlatformUninstallRequest ( ) ;
302
302
req . setInstance ( instance ) ;
303
303
req . setArchitecture ( architecture ) ;
304
304
req . setPlatformPackage ( platform ) ;
305
305
306
306
console . info ( '>>> Starting boards package uninstallation...' , item ) ;
307
307
let logged = false ;
308
308
const resp = client . platformUninstall ( req ) ;
309
- resp . on ( 'data' , ( _ : PlatformUninstallResp ) => {
309
+ resp . on ( 'data' , ( _ : PlatformUninstallResponse ) => {
310
310
if ( ! logged ) {
311
311
this . outputService . append ( { chunk : `uninstalling ${ item . id } \n` } ) ;
312
312
logged = true ;
0 commit comments