|
|
@@ -14,7 +14,6 @@ import (
|
|
|
"pbx-api-gin/internal/app/stc/active"
|
|
|
msgdata "pbx-api-gin/internal/app/stc/data"
|
|
|
alstatus "pbx-api-gin/internal/app/stc/sendstatus"
|
|
|
- "pbx-api-gin/internal/app/stc/socket"
|
|
|
"pbx-api-gin/pkg/lfshook"
|
|
|
"sync"
|
|
|
"time"
|
|
|
@@ -135,12 +134,7 @@ func StationAnn(data []byte) (err error) {
|
|
|
}
|
|
|
|
|
|
//Pa status report
|
|
|
- if active.Actived && active.CabNum == "1" {
|
|
|
- alstatus.PaStatus("", "STN", "start", socket.Conn)
|
|
|
- }
|
|
|
- if active.Actived && active.CabNum == "8" {
|
|
|
- alstatus.PaStatus("", "STN", "start", socket.Conn8)
|
|
|
- }
|
|
|
+ alstatus.PaStatus("", "STN", "start")
|
|
|
|
|
|
action.PlaybackPacu(filename, int(cycleCount), int(delay), "STN")
|
|
|
return nil
|
|
|
@@ -224,12 +218,7 @@ func SpecialAnn(data []byte) {
|
|
|
}
|
|
|
|
|
|
//Pa status report
|
|
|
- if active.Actived && active.CabNum == "1" {
|
|
|
- alstatus.PaStatus("", "SPC", "start", socket.Conn)
|
|
|
- }
|
|
|
- if active.Actived && active.CabNum == "8" {
|
|
|
- alstatus.PaStatus("", "SPC", "start", socket.Conn8)
|
|
|
- }
|
|
|
+ alstatus.PaStatus("", "SPC", "start")
|
|
|
|
|
|
lfshook.NewLogger().Infof("======count:%x", cycleCount)
|
|
|
if int(cycleCount) == 255 {
|
|
|
@@ -254,12 +243,7 @@ func EmgMsg(data []byte) {
|
|
|
}
|
|
|
|
|
|
//Pa status report
|
|
|
- if active.Actived && active.CabNum == "1" {
|
|
|
- alstatus.PaStatus("", "EMG", "start", socket.Conn)
|
|
|
- }
|
|
|
- if active.Actived && active.CabNum == "8" {
|
|
|
- alstatus.PaStatus("", "EMG", "start", socket.Conn8)
|
|
|
- }
|
|
|
+ alstatus.PaStatus("", "EMG", "start")
|
|
|
|
|
|
lfshook.NewLogger().Infof("======count:%x", cycleCount)
|
|
|
if int(cycleCount) == 255 {
|
|
|
@@ -272,15 +256,8 @@ func EmgMsg(data []byte) {
|
|
|
// 停止指定类型广播
|
|
|
func AnnStop(data [4]byte) {
|
|
|
|
|
|
- var conn net.Conn
|
|
|
RunningType := ""
|
|
|
|
|
|
- if active.Actived && active.CabNum == "1" {
|
|
|
- conn = socket.Conn
|
|
|
- } else if active.Actived && active.CabNum == "8" {
|
|
|
- conn = socket.Conn8
|
|
|
- }
|
|
|
-
|
|
|
switch data[0] {
|
|
|
case 0x03:
|
|
|
RunningType = "DCS"
|
|
|
@@ -294,7 +271,7 @@ func AnnStop(data [4]byte) {
|
|
|
RunningType = "CHK"
|
|
|
}
|
|
|
|
|
|
- alstatus.PaStatus("", RunningType, "end", conn)
|
|
|
+ alstatus.PaStatus("", RunningType, "end")
|
|
|
|
|
|
for _, ext := range Pacus {
|
|
|
action.Hangup(ext)
|
|
|
@@ -324,12 +301,7 @@ func DcsAnn(data []byte) {
|
|
|
|
|
|
//lfshook.NewLogger().Infof("======count:%x", cycleCount)
|
|
|
//Pa status report
|
|
|
- if active.Actived && active.CabNum == "1" {
|
|
|
- alstatus.PaStatus("", "DCS", "start", socket.Conn)
|
|
|
- }
|
|
|
- if active.Actived && active.CabNum == "8" {
|
|
|
- alstatus.PaStatus("", "DCS", "start", socket.Conn8)
|
|
|
- }
|
|
|
+ alstatus.PaStatus("", "DCS", "start")
|
|
|
|
|
|
if int(cycleCount) == 255 {
|
|
|
action.PlaybackPacu(filename, 9999999, int(delay), "DCS")
|
|
|
@@ -340,6 +312,7 @@ func DcsAnn(data []byte) {
|
|
|
|
|
|
// 自检广播
|
|
|
func SelfCheck(data []byte) {
|
|
|
+
|
|
|
check := data[8]
|
|
|
delay := data[9]
|
|
|
cycleCount := data[10]
|
|
|
@@ -357,23 +330,12 @@ func SelfCheck(data []byte) {
|
|
|
case 0x01: //start
|
|
|
|
|
|
//Pa status report
|
|
|
- if active.Actived && active.CabNum == "1" {
|
|
|
- alstatus.PaStatus("", "CHK", "start", socket.Conn)
|
|
|
- }
|
|
|
- if active.Actived && active.CabNum == "8" {
|
|
|
- alstatus.PaStatus("", "CHK", "start", socket.Conn8)
|
|
|
- }
|
|
|
-
|
|
|
+ alstatus.PaStatus("", "CHK", "start")
|
|
|
action.PlaybackPacu(filename, int(cycleCount), int(delay), "CHK")
|
|
|
case 0x02: //stop
|
|
|
|
|
|
//Pa status report
|
|
|
- if active.Actived && active.CabNum == "1" {
|
|
|
- alstatus.PaStatus("", "CHK", "end", socket.Conn)
|
|
|
- }
|
|
|
- if active.Actived && active.CabNum == "8" {
|
|
|
- alstatus.PaStatus("", "CHK", "end", socket.Conn8)
|
|
|
- }
|
|
|
+ alstatus.PaStatus("", "CHK", "end")
|
|
|
|
|
|
for _, ext := range Pacus {
|
|
|
asterisk.Hangup(ext)
|
|
|
@@ -516,11 +478,11 @@ func AlarmResetAll() {
|
|
|
}
|
|
|
|
|
|
if active.CabNum == "1" && active.Actived {
|
|
|
- action.Hangup("2311") //1 车接听
|
|
|
- alstatus.AlarmStatus("0000", "allreset", socket.Conn) //send all reset status
|
|
|
+ action.Hangup("2311") //1 车接听
|
|
|
+ alstatus.AlarmStatus("0000", "allreset") //send all reset status
|
|
|
} else if active.CabNum == "8" && active.Actived {
|
|
|
- action.Hangup("2381") //8 车接听
|
|
|
- alstatus.AlarmStatus("0000", "allreset", socket.Conn8) // send all reset status
|
|
|
+ action.Hangup("2381") //8 车接听
|
|
|
+ alstatus.AlarmStatus("0000", "allreset") // send all reset status
|
|
|
}
|
|
|
}
|
|
|
|