Skip to content

Commit

Permalink
Add isConnected
Browse files Browse the repository at this point in the history
  • Loading branch information
kimushu committed Nov 9, 2017
1 parent af9ec0d commit 7483ff5
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 0 deletions.
7 changes: 7 additions & 0 deletions src/boards/board.ts
Original file line number Diff line number Diff line change
Expand Up @@ -85,6 +85,13 @@ export class Board extends EventEmitter {
return this._classes[className];
}

/**
* Check if the board is connected or not
*/
get isConnected(): boolean {
throw new Error("Not implemented");
}

/**
* Get localizes board name (instance method version)
* @return Board name
Expand Down
4 changes: 4 additions & 0 deletions src/boards/peridotPiccoloBoard.ts
Original file line number Diff line number Diff line change
Expand Up @@ -293,6 +293,10 @@ export class PeridotPiccoloBoard extends Board {
});
}

get isConnected(): boolean {
return ((!!this._canarium) && this._canarium.opened);
}

/**
* Connect to board
* @param path Path of the board
Expand Down
4 changes: 4 additions & 0 deletions src/boards/wakayamaRbBoard.ts
Original file line number Diff line number Diff line change
Expand Up @@ -101,6 +101,10 @@ export class WakayamaRbBoard extends Board {
});
}

get isConnected(): boolean {
return !!this._port;
}

connect(path: string): Promise<void> {
this._path = path;
return this._portCall("open");
Expand Down

0 comments on commit 7483ff5

Please sign in to comment.