Documentation
¶
Index ¶
- Constants
- Variables
- func ReadAnyAndPrint(r io.Reader) error
- type C
- type Conn
- type DateCalculator
- func (dc *DateCalculator) GetDate(day int, month int) string
- func (dc *DateCalculator) GetDay(day int) int
- func (dc *DateCalculator) GetHour(hour int) int
- func (dc *DateCalculator) GetMinutes(minute int) int
- func (dc *DateCalculator) GetMonth(month int) int
- func (dc *DateCalculator) GetSeconds(second int) int
- func (dc *DateCalculator) GetTime(minute int, hour int) string
- func (dc *DateCalculator) GetTimeWithSeconds(second int, minute int, hour int) string
- func (dc *DateCalculator) GetYear(v1 int, v2 int, hundredYearValue int, calcHundredYear bool) int
- type DecodedDataRecord
- type DecodedFrame
- type Frame
- type LongFrame
- func ApplicationReset(primaryID uint8) LongFrame
- func ReadLongFrame(conn Conn) (LongFrame, error)
- func ReadSingleCharFrame(r io.Reader) (LongFrame, error)
- func SendUD2() LongFrame
- func SetPrimaryUsingPrimary(oldPrimary uint8, newPrimary uint8) LongFrame
- func SetPrimaryUsingSecondary(secondary uint64, primary uint8) LongFrame
- func (lf LongFrame) A() byte
- func (lf LongFrame) C() C
- func (lf LongFrame) CI() byte
- func (lf LongFrame) ClearFCB()
- func (lf LongFrame) ClearFCV()
- func (lf LongFrame) Decode() (*DecodedFrame, error)
- func (lf LongFrame) DecodeManufacturer() (string, error)
- func (lf LongFrame) L() int
- func (lf LongFrame) SetChecksum()
- func (lf LongFrame) SetFCB()
- func (lf LongFrame) SetFCV()
- func (lf LongFrame) SetLength()
- type ShortFrame
- type Unit
Constants ¶
View Source
const ( DATA_RECORD_DIF_MASK_INST = 0x00 DATA_RECORD_DIF_MASK_MIN = 0x10 DATA_RECORD_DIF_MASK_TYPE_INT32 = 0x04 DATA_RECORD_DIF_MASK_DATA = 0x0F DATA_RECORD_DIF_MASK_FUNCTION = 0x30 DATA_RECORD_DIF_MASK_STORAGE_NO = 0x40 DATA_RECORD_DIF_MASK_EXTENSION = 0x80 DATA_RECORD_DIF_MASK_NON_DATA = 0xF0 DATA_RECORD_DIFE_MASK_STORAGE_NO = 0x0F DATA_RECORD_DIFE_MASK_TARIFF = 0x30 DATA_RECORD_DIFE_MASK_DEVICE = 0x40 DATA_RECORD_DIFE_MASK_EXTENSION = 0x80 DIB_DIF_WITHOUT_EXTENSION = 0x7F DIB_DIF_EXTENSION_BIT = 0x80 DIB_VIF_WITHOUT_EXTENSION = 0x7F DIB_VIF_EXTENSION_BIT = 0x80 DIB_DIF_MANUFACTURER_SPECIFIC = 0x0F DIB_DIF_MORE_RECORDS_FOLLOW = 0x1F DIB_DIF_IDLE_FILLER = 0x2F VARIABLE_DATA_MEDIUM_OTHER = 0x00 VARIABLE_DATA_MEDIUM_OIL = 0x01 VARIABLE_DATA_MEDIUM_ELECTRICITY = 0x02 VARIABLE_DATA_MEDIUM_GAS = 0x03 VARIABLE_DATA_MEDIUM_HEAT_OUT = 0x04 VARIABLE_DATA_MEDIUM_STEAM = 0x05 VARIABLE_DATA_MEDIUM_HOT_WATER = 0x06 VARIABLE_DATA_MEDIUM_WATER = 0x07 VARIABLE_DATA_MEDIUM_HEAT_COST = 0x08 VARIABLE_DATA_MEDIUM_COMPR_AIR = 0x09 VARIABLE_DATA_MEDIUM_COOL_OUT = 0x0A VARIABLE_DATA_MEDIUM_COOL_IN = 0x0B VARIABLE_DATA_MEDIUM_HEAT_IN = 0x0C VARIABLE_DATA_MEDIUM_HEAT_COOL = 0x0D VARIABLE_DATA_MEDIUM_BUS = 0x0E VARIABLE_DATA_MEDIUM_UNKNOWN = 0x0F VARIABLE_DATA_MEDIUM_IRRIGATION = 0x10 VARIABLE_DATA_MEDIUM_WATER_LOGGER = 0x11 VARIABLE_DATA_MEDIUM_GAS_LOGGER = 0x12 VARIABLE_DATA_MEDIUM_GAS_CONV = 0x13 VARIABLE_DATA_MEDIUM_COLORIFIC = 0x14 VARIABLE_DATA_MEDIUM_BOIL_WATER = 0x15 VARIABLE_DATA_MEDIUM_COLD_WATER = 0x16 VARIABLE_DATA_MEDIUM_DUAL_WATER = 0x17 VARIABLE_DATA_MEDIUM_PRESSURE = 0x18 VARIABLE_DATA_MEDIUM_ADC = 0x19 VARIABLE_DATA_MEDIUM_SMOKE = 0x1A VARIABLE_DATA_MEDIUM_ROOM_SENSOR = 0x1B VARIABLE_DATA_MEDIUM_GAS_DETECTOR = 0x1C VARIABLE_DATA_MEDIUM_BREAKER_E = 0x20 VARIABLE_DATA_MEDIUM_VALVE = 0x21 VARIABLE_DATA_MEDIUM_CUSTOMER_UNIT = 0x25 VARIABLE_DATA_MEDIUM_WASTE_WATER = 0x28 VARIABLE_DATA_MEDIUM_GARBAGE = 0x29 VARIABLE_DATA_MEDIUM_VOC = 0x2B VARIABLE_DATA_MEDIUM_SERVICE_UNIT = 0x30 VARIABLE_DATA_MEDIUM_RC_SYSTEM = 0x36 VARIABLE_DATA_MEDIUM_RC_METER = 0x37 CONTROL_MASK_FCB = 0x20 CONTROL_MASK_FCV = 0x10 )
View Source
const SingleCharacterFrame = 0xe5
Variables ¶
View Source
var ErrNoLongFrameFound = fmt.Errorf("no long frame found")
// Does not handle timeout! the new one in tcp.go does // perhaps use io.ReadCloser and close after timeout?
func ReadLongFrame(r io.Reader) (LongFrame, error) {
buf := bufio.NewReader(r)
// TODO if this should be used again must implement whole frame detection from conn.ReadLongFrame
msg, err := buf.ReadBytes(0x16)
if err != nil {
return nil, err
}
return LongFrame(msg), nil
}
View Source
var VIFUnit = map[string]int{
"ENERGY_WH": 0x07,
"ENERGY_J": 0x0F,
"VOLUME": 0x17,
"MASS": 0x1F,
"ON_TIME": 0x23,
"OPERATING_TIME": 0x27,
"POWER_W": 0x2F,
"POWER_J_H": 0x37,
"VOLUME_FLOW": 0x3F,
"VOLUME_FLOW_EXT": 0x47,
"VOLUME_FLOW_EXT_S": 0x4F,
"MASS_FLOW": 0x57,
"FLOW_TEMPERATURE": 0x5B,
"RETURN_TEMPERATURE": 0x5F,
"TEMPERATURE_DIFFERENCE": 0x63,
"EXTERNAL_TEMPERATURE": 0x67,
"PRESSURE": 0x6B,
"DATE": 0x6C,
"DATE_TIME_GENERAL": 0x6D,
"DATE_TIME": 0x6D,
"EXTENTED_TIME": 0x6D,
"EXTENTED_DATE_TIME": 0x6D,
"UNITS_FOR_HCA": 0x6E,
"RES_THIRD_VIFE_TABLE": 0x6F,
"AVG_DURATION": 0x73,
"ACTUALITY_DURATION": 0x77,
"FABRICATION_NO": 0x78,
"IDENTIFICATION": 0x79,
"ADDRESS": 0x7A,
"FIRST_EXT_VIF_CODES": 0xFB,
"VARIABLE_VIF": 0xFC,
"VIF_FOLLOWING": 0x7C,
"SECOND_EXT_VIF_CODES": 0xFD,
"THIRD_EXT_VIF_CODES_RES": 0xEF,
"ANY_VIF": 0x7E,
"MANUFACTURER_SPEC": 0x7F,
}
View Source
var VIFUnitExt = map[string]int{
"CURRENCY_CREDIT": 0x03,
"CURRENCY_DEBIT": 0x07,
"ACCESS_NUMBER": 0x08,
"MEDIUM": 0x09,
"MANUFACTURER": 0x0A,
"PARAMETER_SET_ID": 0x0B,
"MODEL_VERSION": 0x0C,
"HARDWARE_VERSION": 0x0D,
"FIRMWARE_VERSION": 0x0E,
"SOFTWARE_VERSION": 0x0F,
"CUSTOMER_LOCATION": 0x10,
"CUSTOMER": 0x11,
"ACCESS_CODE_USER": 0x12,
"ACCESS_CODE_OPERATOR": 0x13,
"ACCESS_CODE_SYSTEM_OPERATOR": 0x14,
"ACCESS_CODE_DEVELOPER": 0x15,
"PASSWORD": 0x16,
"ERROR_FLAGS": 0x17,
"ERROR_MASKS": 0x18,
"RESERVED": 0x19,
"DIGITAL_OUTPUT": 0x1A,
"DIGITAL_INPUT": 0x1B,
"BAUDRATE": 0x1C,
"RESPONSE_DELAY": 0x1D,
"RETRY": 0x1E,
"RESERVED_2": 0x1F,
"FIRST_STORAGE_NR": 0x20,
"LAST_STORAGE_NR": 0x21,
"SIZE_OF_STORAGE_BLOCK": 0x22,
"RESERVED_3": 0x23,
"STORAGE_INTERVAL": 0x27,
"STORAGE_INTERVAL_MONTH": 0x28,
"STORAGE_INTERVAL_YEARS": 0x29,
"DURATION_SINCE_LAST_READOUT": 0x2F,
"START_OF_TARIFF": 0x30,
"DURATION_OF_TARIFF": 0x3,
"PERIOD_OF_TARIFF": 0x37,
"PERIOD_OF_TARIFF_MONTH": 0x38,
"PERIOD_OF_TARIFF_YEARS": 0x39,
"DIMENSIONLESS": 0x3A,
"VOLTS": 0x4F,
"AMPERE": 0x5F,
"RESET_COUNTER": 0x60,
"CUMULATION_COUNTER": 0x61,
"CONTROL_SIGNAL": 0x62,
"DAY_OF_WEEK": 0x63,
"WEEK_NUMBER": 0x64,
"TIME_POINT_OF_DAY_CHANGE": 0x65,
"STATE_OF_PARAMETER_ACTIVATION": 0x66,
"SPECIAL_SUPPLIER_INFORMATION": 0x67,
"DURATION_SINCE_LAST_CUMULATION": 0x6B,
"OPERATING_TIME_BATTERY": 0x6F,
"DATEAND_TIME_OF_BATTERY_CHANGE": 0x70,
"RSSI": 0x71,
}
View Source
var VIFUnitSecExt = map[string]int{
"RELATIVE_HUMIDITY": 0x1A,
}
Functions ¶
func ReadAnyAndPrint ¶
ReadAnyAndPrint is used for debugging.
Types ¶
type Conn ¶
type Conn interface {
Read(b []byte) (n int, err error)
Write(b []byte) (n int, err error)
SetReadDeadline(t time.Time) error
Close() error
}
func DialSerial ¶
type DateCalculator ¶
type DateCalculator struct{}
func (*DateCalculator) GetDay ¶
func (dc *DateCalculator) GetDay(day int) int
func (*DateCalculator) GetHour ¶
func (dc *DateCalculator) GetHour(hour int) int
func (*DateCalculator) GetMinutes ¶
func (dc *DateCalculator) GetMinutes(minute int) int
func (*DateCalculator) GetMonth ¶
func (dc *DateCalculator) GetMonth(month int) int
func (*DateCalculator) GetSeconds ¶
func (dc *DateCalculator) GetSeconds(second int) int
func (*DateCalculator) GetTimeWithSeconds ¶
func (dc *DateCalculator) GetTimeWithSeconds(second int, minute int, hour int) string
type DecodedDataRecord ¶
type DecodedFrame ¶
type DecodedFrame struct {
SerialNumber int
Manufacturer string
ProductName string
Version int
DeviceType string
AccessNumber int16
Signature int16
Status int
DataRecords []DecodedDataRecord
// contains filtered or unexported fields
}
func ReadAllFrames ¶
func ReadAllFrames(conn Conn, primaryID int) ([]*DecodedFrame, error)
ReadAllFrames supports FCB and reads out all frames from the device using primaryID.
func ReadSingleFrame ¶
func ReadSingleFrame(conn Conn, primaryID int) (*DecodedFrame, error)
ReadSingleFrame reads one frame from the device. Does not reset device before asking.
func (DecodedFrame) HasMoreRecords ¶
func (df DecodedFrame) HasMoreRecords() bool
func (DecodedFrame) SecondaryAddressString ¶
func (df DecodedFrame) SecondaryAddressString() string
type LongFrame ¶
type LongFrame Frame
func ApplicationReset ¶
func ReadLongFrame ¶
func SetPrimaryUsingPrimary ¶
func (LongFrame) Decode ¶
func (lf LongFrame) Decode() (*DecodedFrame, error)
func (LongFrame) DecodeManufacturer ¶
func (LongFrame) SetChecksum ¶
func (lf LongFrame) SetChecksum()
type ShortFrame ¶
type ShortFrame Frame
func NewShortFrame ¶
func NewShortFrame() ShortFrame
func RequestUD2 ¶
func RequestUD2(primaryID uint8) ShortFrame
func SndNKE ¶
func SndNKE(primaryID uint8) ShortFrame
SndNKE slave will ack with SingleCharacterFrame (e5).
func (ShortFrame) A ¶
func (sf ShortFrame) A() byte
func (ShortFrame) C ¶
func (sf ShortFrame) C() C
func (ShortFrame) ClearFCB ¶
func (sf ShortFrame) ClearFCB()
func (ShortFrame) ClearFCV ¶
func (sf ShortFrame) ClearFCV()
func (ShortFrame) SetAddress ¶
func (sf ShortFrame) SetAddress(primary uint8)
func (ShortFrame) SetC ¶
func (sf ShortFrame) SetC(c uint8)
func (ShortFrame) SetChecksum ¶
func (sf ShortFrame) SetChecksum()
func (ShortFrame) SetFCB ¶
func (sf ShortFrame) SetFCB()
func (ShortFrame) SetFCV ¶
func (sf ShortFrame) SetFCV()
Source Files
¶
Click to show internal directories.
Click to hide internal directories.