Documentation ¶
Index ¶
- Constants
- func BitExist(bitmap []byte, bit uint) bool
- func BitSet(bitmap *[]byte, bit uint)
- func DecodeBCD(src []byte, dType int, dataLen int) string
- func DecodeGBK(src []byte) string
- func Default(cfgPath string) error
- func EncodeBCD(data string, dType int, dataLen int) []byte
- func EncodeGBK(src string) []byte
- func Hex2Str(hexstring []byte) string
- func Pack(data map[int]string) (res []byte, err error)
- func SetLogger(logusr Logger)
- func Str2Hex(str []byte) []byte
- func Unpack(msg []byte) (res map[int]string, msgLen int, err error)
- type BinField
- type BitConfig
- type ConfigDef
- type FieldCfg
- type Fielder
- type Logger
- type NumField
- type TextField
- type TrackField
Constants ¶
View Source
const ( //BCDL 左靠bcd BCDL = iota //BCDR 右靠bcd BCDR //NORMAL 正常 NORMAL //BITS 二进制 BITS )
Variables ¶
This section is empty.
Functions ¶
Types ¶
type BinField ¶
type BinField struct {
// contains filtered or unexported fields
}
BinField 二进制域
func NewBinField ¶
NewBinField 创建二进制域
type BitConfig ¶
type BitConfig struct { BitLen int `yaml:"bit_len"` //位图长度 MsgType FieldCfg `yaml:"msg_type"` //报文类型 Fields []FieldCfg `yaml:"fields"` //域配置 }
BitConfig 域配置信息
type ConfigDef ¶
type ConfigDef struct {
// contains filtered or unexported fields
}
ConfigDef 8583报文结构定义
type FieldCfg ¶
type FieldCfg struct { FieldID int `yaml:"field_id"` //域id LenAttr string `yaml:"len_attr"` //长度属性 LenWidth int `yaml:"len_width"` //长度域长度 ValueAttr string `yaml:"value_attr"` //值属性 Max int `yaml:"max"` //值最大长度 Type string `yaml:"type"` //域类型 根据类型选择不同对象 }
FieldCfg 域定义
type Fielder ¶
type Fielder interface { Check(value string) error //域检查 Encode(bf *bytes.Buffer, value string) int //域组包 Decode(br *bytes.Reader) string //域解包 Name() string //域名称 Print(value string) //打印 }
Fielder 域属性
type Logger ¶
type Logger interface { Info(args ...interface{}) Infof(template string, args ...interface{}) }
Logger 日志接口
type NumField ¶
type NumField struct {
// contains filtered or unexported fields
}
NumField 数值域
func NewNumField ¶
NewNumField 创建二进制域
type TextField ¶
type TextField struct {
// contains filtered or unexported fields
}
TextField 文本域
func NewTextField ¶
NewTextField 创建文本域
type TrackField ¶
type TrackField struct {
// contains filtered or unexported fields
}
TrackField 二磁道,三磁道域
func NewTrackField ¶
NewTrackField 创建磁道域
Click to show internal directories.
Click to hide internal directories.