Skip to content

Commit 7f8c06e

Browse files
committedJan 29, 2024
Export NewInfoObj (for GUI)
1 parent 7f1db79 commit 7f8c06e

File tree

4 files changed

+6
-14
lines changed

4 files changed

+6
-14
lines changed
 

‎apdu_test.go

+3-3
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ func TestVariousFrames(t *testing.T) {
2121
m_me_td_1.Asdu.CauseTx = Spont
2222
m_me_td_1.Asdu.Casdu = 1
2323

24-
infoObj := newInfoObj()
24+
infoObj := NewInfoObj()
2525
infoObj.Ioa = 1235
2626
infoObj.Value = IntVal(32767)
2727
infoObj.TimeTag = time.Date(2023, 11, 1, 19, 44, 57, 23000000, time.Local)
@@ -34,7 +34,7 @@ func TestVariousFrames(t *testing.T) {
3434
gi_act.Apci.Ssn = 0
3535
gi_act.Asdu.TypeId = C_IC_NA_1
3636
gi_act.Asdu.CauseTx = Act
37-
infoObj = newInfoObj()
37+
infoObj = NewInfoObj()
3838
infoObj.Ioa = 0
3939
infoObj.CommandInfo.Qoi = statioInterrogation
4040
infoObj.Value = IntVal(0)
@@ -47,7 +47,7 @@ func TestVariousFrames(t *testing.T) {
4747
sc_act.Apci.Rsn = 12
4848
sc_act.Asdu.TypeId = C_SC_NA_1
4949
sc_act.Asdu.CauseTx = Act
50-
infoObj = newInfoObj()
50+
infoObj = NewInfoObj()
5151
infoObj.Ioa = 4500
5252
infoObj.Value = IntVal(1)
5353
sc_act.Asdu.AddInfoObject(infoObj)

‎asdu.go

+1-9
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ func (asdu *Asdu) AddInfoObject(infoObj InfoObj) error {
4646
return nil
4747
}
4848

49-
func newInfoObj() InfoObj {
49+
func NewInfoObj() InfoObj {
5050
ttag := time.Time{}
5151
val := IntVal(0)
5252

@@ -235,14 +235,6 @@ func (infoObj InfoObj) writeInfo(typeId TypeId, buf *bytes.Buffer) error {
235235
infoObj.writeQualitySeparateOctet(buf)
236236

237237
case M_ME_NC_1, M_ME_TF_1:
238-
239-
/*
240-
bits := math.Float32bits(f32)
241-
a.info[a.QualInfoLen()-5] = byte(bits)
242-
a.info[a.QualInfoLen()-4] = byte(bits >> 8)
243-
a.info[a.QualInfoLen()-3] = byte(bits >> 16)
244-
a.info[a.QualInfoLen()-2] = byte(bits >> 24)
245-
*/
246238
bits := math.Float32bits(val)
247239
binary.Write(buf, binary.LittleEndian, byte(bits))
248240
binary.Write(buf, binary.LittleEndian, byte(bits>>8))

‎interactive_control.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -103,7 +103,7 @@ func (state *State) evaluateInputSplit(inputSplit []string) {
103103

104104
case "sp": // temporarily
105105
sp := NewApdu()
106-
infoObj := newInfoObj()
106+
infoObj := NewInfoObj()
107107
infoObj.Ioa = 12345
108108
infoObj.Value = IntVal(1)
109109
sp.Apci.FrameFormat = IFormatFrame

‎objects.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -115,7 +115,7 @@ func (objects *Objects) rangeOverListAndAdd(list []NameTypeIdIoa) {
115115

116116
asdu := Asdu{}
117117
asdu.TypeId = TypeId(typeIdInt)
118-
infoObj := newInfoObj()
118+
infoObj := NewInfoObj()
119119
infoObj.Ioa = Ioa(ioaInt)
120120
asdu.AddInfoObject(infoObj)
121121

0 commit comments

Comments
 (0)
Please sign in to comment.