Documentation ¶
Index ¶
- Variables
- type ArgonOne
- type ArgonOnePowerMode
- type Command
- type CommandFunc
- type Config
- type Conn
- type ConnPool
- type DecodeFrameIteratorFunc
- type DecodeIteratorFunc
- type Display
- type Error
- type Event
- type Field
- type FilePoll
- type FilePollFlags
- type FilePollFunc
- type FontFace
- type FontFlags
- type FontManager
- type FontSize
- type FontSizeUnit
- type GPIO
- type GPIOEdge
- type GPIOMode
- type GPIOPin
- type GPIOPull
- type GPIOState
- type I2C
- type I2CBus
- type LIRC
- type LIRCEvent
- type LIRCMode
- type LIRCType
- type Logger
- type Measurement
- type Media
- type MediaCodec
- type MediaDecodeContext
- type MediaFlag
- type MediaFrame
- type MediaKey
- type MediaManager
- type MediaMetadata
- type MediaPacket
- type MediaStream
- type Metrics
- type PingService
- type PingStub
- type Platform
- type PlatformType
- type Point
- type Publisher
- type SPI
- type SPIDevice
- type SPIMode
- type Server
- type Service
- type ServiceStub
- type Size
- type Unit
- type Version
Constants ¶
This section is empty.
Variables ¶
var ( ZeroPoint = Point{0, 0} ZeroSize = Size{0, 0} )
Functions ¶
This section is empty.
Types ¶
type ArgonOne ¶
type ArgonOne interface { // Set fan duty cycle (0-100) SetFan(uint8) error // Set Power Mode SetPower(ArgonOnePowerMode) error }
type ArgonOnePowerMode ¶
type ArgonOnePowerMode uint
const ( ARGONONE_POWER_DEFAULT ArgonOnePowerMode = iota ARGONONE_POWER_ALWAYSON ARGONONE_POWER_UART )
func (ArgonOnePowerMode) String ¶
func (v ArgonOnePowerMode) String() string
type Command ¶
type Command interface { Name() string // Return command name Usage() string // Return usage information Args() []string // Return command arguments Run(context.Context) error // Run the command }
Command is determined from parsed arguments
type CommandFunc ¶
CommandFunc is the function signature for running a command
type Config ¶
type Config interface { Parse() error // Parse command line arguments Args() []string // Return arguments, not including flags Usage(string) // Print out usage for all or specific command Version() Version // Return version information // Define flags FlagString(string, string, string) *string FlagBool(string, bool, string) *bool FlagUint(string, uint, string) *uint FlagDuration(string, time.Duration, string) *time.Duration // Define commands Command(string, string, CommandFunc) error // Append a command with name and usage arguments // Get values GetString(string) string GetBool(string) bool GetUint(string) uint GetDuration(string) time.Duration GetCommand([]string) Command // Get command from provided arguments }
type Conn ¶
type Conn interface { // Addr returns the bound server address, or empty string if connection is closed Addr() string // Mutex Lock() // Lock during RPC call Unlock() // Unlock at end of RPC call // Methods ListServices(context.Context) ([]string, error) // Return a list of services supported NewStub(string) ServiceStub // Return the stub for a named service }
Conn is a connection to a remote server
type DecodeFrameIteratorFunc ¶
type DecodeFrameIteratorFunc func(MediaDecodeContext, MediaFrame) error
type DecodeIteratorFunc ¶
type DecodeIteratorFunc func(MediaDecodeContext, MediaPacket) error
type Display ¶
type Display interface { Id() uint16 // Return display number Name() string // Return name of the display Size() (uint32, uint32) // Return display size for nominated display number, or (0,0) if display does not exist PixelsPerInch() uint32 // Return the PPI (pixels-per-inch) for the display, or return zero if unknown }
Display implements a pixel-based display device
type Event ¶
type Event interface {
Name() string // Return name of the event
}
Event is an emitted event
type Field ¶
type Field interface { // Name returns field name Name() string // Kind returns kind of field or nil Kind() string // IsNil returns true if value is nil IsNil() bool // Value returns field value, or nil Value() interface{} // SetValue sets specific value and returns error if unsupported SetValue(interface{}) error // Copy returns a copy of the field Copy() Field }
type FilePoll ¶
type FilePoll interface { // Watch a file descriptor for changes Watch(uintptr, FilePollFlags, FilePollFunc) error // Unwatch a file descriptor Unwatch(uintptr) error }
type FilePollFlags ¶
type FilePollFlags uint
Read and Write flags
const ( FILEPOLL_FLAG_READ FilePollFlags = (1 << iota) // File descriptor ready for reading FILEPOLL_FLAG_WRITE // File descriptor ready for writing FILEPOLL_FLAG_NONE FilePollFlags = 0 FILEPOLL_FLAG_MIN FilePollFlags = FILEPOLL_FLAG_READ FILEPOLL_FLAG_MAX FilePollFlags = FILEPOLL_FLAG_WRITE )
func (FilePollFlags) String ¶
func (f FilePollFlags) String() string
func (FilePollFlags) StringFlag ¶
func (f FilePollFlags) StringFlag() string
type FilePollFunc ¶
type FilePollFunc func(uintptr, FilePollFlags)
FilePollFunc is the handler for file polling
type FontFace ¶
type FontFace interface { Name() string // Get Face Name (from the filename) Index() uint // Get Face Index NumFaces() uint // Get Number of faces within the file NumGlyphs() uint // Number of glyphs for the face Family() string // Return name of font family Style() string // Return style name of font face Flags() FontFlags // Return properties for face }
FontFace represents a typeface
type FontManager ¶
type FontManager interface { // Open a font face - first face at index 0 is loaded OpenFace(path string) (FontFace, error) // Open a font face - indexed within file of several faces OpenFaceAtIndex(path string, index uint) (FontFace, error) // Open font faces at path, checking to see if individual files should // be opened through a callback function OpenFacesAtPath(path string, callback func(manager FontManager, path string, info os.FileInfo) bool) error // Destroy a font face DestroyFace(FontFace) error // Return an array of font families which are loaded Families() []string // Return faces in a family and/or with a particular set of attributes Faces(family string, flags FontFlags) []FontFace }
FontManager for font management
type FontSize ¶
type FontSize struct { Size float32 Unit FontSizeUnit }
type FontSizeUnit ¶
type FontSizeUnit uint
const ( FONT_SIZE_PIXELS FontSizeUnit = iota FONT_SIZE_POINTS )
type GPIO ¶
type GPIO interface { // Return number of physical pins, or 0 if if cannot be returned // or nothing is known about physical pins NumberOfPhysicalPins() uint // Return array of available logical pins or nil if nothing is // known about pins Pins() []GPIOPin // Return logical pin for physical pin number. Returns // GPIO_PIN_NONE where there is no logical pin at that position // or we don't now about the physical pins PhysicalPin(uint) GPIOPin // Return physical pin number for logical pin. Returns 0 where there // is no physical pin for this logical pin, or we don't know anything // about the layout PhysicalPinForPin(GPIOPin) uint // Read pin state ReadPin(GPIOPin) GPIOState // Write pin state WritePin(GPIOPin, GPIOState) // Get pin mode GetPinMode(GPIOPin) GPIOMode // Set pin mode SetPinMode(GPIOPin, GPIOMode) // Set pull mode to pull down or pull up - will // return ErrNotImplemented if not supported SetPullMode(GPIOPin, GPIOPull) error // Start watching for rising and/or falling edge, // or stop watching when GPIO_EDGE_NONE is passed. // Will return ErrNotImplemented if not supported Watch(GPIOPin, GPIOEdge) error }
GPIO implements the GPIO interface for simple input and output
type GPIOPin ¶
type GPIOPin uint8 // GPIOPin is the logical GPIO pin
const ( // Invalid pin constant GPIO_PIN_NONE GPIOPin = 0xFF )
type GPIOPull ¶
type GPIOPull uint8 // GPIOPull is the GPIO Pin resistor configuration (pull up/down or floating)
type I2C ¶
type I2C interface { // Return all valid devices Devices() []I2CBus // Set current slave address SetSlave(I2CBus, uint8) error // Get current slave address GetSlave(I2CBus) uint8 // Return true if a slave was detected at a particular address DetectSlave(I2CBus, uint8) (bool, error) // Read and Write data directly Read(I2CBus) ([]byte, error) Write(I2CBus, []byte) (int, error) // Read Byte (8-bits), Word (16-bits) & Block ([]byte) from registers ReadUint8(bus I2CBus, reg uint8) (uint8, error) ReadInt8(bus I2CBus, reg uint8) (int8, error) ReadUint16(bus I2CBus, reg uint8) (uint16, error) ReadInt16(bus I2CBus, reg uint8) (int16, error) ReadBlock(bus I2CBus, reg, length uint8) ([]byte, error) // Write Byte (8-bits) and Word (16-bits) WriteUint8(bus I2CBus, reg, value uint8) error WriteInt8(bus I2CBus, reg uint8, value int8) error WriteUint16(bus I2CBus, reg uint8, value uint16) error WriteInt16(bus I2CBus, reg uint8, value int16) error }
I2C implements the I2C interface for sensors, etc.
type LIRC ¶
type LIRC interface { // Get receive and send modes RecvMode() LIRCMode SendMode() LIRCMode SetRecvMode(LIRCMode) error SetSendMode(LIRCMode) error // Receive parameters RecvDutyCycle() uint32 RecvResolutionMicros() uint32 // Receive parameters SetRecvTimeoutMs(uint32) error SetRecvTimeoutReports(bool) error SetRecvCarrierHz(uint32) error SetRecvCarrierRangeHz(min, max uint32) error // Send parameters SendDutyCycle() uint32 SetSendCarrierHz(uint32) error SetSendDutyCycle(uint32) error // Send Pulse Mode, values are in milliseconds PulseSend([]uint32) error }
LIRC implements the IR send & receive interface
type LIRCEvent ¶
type LIRCEvent interface { Event Type() LIRCType Mode() LIRCMode Value() interface{} // value is uint32 in ms when mode is LIRC_MODE_MODE2 }
LIRCEvent is a value from LIRC
type Logger ¶
type Logger interface { Print(args ...interface{}) // Output logging Debug(args ...interface{}) // Output debugging information Printf(fmt string, args ...interface{}) // Output logging with format Debugf(fmt string, args ...interface{}) // Output debugging with format IsDebug() bool // IsDebug returns true if debug flag is set }
Logger outputs information and debug messages
type Measurement ¶
type Measurement interface { Event Time() time.Time // Time returns the timestamp for the data point or time.Time{} Tags() []Field // Return the dimenstions/tags for the data point Metrics() []Field // Return the metrics for the data point }
Measurement is a single data point
type Media ¶
type Media interface { // Properties URL() *url.URL // Return URL for the media location Metadata() MediaMetadata // Return metadata Flags() MediaFlag // Return flags Streams() []MediaStream // Return streams StreamsForFlag(MediaFlag) []int // Return stream index for flag(s) // DecodeIterator loops over selected streams from media object DecodeIterator([]int, DecodeIteratorFunc) error // DecodeFrameIterator loops over decoded frames from media stream DecodeFrameIterator(MediaDecodeContext, MediaPacket, DecodeFrameIteratorFunc) error }
Media is an input or output
type MediaCodec ¶
type MediaCodec interface {
Flags() MediaFlag // Flags for the codec (Audio, Video, etc)
}
MediaCodec is the codec and parameters
type MediaDecodeContext ¶
type MediaDecodeContext interface { Stream() MediaStream // Origin of the packet Frame() int // Frame counter }
MediaDecodeContext provides packet data and streams for decoding frames of data
type MediaFlag ¶
type MediaFlag uint
const ( MEDIA_FLAG_ALBUM MediaFlag = (1 << iota) // Is part of an album MEDIA_FLAG_ALBUM_TRACK // Is an album track MEDIA_FLAG_ALBUM_COMPILATION // Album is a compliation MEDIA_FLAG_TVSHOW // Is part of a TV Show MEDIA_FLAG_TVSHOW_EPISODE // Is a TV Show episode MEDIA_FLAG_FILE // Is a file MEDIA_FLAG_VIDEO // Contains video MEDIA_FLAG_AUDIO // Contains audio MEDIA_FLAG_DATA // Contains data stream MEDIA_FLAG_ATTACHMENT // Contains attachment MEDIA_FLAG_ARTWORK // Contains artwork MEDIA_FLAG_CAPTIONS // Contains captions MEDIA_FLAG_NONE MediaFlag = 0 MEDIA_FLAG_MIN = MEDIA_FLAG_ALBUM MEDIA_FLAG_MAX = MEDIA_FLAG_CAPTIONS )
func (MediaFlag) FlagString ¶
type MediaFrame ¶
MediaFrame is a decoded audio or video frame
type MediaKey ¶
type MediaKey string
const ( MEDIA_KEY_BRAND_MAJOR MediaKey = "major_brand" // string MEDIA_KEY_BRAND_COMPATIBLE MediaKey = "compatible_brands" // string MEDIA_KEY_CREATED MediaKey = "creation_time" // time.Time MEDIA_KEY_ENCODER MediaKey = "encoder" // string MEDIA_KEY_ALBUM MediaKey = "album" // string MEDIA_KEY_ALBUM_ARTIST MediaKey = "artist" // string MEDIA_KEY_COMMENT MediaKey = "comment" // string MEDIA_KEY_COMPOSER MediaKey = "composer" // string MEDIA_KEY_COPYRIGHT MediaKey = "copyright" // string MEDIA_KEY_YEAR MediaKey = "date" // uint MEDIA_KEY_DISC MediaKey = "disc" // uint MEDIA_KEY_ENCODED_BY MediaKey = "encoded_by" // string MEDIA_KEY_FILENAME MediaKey = "filename" // string MEDIA_KEY_GENRE MediaKey = "genre" // string MEDIA_KEY_LANGUAGE MediaKey = "language" // string MEDIA_KEY_PERFORMER MediaKey = "performer" // string MEDIA_KEY_PUBLISHER MediaKey = "publisher" // string MEDIA_KEY_SERVICE_NAME MediaKey = "service_name" // string MEDIA_KEY_SERVICE_PROVIDER MediaKey = "service_provider" // string MEDIA_KEY_TITLE MediaKey = "title" // string MEDIA_KEY_TRACK MediaKey = "track" // uint MEDIA_KEY_VERSION_MAJOR MediaKey = "major_version" // string MEDIA_KEY_VERSION_MINOR MediaKey = "minor_version" // string MEDIA_KEY_SHOW MediaKey = "show" // string MEDIA_KEY_SEASON MediaKey = "season_number" // uint MEDIA_KEY_EPISODE_SORT MediaKey = "episode_sort" // string MEDIA_KEY_EPISODE_ID MediaKey = "episode_id" // uint MEDIA_KEY_COMPILATION MediaKey = "compilation" // bool MEDIA_KEY_GAPLESS_PLAYBACK MediaKey = "gapless_playback" // bool MEDIA_KEY_ACCOUNT_ID MediaKey = "account_id" // string MEDIA_KEY_DESCRIPTION MediaKey = "description" // string MEDIA_KEY_MEDIA_TYPE MediaKey = "media_type" // string MEDIA_KEY_PURCHASED MediaKey = "purchase_date" // time.Time MEDIA_KEY_ALBUM_SORT MediaKey = "sort_album" // string MEDIA_KEY_ARTIST_SORT MediaKey = "sort_artist" // string MEDIA_KEY_TITLE_SORT MediaKey = "sort_name" // string MEDIA_KEY_SYNOPSIS MediaKey = "synopsis" // string MEDIA_KEY_GROUPING MediaKey = "grouping" // string )
type MediaManager ¶
type MediaManager interface { OpenFile(path string) (Media, error) // Open a media file CreateFile(path string) (Media, error) // Create an output file Close(Media) error // Close a media object }
MediaManager for media file management
type MediaMetadata ¶
type MediaMetadata interface { Keys() []MediaKey // Return all existing keys Value(MediaKey) interface{} // Return value for key, or nil }
MediaMetadata are key value pairs for a media object
type MediaPacket ¶
MediaPacket is a packet of data from a stream
type MediaStream ¶
type MediaStream interface { Index() int // Stream index Flags() MediaFlag // Flags for the stream (Audio, Video, etc) Codec() MediaCodec // Return codec and parameters }
MediaStream is a stream of packets from a media object
type Metrics ¶
type Metrics interface { // Define a measurement with metric definitions and optional tag fields NewMeasurement(string, string, ...Field) (Measurement, error) // NewFields returns array of fields NewFields(...string) []Field // Emit metrics for a named measurement, omitting timestamp Emit(string, ...interface{}) error // EmitTS emits metrics for a named measurement, with defined timestamp EmitTS(string, time.Time, ...interface{}) error // Measurements returns array of all defined measurements Measurements() []Measurement }
Metrics provides a mechanism for defining measurements and emitting data, which may be time-series based and include tags/dimensions (which are indexed) and metrics (which are not)
type PingService ¶
type PingService interface { Service }
type Platform ¶
type Platform interface { Product() string // Product returns product name Type() PlatformType // Type returns flags identifying platform type SerialNumber() string // SerialNumber returns unique serial number for host Uptime() time.Duration // Uptime returns uptime for host LoadAverages() (float64, float64, float64) // LoadAverages returns 1, 5 and 15 minute load averages TemperatureZones() map[string]float32 // Return celcius values for zones NumberOfDisplays() uint // NumberOfDisplays returns the number of possible displays for this host AttachedDisplays() []uint // AttachedDisplays returns array of displays which are connected }
type PlatformType ¶
type PlatformType uint32
const ( PLATFORM_NONE PlatformType = 0 // OS PLATFORM_DARWIN PlatformType = (1 << iota) >> 1 PLATFORM_RPI PLATFORM_LINUX // CPU PLATFORM_X86_32 PLATFORM_X86_64 PLATFORM_BCM2835_ARM6 PLATFORM_BCM2836_ARM7 PLATFORM_BCM2837_ARM8 PLATFORM_BCM2838_ARM8 // MIN AND MAX PLATFORM_MIN = PLATFORM_DARWIN PLATFORM_MAX = PLATFORM_BCM2838_ARM8 )
func (PlatformType) FlagString ¶
func (p PlatformType) FlagString() string
func (PlatformType) String ¶
func (p PlatformType) String() string
type Publisher ¶
type Publisher interface { // Emit an event, which can block if second argument is true Emit(Event, bool) error // Subscribe to events Subscribe() <-chan Event // Unsubscribe from events Unsubscribe(<-chan Event) }
Publisher emits events and allows for subscribing to emitted events
type SPI ¶
type SPI interface { Mode() SPIMode // Get SPI mode MaxSpeedHz() uint32 // Get SPI speed BitsPerWord() uint8 // Get Bits Per Word SetMode(SPIMode) error // Set SPI mode SetMaxSpeedHz(uint32) error // Set SPI speed SetBitsPerWord(uint8) error // Set Bits Per Word Transfer(send []byte) ([]byte, error) // Read/Write Read(len uint32) ([]byte, error) // Read Write(send []byte) error // Write }
SPI implements the SPI interface for sensors, etc.
type SPIMode ¶
type SPIMode uint8 // SPIMode is the SPI Mode
const ( SPI_MODE_CPHA SPIMode = 0x01 SPI_MODE_CPOL SPIMode = 0x02 SPI_MODE_0 SPIMode = 0x00 SPI_MODE_1 SPIMode = (0x00 | SPI_MODE_CPHA) SPI_MODE_2 SPIMode = (SPI_MODE_CPOL | 0x00) SPI_MODE_3 SPIMode = (SPI_MODE_CPOL | SPI_MODE_CPHA) SPI_MODE_NONE SPIMode = 0xFF )
type Server ¶
type Server interface { RegisterService(interface{}, Service) error // Register an RPC service StartInBackground(network, addr string) error // Start server in background and return Stop(bool) error // Stop server, when argument is true forcefully disconnects any clients Addr() string // Addr returns the address of the server, or empty if not connected }
Server is a generic gRPC server, which can serve registered services
type Service ¶
type Service interface {
CancelStreams()
}
Service defines an RPC service, which can cancel any on-going streams when server stops
type ServiceStub ¶
type ServiceStub interface {
New(Conn)
}
ServiceStub is a client-side stub used to invoke remote service methods