| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748 |
- package mcu_ctrl_board
- /*
- #include "mcu_ctrl_board.h"
- */
- import "C"
- import (
- "path/filepath"
- "strings"
- "hnyfkj.com.cn/rtu/linux/baseapp"
- "hnyfkj.com.cn/rtu/linux/rtu/cbd/utils"
- )
- func playTextAudio(text string) bool {
- audioFile := ""
- switch text {
- case "button":
- audioFile = "voices/button.wav"
- case "reset":
- audioFile = "voices/reset.wav"
- case "save":
- audioFile = "voices/save.wav"
- case "takephoto.mp3":
- audioFile = "voices/takephoto.wav"
- case "workdone":
- audioFile = "voices/workdone.wav"
- case "workstart.mp3":
- audioFile = "voices/workstart.wav"
- default:
- return false
- }
- utils.PlayAudioAsync(filepath.Join(baseapp.EXEC_DIR, audioFile))
- return true
- }
- // 处理TEXT报文 支持老版协议
- func processText(textStr string) *C.char {
- text := strings.TrimSpace(textStr)
- if !playTextAudio(text) {
- baseapp.Logger.Warnf("未知的TEXT命令: %s", text)
- }
- return nil
- }
|