This commit is contained in:
suyl
2021-08-04 15:11:12 +08:00
parent d2e06c0231
commit 2d75a94b24
2 changed files with 24 additions and 15 deletions

View File

@@ -11,6 +11,7 @@ import (
"net"
"strings"
"time"
"unicode/utf8"
)
//入口
@@ -245,6 +246,13 @@ func (t *TcpClient) doPrint(key string) (err error) {
dataStr := <-t.CallBackMap[printMsg.PrintNo]
a, b := getCallbackMsgInfo(dataStr)
t.changePrintMsg(dataStr, a, b)
//判断音频暂停?
//收到打印成功回调后,如果消息中有音频,需要等待一下
if sounds := regexpSoundSpan.FindStringSubmatch(printMsg.Content); len(sounds) > 0 {
sound := sounds[1]
lenTime := time.Duration(utf8.RuneCountInString(sound)) * time.Second
time.Sleep(lenTime)
}
}
}
}

View File

@@ -51,7 +51,7 @@ const (
signQrCenter = "<qrc>" //二维码居中
signQrLeft = "<qrl>" //二维码居左
signQrRight = "<qrr>" //二维码居右
signSound = "<sound>" //声音
signSound, signSoundEnd = "<sound>", "</sound>"
hexSignBROrEXE = "0a"
hexSignCenter = "1b6101"
@@ -107,6 +107,7 @@ var (
regexpQrl = regexp.MustCompile(byteSignQrLeft + "(.*?)" + byteSignQrLeftE)
regexpQrr = regexp.MustCompile(byteSignQrRight + "(.*?)" + byteSignQrRightE)
regexpSound = regexp.MustCompile(byteSignSound + "(.*?)" + byteSignSoundE)
regexpSoundSpan = regexp.MustCompile(signSound + "(.*?)" + signSoundEnd)
)
type PrintInfo struct {