core

package
v2.0.8 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jul 28, 2020 License: GPL-3.0 Imports: 20 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type ArdiConfig

type ArdiConfig struct {
	// contains filtered or unexported fields
}

ArdiConfig represents core module for ardi.json manipulation

func NewArdiConfig

func NewArdiConfig(confPath string, initialConfig types.ArdiConfig, logger *log.Logger) *ArdiConfig

NewArdiConfig returns core json module for handling ardi.json config

func (*ArdiConfig) AddBoardURL

func (a *ArdiConfig) AddBoardURL(url string) error

AddBoardURL to ardi.json

func (*ArdiConfig) AddBuild

func (a *ArdiConfig) AddBuild(name, sketch, fqbn string, buildProps []string) error

AddBuild to ardi.json

func (*ArdiConfig) AddLibrary

func (a *ArdiConfig) AddLibrary(name, version string) error

AddLibrary to ardi.json

func (*ArdiConfig) AddPlatform

func (a *ArdiConfig) AddPlatform(platform, version string) error

AddPlatform to ardi.json

func (*ArdiConfig) GetBoardURLS

func (a *ArdiConfig) GetBoardURLS() []string

GetBoardURLS returns board urls specified in config

func (*ArdiConfig) GetBuilds

func (a *ArdiConfig) GetBuilds() map[string]types.ArdiBuild

GetBuilds returns builds specified in config

func (*ArdiConfig) GetCompileOpts

func (a *ArdiConfig) GetCompileOpts(buildName string) (*rpc.CompileOpts, error)

GetCompileOpts returns appropriate compile options for an ardi build

func (*ArdiConfig) GetLibraries

func (a *ArdiConfig) GetLibraries() map[string]string

GetLibraries returns libraries specired in config

func (*ArdiConfig) GetPlatforms

func (a *ArdiConfig) GetPlatforms() map[string]string

GetPlatforms returns platforms specified in config

func (*ArdiConfig) ListBoardURLS

func (a *ArdiConfig) ListBoardURLS()

ListBoardURLS lists all board urls in config

func (*ArdiConfig) ListBuilds

func (a *ArdiConfig) ListBuilds(builds []string)

ListBuilds lists build specifications in ardi.json

func (*ArdiConfig) ListLibraries

func (a *ArdiConfig) ListLibraries()

ListLibraries lists installed libraries

func (*ArdiConfig) ListPlatforms

func (a *ArdiConfig) ListPlatforms()

ListPlatforms lists all board urls in config

func (*ArdiConfig) RemoveBoardURL

func (a *ArdiConfig) RemoveBoardURL(url string) error

RemoveBoardURL from ardi.json

func (*ArdiConfig) RemoveBuild

func (a *ArdiConfig) RemoveBuild(build string) error

RemoveBuild removes specified build from ardi.json

func (*ArdiConfig) RemoveLibrary

func (a *ArdiConfig) RemoveLibrary(name string) error

RemoveLibrary from ardi.json

func (*ArdiConfig) RemovePlatform

func (a *ArdiConfig) RemovePlatform(platform string) error

RemovePlatform from ardi.json

type ArdiCore

type ArdiCore struct {
	RPCClient rpc.Client
	Config    *ArdiConfig
	CliConfig *ArdiYAML
	Watcher   *WatchCore
	Board     *BoardCore
	Compiler  *CompileCore
	Uploader  *UploadCore
	Lib       *LibCore
	Platform  *PlatformCore
	// contains filtered or unexported fields
}

ArdiCore represents the core package of ardi

func NewArdiCore

func NewArdiCore(opts NewArdiCoreOpts) *ArdiCore

NewArdiCore returns a new ardi core

func (*ArdiCore) CompileArdiBuild

func (c *ArdiCore) CompileArdiBuild(buildOpts CompileArdiBuildOpts) (*rpc.CompileOpts, *rpc.Board, error)

CompileArdiBuild compiles specified build from ardi.json

func (*ArdiCore) CompileSketch

func (c *ArdiCore) CompileSketch(sketchOpts CompileSketchOpts) (*rpc.CompileOpts, *rpc.Board, error)

