Documentation ¶
Index ¶
- Constants
- Variables
- func CategoriesGoCode(cats []*gen.CategoryMetadata) ([]byte, error)
- func CharacteristicFileName(char *gen.CharacteristicMetadata) string
- func CharacteristicGoCode(char *gen.CharacteristicMetadata) ([]byte, error)
- func CharacteristicLocalFilePath(char *gen.CharacteristicMetadata) string
- func CharacteristicRelativeFilePath(char *gen.CharacteristicMetadata) string
- func ServiceFileName(svc *gen.ServiceMetadata) string
- func ServiceGoCode(svc *gen.ServiceMetadata, chars []*gen.CharacteristicMetadata) ([]byte, error)
- func ServiceLocalFilePath(sv *gen.ServiceMetadata) string
- func ServiceRelativeFilePath(sv *gen.ServiceMetadata) string
- type ByValue
- type Categories
- type Category
- type Characteristic
- type ConstDecl
- type Service
Constants ¶
const CatsStructTemplate = `` /* 156-byte string literal not displayed */
CatsStructTemplate is template for a categories struct.
const CharStructTemplate = `` /* 785-byte string literal not displayed */
CharStructTemplate is template for a characteristic struct.
const ServiceStructTemplate = `` /* 553-byte string literal not displayed */
ServiceStructTemplate is template for a service struct.
Variables ¶
var ( ServiceLocalDir = filepath.Join(libPath, "service") CharacteristicLocalDir = filepath.Join(libPath, "characteristic") ServiceDir = "service" CharacteristicDir = "characteristic" )
Functions ¶
func CategoriesGoCode ¶
func CategoriesGoCode(cats []*gen.CategoryMetadata) ([]byte, error)
CategoriesGoCode returns the go code for a categories file
func CharacteristicFileName ¶
func CharacteristicFileName(char *gen.CharacteristicMetadata) string
FileName returns the filename for a characteristic
func CharacteristicGoCode ¶
func CharacteristicGoCode(char *gen.CharacteristicMetadata) ([]byte, error)
CharacteristicGoCode returns the o code for a characteristic file
func CharacteristicLocalFilePath ¶
func CharacteristicLocalFilePath(char *gen.CharacteristicMetadata) string
CharacteristicLocalFilePath returns the filepath to a characteristic
func CharacteristicRelativeFilePath ¶
func CharacteristicRelativeFilePath(char *gen.CharacteristicMetadata) string
CharacteristicRelativeFilePath returns the relative filepath to a characteristic
func ServiceFileName ¶
func ServiceFileName(svc *gen.ServiceMetadata) string
FileName returns the filename for a characteristic
func ServiceGoCode ¶
func ServiceGoCode(svc *gen.ServiceMetadata, chars []*gen.CharacteristicMetadata) ([]byte, error)
ServiceGoCode returns the o code for a characteristic file
func ServiceLocalFilePath ¶
func ServiceLocalFilePath(sv *gen.ServiceMetadata) string
ServiceLocalFilePath returns the filepath to a service
func ServiceRelativeFilePath ¶
func ServiceRelativeFilePath(sv *gen.ServiceMetadata) string
ServiceRelativeFilePath returns the relative filepath to a service
Types ¶
type ByValue ¶
type ByValue []ConstDecl
ByValue defines a type for sorting const declarations by value by Impelementing the sort.Interface interface
type Categories ¶
type Categories struct {
Consts []*Category
}
func NewCategories ¶
func NewCategories(cats []*gen.CategoryMetadata) *Categories
type Category ¶
func NewCategory ¶
func NewCategory(cat *gen.CategoryMetadata) *Category
type Characteristic ¶
type Characteristic struct { Name string // Name of the characteristic EmbeddedStructName string // Name of the embedded struct (e.g. Int) FormatTypeName string // Name of the format type (e.g. FormatInt32) StructName string // Name of the struct (e.g. Brightness) FileName string // Name of the file (e.g. brightness.go) LocalFilePath string // Path to the file (e.g. ~/User/Go/src/github.com/MrEhbr/hc/characteristic/brightness.go) RelFilePath string // Relative path to the file from the project root (e.g. characteristic/brightness.go) PermsDecl string // Permissions declaration (e.g. []string{PermRead, PermWrite, PermEvents}) TypeName string // Name of type e.g. TypeBrightness TypeValue string // Value of the type e.g. 00000008-0000-1000-8000-0026BB765291 DefaultValue interface{} // e.g. 0 MinValue interface{} // e.g. 0 MaxValue interface{} // e.g. 100 StepValue interface{} // e.g. 1 UnitName string // Name of the unit e.g. UnitPercentage Consts []ConstDecl }
Characteristic holds characteristic template data
func NewCharacteristic ¶
func NewCharacteristic(char *gen.CharacteristicMetadata) *Characteristic
func (Characteristic) HasConsts ¶
func (d Characteristic) HasConsts() bool
HasConsts returns true if characteristic has const declarations
func (Characteristic) HasDefaultValue ¶
func (d Characteristic) HasDefaultValue() bool
HasDefaultValue returns true if characteristic has a default value
func (Characteristic) HasMaxValue ¶
func (d Characteristic) HasMaxValue() bool
HasMaxValue returns true if characteristic has a max value
func (Characteristic) HasMinValue ¶
func (d Characteristic) HasMinValue() bool
HasMinValue returns true if characteristic has a min value
func (Characteristic) HasStepValue ¶
func (d Characteristic) HasStepValue() bool
HasStepValue returns true if characteristic has a step value
type Service ¶
type Service struct { Name string // Name of the service (e.g. Light bulb) StructName string // Name of the struct (e.g. Lightbulb) FileName string // Name of the file (e.g. lightbulb.go) LocalFilePath string // Path to the file (e.g. ~/User/Go/src/github.com/MrEhbr/hc/service/lightbulb.go) RelFilePath string // Relative path to the file from the project root (e.g. service/lightbulb.go) TypeName string // Name of type e.g. TypeLightbulb TypeValue string // Value of the type e.g. 00000008-0000-1000-8000-0026BB765291 Chars []*Characteristic Optional []*Characteristic }
Service holds service template data
func ServiceDecl ¶
func ServiceDecl(svc *gen.ServiceMetadata, chars []*gen.CharacteristicMetadata) *Service