github.com/simpleiot/simpleiot@v0.18.3/node/onewire-node.go (about)

     1  package node
     2  
     3  import (
     4  	"github.com/simpleiot/simpleiot/data"
     5  )
     6  
     7  type oneWireNode struct {
     8  	nodeID          string
     9  	description     string
    10  	index           int
    11  	debugLevel      int
    12  	pollPeriod      int
    13  	disabled        bool
    14  	errorCount      int
    15  	errorCountReset bool
    16  }
    17  
    18  func newOneWireNode(node data.NodeEdge) (*oneWireNode, error) {
    19  	ret := oneWireNode{
    20  		nodeID: node.ID,
    21  	}
    22  
    23  	ret.description, _ = node.Points.Text(data.PointTypeDescription, "")
    24  	ret.index, _ = node.Points.ValueInt(data.PointTypeIndex, "")
    25  	ret.debugLevel, _ = node.Points.ValueInt(data.PointTypeDebug, "")
    26  	ret.disabled, _ = node.Points.ValueBool(data.PointTypeDisabled, "")
    27  	ret.pollPeriod, _ = node.Points.ValueInt(data.PointTypePollPeriod, "")
    28  	ret.errorCount, _ = node.Points.ValueInt(data.PointTypeErrorCount, "")
    29  	ret.errorCountReset, _ = node.Points.ValueBool(data.PointTypeErrorCountReset, "")
    30  
    31  	return &ret, nil
    32  }