Commit 65ecbaf6 authored by Cristian Maglie's avatar Cristian Maglie

Inlining methods in ArduinoCoreServiceImpl (part 15: SupportedUserFields,...

Inlining methods in ArduinoCoreServiceImpl (part 15: SupportedUserFields, ListProgrammersAvailableForUpload, EnumerateMonitorPortSettings)
parent 0442319a
...@@ -37,26 +37,11 @@ type arduinoCoreServerImpl struct { ...@@ -37,26 +37,11 @@ type arduinoCoreServerImpl struct {
versionString string versionString string
} }
// Version FIXMEDOC // Version returns the version of the Arduino CLI
func (s *arduinoCoreServerImpl) Version(ctx context.Context, req *rpc.VersionRequest) (*rpc.VersionResponse, error) { func (s *arduinoCoreServerImpl) Version(ctx context.Context, req *rpc.VersionRequest) (*rpc.VersionResponse, error) {
return &rpc.VersionResponse{Version: s.versionString}, nil return &rpc.VersionResponse{Version: s.versionString}, nil
} }
// SupportedUserFields FIXMEDOC
func (s *arduinoCoreServerImpl) SupportedUserFields(ctx context.Context, req *rpc.SupportedUserFieldsRequest) (*rpc.SupportedUserFieldsResponse, error) {
return SupportedUserFields(ctx, req)
}
// ListProgrammersAvailableForUpload FIXMEDOC
func (s *arduinoCoreServerImpl) ListProgrammersAvailableForUpload(ctx context.Context, req *rpc.ListProgrammersAvailableForUploadRequest) (*rpc.ListProgrammersAvailableForUploadResponse, error) {
return ListProgrammersAvailableForUpload(ctx, req)
}
// EnumerateMonitorPortSettings FIXMEDOC
func (s *arduinoCoreServerImpl) EnumerateMonitorPortSettings(ctx context.Context, req *rpc.EnumerateMonitorPortSettingsRequest) (*rpc.EnumerateMonitorPortSettingsResponse, error) {
return EnumerateMonitorPortSettings(ctx, req)
}
// CheckForArduinoCLIUpdates FIXMEDOC // CheckForArduinoCLIUpdates FIXMEDOC
func (s *arduinoCoreServerImpl) CheckForArduinoCLIUpdates(ctx context.Context, req *rpc.CheckForArduinoCLIUpdatesRequest) (*rpc.CheckForArduinoCLIUpdatesResponse, error) { func (s *arduinoCoreServerImpl) CheckForArduinoCLIUpdates(ctx context.Context, req *rpc.CheckForArduinoCLIUpdatesRequest) (*rpc.CheckForArduinoCLIUpdatesResponse, error) {
return updatecheck.CheckForArduinoCLIUpdates(ctx, req) return updatecheck.CheckForArduinoCLIUpdates(ctx, req)
......
...@@ -25,7 +25,7 @@ import ( ...@@ -25,7 +25,7 @@ import (
) )
// EnumerateMonitorPortSettings returns a description of the configuration settings of a monitor port // EnumerateMonitorPortSettings returns a description of the configuration settings of a monitor port
func EnumerateMonitorPortSettings(ctx context.Context, req *rpc.EnumerateMonitorPortSettingsRequest) (*rpc.EnumerateMonitorPortSettingsResponse, error) { func (s *arduinoCoreServerImpl) EnumerateMonitorPortSettings(ctx context.Context, req *rpc.EnumerateMonitorPortSettingsRequest) (*rpc.EnumerateMonitorPortSettingsResponse, error) {
pme, release, err := instances.GetPackageManagerExplorer(req.GetInstance()) pme, release, err := instances.GetPackageManagerExplorer(req.GetInstance())
if err != nil { if err != nil {
return nil, err return nil, err
......
...@@ -41,7 +41,7 @@ import ( ...@@ -41,7 +41,7 @@ import (
// SupportedUserFields returns a SupportedUserFieldsResponse containing all the UserFields supported // SupportedUserFields returns a SupportedUserFieldsResponse containing all the UserFields supported
// by the upload tools needed by the board using the protocol specified in SupportedUserFieldsRequest. // by the upload tools needed by the board using the protocol specified in SupportedUserFieldsRequest.
func SupportedUserFields(ctx context.Context, req *rpc.SupportedUserFieldsRequest) (*rpc.SupportedUserFieldsResponse, error) { func (s *arduinoCoreServerImpl) SupportedUserFields(ctx context.Context, req *rpc.SupportedUserFieldsRequest) (*rpc.SupportedUserFieldsResponse, error) {
if req.GetProtocol() == "" { if req.GetProtocol() == "" {
return nil, &cmderrors.MissingPortProtocolError{} return nil, &cmderrors.MissingPortProtocolError{}
} }
......
...@@ -25,7 +25,7 @@ import ( ...@@ -25,7 +25,7 @@ import (
) )
// ListProgrammersAvailableForUpload FIXMEDOC // ListProgrammersAvailableForUpload FIXMEDOC
func ListProgrammersAvailableForUpload(ctx context.Context, req *rpc.ListProgrammersAvailableForUploadRequest) (*rpc.ListProgrammersAvailableForUploadResponse, error) { func (s *arduinoCoreServerImpl) ListProgrammersAvailableForUpload(ctx context.Context, req *rpc.ListProgrammersAvailableForUploadRequest) (*rpc.ListProgrammersAvailableForUploadResponse, error) {
pme, release, err := instances.GetPackageManagerExplorer(req.GetInstance()) pme, release, err := instances.GetPackageManagerExplorer(req.GetInstance())
if err != nil { if err != nil {
return nil, err return nil, err
......
...@@ -18,7 +18,6 @@ package arguments ...@@ -18,7 +18,6 @@ package arguments
import ( import (
"context" "context"
"github.com/arduino/arduino-cli/commands"
f "github.com/arduino/arduino-cli/internal/algorithms" f "github.com/arduino/arduino-cli/internal/algorithms"
"github.com/arduino/arduino-cli/internal/cli/instance" "github.com/arduino/arduino-cli/internal/cli/instance"
rpc "github.com/arduino/arduino-cli/rpc/cc/arduino/cli/commands/v1" rpc "github.com/arduino/arduino-cli/rpc/cc/arduino/cli/commands/v1"
...@@ -58,7 +57,7 @@ func GetInstalledProgrammers(ctx context.Context, srv rpc.ArduinoCoreServiceServ ...@@ -58,7 +57,7 @@ func GetInstalledProgrammers(ctx context.Context, srv rpc.ArduinoCoreServiceServ
installedProgrammers := make(map[string]string) installedProgrammers := make(map[string]string)
for _, board := range list.GetBoards() { for _, board := range list.GetBoards() {
programmers, _ := commands.ListProgrammersAvailableForUpload(context.Background(), &rpc.ListProgrammersAvailableForUploadRequest{ programmers, _ := srv.ListProgrammersAvailableForUpload(ctx, &rpc.ListProgrammersAvailableForUploadRequest{
Instance: inst, Instance: inst,
Fqbn: board.GetFqbn(), Fqbn: board.GetFqbn(),
}) })
......
...@@ -253,7 +253,7 @@ func runCompileCommand(cmd *cobra.Command, args []string, srv rpc.ArduinoCoreSer ...@@ -253,7 +253,7 @@ func runCompileCommand(cmd *cobra.Command, args []string, srv rpc.ArduinoCoreSer
var uploadRes *rpc.UploadResult var uploadRes *rpc.UploadResult
if compileError == nil && uploadAfterCompile { if compileError == nil && uploadAfterCompile {
userFieldRes, err := commands.SupportedUserFields(context.Background(), &rpc.SupportedUserFieldsRequest{ userFieldRes, err := srv.SupportedUserFields(ctx, &rpc.SupportedUserFieldsRequest{
Instance: inst, Instance: inst,
Fqbn: fqbn, Fqbn: fqbn,
Protocol: port.GetProtocol(), Protocol: port.GetProtocol(),
......
...@@ -147,7 +147,7 @@ func runMonitorCmd( ...@@ -147,7 +147,7 @@ func runMonitorCmd(
feedback.FatalError(err, feedback.ErrGeneric) feedback.FatalError(err, feedback.ErrGeneric)
} }
enumerateResp, err := commands.EnumerateMonitorPortSettings(context.Background(), &rpc.EnumerateMonitorPortSettingsRequest{ enumerateResp, err := srv.EnumerateMonitorPortSettings(ctx, &rpc.EnumerateMonitorPortSettingsRequest{
Instance: inst, Instance: inst,
PortProtocol: portProtocol, PortProtocol: portProtocol,
Fqbn: fqbn, Fqbn: fqbn,
......
...@@ -118,7 +118,7 @@ func runUploadCommand(srv rpc.ArduinoCoreServiceServer, args []string, uploadFie ...@@ -118,7 +118,7 @@ func runUploadCommand(srv rpc.ArduinoCoreServiceServer, args []string, uploadFie
defaultProtocol := sketch.GetDefaultProtocol() defaultProtocol := sketch.GetDefaultProtocol()
fqbn, port := arguments.CalculateFQBNAndPort(&portArgs, &fqbnArg, inst, srv, defaultFQBN, defaultAddress, defaultProtocol) fqbn, port := arguments.CalculateFQBNAndPort(&portArgs, &fqbnArg, inst, srv, defaultFQBN, defaultAddress, defaultProtocol)
userFieldRes, err := commands.SupportedUserFields(context.Background(), &rpc.SupportedUserFieldsRequest{ userFieldRes, err := srv.SupportedUserFields(ctx, &rpc.SupportedUserFieldsRequest{
Instance: inst, Instance: inst,
Fqbn: fqbn, Fqbn: fqbn,
Protocol: port.GetProtocol(), Protocol: port.GetProtocol(),
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment