Documentation ¶
Overview ¶
Package part5 provides the OSI application layer with asynchronous I/O.
Index ¶
- Variables
- type Bits
- type BitsCmd
- type Caller
- func (c *Caller) Bits(id info.ID, v uint32, attrs MeasureAttrs)
- func (c *Caller) BitsCmd(id info.ID, bits uint32, addr info.ObjAddr, tag time.Time, term CmdTerm) error
- func (c *Caller) Double(id info.ID, v info.DoublePoint, attrs MeasureAttrs) error
- func (c *Caller) DoubleCmd(id info.ID, p info.DoublePoint, attrs ExecAttrs, term CmdTerm) error
- func (c *Caller) Float(id info.ID, v float32, attrs MeasureAttrs) error
- func (c *Caller) FloatSetpoint(id info.ID, p float32, attrs ExecAttrs, term CmdTerm) error
- func (c *Caller) Normal(id info.ID, v info.Normal, attrs MeasureAttrs)
- func (c *Caller) NormalSetpoint(id info.ID, p info.Normal, attrs ExecAttrs, term CmdTerm) error
- func (c *Caller) RegulCmd(id info.ID, up info.DoublePoint, attrs ExecAttrs, term CmdTerm) error
- func (c *Caller) Scaled(id info.ID, v int16, attrs MeasureAttrs)
- func (c *Caller) ScaledSetpoint(id info.ID, p int16, attrs ExecAttrs, term CmdTerm) error
- func (c *Caller) Send(u *info.ASDU) error
- func (c *Caller) Single(id info.ID, v info.SinglePoint, attrs MeasureAttrs) error
- func (c *Caller) SingleCmd(id info.ID, p info.SinglePoint, attrs ExecAttrs, term CmdTerm) error
- func (c *Caller) Step(id info.ID, v info.StepPos, attrs MeasureAttrs)
- type CmdTerm
- type Delegate
- type Double
- type DoubleCmd
- type ExecAttrs
- type ExecTerm
- type Float
- type FloatSetpoint
- type MeasureAttrs
- type Normal
- type NormalSetpoint
- type RegulCmd
- type Scaled
- type ScaledSetpoint
- type Single
- type SingleCmd
- type Step
- Bugs
Constants ¶
This section is empty.
Variables ¶
var ErrCmdDeny = errors.New("part5: command execution denied")
ErrCmdDeny signals a remote acceptance rejection.
var ErrCmdRace = errors.New("part5: pending command execution on same address")
ErrCmdRace signals a concurrent command execution.
Functions ¶
This section is empty.
Types ¶
type Bits ¶
type Bits func(info.ID, uint32, MeasureAttrs)
Bits gets called for type M_BO_NA_1, M_BO_TA_1 and M_BO_TB_1.
type BitsCmd ¶
BitsCmd gets called for type C_BO_NA_1 and C_BO_TA_1. The timestamp is zero when the data is invalid or when the type does not include timing at all. Return ok causes a positive info.Actcon or negative info.NegFlag confirmation message to be send about whether the specified control action is about to commence—hence the actual execution should proceed in a separate routine and ExecTerm may be called once on completion.
type Caller ¶
type Caller struct {
// contains filtered or unexported fields
}
Caller submits messages. All of its methods are thread-safe.
func MustLaunch ¶
func MustLaunch(t *session.Transport, p *info.Params, delegates map[info.CommonAddr]*Delegate) (*Caller, <-chan error)
MustLaunch starts a setup which runs until session.Exit. If the configuration is invalid, MustLaunch will panic.
func (*Caller) Bits ¶
func (c *Caller) Bits(id info.ID, v uint32, attrs MeasureAttrs)
Bits sends a type M_BO_NA_1, M_BO_TA_1 or M_BO_TB_1.
func (*Caller) BitsCmd ¶
func (c *Caller) BitsCmd(id info.ID, bits uint32, addr info.ObjAddr, tag time.Time, term CmdTerm) error
BitsCmd sends a type C_BO_NA_1 or C_BO_TA_1.
func (*Caller) Double ¶
func (c *Caller) Double(id info.ID, v info.DoublePoint, attrs MeasureAttrs) error
Double sends a type M_DP_NA_1, M_DP_TA_1 or M_DP_TB_1.
func (*Caller) FloatSetpoint ¶
FloatSetpoint sends a type C_SE_NC_1 or C_SE_TC_1.
func (*Caller) Normal ¶
Normal sends a type M_ME_NA_1, M_ME_TA_1, M_ME_TD_1 or M_ME_ND_1. The quality descriptor must default to info.OK for type M_ME_ND_1.
func (*Caller) NormalSetpoint ¶
NormalSetpoint sends a type C_SE_NA_1 or C_SE_TA_1.
func (*Caller) Scaled ¶
func (c *Caller) Scaled(id info.ID, v int16, attrs MeasureAttrs)
Scaled sends a type M_ME_NB_1, M_ME_TB_1 or M_ME_TE_1.
func (*Caller) ScaledSetpoint ¶
ScaledSetpoint sends a type C_SE_NB_1 or C_SE_TB_1.
func (*Caller) Single ¶
func (c *Caller) Single(id info.ID, v info.SinglePoint, attrs MeasureAttrs) error
Single sends a type M_SP_NA_1, M_SP_TA_1 or M_SP_TB_1.
type CmdTerm ¶
type CmdTerm func(error)
CmdTerm gets called for notification messages about the termination of a command execution. Note that the outcome, whether success or failure, is out of scope and error handling is unspecified.
This notification step is optional depending on the vendor. When ignored (with a nil CmdTerm) then it must be done consistently so per address or risk false hits.
Go routines may safely wait for a call thanks to timeout protection(s).
type Delegate ¶
type Delegate struct { sync.WaitGroup // All inbound messages are reported to these entries first. The // functions are called in order of appearance. An ASDU is dropped // immediately when the return is false. Thus All can be used as a // filter, a preprocessor or as an extension point. All []func(*info.ASDU) (pass bool) // Tests are called in order of appearance for type C_TS_NA_1. // See section 5, subclause 6.11. Tests []func() (ok bool) // Listeners For Measured Values [primary] // Use info.IrrelevantAddr to catch'm all. Singles map[info.ObjAddr]Single Doubles map[info.ObjAddr]Double Steps map[info.ObjAddr]Step Bits map[info.ObjAddr]Bits Normals map[info.ObjAddr]Normal Scaleds map[info.ObjAddr]Scaled Floats map[info.ObjAddr]Float // Listeners For Commands [secondary] // Use info.IrrelevantAddr to catch'm all. SingleCmds map[info.ObjAddr]SingleCmd DoubleCmds map[info.ObjAddr]DoubleCmd RegulCmds map[info.ObjAddr]RegulCmd NormalSetpoints map[info.ObjAddr]NormalSetpoint ScaledSetpoints map[info.ObjAddr]ScaledSetpoint FloatSetpoints map[info.ObjAddr]FloatSetpoint BitsCmds map[info.ObjAddr]BitsCmd }
Delegate is a listener configuration for one common address.
type Double ¶
type Double func(info.ID, info.DoublePoint, MeasureAttrs)
Double gets called for type M_DP_NA_1, M_DP_TA_1 and M_DP_TB_1.
type DoubleCmd ¶
DoubleCmd gets called for type C_DC_NA_1 and C_DC_TA_1. Return ok causes a positive info.Actcon or negative info.NegFlag confirmation message to be send about whether the specified control action is about to commence—hence the actual execution should proceed in a separate routine and ExecTerm may be called once on completion.
type ExecAttrs ¶
type ExecAttrs struct { Addr info.ObjAddr // Use constants for the qualifier of command. // See info.Cmd.Qual and info.SetpointCmd.Qual. Qual uint // The timestamp is zero when the data is invalid // or when the type does not include timing at all. Time time.Time // Flags whether to execute with "select" protection. // See README.md and section 5, subclause 6.8. InSelect bool }
ExecAttrs are the command execution attributes.
type ExecTerm ¶
type ExecTerm func()
ExecTerm causes a notification message to be send about the termination of a command execution. Note that the outcome, whether success or failure, is out of scope and error handling is unspecified.
This notification step is optional depending on the vendor.
type Float ¶
type Float func(info.ID, float32, MeasureAttrs)
Float gets called for type M_ME_NC_1, M_ME_TC_1 and M_ME_TF_1.
type FloatSetpoint ¶
FloatSetpoint gets called for type C_SE_NC_1 and C_SE_TC_1. Return ok causes a positive info.Actcon or negative info.NegFlag confirmation message to be send about whether the specified control action is about to commence—hence the actual execution should proceed in a separate routine and ExecTerm may be called once on completion.
type MeasureAttrs ¶
type MeasureAttrs struct { Addr info.ObjAddr // Quality descriptor info.OK means no remarks. QualDesc uint // The timestamp is zero when the data is invalid // or when the type does not include timing at all. Time time.Time }
MeasureAttrs are the measured value attributes.
type Normal ¶
type Normal func(info.ID, info.Normal, MeasureAttrs)
Normal gets called for type M_ME_NA_1, M_ME_TA_1, M_ME_TD_1 and M_ME_ND_1. The quality descriptor defaults to info.OK for type M_ME_ND_1.
type NormalSetpoint ¶
NormalSetpoint gets called for type C_SE_NA_1 and C_SE_TA_1. Return ok causes a positive info.Actcon or negative info.NegFlag confirmation message to be send about whether the specified control action is about to commence—hence the actual execution should proceed in a separate routine and ExecTerm may be called once on completion.
type RegulCmd ¶
RegulCmd gets called for type C_RC_NA_1 and C_RC_TA_1. Return ok causes a positive info.Actcon or negative info.NegFlag confirmation message to be send about whether the specified control action is about to commence—hence the actual execution should proceed in a separate routine and ExecTerm may be called once on completion.
type Scaled ¶
type Scaled func(info.ID, int16, MeasureAttrs)
Scaled gets called for type M_ME_NB_1, M_ME_TB_1 and M_ME_TE_1.
type ScaledSetpoint ¶
ScaledSetpoint gets called for type C_SE_NB_1 and C_SE_TB_1. Return ok causes a positive info.Actcon or negative info.NegFlag confirmation message to be send about whether the specified control action is about to commence—hence the actual execution should proceed in a separate routine and ExecTerm may be called once on completion.
type Single ¶
type Single func(info.ID, info.SinglePoint, MeasureAttrs)
Single gets called for type M_SP_NA_1, M_SP_TA_1 and M_SP_TB_1.
type SingleCmd ¶
SingleCmd gets called for type C_SC_NA_1 and C_SC_TA_1. Return ok causes a positive info.Actcon or negative info.NegFlag confirmation message to be send about whether the specified control action is about to commence—hence the actual execution should proceed in a separate routine and ExecTerm may be called once on completion.
Notes ¶
Bugs ¶
Hardcoded command termination timeout of 60s.
Hardcoded command activation timeout of 10s.
Hardcoded select timeout of 10s.
Directories ¶
Path | Synopsis |
---|---|
Package info provides the OSI presentation layer.
|
Package info provides the OSI presentation layer. |
Package media provides the OSI media layers from section 1 & 2.
|
Package media provides the OSI media layers from section 1 & 2. |
Package session provides the OSI transport and session layers.
|
Package session provides the OSI transport and session layers. |
Package track follows address states.
|
Package track follows address states. |