浏览代码

无占用信号是不能发起相关操作

dujunchen 5 天之前
父节点
当前提交
f2cf31a112
共有 1 个文件被更改,包括 42 次插入41 次删除
  1. 42 41
      internal/app/stc/broadcast/stc-broadcast.go

+ 42 - 41
internal/app/stc/broadcast/stc-broadcast.go

@@ -161,55 +161,62 @@ func processPacket(packet []byte) {
 		*/
 		break
 	case 0x02: // STN
-		if priority.CheckPriority("STN") {
-			action.HangupRunningTask("STN") //STN interrupt other
-			StationAnn(packet)
-		} else {
-			alstatus.PaStatus("", "STN", "refuse")
+		if active.ActivedCab != "" {
+			if priority.CheckPriority("STN") {
+				action.HangupRunningTask("STN") //STN interrupt other
+				StationAnn(packet)
+			} else {
+				alstatus.PaStatus("", "STN", "refuse")
+			}
 		}
-
 	case 0x05: // SPC
-		if priority.CheckPriority("SPC") {
-			action.HangupRunningTask("SPC") //SPC interrupt other
-			SpecialAnn(packet)
-		} else {
-			alstatus.PaStatus("", "SPC", "refuse")
+		if active.ActivedCab != "" {
+			if priority.CheckPriority("SPC") {
+				action.HangupRunningTask("SPC") //SPC interrupt other
+				SpecialAnn(packet)
+			} else {
+				alstatus.PaStatus("", "SPC", "refuse")
+			}
 		}
-
 	case 0x06: // EMG
-		if priority.CheckPriority("EMG") {
-			action.HangupRunningTask("EMG") //EMG interrupt other
-			EmgMsg(packet)
-		} else {
-			alstatus.PaStatus("", "EMG", "refuse")
+		if active.ActivedCab != "" {
+			if priority.CheckPriority("EMG") {
+				action.HangupRunningTask("EMG") //EMG interrupt other
+				EmgMsg(packet)
+			} else {
+				alstatus.PaStatus("", "EMG", "refuse")
+			}
 		}
 	case 0x07: // STOP
 		AnnStop([4]byte{packet[8], packet[9], packet[10], packet[11]})
 
 	case 0x08: // DCS
-		if priority.CheckPriority("DCS") {
-			action.HangupRunningTask("DCS") //DCS interrupt other
-			DcsAnn(packet)
-		} else {
-			alstatus.PaStatus("", "DCS", "refuse")
+		if active.ActivedCab != "" {
+			if priority.CheckPriority("DCS") {
+				action.HangupRunningTask("DCS") //DCS interrupt other
+				DcsAnn(packet)
+			} else {
+				alstatus.PaStatus("", "DCS", "refuse")
+			}
 		}
-
 	case 0x09: // SELF CHECK
-		if priority.CheckPriority("CHK") {
-			action.HangupRunningTask("CHK") //CHK interrupt other
-			SelfCheck(packet)
-		} else {
-			alstatus.PaStatus("", "CHK", "refuse")
+		if active.ActivedCab != "" {
+			if priority.CheckPriority("CHK") {
+				action.HangupRunningTask("CHK") //CHK interrupt other
+				SelfCheck(packet)
+			} else {
+				alstatus.PaStatus("", "CHK", "refuse")
+			}
 		}
-
 	case 0x0a: // Tone-test
-		if priority.CheckPriority("VOL") {
-			action.HangupRunningTask("VOL") //VOL interrupt other
-			ToneTest(packet)
-		} else {
-			alstatus.PaStatus("", "VOL", "refuse")
+		if active.ActivedCab != "" {
+			if priority.CheckPriority("VOL") {
+				action.HangupRunningTask("VOL") //VOL interrupt other
+				ToneTest(packet)
+			} else {
+				alstatus.PaStatus("", "VOL", "refuse")
+			}
 		}
-
 	case 0x0e: //TMS answer PAD
 		if priority.CheckPriority("PAD-TMS") {
 			action.HangupRunningTask("PAD-TMS") //PAD-TMS interrupt other
@@ -287,17 +294,11 @@ func Active(data [2]byte) {
 	case 1:
 		active.ActivedCab = "1"
 		//lfshook.NewLogger().Logger.Infof("=================active===MC1===============")
-		if active.CabNum == "8" { // local cab is MC1
-			action.InActiveHangup()
-		}
 
 	case 8:
 
 		active.ActivedCab = "8"
 		//lfshook.NewLogger().Logger.Infof("=================active===MC8===============")
-		if active.CabNum == "1" { //Local cab is MC8
-			action.InActiveHangup()
-		}
 	}
 }