forked from adrianmo/go-nmea
-
Notifications
You must be signed in to change notification settings - Fork 1
/
fir.go
102 lines (87 loc) · 3.53 KB
/
fir.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
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
package nmea
const (
// TypeFIR type of FIR sentence for Fire Detection
TypeFIR = "FIR"
// TypeEventOrAlarmFIR is Event, Fire Alarm type
TypeEventOrAlarmFIR = "E"
// TypeFaultFIR is type for Fault
TypeFaultFIR = "F"
// TypeDisablementFIR is type for detector disablement
TypeDisablementFIR = "D"
// ConditionActivationFIR is activation condition
ConditionActivationFIR = "A"
// ConditionNonActivationFIR is non-activation condition
ConditionNonActivationFIR = "V"
// ConditionUnknownFIR is unknown condition
ConditionUnknownFIR = "X"
// AlarmStateAcknowledgedFIR is value for alarm acknowledgement
AlarmStateAcknowledgedFIR = "A"
// AlarmStateNotAcknowledgedFIR is value for alarm being not acknowledged
AlarmStateNotAcknowledgedFIR = "V"
)
// FIR - Fire Detection event with time and location
// Source: "Interfacing Voyage Data Recorder Systems, AutroSafe Interactive Fire-Alarm System, 116-P-BSL336/EE, RevA 2007-01-25,
// Autronica Fire and Security AS " (page 39 | p.8.1.6)
// https://product.autronicafire.com/fileshare/fileupload/14251/bsl336_ee.pdf
//
// Format: $FRFIR,a,hhmmss,aa,aa,xxx,xxx,a,a,c--c*hh<CR><LF>
// Example: $FRFIR,E,103000,FD,PT,000,007,A,V,Fire Alarm : TEST PT7 Name TEST DZ2 Name*7A
type FIR struct {
BaseSentence
// Type is type of the message
// * E – Event, Fire Alarm
// * F – Fault
// * D – Disablement
Type string
// Time is Event Time
Time Time
// SystemIndicator is system indicator. Detector system type with 2 char identifier.
// * FD Generic fire detector
// * FH Heat detector
// * FS Smoke detector
// * FD Smoke and heat detector
// * FM Manual call point
// * GD Any gas detector
// * GO Oxygen gas detector
// * GS Hydrogen sulphide gas detector
// * GH Hydro-carbon gas detector
// * SF Sprinkler flow switch
// * SV Sprinkler manual valve release
// * CO CO2 manual release
// * OT Other
SystemIndicator string
// DivisionIndicator1 is first division indicator for locating origin detector for this message
DivisionIndicator1 string
// DivisionIndicator2 is second division indicator for locating origin detector for this message
DivisionIndicator2 int64
// FireDetectorNumberOrCount is Fire detector number or activated detectors count (seems to be field with overloaded meaning)
FireDetectorNumberOrCount int64
// Condition describes the condition triggering current message
// * A – Activation
// * V – Non-activation
// * X – State unknown
Condition string
// AlarmAckState is Alarm's acknowledge state
// * A – Acknowledged
// * V – Not acknowledged
AlarmAckState string
// Message's description text (could be cut to fit max packet length)
Message string
}
// newFIR constructor
func newFIR(s BaseSentence) (FIR, error) {
p := NewParser(s)
p.AssertType(TypeFIR)
return FIR{
BaseSentence: s,
Type: p.EnumString(0, "message type", TypeEventOrAlarmFIR, TypeFaultFIR, TypeDisablementFIR),
Time: p.Time(1, "time"),
SystemIndicator: p.String(2, "system indicator"),
DivisionIndicator1: p.String(3, "division indicator 1"),
DivisionIndicator2: p.Int64(4, "division indicator 2"),
FireDetectorNumberOrCount: p.Int64(5, "fire detector number or count"),
Condition: p.EnumString(6, "condition", ConditionActivationFIR, ConditionNonActivationFIR, ConditionUnknownFIR),
AlarmAckState: p.EnumString(7, "alarm acknowledgement state", AlarmStateAcknowledgedFIR, AlarmStateNotAcknowledgedFIR),
Message: p.String(8, "message"),
}, p.Err()
}