Documentation ¶
Index ¶
- Constants
- Variables
- func AppendPackedLength(dest *ByteArray, length uint32)
- func ByteCountOfPackedLength(length uint32) int
- func ByteToHexString(b byte) string
- func CheckBufferSize(buf []byte, requiredLength int, args ...interface{})
- func Float32Epsilon() float32
- func Float64Epsilon() float64
- func HexStringToByte(s string) (byte, error)
- func MarshalObject(obj encoding.BinaryMarshaler) []byte
- func MarshalProtoMessage(pb proto.Message) ([]byte, error)
- func MarshalSimpleType(d interface{}) []byte
- func MarshalString(s string) []byte
- func SetByteOrder(o binary.ByteOrder)
- func SetErrorWhenMarshalObjectErrorPanic(typeName string, err *error) func()
- func SetErrorWhenUnmarshalObjectErrorPanic(typeName string, err *error) func()
- func UnmarshalObject(dest BinaryUnmarshalerWithSize, data []byte) int
- func UnmarshalProtoMessage(data []byte, out proto.Message) int
- func UnmarshalSimpleType(p interface{}, data []byte) int
- func UnmarshalString(dest *string, data []byte) int
- func UnpackLength(data ByteArray) (uint32, error)
- type Alarm
- func (a *Alarm) AlarmCount() uint32
- func (a *Alarm) CancelAlarm()
- func (a *Alarm) Check()
- func (a *Alarm) DataId() string
- func (a *Alarm) Disable()
- func (a *Alarm) Enable()
- func (a *Alarm) IgnoreCount() uint32
- func (a *Alarm) IsAlarming() bool
- func (a *Alarm) IsEnabled() bool
- func (a *Alarm) LastAlarmTime() time.Time
- func (a *Alarm) LastAlarmValue() Number
- func (a *Alarm) LastCancelTime() time.Time
- func (a *Alarm) LastCancelValue() Number
- func (a *Alarm) OnAlarm(f func(Number, *Alarm)) *Alarm
- func (a *Alarm) OnAlarmCanceled(f func(Number, *Alarm)) *Alarm
- func (a *Alarm) Range() Range
- func (a *Alarm) SetEnable(en bool)
- func (a *Alarm) SetIgnoreCount(c uint32) *Alarm
- func (a *Alarm) SetRange(newRange Range) *Alarm
- func (a *Alarm) State() AlarmState
- type AlarmRecord
- func (v *AlarmRecord) FromProtoMessage(p *types.SAlarmInfo)
- func (a *AlarmRecord) MarshalBinary() (data []byte, err error)
- func (a *AlarmRecord) ToProtoMessage() *types.SAlarmInfo
- func (v *AlarmRecord) UnmarshalBinary(data []byte) error
- func (v *AlarmRecord) UnmarshalBinaryWithSize(data []byte) (_ int, err error)
- type AlarmState
- type BinaryUnmarshalerWithSize
- type ByteArray
- func (ba *ByteArray) AddCrc16()
- func (ba *ByteArray) AppendByte(b byte)
- func (ba *ByteArray) AppendBytes(arr []byte)
- func (ba *ByteArray) AppendIntAsByte(i int)
- func (ba *ByteArray) AppendString(s string)
- func (ba *ByteArray) Assign(data []byte)
- func (ba *ByteArray) AssignByCopy(data []byte)
- func (ba ByteArray) Clone() ByteArray
- func (ba ByteArray) Crc16() uint16
- func (ba ByteArray) Crc32() uint32
- func (ba ByteArray) Crc8() byte
- func (ba *ByteArray) FromProtoMessage(p *types.WSByteArray)
- func (ba ByteArray) Len() int
- func (ba *ByteArray) MarshalBinary() (_ []byte, err error)
- func (ba *ByteArray) ToProtoMessage() *types.WSByteArray
- func (ba ByteArray) ToString() string
- func (ba ByteArray) ToStringEx(withLen bool, sep string, prefix string, suffix string) string
- func (ba *ByteArray) UnmarshalBinary(data []byte) error
- func (ba *ByteArray) UnmarshalBinaryWithSize(data []byte) (_ int, err error)
- type MarshalObjectError
- type NamedData
- func (data *NamedData) AddCheckReadMethod(f func(*NamedData, Number) bool)
- func (data *NamedData) AddCheckWriteMethod(f func(*NamedData, Number) bool)
- func (data *NamedData) Error() *Alarm
- func (v *NamedData) FromProtoMessage(p *types.WSData)
- func (data *NamedData) Id() string
- func (data *NamedData) IsAutoCheck() bool
- func (data *NamedData) IsReadable() bool
- func (data *NamedData) IsWritable(newValue Number) bool
- func (data *NamedData) MarshalBinary() (result []byte, err error)
- func (data *NamedData) Name() string
- func (data *NamedData) OnModified(f func(*NamedData, Number, Number))
- func (data *NamedData) OnRangeModified(f func(Range, Range))
- func (data *NamedData) Range() Range
- func (data *NamedData) SetAutoCheck(b bool)
- func (data *NamedData) SetName(s string)
- func (data *NamedData) SetRane(r Range) bool
- func (data *NamedData) SetValue(newValue Number) bool
- func (data *NamedData) SignalCheckRead() SignalDataCheck
- func (data *NamedData) SignalCheckWrite() SignalDataCheck
- func (v *NamedData) ToProtoMessage() *types.WSData
- func (v *NamedData) UnmarshalBinary(data []byte) error
- func (v *NamedData) UnmarshalBinaryWithSize(data []byte) (_ int, err error)
- func (data *NamedData) Value() Number
- func (data *NamedData) Warning() *Alarm
- type Number
- func (v *Number) FromProtoMessage(p *types.WSNumber)
- func (v *Number) MarshalBinary() (_ []byte, err error)
- func (v Number) ToByte() byte
- func (v Number) ToFloat32() float32
- func (v Number) ToFloat64() float64
- func (v Number) ToInt16() int16
- func (v Number) ToInt32() int32
- func (v Number) ToInt64() int64
- func (v Number) ToInt8() int8
- func (v *Number) ToProtoMessage() *types.WSNumber
- func (v Number) ToUint16() uint16
- func (v Number) ToUint32() uint32
- func (v Number) ToUint64() uint64
- func (v Number) ToUint8() uint8
- func (v *Number) UnmarshalBinary(data []byte) error
- func (v *Number) UnmarshalBinaryWithSize(data []byte) (_ int, err error)
- type Range
- type SignalAlarm
- type SignalDataCheck
- type SignalDataModified
- type SignalDataRangeModified
- type UnmarshalObjectError
Constants ¶
const ( MaxNumber Number = Number(math.MaxFloat64) MinNumber Number = Number(-math.MaxFloat64) // Ref: https://en.wikipedia.org/wiki/Double-precision_floating-point_format#IEEE_754_double-precision_binary_floating-point_format:_binary64 // The 53-bit significand precision gives from 15 to 17 significant decimal digits precision (2^−53 ≈ 1.11 × 10^−16). If a decimal string with at most 15 significant digits is converted to IEEE 754 double-precision representation, and then converted back to a decimal string with the same number of digits, the final result should match the original string. If an IEEE 754 double-precision number is converted to a decimal string with at least 17 significant digits, and then converted back to double-precision representation, the final result must match the original number. MaxIntNumber int64 = 1e16 MinIntNumber int64 = -1e16 MaxUintNumber uint64 = 1e16 )
Variables ¶
var AlarmState_name = map[int32]string{
0: "Overflow",
1: "Underflow",
2: "AutoCanceled",
3: "ManualCanceled",
}
var AlarmState_value = map[string]int32{
"Overflow": 0,
"Underflow": 1,
"AutoCanceled": 2,
"ManualCanceled": 3,
}
var InvalidPackedLengthError error = errors.New("Invalid format for PackedLength")
Functions ¶
func AppendPackedLength ¶
func ByteCountOfPackedLength ¶
func ByteToHexString ¶
func CheckBufferSize ¶
func Float32Epsilon ¶
func Float32Epsilon() float32
func Float64Epsilon ¶
func Float64Epsilon() float64
func HexStringToByte ¶
func MarshalObject ¶
func MarshalObject(obj encoding.BinaryMarshaler) []byte
func MarshalSimpleType ¶
func MarshalSimpleType(d interface{}) []byte
func MarshalString ¶
func SetByteOrder ¶
func UnmarshalObject ¶
func UnmarshalObject(dest BinaryUnmarshalerWithSize, data []byte) int
func UnmarshalSimpleType ¶
func UnmarshalString ¶
func UnpackLength ¶
Types ¶
type Alarm ¶
type Alarm struct {
// contains filtered or unexported fields
}
func (*Alarm) AlarmCount ¶
func (*Alarm) CancelAlarm ¶
func (a *Alarm) CancelAlarm()
func (*Alarm) IgnoreCount ¶
func (*Alarm) IsAlarming ¶
func (*Alarm) LastAlarmTime ¶
func (*Alarm) LastAlarmValue ¶
func (*Alarm) LastCancelTime ¶
func (*Alarm) LastCancelValue ¶
func (*Alarm) SetIgnoreCount ¶
func (*Alarm) State ¶
func (a *Alarm) State() AlarmState
type AlarmRecord ¶
func NewAlarmRecord ¶
func NewAlarmRecord(a *Alarm) AlarmRecord
func (*AlarmRecord) FromProtoMessage ¶
func (v *AlarmRecord) FromProtoMessage(p *types.SAlarmInfo)
func (*AlarmRecord) MarshalBinary ¶
func (a *AlarmRecord) MarshalBinary() (data []byte, err error)
MarshalBinary implements the encoding.BinaryMarshaler interface.
func (*AlarmRecord) ToProtoMessage ¶
func (a *AlarmRecord) ToProtoMessage() *types.SAlarmInfo
func (*AlarmRecord) UnmarshalBinary ¶
func (v *AlarmRecord) UnmarshalBinary(data []byte) error
UnmarshalBinary implements the encoding.BinaryUnmarshaler interface.
func (*AlarmRecord) UnmarshalBinaryWithSize ¶
func (v *AlarmRecord) UnmarshalBinaryWithSize(data []byte) (_ int, err error)
UnmarshalBinaryWithSize implements the common.BinaryUnmarshalerWithSize interface.
type AlarmState ¶
type AlarmState int32
const ( OverFlow AlarmState = 0 UnderFlow AlarmState = 1 AutoCanceled AlarmState = 2 ManualCanceled AlarmState = 3 )
type ByteArray ¶
type ByteArray []byte
func NewByteArray ¶
func NewByteArray(args ...interface{}) *ByteArray
func PackLength ¶
func (*ByteArray) AppendByte ¶
func (*ByteArray) AppendBytes ¶
func (*ByteArray) AppendIntAsByte ¶
func (*ByteArray) AppendString ¶
func (*ByteArray) AssignByCopy ¶
func (*ByteArray) FromProtoMessage ¶
func (ba *ByteArray) FromProtoMessage(p *types.WSByteArray)
func (*ByteArray) MarshalBinary ¶
MarshalBinary implements the encoding.BinaryMarshaler interface.
func (*ByteArray) ToProtoMessage ¶
func (ba *ByteArray) ToProtoMessage() *types.WSByteArray
func (ByteArray) ToStringEx ¶
func (*ByteArray) UnmarshalBinary ¶
UnmarshalBinary implements the encoding.BinaryUnmarshaler interface.
type MarshalObjectError ¶
type MarshalObjectError error
func NewMarshalObjectError ¶
func NewMarshalObjectError(err error) MarshalObjectError
type NamedData ¶
type NamedData struct {
// contains filtered or unexported fields
}
func NewNamedData ¶
func (*NamedData) AddCheckReadMethod ¶
func (*NamedData) AddCheckWriteMethod ¶
func (*NamedData) FromProtoMessage ¶
func (*NamedData) IsAutoCheck ¶
func (*NamedData) IsReadable ¶
func (*NamedData) IsWritable ¶
func (*NamedData) MarshalBinary ¶
MarshalBinary implements the encoding.BinaryMarshaler interface.
func (*NamedData) OnModified ¶
func (*NamedData) OnRangeModified ¶
func (*NamedData) SetAutoCheck ¶
func (*NamedData) SignalCheckRead ¶
func (data *NamedData) SignalCheckRead() SignalDataCheck
func (*NamedData) SignalCheckWrite ¶
func (data *NamedData) SignalCheckWrite() SignalDataCheck
func (*NamedData) ToProtoMessage ¶
func (*NamedData) UnmarshalBinary ¶
UnmarshalBinary implements the encoding.BinaryUnmarshaler interface.
func (*NamedData) UnmarshalBinaryWithSize ¶
UnmarshalBinaryWithSize implements the common.BinaryUnmarshalerWithSize interface.
type Number ¶
type Number float64
const (
InvalidValue Number = -1
)
func (*Number) FromProtoMessage ¶
func (*Number) MarshalBinary ¶
MarshalBinary implements the encoding.BinaryMarshaler interface.
func (*Number) ToProtoMessage ¶
func (*Number) UnmarshalBinary ¶
UnmarshalBinary implements the encoding.BinaryUnmarshaler interface.
type Range ¶
type Range struct {
// contains filtered or unexported fields
}
func (*Range) ChangeFromInternalType ¶
type SignalAlarm ¶
func (*SignalAlarm) Connect ¶
func (sig *SignalAlarm) Connect(f func(Number, *Alarm))
type SignalDataCheck ¶
type SignalDataModified ¶
type SignalDataRangeModified ¶
func (*SignalDataRangeModified) Connect ¶
func (sig *SignalDataRangeModified) Connect(f func(Range, Range))
type UnmarshalObjectError ¶
type UnmarshalObjectError error
func NewNotEnoughDataError ¶
func NewNotEnoughDataError(required, offer, offset int) UnmarshalObjectError
func NewUnmarshalObjectError ¶
func NewUnmarshalObjectError(err error) UnmarshalObjectError