Documentation
¶
Index ¶
- Constants
- Variables
- func AddressToString(a DeviceAddress) (ret string)
- func Dump(b []byte) string
- func Init(rf *RFModel, transmitter TranscieverModel.Transmitter)
- type Device
- type DeviceAddress
- type EDataType
- type EResponseCode
- type Error
- type ErrorType
- type FuncNo
- type RFModel
- type UID
- type UnitFunction
- type UnitFunctionKey
- type Variant
Constants ¶
View Source
const ( PacketLength uint = 32 RequestHeaderSize uint = 4 ResponseHeaderSize uint = 3 MaxDataLengthRq = PacketLength - RequestHeaderSize MaxDataLengthRs = PacketLength - ResponseHeaderSize )
for RF packet parsing
View Source
const ( EDNone EDataType = 0 EDBool = 1 EDByte = 2 EDInt32 = 3 EDString = 4 EDByteArray = 5 EDUnspecified = 0xF )
EDataType enum
View Source
const ( // Unit 0, global device functions F0SetNewSessionKey FuncNo = 10 F0SetMACAddress = 12 F0SetRFChannel = 16 F0GetDeviceStatistics = 13 F0NOP = 15 F0ResetTransactionID = 14 F0SetSlaveMode = 17 // per Unit functions FGetListOfUnitFunctions = 0 FGetTextDescription = 1 FSetTextDescription = 2 )
RF functions
View Source
const ( ERCOk EResponseCode = 0 ERCAddressBadLength = 1 ERCChBadChannels = 0x10 ERCChBadPermissions = 0x12 ERCChValidationFailed = 0x13 ERCNotImplemented = 0x7F ERCBadVersion = 0x90 ERCBadUnitId = 0xA0 ERCNotConsecutiveTransactionId = 0xB0 ERCBadFunctionId = 0xC0 ERCResponseTooBig = 0xD0 ERCBadRequestData = 0xE0 )
View Source
const ( EGeneral ErrorType = "general error" EBadParameter = "bad parameter" EBadResponse = "bad response" EPacketValidation = "packet validation" EDeviceTimeout = "device did not respond 3 times in a row" EBadCode = "function return code is not 0" )
Variables ¶
View Source
var Devices = map[DeviceAddress]*Device{}
Devices all known devices
View Source
var UnitFunctions = map[UnitFunctionKey]UnitFunction{}
UnitFunctions all known functions of all known devices
Functions ¶
func AddressToString ¶
func AddressToString(a DeviceAddress) (ret string)
Types ¶
type Device ¶
type Device struct { Address DeviceAddress LastUpdate time.Time UnitCount uint BuildNumber uint32 AllFunctions []UnitFunctionKey }
Device represents a device with one transceiver with multiple units in it
type DeviceAddress ¶
type DeviceAddress TranscieverModel.Address
func ParseAddress ¶
func ParseAddress(s string) (ret DeviceAddress)
type EResponseCode ¶
type EResponseCode byte
type RFModel ¶
type RFModel struct {
// contains filtered or unexported fields
}
RFModel handler
func (*RFModel) CallFunction ¶
func (rf *RFModel) CallFunction(uid UID, fno FuncNo, payload TranscieverModel.Payload) TranscieverModel.Payload
CallFunction is basic api for RFModel TODO shall catch and handle all the transceiver panics TODO retry 3 times on any error may panic by its own
func (*RFModel) ReadFunction ¶
ReadFunction read from the unit call given function with empty payload and parse result according to the function output type (fn 0 of a given unit)
type UnitFunction ¶
type UnitFunction struct {
// contains filtered or unexported fields
}
UnitFunction ...
Click to show internal directories.
Click to hide internal directories.