Documentation
¶
Index ¶
- Variables
- func BuildDevice(env Project, options *BuildOptions) (err error)
- func CreateDevice(project Project, deviceJson string, deviceDir string, deviceName string) error
- func InstallContribution(project Project, path string, version string) error
- func InstallLibs(project Project, libs []*Lib) error
- func PrepareDevice(project Project, options *PrepareOptions) (err error)
- func RenderTemplate(w io.Writer, tpl string, data interface{}) error
- func UploadDevice(env Project) error
- func Usage()
- type ActionConfig
- type ActionContrib
- type ActivityActionConfig
- type ActivityConfig
- type ActivityContrib
- type ActivityDescriptor
- type BuildOptions
- type BuildPreProcessor
- type Descriptor
- type DeviceDetails
- type DevicePlatform
- type DeviceProfile
- type DeviceSupportDetails
- type FlogoDeviceDescriptor
- type FlowActionConfig
- type FlowTree
- type Lib
- type PioProject
- func (*PioProject) Build() error
- func (*PioProject) Clean() error
- func (p *PioProject) Create() error
- func (p *PioProject) GetContributionDir() string
- func (p *PioProject) GetLibDir() string
- func (p *PioProject) GetRootDir() string
- func (p *PioProject) GetSourceDir() string
- func (p *PioProject) Init(basePath string) error
- func (p *PioProject) InstallContribution(depPath string, version string) error
- func (p *PioProject) InstallLib(name string, id int) error
- func (p *PioProject) Open() error
- func (p *PioProject) Setup(board string) error
- func (p *PioProject) UninstallContribution(depPath string) error
- func (*PioProject) Upload() error
- type PlatformFeature
- type PrepareOptions
- type Project
- type Setting
- type SettingsConfig
- type Task
- type TriggerConfig
- type TriggerContrib
- type TriggerDescriptor
- type WithSettings
Constants ¶
This section is empty.
Variables ¶
var (
CommandRegistry = cli.NewCommandRegistry()
)
var DeviceFuncMap = template.FuncMap{ "val": func(name string, value interface{}) map[string]interface{} { val := make(map[string]interface{}, 1) val[name] = value return val }, "setting": func(ctx interface{}, key string) string { config := ctx.(WithSettings) return config.GetSetting(key) }, "settingb": func(ctx interface{}, key string) bool { config := ctx.(WithSettings) val, _ := strconv.ParseBool(config.GetSetting(key)) return val }, "debug": func(ctx interface{}) bool { config := ctx.(WithSettings) debug := config.GetSetting("device:debug") return debug == "true" }, }
Functions ¶
func BuildDevice ¶
func BuildDevice(env Project, options *BuildOptions) (err error)
BuildDevice build the flogo application
func CreateDevice ¶
CreateDevice creates an device project from the specified json device descriptor
func InstallContribution ¶
InstallDependency install a dependency
func InstallLibs ¶
func PrepareDevice ¶
func PrepareDevice(project Project, options *PrepareOptions) (err error)
PrepareDevice do all pre-build setup and pre-processing
func RenderTemplate ¶
RenderFileTemplate renders the specified template
Types ¶
type ActionConfig ¶
type ActionConfig struct {
Id string `json:"id"`
Ref string `json:"ref"`
Data json.RawMessage `json:"data"`
}
Config is the configuration for the Action
type ActionContrib ¶
func LoadActionContrib ¶
func LoadActionContrib(proj Project, ref string) (*ActionContrib, error)
func RegisterActionContrib ¶
func RegisterActionContrib(ref string, tpl string) *ActionContrib
todo move to contrib contributions
func (*ActionContrib) GetActivities ¶
func (ac *ActionContrib) GetActivities(tree *FlowTree) []*ActivityContrib
type ActivityActionConfig ¶
type ActivityActionConfig struct {
UseTriggerVal bool `json:"useTriggerVal"`
Activity *ActivityConfig `json:"activity"`
}
todo hardcoded for now, should be generated from action-ref
type ActivityConfig ¶
type ActivityConfig struct {
Id string `json:"id"`
Ref string `json:"ref"`
Attributes map[string]string `json:"attributes"`
}
func (*ActivityConfig) GetSetting ¶
func (ac *ActivityConfig) GetSetting(key string) string
type ActivityContrib ¶
type ActivityContrib struct {
Template string
Descriptor *ActivityDescriptor
}
func LoadActivityContrib ¶
func LoadActivityContrib(proj Project, ref string) (*ActivityContrib, error)
func (*ActivityContrib) Libs ¶
func (ac *ActivityContrib) Libs() []*Lib
type ActivityDescriptor ¶
type ActivityDescriptor struct {
*Descriptor
Ref string `json:"ref"`
Libs []*Lib `json:"libs"`
Settings []*Setting `json:"settings"`
DeviceSupport []*DeviceSupportDetails `json:"device_support"`
}
func ParseActivityDescriptor ¶
func ParseActivityDescriptor(contribJson string) (contrib *ActivityDescriptor, err error)
ParseActivityDescriptor parse the device activity descriptor
type BuildOptions ¶
type BuildOptions struct {
*PrepareOptions
SkipPrepare bool
}
type BuildPreProcessor ¶
BuildPreProcessor interface for build pre-processors
type Descriptor ¶
type DeviceDetails ¶
type DeviceDetails struct {
Profile string `json:"profile"`
MqttEnabled bool `json:"mqtt_enabled"`
Settings map[string]string `json:"settings"`
Actions []*ActionConfig `json:"actions"`
Triggers []*TriggerConfig `json:"triggers"`
}
FlogoAppDescriptor is the descriptor for a Flogo application
type DevicePlatform ¶
type DevicePlatform struct {
*Descriptor
Framework string `json:"arduino"`
MainTemplate string `json:"main_template"`
WifiDetails []*PlatformFeature `json:"wifi"`
MqttDetails *PlatformFeature `json:"mqtt"`
}
func GetDevicePlatform ¶
func GetDevicePlatform(proj Project, ref string) (*DevicePlatform, error)
func ParseDevicePlatform ¶
func ParseDevicePlatform(platformJson string) (*DevicePlatform, error)
ParseDeviceProfile parse the device platform
type DeviceProfile ¶
type DeviceProfile struct {
*Descriptor
Board string `json:"board"`
Platform string `json:"platform"`
PlatformWifi string `json:"platform_wifi"`
}
func GetDeviceProfile ¶
func GetDeviceProfile(proj Project, ref string) (*DeviceProfile, error)
func ParseDeviceProfile ¶
func ParseDeviceProfile(profileJson string) (*DeviceProfile, error)
ParseDeviceProfile parse the device profile
type DeviceSupportDetails ¶
type FlogoDeviceDescriptor ¶
type FlogoDeviceDescriptor struct {
*Descriptor
Device *DeviceDetails `json:"device"`
Actions []*ActionConfig `json:"actions"`
Triggers []*TriggerConfig `json:"triggers"`
}
FlogoAppDescriptor is the descriptor for a Flogo application
func ParseDeviceDescriptor ¶
func ParseDeviceDescriptor(deviceJson string) (*FlogoDeviceDescriptor, error)
ParseDeviceDescriptor parse the device descriptor
type FlowActionConfig ¶
type FlowActionConfig struct {
Flow map[string]interface{} `json:"flow"`
}
todo hardcoded for now, should be generated from action-ref
type PioProject ¶
func (*PioProject) Build ¶
func (*PioProject) Build() error
func (*PioProject) Clean ¶
func (*PioProject) Clean() error
func (*PioProject) Create ¶
func (p *PioProject) Create() error
func (*PioProject) GetContributionDir ¶
func (p *PioProject) GetContributionDir() string
func (*PioProject) GetLibDir ¶
func (p *PioProject) GetLibDir() string
func (*PioProject) GetRootDir ¶
func (p *PioProject) GetRootDir() string
func (*PioProject) GetSourceDir ¶
func (p *PioProject) GetSourceDir() string
func (*PioProject) Init ¶
func (p *PioProject) Init(basePath string) error
func (*PioProject) InstallContribution ¶
func (p *PioProject) InstallContribution(depPath string, version string) error
func (*PioProject) InstallLib ¶
func (p *PioProject) InstallLib(name string, id int) error
func (*PioProject) Open ¶
func (p *PioProject) Open() error
func (*PioProject) Setup ¶
func (p *PioProject) Setup(board string) error
func (*PioProject) UninstallContribution ¶
func (p *PioProject) UninstallContribution(depPath string) error
func (*PioProject) Upload ¶
func (*PioProject) Upload() error
type PlatformFeature ¶
type PrepareOptions ¶
type PrepareOptions struct {
PreProcessor BuildPreProcessor
}
type Project ¶
type Project interface {
// GetRootDir get the root directory of the project
GetRootDir() string
// GetSourceDir get the source directory of the project
GetSourceDir() string
// GetLibDir get the lib directory of the project
GetLibDir() string
// GetContributionDir get the contribution directory of the project
GetContributionDir() string
// Init initializes the project settings an validates it requirements
Init(path string) error
// Create the project directory and its structure
Create() error
// Setup the project directory
Setup(board string) error
// Open the project directory and validate its structure
Open() error
InstallLib(name string, id int) error
// InstallContribution install a contribution
InstallContribution(path string, version string) error
// UninstallContribution uninstall a contribution
UninstallContribution(path string) error
Build() error
Upload() error
Clean() error
}
func NewPlatformIoProject ¶
func NewPlatformIoProject() Project
func SetupExistingProjectEnv ¶
func SetupNewProjectEnv ¶
func SetupNewProjectEnv() Project
type SettingsConfig ¶
func (*SettingsConfig) GetSetting ¶
func (s *SettingsConfig) GetSetting(key string) string
type Task ¶
type Task struct {
Id int
FlowId string
ActivityRef string
Attributes map[string]string
Precondition string
NextTasks []*Task
// contains filtered or unexported fields
}
func (*Task) GetSetting ¶
type TriggerConfig ¶
type TriggerConfig struct {
Id string `json:"id"`
Ref string `json:"ref"`
ActionId string `json:"actionId"`
Settings map[string]string `json:"settings"`
}
TriggerConfig is the configuration for a Trigger
func (*TriggerConfig) GetSetting ¶
func (tc *TriggerConfig) GetSetting(key string) string
type TriggerContrib ¶
type TriggerContrib struct {
Template string
Descriptor *TriggerDescriptor
}
func LoadTriggerContrib ¶
func LoadTriggerContrib(proj Project, ref string) (*TriggerContrib, error)
func (*TriggerContrib) Libs ¶
func (tc *TriggerContrib) Libs() []*Lib
type TriggerDescriptor ¶
type TriggerDescriptor struct {
*Descriptor
Ref string `json:"ref"`
Libs []*Lib `json:"libs"`
Settings []*Setting `json:"settings"`
Outputs []*Setting `json:"outputs"`
DeviceSupport []*DeviceSupportDetails `json:"device_support"`
}
func ParseTriggerDescriptor ¶
func ParseTriggerDescriptor(contribJson string) (contrib *TriggerDescriptor, err error)
ParseTriggerDescriptor parse the device trigger descriptor