CompileSketch compiles specified sketch directory or sketch file

func (*ArdiCore) GetTargetBoard

func (c *ArdiCore) GetTargetBoard(fqbn string, onlyConnected bool) (*rpc.Board, error)

GetTargetBoard returns target info for a connected & disconnected boards

type ArdiSerialPort

type ArdiSerialPort struct {
	// contains filtered or unexported fields
}

ArdiSerialPort represents our serial port wrapper

func (*ArdiSerialPort) IsStreaming

func (p *ArdiSerialPort) IsStreaming() bool

IsStreaming returns whether or not we are currently printing logs from port

func (*ArdiSerialPort) Stop

func (p *ArdiSerialPort) Stop()

Stop printing serial port logs

func (*ArdiSerialPort) Watch

func (p *ArdiSerialPort) Watch() error

Watch connects to a serial port and prints any logs received.

type ArdiYAML

type ArdiYAML struct {
	Config types.ArduinoCliSettings
	// contains filtered or unexported fields
}

ArdiYAML represents core module for data config file manipulations

func NewArdiYAML

func NewArdiYAML(confPath string, initalConfig types.ArduinoCliSettings) *ArdiYAML

NewArdiYAML returns core yaml module for handling data config file

func (*ArdiYAML) AddBoardURL

func (a *ArdiYAML) AddBoardURL(url string) error

AddBoardURL add a board url to data config file

func (*ArdiYAML) RemoveBoardURL

func (a *ArdiYAML) RemoveBoardURL(url string) error

RemoveBoardURL remove a board url from data config file

type BoardCore

type BoardCore struct {
	// contains filtered or unexported fields
}

BoardCore module for board commands

func NewBoardCore

func NewBoardCore(client rpc.Client, logger *log.Logger) *BoardCore

NewBoardCore module instance for board commands

func (*BoardCore) FQBNS

func (b *BoardCore) FQBNS(query string) error

FQBNS lists all available boards with associated fqbns

func (*BoardCore) Platforms

func (b *BoardCore) Platforms(query string) error

Platforms lists all available boards with associated platorms

type CompileArdiBuildOpts

type CompileArdiBuildOpts struct {
	BuildName           string
	OnlyConnectedBoards bool
}

CompileArdiBuildOpts options for compiling a build specified in ardi.json

type CompileCore

type CompileCore struct {
	// contains filtered or unexported fields
}

CompileCore represents core module for compile commands

func NewCompileCore

func NewCompileCore(client rpc.Client, logger *log.Logger) *CompileCore

NewCompileCore instance of core module for compile commands

func (*CompileCore) Compile

func (c *CompileCore) Compile(opts rpc.CompileOpts) error

Compile compiles a given project sketch

func (*CompileCore) IsCompiling

func (c *CompileCore) IsCompiling() bool

IsCompiling returns if core is currently compiling

func (*CompileCore) WatchForChanges

func (c *CompileCore) WatchForChanges(opts rpc.CompileOpts) error

WatchForChanges watches sketch for changes and recompiles

type CompileSketchOpts

type CompileSketchOpts struct {
	Sketch              string
	FQBN                string
	BuildPros           []string
	ShowProps           bool
	OnlyConnectedBoards bool
}

CompileSketchOpts options for compiling sketch directory or file

type FileWatcher

type FileWatcher struct {
	// contains filtered or unexported fields
}

FileWatcher watches sketch files for changes and runs user defined actions

func NewFileWatcher

func NewFileWatcher(file string, logger *log.Logger) (*FileWatcher, error)

NewFileWatcher returns a new sketch watcher instance

func (*FileWatcher) AddListener

func (f *FileWatcher) AddListener(l Listener)

AddListener adds an action to run on file change

func (*FileWatcher) Close

func (f *FileWatcher) Close()

Close closes the os watcher, watcher can not be restarted

func (*FileWatcher) Restart

func (f *FileWatcher) Restart()

Restart restarts existing watcher

func (*FileWatcher) Stop

