Skip to content

Commit 2585ff7

Browse files
committed
Removed Protocol type
1 parent 3b04d8d commit 2585ff7

File tree

2 files changed

+5
-20
lines changed

2 files changed

+5
-20
lines changed

arduino-ide-extension/src/common/protocol/boards-service.ts

Lines changed: 2 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -134,7 +134,7 @@ export const BoardsServicePath = '/services/boards-service';
134134
export const BoardsService = Symbol('BoardsService');
135135
export interface BoardsService
136136
extends Installable<BoardsPackage>,
137-
Searchable<BoardsPackage> {
137+
Searchable<BoardsPackage> {
138138
/**
139139
* Deprecated. `getState` should be used to correctly map a board with a port.
140140
* @deprecated
@@ -156,26 +156,13 @@ export interface BoardsService
156156

157157
export interface Port {
158158
readonly address: string;
159-
readonly protocol: Port.Protocol;
159+
readonly protocol: string;
160160
/**
161161
* Optional label for the protocol. For example: `Serial Port (USB)`.
162162
*/
163163
readonly label?: string;
164164
}
165165
export namespace Port {
166-
export type Protocol = 'serial' | 'network' | 'unknown';
167-
export namespace Protocol {
168-
export function toProtocol(protocol: string | undefined): Protocol {
169-
if (protocol === 'serial') {
170-
return 'serial';
171-
} else if (protocol === 'network') {
172-
return 'network';
173-
} else {
174-
return 'unknown';
175-
}
176-
}
177-
}
178-
179166
export function is(arg: any): arg is Port {
180167
return (
181168
!!arg &&

arduino-ide-extension/src/node/board-discovery.ts

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -95,11 +95,9 @@ export class BoardDiscovery extends CoreClientAware {
9595
const newState = deepClone(this._state);
9696

9797
const address = (detectedPort as any).getPort().getAddress();
98-
const protocol = Port.Protocol.toProtocol(
99-
(detectedPort as any).getPort().getProtocol()
100-
);
101-
// const label = detectedPort.getProtocolLabel();
102-
const port = { address, protocol };
98+
const protocol = (detectedPort as any).getPort().getProtocol();
99+
const label = (detectedPort as any).getPort().getLabel();;
100+
const port = { address, protocol, label };
103101
const boards: Board[] = [];
104102
for (const item of detectedPort.getMatchingBoardsList()) {
105103
boards.push({

0 commit comments

Comments
 (0)