Documentation ¶
Index ¶
- Constants
- Variables
- func IncrementFailLookupCount()
- func IncrementSuccessLookupCount()
- func LoopedTemperatureLookupWorker(request chan (TemperatureLookupJob), responseChan chan (Temperature), ...)
- type LookupStat
- type Temperature
- type TemperatureLookup
- type TemperatureLookupJob
- type TemperatureLookupWorker
Constants ¶
View Source
const (
SENSOR_PATH_SUFFIX = "/w1_slave"
)
Variables ¶
View Source
var (
SENSOR_PATH_PREFIX = "/sys/bus/w1/devices/" // this needs to be variable in order to enable the main prgramm to set the w1 device path
)
Functions ¶
func IncrementFailLookupCount ¶
func IncrementFailLookupCount()
func IncrementSuccessLookupCount ¶
func IncrementSuccessLookupCount()
func LoopedTemperatureLookupWorker ¶
func LoopedTemperatureLookupWorker(request chan (TemperatureLookupJob), responseChan chan (Temperature), interrupt chan (bool), logDestination *io.Writer, logMutex *sync.Mutex)
implements simple TemperatureLookupWorker
Types ¶
type LookupStat ¶
func GetLookupStats ¶
func GetLookupStats() (stats LookupStat)
type Temperature ¶
type Temperature struct {
// contains filtered or unexported fields
}
func First ¶
func First(replicas ...TemperatureLookup) *Temperature
*
- The replicated TemperatureLookup creates a chanel, spawns the replicated TemperatureLookups and
- returns the first valid Temperature struct that comes in from the chanel.
- If TemperatureLookups time out, empty Temperature struct is returned.
- @param replicas slice of TemperaturLookup functions
- @return pointer to a valid or an empty Temperature
func NewTemperature ¶
func NewTemperature(sensorId, logic string) *Temperature
func SensorTemperaturGenerator ¶
func SensorTemperaturGenerator(sensorId, sensorLogic string, logDestination *io.Writer, logMutex *sync.Mutex) (data Temperature)
implements TemperaturLookup since parses and validates the temperature data for this sensor object
func (*Temperature) AddValue ¶
func (t *Temperature) AddValue(delta int)
func (*Temperature) GetSensorId ¶
func (t *Temperature) GetSensorId() string
func (*Temperature) GetSensorLogic ¶
func (t *Temperature) GetSensorLogic() string
func (*Temperature) GetValue ¶
func (t *Temperature) GetValue() int
func (*Temperature) IsValid ¶
func (t *Temperature) IsValid() bool
func (*Temperature) SetLogic ¶
func (t *Temperature) SetLogic(logic string)
type TemperatureLookup ¶
type TemperatureLookup func() Temperature
*
- A function that returns a Temperature struct.
func Init_Sensor ¶
func Init_Sensor(sensorId string, logDestination *io.Writer, logMutex *sync.Mutex) TemperatureLookup
*
- Initializes a temperature sensor by implementing the TemperatureLookup function
- @return TemperatureLookup function which creates a complete Temperatur object from the sensor
type TemperatureLookupJob ¶
type TemperatureLookupJob struct {
SensorId, SensorLogic string
}
type TemperatureLookupWorker ¶
type TemperatureLookupWorker func(routine TemperatureLookup, request chan (TemperatureLookupJob), interrupt chan (bool))
Click to show internal directories.
Click to hide internal directories.