-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmethods_BNF.go
48 lines (38 loc) · 1015 Bytes
/
methods_BNF.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
45
46
47
48
package mpost
import (
"github.com/hard-soft-ware/mpost/acceptor"
"github.com/hard-soft-ware/mpost/consts"
"github.com/hard-soft-ware/mpost/enum"
)
////////////////////////////////////
func (m *MethodsObj) GetBNFStatus() enum.BNFStatusType {
m.a.Log.Method("Getting BNF status", nil)
err := acceptor.Verify(acceptor.Cap.BNFStatus, "BNFStatus")
if err != nil {
m.a.Log.Err("GetBNFStatus", err)
return enum.BNFStatusUnknown
}
payload := []byte{consts.CmdAuxiliary.Byte(), 0, 0, consts.CmdAuxBNFStatus.Byte()}
reply, err := m.a.SendSynchronousCommand(payload)
if err != nil {
m.a.Log.Err("GetBNFStatus", err)
return enum.BNFStatusUnknown
}
if len(reply) == 9 {
if reply[3] == 0 {
return enum.BNFStatusNotAttached
} else {
if reply[4] == 0 {
return enum.BNFStatusOK
} else {
return enum.BNFStatusError
}
}
}
return enum.BNFStatusUnknown
}
//
func (m *MethodsObj) GetCapBNFStatus() bool {
m.a.Log.Method("GetCapBNFStatus", nil)
return acceptor.Cap.BNFStatus
}