Documentation ¶
Index ¶
Constants ¶
View Source
const ( // PvUnknown represents unknown type PvUnknown = iota // PvU16 represents uint16 PvU16 // PvU32 represents uint32 PvU32 // PvU64 represents uint64 PvU64 // PvI16 represents int16 PvI16 // PvI32 represents int32 PvI32 // PvI64 represents int64 PvI64 // PvF32 represents float32 PvF32 // PvF64 represents float64 PvF64 // PvBool represents bool PvBool )
Variables ¶
View Source
var ( // DecoderMap assign pvDecoder to each PvType DecoderMap = map[PvType]pvDecoder{ PvUnknown: pvUnknownDecoder, PvU16: pvU16Decoder, PvU32: pvU32Decoder, PvU64: pvU64Decoder, PvI32: pvI32Decoder, PvI64: pvI64Decoder, PvF32: pvF32Decoder, PvF64: pvF64Decoder, PvBool: pvBoolDecoder, } )
View Source
var ( // EncoderMap assign pvEncoder to each PvType EncoderMap = map[PvType]pvEncoder{ PvUnknown: pvUnknownEncoder, PvU16: pvU16Encoder, PvU32: pvU32Encoder, PvU64: pvU64Encoder, PvI32: pvI32Encoder, PvI64: pvI64Encoder, PvF32: pvF32Encoder, PvF64: pvF64Encoder, PvBool: pvBoolEncoder, } )
View Source
var ( // ErrTimeout means timeout ErrTimeout = errors.New("timeout") )
View Source
var ( // ErrUnknownPvType means unknown pv type ErrUnknownPvType = errors.New("Unknown pv type") )
Functions ¶
func PvI16Encoder ¶
PvI16Encoder encodes int16 payload to byte array
Types ¶
type ModbusPV ¶
type ModbusPV interface { Name() string Writable() bool PvType() PvType Get(context.Context) (Payload, error) Put(context.Context, Payload) error }
ModbusPV is an interface for pv getter and putter
func NewModbusPV ¶
func NewModbusPV(name string, handler modbus.ClientHandler, pvType PvType, offset uint16, writable bool) ModbusPV
NewModbusPV returns a ModbusPV
type Payload ¶
type Payload = interface{}
Payload is the payload in pv
func PvI16Decoder ¶
PvI16Decoder decodes byte array to int16 payload
Click to show internal directories.
Click to hide internal directories.