Documentation ¶
Index ¶
- Variables
- func LoadConfigAndObjectsFromFile(filePathAndName string) (*Config, *Objects, error)
- func NewLogChan() chan string
- func TypeIsTimeTagged(typeId TypeId) bool
- func WriteConfigAndObjectsToFile(state *State, filePathAndName string) error
- type AllChans
- type Apci
- type Apdu
- type Asdu
- type Casdu
- type CauseTx
- type CommandInfo
- type Config
- type ConfiguredObjects
- type ConnState
- type FloatVal
- type FrameFormat
- type InfoObj
- type InfoValue
- type IntVal
- type Ioa
- type NameTypeIdIoa
- type Num
- type ObjectList
- type Objects
- type ObjectsMap
- type OrigAddr
- type Qoi
- type Qu
- type Quality
- type Quoc
- type SeqNumber
- type State
- type TypeId
- type UFormat
Constants ¶
This section is empty.
Variables ¶
View Source
var ( TypeIDs []string = []string{ M_SP_NA_1.String(), M_DP_NA_1.String(), M_ST_NA_1.String(), M_BO_NA_1.String(), M_ME_NA_1.String(), M_ME_NB_1.String(), M_ME_NC_1.String(), M_IT_NA_1.String(), M_SP_TB_1.String(), M_DP_TB_1.String(), M_ST_TB_1.String(), M_BO_TB_1.String(), M_ME_TD_1.String(), M_ME_TE_1.String(), M_ME_TF_1.String(), M_IT_TB_1.String(), C_SC_NA_1.String(), C_DC_NA_1.String(), C_RC_NA_1.String(), C_SE_NA_1.String(), C_SE_NB_1.String(), C_SE_NC_1.String(), C_BO_NA_1.String(), C_SC_TA_1.String(), C_DC_TA_1.String(), C_RC_TA_1.String(), C_SE_TA_1.String(), C_SE_TB_1.String(), C_SE_TC_1.String(), C_BO_TA_1.String(), M_EI_NA_1.String(), } CauseTxs []string = []string{ Per_Cyc.String(), Back.String(), Spont.String(), Init.String(), Req.String(), Act.String(), ActCon.String(), Deact.String(), DeactCon.String(), ActTerm.String(), Retrem.String(), Retloc.String(), Inrogen.String(), Inro1.String(), Reqcogen.String(), Reqco1.String(), UkTypeId.String(), UkCauseTx.String(), UkComAdrASDU.String(), UkIOA.String(), } )
for GUI
View Source
var (
LogChan chan string
)
Functions ¶
func NewLogChan ¶
func NewLogChan() chan string
func TypeIsTimeTagged ¶
Types ¶
type Apci ¶
type Apci struct { FrameFormat FrameFormat Rsn SeqNumber Ssn SeqNumber UFormat UFormat // contains filtered or unexported fields }
type Apdu ¶
type Asdu ¶
type Asdu struct { TypeId TypeId // Type Identification Num Num Sequence bool CauseTx CauseTx // Cause of Transmission Negative bool Test bool OrigAddr OrigAddr // Originator Address Casdu Casdu // Common ASDU InfoObj []InfoObj }
func (*Asdu) AddInfoObject ¶
an ASDU can contain multiple InfoObjects, append them using this function
type CauseTx ¶
type CauseTx uint8
const ( Per_Cyc CauseTx = 1 Back CauseTx = 2 Spont CauseTx = 3 Init CauseTx = 4 Req CauseTx = 5 Act CauseTx = 6 ActCon CauseTx = 7 Deact CauseTx = 8 DeactCon CauseTx = 9 ActTerm CauseTx = 10 Retrem CauseTx = 11 Retloc CauseTx = 12 File CauseTx = 13 Inrogen CauseTx = 20 Inro1 CauseTx = 21 Inro2 CauseTx = 22 Inro3 CauseTx = 23 Inro4 CauseTx = 24 Inro5 CauseTx = 25 Inro6 CauseTx = 26 Inro7 CauseTx = 27 Inro8 CauseTx = 28 Inro9 CauseTx = 29 Inro10 CauseTx = 30 Inro11 CauseTx = 31 Inro12 CauseTx = 32 Inro13 CauseTx = 33 Inro14 CauseTx = 34 Inro15 CauseTx = 35 Inro16 CauseTx = 36 Reqcogen CauseTx = 37 Reqco1 CauseTx = 38 Reqco2 CauseTx = 39 Reqco3 CauseTx = 40 Reqco4 CauseTx = 41 UkTypeId CauseTx = 44 UkCauseTx CauseTx = 45 UkComAdrASDU CauseTx = 46 UkIOA CauseTx = 47 )
Cause of Transmission
func CauseTxFromName ¶
type CommandInfo ¶
type Config ¶
type Config struct { Mode string `toml:"mode"` Ipv4Addr string `toml:"ipv4Addr"` Port int `toml:"port"` Casdu int `toml:"casdu"` AutoAck bool `toml:"autoAck"` K int `toml:"k"` W int `toml:"w"` T1 int `toml:"t1"` T2 int `toml:"t2"` T3 int `toml:"t3"` IoaStructured bool `toml:"ioaStructured"` InteractiveMode bool `toml:"interactiveMode"` UseLocalTime bool `toml:"useLocalTime"` LogToBuffer bool `toml:"logToBuffer"` LogToStdOut bool `toml:"logToStdOut"` }
type ConfiguredObjects ¶
type ConfiguredObjects struct { MonitoringList []NameTypeIdIoa `toml:"monitoringList,multiline,omitempty"` ControlList []NameTypeIdIoa `toml:"controlList,multiline,omitempty"` }
for toml conf file
func NewConfiguredObjects ¶
func NewConfiguredObjects() *ConfiguredObjects
type FrameFormat ¶
type FrameFormat byte
const ( IFormatFrame FrameFormat = 0 SFormatFrame FrameFormat = 1 UFormatFrame FrameFormat = 3 )
type InfoObj ¶
type InfoObj struct { Ioa Ioa // Info Object Address Value InfoValue Quality Quality CommandInfo CommandInfo TimeTag time.Time // todo: add su, iv bits }
func NewInfoObj ¶
func NewInfoObj() InfoObj
type NameTypeIdIoa ¶
type NameTypeIdIoa [3]string
holds three strings: obj name, typeId, IOA all are strings, so the toml marshaller will produce toml arrays (otherwise tables)
type ObjectList ¶
type ObjectList []string
func (ObjectList) FindObjectInList ¶
func (objectList ObjectList) FindObjectInList(objName string) (int, error)
type Objects ¶
type Objects struct { sync.RWMutex // maps keep obj Names and refer to Asdu objects MoniObjects ObjectsMap CtrlObjects ObjectsMap // lists are mainly for GUI use (could be merged with configuredObjects?) MoniList ObjectList CtrlList ObjectList // contains filtered or unexported fields }
func NewObjects ¶
func NewObjects() *Objects
func (*Objects) AddObjectByName ¶
func (Objects) PrintObjects ¶
func (objects Objects) PrintObjects()
func (*Objects) RemoveObject ¶
type ObjectsMap ¶
func (ObjectsMap) ObjectExists ¶
func (objectsMap ObjectsMap) ObjectExists(objName string, ioa int, typeId int) bool
search for object by providing name, or ioa and typeid
type State ¶
type State struct { Config Config ConnState ConnState Chans AllChans Objects *Objects Running bool // true when trying to connect/waiting for connection TcpConnected bool Ctx context.Context Wg sync.WaitGroup Cancel context.CancelFunc // contains filtered or unexported fields }
func (*State) ParseFlags ¶
func (state *State) ParseFlags()
type TypeId ¶
type TypeId uint8
const ( M_SP_NA_1 TypeId = 1 // single-point information M_DP_NA_1 TypeId = 3 // double-point information M_ST_NA_1 TypeId = 5 // step position information M_BO_NA_1 TypeId = 7 // bitstring of 32 bits M_ME_NA_1 TypeId = 9 // measured value, normalized value M_ME_NB_1 TypeId = 11 // measured value, scaled value M_ME_NC_1 TypeId = 13 // measured value, short floating point number M_IT_NA_1 TypeId = 15 // integrated totals M_SP_TB_1 TypeId = 30 // single-point information with time tag CP56Time2a M_DP_TB_1 TypeId = 31 // double-point information with time tag CP56Time2a M_ST_TB_1 TypeId = 32 // step position information with time tag CP56Time2a M_BO_TB_1 TypeId = 33 // bitstring of 32 bit with time tag CP56Time2a M_ME_TD_1 TypeId = 34 // measured value, normalized value with time tag CP56Time2a M_ME_TE_1 TypeId = 35 // measured value, scaled value with time tag CP56Time2a M_ME_TF_1 TypeId = 36 // measured value, short floating point number with time tag CP56Time2a M_IT_TB_1 TypeId = 37 // integrated totals with time tag CP56Time2a C_SC_NA_1 TypeId = 45 // single command C_DC_NA_1 TypeId = 46 // double command C_RC_NA_1 TypeId = 47 // regulating step command C_SE_NA_1 TypeId = 48 // set point command, normalized value C_SE_NB_1 TypeId = 49 // set point command, scaled value C_SE_NC_1 TypeId = 50 // set point command, short floating point number C_BO_NA_1 TypeId = 51 // bitstring of 32 bits C_SC_TA_1 TypeId = 58 // single command with time tag CP56Time2a C_DC_TA_1 TypeId = 59 // double command with time tag CP56Time2a C_RC_TA_1 TypeId = 60 // regulating step command with time tag CP56Time2a C_SE_TA_1 TypeId = 61 // set point command, normalized value with time tag CP56Time2a C_SE_TB_1 TypeId = 62 // set point command, scaled value with time tag CP56Time2a C_SE_TC_1 TypeId = 63 // set point command, short floating-point number with time tag CP56Time2a C_BO_TA_1 TypeId = 64 // bitstring of 32 bits with time tag CP56Time2a M_EI_NA_1 TypeId = 70 // end of initialization C_IC_NA_1 TypeId = 100 // interrogation command C_CI_NA_1 TypeId = 101 // counter interrogation command C_RD_NA_1 TypeId = 102 // read command C_CS_NA_1 TypeId = 103 // clock synchronization command C_RP_NA_1 TypeId = 105 // reset process command C_TS_TA_1 TypeId = 107 // test command with time tag CP56Time2a // "private" range for internal purposes, will not be sent INTERNAL_STATE_MACHINE_NOTIFIER TypeId = 200 )
Type IDs
func TypeIdFromName ¶
Source Files ¶
Click to show internal directories.
Click to hide internal directories.