|
|
@@ -23,6 +23,11 @@ func SendToStc(conn net.Conn, data []byte) {
|
|
|
// report alarm status to STC
|
|
|
func AlarmStatus(exten string, status string) {
|
|
|
|
|
|
+ //Not Master role , ignore
|
|
|
+ if !active.Master {
|
|
|
+ return
|
|
|
+ }
|
|
|
+
|
|
|
//check exten if it is a alarm exten
|
|
|
if !utils.IsPAIU(exten) { // if not alarm device , return
|
|
|
return
|
|
|
@@ -74,19 +79,24 @@ func AlarmStatus(exten string, status string) {
|
|
|
}
|
|
|
//check if actived
|
|
|
lfshook.NewLogger().Logger.Infof("===AlarmStatus=ext:%s===carr:%x==========pos:%x=========status:%x", exten, protocol.Data[0], protocol.Data[1], protocol.Data[2])
|
|
|
- if active.Actived {
|
|
|
- if socket.Conn != nil {
|
|
|
- SendToStc(socket.Conn, encoded)
|
|
|
- }
|
|
|
|
|
|
- if socket.Conn8 != nil {
|
|
|
- SendToStc(socket.Conn8, encoded)
|
|
|
- }
|
|
|
+ if socket.Conn != nil {
|
|
|
+ SendToStc(socket.Conn, encoded)
|
|
|
}
|
|
|
+
|
|
|
+ if socket.Conn8 != nil {
|
|
|
+ SendToStc(socket.Conn8, encoded)
|
|
|
+ }
|
|
|
+
|
|
|
}
|
|
|
|
|
|
// report broadcast status to STC
|
|
|
func PaStatus(src string, patype string, operation string) {
|
|
|
+
|
|
|
+ //Not Master role , ignore
|
|
|
+ if !active.Master {
|
|
|
+ return
|
|
|
+ }
|
|
|
lfshook.NewLogger().Logger.Infof("===PAStatus=Startext:%s=== type:%s=========action:%s", src, patype, operation)
|
|
|
protocol := msgdata.NewProtocol()
|
|
|
protocol.MessageID = 0x22
|
|
|
@@ -151,14 +161,24 @@ func PaStatus(src string, patype string, operation string) {
|
|
|
return
|
|
|
}
|
|
|
|
|
|
- if active.Actived {
|
|
|
+ if socket.Conn != nil {
|
|
|
SendToStc(socket.Conn, encoded)
|
|
|
+ }
|
|
|
+
|
|
|
+ if socket.Conn8 != nil {
|
|
|
SendToStc(socket.Conn8, encoded)
|
|
|
}
|
|
|
+
|
|
|
}
|
|
|
|
|
|
// report broadcast status to STC
|
|
|
func OccPad(operation string) {
|
|
|
+
|
|
|
+ //Not Master role , ignore
|
|
|
+ if !active.Master {
|
|
|
+ return
|
|
|
+ }
|
|
|
+
|
|
|
lfshook.NewLogger().Logger.Infof("===OCC-PAD========action:%s", operation)
|
|
|
protocol := msgdata.NewProtocol()
|
|
|
protocol.MessageID = 0x2A
|
|
|
@@ -181,10 +201,14 @@ func OccPad(operation string) {
|
|
|
return
|
|
|
}
|
|
|
|
|
|
- if active.Actived {
|
|
|
+ if socket.Conn != nil {
|
|
|
SendToStc(socket.Conn, encoded)
|
|
|
+ }
|
|
|
+
|
|
|
+ if socket.Conn8 != nil {
|
|
|
SendToStc(socket.Conn8, encoded)
|
|
|
}
|
|
|
+
|
|
|
}
|
|
|
|
|
|
// report broadcast status to STC
|
|
|
@@ -197,6 +221,11 @@ func SendRecordFile(filename, rcdtype string) {
|
|
|
return
|
|
|
}
|
|
|
*/
|
|
|
+ //Not Master role , ignore
|
|
|
+ if !active.Master {
|
|
|
+ return
|
|
|
+ }
|
|
|
+
|
|
|
protocol := msgdata.NewProtocol()
|
|
|
protocol.MessageID = 0x31
|
|
|
|
|
|
@@ -226,8 +255,12 @@ func SendRecordFile(filename, rcdtype string) {
|
|
|
return
|
|
|
}
|
|
|
|
|
|
- if active.Actived {
|
|
|
+ if socket.Conn != nil {
|
|
|
SendToStc(socket.Conn, encoded)
|
|
|
+ }
|
|
|
+
|
|
|
+ if socket.Conn8 != nil {
|
|
|
SendToStc(socket.Conn8, encoded)
|
|
|
}
|
|
|
+
|
|
|
}
|