Skip to content

Commit 025eccd

Browse files
committed
Added implementation of BoardIdentify
1 parent b8e076a commit 025eccd

File tree

1 file changed

+42
-0
lines changed

1 file changed

+42
-0
lines changed

commands/service_board_identify.go

Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
// This file is part of arduino-cli.
2+
//
3+
// Copyright 2020 ARDUINO SA (http://www.arduino.cc/)
4+
//
5+
// This software is released under the GNU General Public License version 3,
6+
// which covers the main part of arduino-cli.
7+
// The terms of this license can be found at:
8+
// https://www.gnu.org/licenses/gpl-3.0.en.html
9+
//
10+
// You can be released from the requirements of the above licenses by purchasing
11+
// a commercial license. Buying such a license is mandatory if you want to
12+
// modify or otherwise use the software for commercial activities involving the
13+
// Arduino software without disclosing the source code of your own applications.
14+
// To purchase a commercial license, send an email to license@arduino.cc.
15+
16+
package commands
17+
18+
import (
19+
"context"
20+
21+
"github.com/arduino/arduino-cli/commands/internal/instances"
22+
rpc "github.com/arduino/arduino-cli/rpc/cc/arduino/cli/commands/v1"
23+
"github.com/arduino/go-properties-orderedmap"
24+
)
25+
26+
// BoardIdentify identifies the board based on the provided properties
27+
func (s *arduinoCoreServerImpl) BoardIdentify(ctx context.Context, req *rpc.BoardIdentifyRequest) (*rpc.BoardIdentifyResponse, error) {
28+
pme, release, err := instances.GetPackageManagerExplorer(req.GetInstance())
29+
if err != nil {
30+
return nil, err
31+
}
32+
defer release()
33+
34+
props := properties.NewFromHashmap(req.GetProperties())
35+
res, err := identify(pme, props, s.settings, true)
36+
if err != nil {
37+
return nil, err
38+
}
39+
return &rpc.BoardIdentifyResponse{
40+
Boards: res,
41+
}, nil
42+
}

0 commit comments

Comments
 (0)