Documentation ¶
Index ¶
- Constants
- Variables
- func ArcSegmentValidate(srcData []byte) error
- func ConfigFrame(maxSize uint32) error
- func FrameValidate(srcData []byte) error
- type ArcItem
- type ArcItemArray
- type ArcItemRaw
- type Coder
- type CountItem
- type DataGroup
- func (d *DataGroup) AppendSegment(segment ISegment)
- func (d *DataGroup) Decode(data []byte) error
- func (d *DataGroup) Dump()
- func (d *DataGroup) Encode(buf []byte) (int, error)
- func (d *DataGroup) GetArcSegment() (*SegmentArc, error)
- func (d *DataGroup) GetSegment(SType byte) (ISegment, error)
- func (d *DataGroup) Validate() error
- type Frame
- type IProto
- type ISegment
- type SegmentArc
- func (s *SegmentArc) Decode(srcData []byte) error
- func (s *SegmentArc) Dump()
- func (s *SegmentArc) Encode(buf []byte) (int, error)
- func (s *SegmentArc) GetData() []byte
- func (s *SegmentArc) GetType() byte
- func (s *SegmentArc) SetData(data []byte)
- func (s *SegmentArc) Size() uint32
- func (s *SegmentArc) Type() byte
- func (s *SegmentArc) Validate() error
Constants ¶
View Source
const ( // STypeArc arc type STypeArc byte = 10 // ItemSampleRate - ItemSampleRate = 1 )
View Source
const DefaultHeadLength = 8
DefaultHeadLength head + size
View Source
const LengthWithoutData uint32 = 17
LengthWithoutData ... Timestamp + ID + Crc + End
Variables ¶
View Source
var ( //Head ... Head = []byte{0xFC, 0xFC, 0xFC, 0xFC} //End ... End uint8 = 0xFD // MaxSize - MaxSize uint32 = 1024 * 6 )
Functions ¶
func ArcSegmentValidate ¶ added in v1.0.6
ArcSegmentValidate - validation
Types ¶
type ArcItemArray ¶ added in v1.0.6
ArcItemArray is an array of arc item
type ArcItemRaw ¶ added in v1.0.6
ArcItemRaw include raw data of ArcItem value
type Coder ¶
type Coder struct {
IsCrcCheck bool
}
Coder -
type DataGroup ¶
type DataGroup struct { Count byte //1 segment count Sizes []uint32 //4 each segment size STypes []byte // segment type Segments []ISegment //n data }
DataGroup Protocol=2 CType 1:GetCollector2Structure.Size()
func (*DataGroup) AppendSegment ¶
AppendSegment - AppendSegment
func (*DataGroup) GetArcSegment ¶ added in v1.0.6
func (d *DataGroup) GetArcSegment() (*SegmentArc, error)
GetArcSegment - GetArcSegment
func (*DataGroup) GetSegment ¶
GetSegment - GetSegment
type Frame ¶
type Frame struct { Head [4]byte //4 Head 0xFC 0xFC 0xFC 0xFC Size uint32 //4 Package size [Timestamp, End] = 17+n BigEndian Timestamp int64 //8 timestamp ms BigEndian ID [6]byte //6 machin id (Mac Address) DataGroup DataGroup //n data Crc uint16 //2 crc [Timestamp, Data], CRC-16 BigEndian End byte //1 End 0xFD }
Frame package size 25+n
type SegmentArc ¶ added in v1.0.6
SegmentArc arc
func NewDefaultSegmentArc ¶ added in v1.0.6
func NewDefaultSegmentArc() *SegmentArc
NewDefaultSegmentArc -
func (*SegmentArc) Decode ¶ added in v1.0.6
func (s *SegmentArc) Decode(srcData []byte) error
Decode - decode
func (*SegmentArc) Encode ¶ added in v1.0.6
func (s *SegmentArc) Encode(buf []byte) (int, error)
Encode - encode
func (*SegmentArc) GetData ¶ added in v1.0.6
func (s *SegmentArc) GetData() []byte
GetData - get data
func (*SegmentArc) SetData ¶ added in v1.0.6
func (s *SegmentArc) SetData(data []byte)
SetData - set data
Click to show internal directories.
Click to hide internal directories.