Documentation
¶
Index ¶
- Constants
- Variables
- func DecodeBCD(src *[]byte) (outByte []byte, outVal int8, err error)
- func DecodeBitString(src *[]byte, length uint64) (outByte []byte, outVal string, err error)
- func DecodeBoolean(src *[]byte) (outByte []byte, outVal bool, err error)
- func DecodeDate(src *[]byte) (outByte []byte, outVal time.Time, err error)
- func DecodeDateTime(src *[]byte) (outByte []byte, outVal time.Time, err error)
- func DecodeDoubleLong(src *[]byte) (outByte []byte, outVal int32, err error)
- func DecodeDoubleLongUnsigned(src *[]byte) (outByte []byte, outVal uint32, err error)
- func DecodeEnum(src *[]byte) (outByte []byte, outVal uint8, err error)
- func DecodeFloat32(src *[]byte) (outByte []byte, outVal float32, err error)
- func DecodeFloat64(src *[]byte) (outByte []byte, outVal float64, err error)
- func DecodeInteger(src *[]byte) (outByte []byte, outVal int8, err error)
- func DecodeLength(src *[]byte) (outByte []byte, outVal uint64, err error)
- func DecodeLong(src *[]byte) (outByte []byte, outVal int16, err error)
- func DecodeLong64(src *[]byte) (outByte []byte, outVal int64, err error)
- func DecodeLong64Unsigned(src *[]byte) (outByte []byte, outVal uint64, err error)
- func DecodeLongUnsigned(src *[]byte) (outByte []byte, outVal uint16, err error)
- func DecodeOctetString(src *[]byte, length uint64) (outByte []byte, outVal string, err error)
- func DecodeTime(src *[]byte) (outByte []byte, outVal time.Time, err error)
- func DecodeUTF8String(src *[]byte, length uint64) (outByte []byte, outVal string, err error)
- func DecodeUnsigned(src *[]byte) (outByte []byte, outVal uint8, err error)
- func DecodeVisibleString(src *[]byte, length uint64) (outByte []byte, outVal string, err error)
- func EncodeArray(data []*DlmsData) ([]byte, error)
- func EncodeBCD(data int8) ([]byte, error)
- func EncodeBCDs(data string) ([]byte, error)
- func EncodeBitString(data string) ([]byte, error)
- func EncodeBoolean(data bool) ([]byte, error)
- func EncodeDate(data time.Time) ([]byte, error)
- func EncodeDateTime(data time.Time) ([]byte, error)
- func EncodeDoubleLong(data int32) ([]byte, error)
- func EncodeDoubleLongUnsigned(data uint32) ([]byte, error)
- func EncodeEnum(data uint8) ([]byte, error)
- func EncodeFloat32(data float32) ([]byte, error)
- func EncodeFloat64(data float64) ([]byte, error)
- func EncodeInteger(data int8) ([]byte, error)
- func EncodeLength(dataLength interface{}) ([]byte, error)
- func EncodeLong(data int16) ([]byte, error)
- func EncodeLong64(data int64) ([]byte, error)
- func EncodeLong64Unsigned(data uint64) ([]byte, error)
- func EncodeLongUnsigned(data uint16) ([]byte, error)
- func EncodeOctetString(data string) ([]byte, error)
- func EncodeStructure(data []*DlmsData) ([]byte, error)
- func EncodeTime(data time.Time) ([]byte, error)
- func EncodeUTF8String(data string) ([]byte, error)
- func EncodeUnsigned(data uint8) ([]byte, error)
- func EncodeVisibleString(data string) ([]byte, error)
- func UnmarshalData(data DlmsData, v interface{}) error
- func ValidNumberType(k interface{}) (reflect.Kind, error)
- type Decoder
- type DlmsData
- func CreateAxdrArray(data []*DlmsData) *DlmsData
- func CreateAxdrBCD(data int8) *DlmsData
- func CreateAxdrBitString(data string) *DlmsData
- func CreateAxdrBoolean(data bool) *DlmsData
- func CreateAxdrDate(data time.Time) *DlmsData
- func CreateAxdrDateTime(data time.Time) *DlmsData
- func CreateAxdrDoubleLong(data int32) *DlmsData
- func CreateAxdrDoubleLongUnsigned(data uint32) *DlmsData
- func CreateAxdrEnum(data uint8) *DlmsData
- func CreateAxdrFloat32(data float32) *DlmsData
- func CreateAxdrFloat64(data float64) *DlmsData
- func CreateAxdrFloatingPoint(data float32) *DlmsData
- func CreateAxdrInteger(data int8) *DlmsData
- func CreateAxdrLong(data int16) *DlmsData
- func CreateAxdrLong64(data int64) *DlmsData
- func CreateAxdrLong64Unsigned(data uint64) *DlmsData
- func CreateAxdrLongUnsigned(data uint16) *DlmsData
- func CreateAxdrOctetString(data interface{}) *DlmsData
- func CreateAxdrStructure(data []*DlmsData) *DlmsData
- func CreateAxdrTime(data time.Time) *DlmsData
- func CreateAxdrUTF8String(data string) *DlmsData
- func CreateAxdrUnsigned(data uint8) *DlmsData
- func CreateAxdrVisibleString(data string) *DlmsData
- func MarshalData(v interface{}) (*DlmsData, error)
Constants ¶
const ( TagNull dataTag = 0 TagArray dataTag = 1 TagStructure dataTag = 2 TagBoolean dataTag = 3 TagBitString dataTag = 4 TagDoubleLong dataTag = 5 TagDoubleLongUnsigned dataTag = 6 TagFloatingPoint dataTag = 7 TagOctetString dataTag = 9 TagVisibleString dataTag = 10 TagUTF8String dataTag = 12 TagBCD dataTag = 13 TagInteger dataTag = 15 TagLong dataTag = 16 TagUnsigned dataTag = 17 TagLongUnsigned dataTag = 18 TagCompactArray dataTag = 19 TagLong64 dataTag = 20 TagLong64Unsigned dataTag = 21 TagEnum dataTag = 22 TagFloat32 dataTag = 23 TagFloat64 dataTag = 24 TagDateTime dataTag = 25 TagDate dataTag = 26 TagTime dataTag = 27 TagDontCare dataTag = 255 )
Variables ¶
var ErrLengthLess = errors.New("not enough byte length provided")
var ReversedTimeZone = false
Functions ¶
func DecodeBitString ¶
func DecodeDate ¶
Decode 5 bytes data into time.Time object year highbyte, year lowbyte, month, day of month, day of week
func DecodeDateTime ¶
Decode 12 bytes data into time.Time object year highbyte, year lowbyte, month, day of month, day of week, hour, minute, second, hundredths of second, deviation highbyte, -- interpreted as long in minutes of local time of UTC deviation lowbyte, clock status
func DecodeDoubleLong ¶
func DecodeLong64Unsigned ¶
func DecodeLongUnsigned ¶
func DecodeOctetString ¶
func DecodeTime ¶
Decode 4 bytes data into time.Time object hour, minute, second, hundredths
func DecodeUTF8String ¶
func DecodeVisibleString ¶
func EncodeArray ¶
func EncodeBCDs ¶
Standard 8-4-2-1 decimal-only encoding note: this is not part of A-XDR encoder
func EncodeBitString ¶
Encodes string of binary into byte. If length of bitstring is not multiplication of 8 bits, the left over will be put as trailing zeros. Sample: "111"-> E0
func EncodeBoolean ¶
func EncodeDate ¶
Encodes a date of time object into 5 bytes data year highbyte, year lowbyte, month, day of month, day of week
func EncodeDateTime ¶
Encodes datetime of time object into 12 bytes data year highbyte, year lowbyte, month, day of month, day of week, hour, minute, second, hundredths of second, deviation highbyte, -- interpreted as long in minutes of local time of UTC deviation lowbyte, clock status -- 0x00 means ok, 0xFF means not specified
func EncodeDoubleLong ¶
func EncodeEnum ¶
func EncodeFloat32 ¶
func EncodeFloat64 ¶
func EncodeInteger ¶
func EncodeLength ¶
Encodes a number into correct byte according to A-XDR rule high-bit of first byte (x000 0000) will determine if first byte is L-of-length or not. If it is, then the rest bits are the value of L-of-length, else is the length itself. Sample (int -> hex). 3->03, 131->81 83, 25000->82 61 A8
func EncodeLong ¶
func EncodeLong64 ¶
func EncodeLong64Unsigned ¶
func EncodeLongUnsigned ¶
func EncodeOctetString ¶
An ordered sequence of octets (8 bit bytes) Obis / Logical Name is en/decoded using TagOctetString other than that, input will be processed as hexstring
func EncodeStructure ¶
func EncodeTime ¶
Encodes a time of time object into 4 bytes data hour, minute, second, hundredths
func EncodeUTF8String ¶
An ordered sequence of characters encoded as UTF-8
func EncodeUnsigned ¶
func EncodeVisibleString ¶
An ordered sequence of ASCII characters
func UnmarshalData ¶
func ValidNumberType ¶
Check if input is a valid u/int 8-64
Types ¶
type Decoder ¶
type Decoder struct {
// contains filtered or unexported fields
}
func NewDataDecoder ¶
Create new decode from either supplied byte slice pointer. It will remove first byte from source
type DlmsData ¶
type DlmsData struct { Tag dataTag Value interface{} }
func CreateAxdrArray ¶
func CreateAxdrBCD ¶
func CreateAxdrBitString ¶
func CreateAxdrBoolean ¶
func CreateAxdrDate ¶
func CreateAxdrDateTime ¶
func CreateAxdrDoubleLong ¶
func CreateAxdrEnum ¶
func CreateAxdrFloat32 ¶
func CreateAxdrFloat64 ¶
func CreateAxdrFloatingPoint ¶
func CreateAxdrInteger ¶
func CreateAxdrLong ¶
func CreateAxdrLong64 ¶
func CreateAxdrLongUnsigned ¶
func CreateAxdrOctetString ¶
func CreateAxdrOctetString(data interface{}) *DlmsData
expect Hex string as input
func CreateAxdrStructure ¶
func CreateAxdrTime ¶
func CreateAxdrUTF8String ¶
expect UTF-8 strings as input
func CreateAxdrUnsigned ¶
func CreateAxdrVisibleString ¶
expect ASCII strings as input