func (f *FileWatcher) Stop()

Stop stops watching file with ability to restart at any time

func (*FileWatcher) Watch

func (f *FileWatcher) Watch() error

Watch watches the file for changes and runs user defined actions

type LibCore

type LibCore struct {
	// contains filtered or unexported fields
}

LibCore core module for lib commands

func NewLibCore

func NewLibCore(client rpc.Client, logger *log.Logger) *LibCore

NewLibCore Lib instance

func (*LibCore) Add

func (l *LibCore) Add(lib string) (string, string, error)

Add library for project

func (*LibCore) ListInstalled

func (l *LibCore) ListInstalled() error

ListInstalled lists all installed libraries

func (*LibCore) Remove

func (l *LibCore) Remove(library string) error

Remove library either globally or for project

func (*LibCore) Search

func (l *LibCore) Search(searchArg string) error

Search all available libraries with optional search filter

type Listener

type Listener = func()

Listener represents and action to run on file change

type NewArdiCoreOpts

type NewArdiCoreOpts struct {
	Global             bool
	ArdiConfig         types.ArdiConfig
	ArduinoCliSettings types.ArduinoCliSettings
	Client             rpc.Client
	Logger             *log.Logger
}

NewArdiCoreOpts options fore creating new ardi core

type PlatformCore

type PlatformCore struct {
	// contains filtered or unexported fields
}

PlatformCore module for platform commands

func NewPlatformCore

func NewPlatformCore(client rpc.Client, logger *log.Logger) *PlatformCore

NewPlatformCore platform module instance

func (*PlatformCore) Add

func (p *PlatformCore) Add(platform string) (string, string, error)

Add installs specified platforms

func (*PlatformCore) ListAll

func (p *PlatformCore) ListAll() error

ListAll lists all available platforms

func (*PlatformCore) ListInstalled

func (p *PlatformCore) ListInstalled() error

ListInstalled lists only installed platforms

func (*PlatformCore) Remove

func (p *PlatformCore) Remove(platform string) (string, error)

Remove uninstalls specified platforms

type SerialPort

type SerialPort interface {
	Watch() error
	Stop()
	IsStreaming() bool
}

SerialPort represents a board port on which to stream logs

func NewArdiSerialPort

func NewArdiSerialPort(name string, baud int, logger *log.Logger) SerialPort

NewArdiSerialPort returns instance of serial port wrapper

type UploadCore

type UploadCore struct {
	// contains filtered or unexported fields
}

UploadCore represents core module for ardi upload commands

func NewUploadCore

func NewUploadCore(client rpc.Client, logger *log.Logger) *UploadCore

NewUploadCore returns new ardi upload core

func (*UploadCore) Attach

func (u *UploadCore) Attach(device string, baud int, port SerialPort)

Attach attaches to the associated board port and prints logs

func (*UploadCore) IsUploading

func (u *UploadCore) IsUploading() bool

IsUploading returns whether or not core is currently uploading

func (*UploadCore) Upload

func (u *UploadCore) Upload(board *rpc.Board, buildDir string) error

Upload compiled sketches to the specified board

type WatchCore

type WatchCore struct {
	// contains filtered or unexported fields
}

WatchCore represents core module for adi go commands

func NewWatchCore

func NewWatchCore(compiler *CompileCore, uploader *UploadCore, logger *log.Logger) *WatchCore

NewWatchCore returns new Project instance

func (*WatchCore) SetTargets

func (w *WatchCore) SetTargets(targets WatchCoreTargets) error

SetTargets sets the board and compile options for the watcher

func (*WatchCore) Stop

func (w *WatchCore) Stop()

Stop deletes watcher and unattaches from port

func (*WatchCore) Watch

func (w *WatchCore) Watch() error

Watch responds to changes in a given sketch file by automatically recompiling and re-uploading.

type WatchCoreTargets

type WatchCoreTargets struct {
	Board       *rpc.Board
	CompileOpts *rpc.CompileOpts
	Baud        int
	Port        SerialPort
}

WatchCoreTargets targets for watching, recompiling, and reuploading

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL