/
pps.go
44 lines (39 loc) · 806 Bytes
/
pps.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
package main
import (
"bytes"
"time"
)
type Pps struct {
No int
Name string
PpsType uint8
PrevPps uint32
NextPps uint32
DirPps uint32
Data string
Size uint32
StartBlock uint32
}
func (pps *Pps) getPpsWk() string {
buf := new(bytes.Buffer)
putVar(buf, []byte(PadRight(pps.Name, "\x00", 64)))
putVar(buf,
int16(len(pps.Name) + 2),
pps.PpsType,
int8(0x00),
pps.PrevPps,
pps.NextPps,
pps.DirPps,
[]byte("\x00\x09\x02\x00"),
[]byte("\x00\x00\x00\x00"),
[]byte("\xc0\x00\x00\x00"),
[]byte("\x00\x00\x00\x46"),
[]byte("\x00\x00\x00\x00"),
[]byte(localDateToOLE(time.Now().Unix())),
[]byte(localDateToOLE(time.Now().Unix())),
pps.StartBlock,
pps.Size,
uint32(0),
)
return buf.String()
}