diff --git a/client.go b/client.go index 44cf16c..bb58eb5 100644 --- a/client.go +++ b/client.go @@ -512,12 +512,12 @@ func (b *Talkkonnect) ClientStart() { if Config.Global.Software.Settings.StreamOnStart { time.Sleep(Config.Global.Software.Settings.StreamOnStartAfter * time.Second) - b.cmdPlayback("xml settings") + b.cmdPlayback() } if Config.Global.Software.Settings.TXOnStart { time.Sleep(Config.Global.Software.Settings.TXOnStartAfter * time.Second) - b.cmdStartTransmitting("xml settings") + b.cmdStartTransmitting() } keyPressListenerLoop: @@ -532,105 +532,105 @@ keyPressListenerLoop: case term.KeyDelete: b.cmdDisplayMenu() case term.KeyF1: - b.cmdChannelUp("tty keyboard") + b.cmdChannelUp() case term.KeyF2: - b.cmdChannelDown("tty keyboard") + b.cmdChannelDown() case term.KeyF3: - b.cmdMuteUnmute("toggle", "tty keyboard") + b.cmdMuteUnmute("toggle") case term.KeyF4: - b.cmdCurrentVolume("tty keyboard") + b.cmdCurrentVolume() case term.KeyF5: - b.cmdVolumeUp("tty keyboard") + b.cmdVolumeUp() case term.KeyF6: - b.cmdVolumeDown("tty keyboard") + b.cmdVolumeDown() case term.KeyF7: - b.cmdListServerChannels("tty keyboard") + b.cmdListServerChannels() case term.KeyF8: - b.cmdStartTransmitting("tty keyboard") + b.cmdStartTransmitting() case term.KeyF9: - b.cmdStopTransmitting("tty keyboard") + b.cmdStopTransmitting() case term.KeyF10: - b.cmdListOnlineUsers("tty keyboard") + b.cmdListOnlineUsers() case term.KeyF11: - b.cmdPlayback("tty keyboard") + b.cmdPlayback() case term.KeyF12: - go b.cmdGPSPosition("tty keyboard") + go b.cmdGPSPosition() case term.KeyCtrlB: - b.cmdLiveReload("tty keyboard") + b.cmdLiveReload() case term.KeyCtrlC: talkkonnectAcknowledgements("\u001b[44;1m") // add blue background to banner reference https://www.lihaoyi.com/post/BuildyourownCommandLinewithANSIescapecodes.html#background-colors - b.cmdQuitTalkkonnect("tty keyboard") + b.cmdQuitTalkkonnect() case term.KeyCtrlD: b.cmdDebugStacktrace() case term.KeyCtrlE: - b.cmdSendEmail("tty keyboard") + b.cmdSendEmail() case term.KeyCtrlF: - b.cmdConnPreviousServer("tty keyboard") + b.cmdConnPreviousServer() case term.KeyCtrlH: - cmdSanityCheck("tty keyboard") + cmdSanityCheck() case term.KeyCtrlI: // New. Audio Recording. Traffic - b.cmdAudioTrafficRecord("tty keyboard") + b.cmdAudioTrafficRecord() case term.KeyCtrlJ: // New. Audio Recording. Mic - b.cmdAudioMicRecord("tty keyboard") + b.cmdAudioMicRecord() case term.KeyCtrlK: // New/ Audio Recording. Combo - b.cmdAudioMicTrafficRecord("tty keyboard") + b.cmdAudioMicTrafficRecord() case term.KeyCtrlL: - b.cmdClearScreen("tty keyboard") + b.cmdClearScreen() case term.KeyCtrlO: - b.cmdPingServers("tty keyboard") + b.cmdPingServers() case term.KeyCtrlN: - b.cmdConnNextServer("tty keyboard") + b.cmdConnNextServer() case term.KeyCtrlP: - b.cmdPanicSimulation("tty keyboard") + b.cmdPanicSimulation() case term.KeyCtrlG: - b.cmdPlayRepeaterTone("tty keyboard") + b.cmdPlayRepeaterTone() case term.KeyCtrlR: - b.cmdRepeatTxLoop("tty keyboard") + b.cmdRepeatTxLoop() case term.KeyCtrlS: - b.cmdScanChannels("tty keyboard") + b.cmdScanChannels() case term.KeyCtrlT: - cmdThanks("tty keyboard") + cmdThanks() case term.KeyCtrlU: - b.cmdShowUptime("tty keyboard") + b.cmdShowUptime() case term.KeyCtrlV: - b.cmdDisplayVersion("tty keyboard") + b.cmdDisplayVersion() case term.KeyCtrlX: - b.cmdDumpXMLConfig("tty keyboard") + b.cmdDumpXMLConfig() default: if _, ok := TTYKeyMap[ev.Ch]; ok { switch strings.ToLower(TTYKeyMap[ev.Ch].Command) { case "channelup": - b.cmdChannelUp("tty keyboard") + b.cmdChannelUp() case "channeldown": - b.cmdChannelDown("tty keyboard") + b.cmdChannelDown() case "serverup": - b.cmdConnNextServer("tty keyboard") + b.cmdConnNextServer() case "serverdown": - b.cmdConnPreviousServer("tty keyboard") + b.cmdConnPreviousServer() case "mute": - b.cmdMuteUnmute("mute", "tty keyboard") + b.cmdMuteUnmute("mute") case "unmute": - b.cmdMuteUnmute("unmute", "tty keyboard") + b.cmdMuteUnmute("unmute") case "mute-toggle": - b.cmdMuteUnmute("toggle", "tty keyboard") + b.cmdMuteUnmute("toggle") case "stream-toggle": - b.cmdPlayback("tty keyboard") + b.cmdPlayback() case "volumeup": - b.cmdVolumeUp("tty keyboard") + b.cmdVolumeUp() case "volumedown": - b.cmdVolumeDown("tty keyboard") + b.cmdVolumeDown() case "setcomment": if TTYKeyMap[ev.Ch].ParamValue == "setcomment" { log.Println("info: Set Commment ", TTYKeyMap[ev.Ch].ParamValue) b.Client.Self.SetComment(TTYKeyMap[ev.Ch].ParamValue) } case "transmitstart": - b.cmdStartTransmitting("tty keyboard") + b.cmdStartTransmitting() case "transmitstop": - b.cmdStopTransmitting("tty keyboard") + b.cmdStopTransmitting() case "record": - b.cmdAudioTrafficRecord("tty keyboard") - b.cmdAudioMicRecord("tty keyboard") + b.cmdAudioTrafficRecord() + b.cmdAudioMicRecord() case "voicetargetset": Paramvalue, err := strconv.Atoi(TTYKeyMap[ev.Ch].ParamValue) if err != nil { diff --git a/commandkeys.go b/commandkeys.go index 96cf0dc..e935f68 100644 --- a/commandkeys.go +++ b/commandkeys.go @@ -51,19 +51,19 @@ func (b *Talkkonnect) cmdDisplayMenu() { b.ParticipantLEDUpdate(true) } -func (b *Talkkonnect) cmdChannelUp(source string) { - log.Printf("debug: F1 pressed Channel Up (+) Requested from %v\n", source) +func (b *Talkkonnect) cmdChannelUp() { + log.Printf("debug: F1 pressed Channel Up (+) Requested\n") b.ChannelUp() } -func (b *Talkkonnect) cmdChannelDown(source string) { - log.Printf("debug: F2 pressed Channel Down (-) Requested from %v\n", source) +func (b *Talkkonnect) cmdChannelDown() { + log.Printf("debug: F2 pressed Channel Down (-) Requested \n") b.ChannelDown() } -func (b *Talkkonnect) cmdMuteUnmute(subCommand, source string) { +func (b *Talkkonnect) cmdMuteUnmute(subCommand string) { - log.Printf("debug: F3 pressed %v Speaker Requested from %v\n", subCommand, source) + log.Printf("debug: F3 pressed %v Speaker Requested \n", subCommand) OrigMuted, err := volume.GetMuted(Config.Global.Software.Settings.OutputMuteControlDevice) if err != nil { @@ -157,13 +157,13 @@ func (b *Talkkonnect) cmdMuteUnmute(subCommand, source string) { return } } -func (b *Talkkonnect) cmdCurrentVolume(source string) { +func (b *Talkkonnect) cmdCurrentVolume() { OrigVolume, err := volume.GetVolume(Config.Global.Software.Settings.OutputVolControlDevice) if err != nil { log.Printf("error: Unable to get current volume: %+v\n", err) } - log.Printf("debug: F4 pressed Volume Level Requested From =%v\n", source) + log.Printf("debug: F4 pressed Volume Level Requested\n") log.Println("info: Volume Level is at", OrigVolume, "%") TTSEvent("currentvolumelevel") @@ -179,8 +179,8 @@ func (b *Talkkonnect) cmdCurrentVolume(source string) { } } -func (b *Talkkonnect) cmdVolumeUp(source string) { - log.Printf("debug: F5 pressed Volume UP (+) from %v\n", source) +func (b *Talkkonnect) cmdVolumeUp() { + log.Printf("debug: F5 pressed Volume UP (+) \n") origVolume, err := volume.GetVolume(Config.Global.Software.Settings.OutputVolControlDevice) if err != nil { log.Printf("warn: unable to get original volume: %+v volume control will not work!\n", err) @@ -219,8 +219,8 @@ func (b *Talkkonnect) cmdVolumeUp(source string) { TTSEvent("digitalvolumeup") } -func (b *Talkkonnect) cmdVolumeDown(source string) { - log.Printf("info: F6 pressed Volume Down (-) from %v\n", source) +func (b *Talkkonnect) cmdVolumeDown() { + log.Printf("info: F6 pressed Volume Down (-) \n") origVolume, err := volume.GetVolume(Config.Global.Software.Settings.OutputVolControlDevice) if err != nil { log.Printf("warn: unable to get original volume: %+v volume control will not work!\n", err) @@ -260,16 +260,16 @@ func (b *Talkkonnect) cmdVolumeDown(source string) { TTSEvent("digitalvolumedown") } -func (b *Talkkonnect) cmdListServerChannels(source string) { - log.Printf("debug: F7 pressed Channel List Requested %v\n", source) +func (b *Talkkonnect) cmdListServerChannels() { + log.Printf("debug: F7 pressed Channel List Requested \n") TTSEvent("listserverchannels") b.ListChannels(true) b.ParticipantLEDUpdate(true) } -func (b *Talkkonnect) cmdStartTransmitting(source string) { - log.Printf("debug: F8 pressed TX Mode Requested (Start Transmitting) from %v\n", source) +func (b *Talkkonnect) cmdStartTransmitting() { + log.Printf("debug: F8 pressed TX Mode Requested (Start Transmitting) \n") log.Println("info: Start Transmitting") TTSEvent("starttransmitting") @@ -294,8 +294,8 @@ func (b *Talkkonnect) cmdStartTransmitting(source string) { } } -func (b *Talkkonnect) cmdStopTransmitting(source string) { - log.Printf("debug: F9 pressed RX Mode Request (Stop Transmitting) from %v\n", source) +func (b *Talkkonnect) cmdStopTransmitting() { + log.Printf("debug: F9 pressed RX Mode Request (Stop Transmitting) \n") log.Println("info: Stop Transmitting") TTSEvent("stoptransmitting") @@ -320,8 +320,8 @@ func (b *Talkkonnect) cmdStopTransmitting(source string) { } } -func (b *Talkkonnect) cmdListOnlineUsers(source string) { - log.Printf("debug: F10 pressed Online User(s) in Current Channel Requested from %v\n", source) +func (b *Talkkonnect) cmdListOnlineUsers() { + log.Printf("debug: F10 pressed Online User(s) in Current Channel Requested \n") log.Println("info: F10 Online User(s) in Current Channel") TTSEvent("listonlineusers") @@ -331,8 +331,8 @@ func (b *Talkkonnect) cmdListOnlineUsers(source string) { b.ParticipantLEDUpdate(true) } -func (b *Talkkonnect) cmdPlayback(source string) { - log.Printf("debug: F11 pressed Start/Stop Stream Stream into Current Channel Requested from %v", source) +func (b *Talkkonnect) cmdPlayback() { + log.Printf("debug: F11 pressed Start/Stop Stream Stream into Current Channel Requested \n") log.Println("info: Stream into Current Channel") b.BackLightTimer() @@ -359,8 +359,8 @@ func (b *Talkkonnect) cmdPlayback(source string) { } } -func (b *Talkkonnect) cmdGPSPosition(source string) { - log.Printf("debug: F12 pressed from %v\n", source) +func (b *Talkkonnect) cmdGPSPosition() { + log.Printf("debug: F12 pressed \n") log.Println("info: GPS details requested") TTSEvent("requestgpsposition") @@ -384,14 +384,13 @@ func (b *Talkkonnect) cmdGPSPosition(source string) { } } - tnow := fmt.Sprintf(time.Now().Format("15:04:05")) if Config.Global.Hardware.GPS.Enabled { if Config.Global.Hardware.LCD.Enabled && (Config.Global.Hardware.GPS.GpsDisplayShow || Config.Global.Hardware.Traccar.DeviceScreenEnabled) { LcdText = [4]string{"nil", "GPS ERR1", "GPS Device Error", ""} go hd44780.LcdDisplay(LcdText, LCDRSPin, LCDEPin, LCDD4Pin, LCDD5Pin, LCDD6Pin, LCDD7Pin, LCDInterfaceType, LCDI2CAddress) } if Config.Global.Hardware.OLED.Enabled { - oledDisplay(false, 4, 1, "GPS ERR1"+tnow) + oledDisplay(false, 4, 1, "GPS ERR1 "+time.Now().Format("15:04:05")) oledDisplay(false, 5, 1, "GPS Device Error") oledDisplay(false, 6, 1, "") oledDisplay(false, 7, 1, "") @@ -421,14 +420,13 @@ func (b *Talkkonnect) cmdGPSPosition(source string) { } // - tnow := fmt.Sprintf(time.Now().Format("15:04:05")) if Config.Global.Hardware.GPS.Enabled { if Config.Global.Hardware.LCD.Enabled && (Config.Global.Hardware.GPS.GpsDisplayShow || Config.Global.Hardware.Traccar.DeviceScreenEnabled) { LcdText = [4]string{"nil", "GPS ERR2", "No Good GPS Reading", ""} go hd44780.LcdDisplay(LcdText, LCDRSPin, LCDEPin, LCDD4Pin, LCDD5Pin, LCDD6Pin, LCDD7Pin, LCDInterfaceType, LCDI2CAddress) } if Config.Global.Hardware.OLED.Enabled { - oledDisplay(false, 4, 1, "GPS ERR2"+tnow) + oledDisplay(false, 4, 1, "GPS ERR2 "+time.Now().Format("15:04:05")) oledDisplay(false, 5, 1, "No Good GPS Reading") oledDisplay(false, 6, 1, "") oledDisplay(false, 7, 1, "") @@ -437,8 +435,8 @@ func (b *Talkkonnect) cmdGPSPosition(source string) { } } -func (b *Talkkonnect) cmdQuitTalkkonnect(source string) { - log.Printf("debug: Ctrl-C Terminate Program Requested from %v\n", source) +func (b *Talkkonnect) cmdQuitTalkkonnect() { + log.Printf("debug: Ctrl-C Terminate Program Requested \n") duration := time.Since(StartTime) log.Printf("info: Talkkonnect Now Running For %v \n", secondsToHuman(int(duration.Seconds()))) TTSEvent("quittalkkonnect") @@ -461,8 +459,8 @@ func (b *Talkkonnect) cmdDebugStacktrace() { goStreamStats() } -func (b *Talkkonnect) cmdSendEmail(source string) { - log.Printf("debug: Ctrl-E Pressed from %v\n", source) +func (b *Talkkonnect) cmdSendEmail() { + log.Printf("debug: Ctrl-E Pressed \n") log.Println("info: Send Email Requested") var i int = 0 @@ -516,8 +514,8 @@ func (b *Talkkonnect) cmdSendEmail(source string) { } } -func (b *Talkkonnect) cmdConnPreviousServer(source string) { - log.Printf("debug: Ctrl-F Pressed from %v", source) +func (b *Talkkonnect) cmdConnPreviousServer() { + log.Printf("debug: Ctrl-F Pressed \n") log.Println("info: Previous Server Requested") TTSEvent("previousserver") @@ -532,9 +530,9 @@ func (b *Talkkonnect) cmdConnPreviousServer(source string) { } } -func (b *Talkkonnect) cmdClearScreen(source string) { +func (b *Talkkonnect) cmdClearScreen() { reset() - log.Printf("debug: Ctrl-L Pressed Cleared Screen from %v\n", source) + log.Printf("debug: Ctrl-L Pressed Cleared Screen \n") if Config.Global.Hardware.TargetBoard == "rpi" { if LCDEnabled { LcdText = [4]string{"nil", "nil", "nil", "nil"} @@ -549,15 +547,15 @@ func (b *Talkkonnect) cmdClearScreen(source string) { } } -func (b *Talkkonnect) cmdPingServers(source string) { - log.Printf("debug: Ctrl-O Pressed %v\n", source) +func (b *Talkkonnect) cmdPingServers() { + log.Printf("debug: Ctrl-O Pressed \n") log.Println("info: Ping Servers") TTSEvent("pingservers") b.pingServers() } -func (b *Talkkonnect) cmdConnNextServer(source string) { - log.Printf("debug: Ctrl-N Pressed from %v\n", source) +func (b *Talkkonnect) cmdConnNextServer() { + log.Printf("debug: Ctrl-N Pressed \n") log.Println("info: Next Server Requested Killing This Session, talkkonnect should be restarted by systemd") TTSEvent("nextserver") @@ -573,8 +571,8 @@ func (b *Talkkonnect) cmdConnNextServer(source string) { } -func (b *Talkkonnect) cmdAudioTrafficRecord(source string) { - log.Printf("debug: Ctrl-I Pressed from %v\n", source) +func (b *Talkkonnect) cmdAudioTrafficRecord() { + log.Printf("debug: Ctrl-I Pressed \n") log.Println("info: Traffic Recording Requested") if !Config.Global.Hardware.AudioRecordFunction.Enabled { log.Println("warn: Audio Recording Function Not Enabled") @@ -605,8 +603,8 @@ func (b *Talkkonnect) cmdAudioTrafficRecord(source string) { } } -func (b *Talkkonnect) cmdAudioMicRecord(source string) { - log.Printf("debug: Ctrl-J Pressed from %v\n", source) +func (b *Talkkonnect) cmdAudioMicRecord() { + log.Printf("debug: Ctrl-J Pressed \n") log.Println("info: Ambient (Mic) Recording Requested") if !Config.Global.Hardware.AudioRecordFunction.Enabled { log.Println("warn: Audio Recording Function Not Enabled") @@ -637,8 +635,8 @@ func (b *Talkkonnect) cmdAudioMicRecord(source string) { } } -func (b *Talkkonnect) cmdAudioMicTrafficRecord(source string) { - log.Printf("debug: Ctrl-K Pressed from %v\n", source) +func (b *Talkkonnect) cmdAudioMicTrafficRecord() { + log.Printf("debug: Ctrl-K Pressed \n") log.Println("info: Recording (Traffic and Mic) Requested") if !Config.Global.Hardware.AudioRecordFunction.Enabled { log.Println("warn: Audio Recording Function Not Enabled") @@ -669,12 +667,12 @@ func (b *Talkkonnect) cmdAudioMicTrafficRecord(source string) { } } -func (b *Talkkonnect) cmdPanicSimulation(source string) { +func (b *Talkkonnect) cmdPanicSimulation() { if !(IsConnected) { return } b.BackLightTimer() - log.Printf("debug: Ctrl-P Pressed from %v\n", source) + log.Printf("debug: Ctrl-P Pressed \n") log.Println("info: Panic Button Start/Stop Simulation Requested") TTSEvent("panicsimulation") @@ -738,7 +736,7 @@ func (b *Talkkonnect) cmdPanicSimulation(source string) { // New. Send email after Panic Event // if Config.Global.Hardware.PanicFunction.PMailEnabled { - b.cmdSendEmail("from panic") + b.cmdSendEmail() log.Println("info: Sending Panic Alert Email To Predefined Email Address") } // @@ -771,36 +769,36 @@ func (b *Talkkonnect) cmdPanicSimulation(source string) { } } -func (b *Talkkonnect) cmdRepeatTxLoop(source string) { - log.Printf("debug: Ctrl-R Pressed from %v\n", source) +func (b *Talkkonnect) cmdRepeatTxLoop() { + log.Printf("debug: Ctrl-R Pressed \n") log.Println("info: Repeat TX Test Requested") isrepeattx = !isrepeattx go b.repeatTx() } -func (b *Talkkonnect) cmdScanChannels(source string) { - log.Printf("debug: Ctrl-S Pressed fgrom %v\n", source) +func (b *Talkkonnect) cmdScanChannels() { + log.Printf("debug: Ctrl-S Pressed fgrom \n") log.Println("info: Scanning Channels") TTSEvent("startscanning") b.Scan() } -func cmdThanks(source string) { - log.Printf("debug: Ctrl-T Pressed from %v\n", source) +func cmdThanks() { + log.Printf("debug: Ctrl-T Pressed \n") log.Println("info: Thanks and Acknowledgements Screen Request ") talkkonnectAcknowledgements("\u001b[44;1m") // add blue background to banner reference https://www.lihaoyi.com/post/BuildyourownCommandLinewithANSIescapecodes.html#background-colors } -func (b *Talkkonnect) cmdShowUptime(source string) { - log.Printf("debug: Ctrl-U Pressed from %v\n", source) +func (b *Talkkonnect) cmdShowUptime() { + log.Printf("debug: Ctrl-U Pressed \n") log.Println("info: Talkkonnect Uptime Request ") duration := time.Since(StartTime) log.Printf("info: Talkkonnect Now Running For %v \n", secondsToHuman(int(duration.Seconds()))) } -func (b *Talkkonnect) cmdDisplayVersion(source string) { - log.Printf("debug: Ctrl-V Pressed from %v\n", source) +func (b *Talkkonnect) cmdDisplayVersion() { + log.Printf("debug: Ctrl-V Pressed \n") log.Println("info: Talkkonnect Version Request ") releasedVersion := checkGitHubVersion() if talkkonnectVersion != releasedVersion { @@ -810,15 +808,15 @@ func (b *Talkkonnect) cmdDisplayVersion(source string) { } } -func (b *Talkkonnect) cmdDumpXMLConfig(source string) { - log.Printf("debug: Ctrl-X Pressed from %v\n", source) +func (b *Talkkonnect) cmdDumpXMLConfig() { + log.Printf("debug: Ctrl-X Pressed \n") log.Println("info: Print XML Config " + ConfigXMLFile) TTSEvent("printxmlconfig") printxmlconfig() } -func (b *Talkkonnect) cmdPlayRepeaterTone(source string) { - log.Printf("debug: Ctrl-G Pressed from %v\n", source) +func (b *Talkkonnect) cmdPlayRepeaterTone() { + log.Printf("debug: Ctrl-G Pressed \n") log.Println("info: Play Repeater Tone on Speaker and Simulate RX Signal") b.BackLightTimer() @@ -831,8 +829,8 @@ func (b *Talkkonnect) cmdPlayRepeaterTone(source string) { } -func (b *Talkkonnect) cmdLiveReload(source string) { - log.Printf("debug: Ctrl-B Pressed from %v\n", source) +func (b *Talkkonnect) cmdLiveReload() { + log.Printf("debug: Ctrl-B Pressed \n") log.Println("info: XML Config Live Reload") err := readxmlconfig(ConfigXMLFile, true) if err != nil { @@ -841,8 +839,8 @@ func (b *Talkkonnect) cmdLiveReload(source string) { } } -func cmdSanityCheck(source string) { - log.Printf("debug: Ctrl-H Pressed from %v\n", source) +func cmdSanityCheck() { + log.Printf("debug: Ctrl-H Pressed \n") log.Println("info: XML Sanity Checker") CheckConfigSanity(false) } diff --git a/gpio.go b/gpio.go index b5daba6..f0064db 100644 --- a/gpio.go +++ b/gpio.go @@ -449,7 +449,7 @@ func (b *Talkkonnect) initGPIO() { } else { log.Println("debug: Panic Button is pressed") playIOMedia("iopanic") - b.cmdPanicSimulation("gpio button") + b.cmdPanicSimulation() time.Sleep(150 * time.Millisecond) } } @@ -502,7 +502,7 @@ func (b *Talkkonnect) initGPIO() { } else { playIOMedia("iostreamtoggle") log.Println("debug: Stream Button is pressed") - b.cmdPlayback("gpio button") + b.cmdPlayback() time.Sleep(150 * time.Millisecond) } } @@ -527,11 +527,11 @@ func (b *Talkkonnect) initGPIO() { if currentStateB != currentStateA && err1 == nil { playIOMedia("iorotarycw") log.Println("debug: Rotating Clockwise") - b.cmdChannelUp("rotary encoder") + b.cmdChannelUp() } else { log.Println("debug: Rotating CounterClockwise") playIOMedia("iorotaryccw") - b.cmdChannelDown("rotary encoder") + b.cmdChannelDown() } } LastStateA = currentStateA @@ -558,7 +558,7 @@ func (b *Talkkonnect) initGPIO() { } else { log.Println("debug: Vol UP Button is pressed") playIOMedia("iovolup") - b.cmdVolumeUp("gpio button") + b.cmdVolumeUp() } } } else { @@ -582,7 +582,7 @@ func (b *Talkkonnect) initGPIO() { } else { log.Println("debug: Vol Down Button is pressed") playIOMedia("iovoldown") - b.cmdVolumeDown("gpio button") + b.cmdVolumeDown() } } } else { @@ -689,7 +689,7 @@ func (b *Talkkonnect) initGPIO() { } else { log.Println("debug: NextServer Button is pressed") playIOMedia("iocnextserver") - b.cmdConnNextServer("gpio button") + b.cmdConnNextServer() time.Sleep(150 * time.Millisecond) } } @@ -715,7 +715,7 @@ func (b *Talkkonnect) initGPIO() { } else { log.Println("debug: Repeater Tone Button is pressed") playIOMedia("iorepeatertone") - b.cmdPlayRepeaterTone("gpio button") + b.cmdPlayRepeaterTone() time.Sleep(150 * time.Millisecond) } } diff --git a/media.go b/media.go index f4672ad..378b858 100644 --- a/media.go +++ b/media.go @@ -37,13 +37,11 @@ import ( "log" "os/exec" "strconv" - "time" ) func aplayLocal(fileNameWithPath string) { var player string - - CmdArguments := []string{} + var CmdArguments = []string{} if path, err := exec.LookPath("aplay"); err == nil { CmdArguments = []string{fileNameWithPath, "-q", "-N"} @@ -121,6 +119,7 @@ func (b *Talkkonnect) PlayTone(toneFreq int, toneDuration float32, destination s } } +/* func playAnnouncementMedia(id int) { for _, multimedia := range Config.Global.Multimedia.ID { @@ -150,15 +149,16 @@ func playAnnouncementMedia(id int) { } } if multimedia.Params.Playintostream { - log.Println("alert: todo play into stream") + log.Println("alert: todo play into stream not implemented yet") + } + + if multimedia.Params.Voicetarget { + log.Println("alert: todo play to voice targets not implemented yet") } } } - - // Config.Global.Multimedia.Params.Playintostream - // Config.Global.Multimedia.Params.Voicetarget - } +*/ func findEventSound(findEventSound string) EventSoundStruct { for _, sound := range Config.Global.Software.Sounds.Sound { diff --git a/usbkeyboard.go b/usbkeyboard.go index f93369a..fec8c18 100644 --- a/usbkeyboard.go +++ b/usbkeyboard.go @@ -66,35 +66,35 @@ func (b *Talkkonnect) USBKeyboard() { switch strings.ToLower(USBKeyMap[rune(ke.Scancode)].Command) { case "channelup": playIOMedia("usbchannelup") - b.cmdChannelUp("usb keyboard") + b.cmdChannelUp() case "channeldown": playIOMedia("usbchanneldown") - b.cmdChannelDown("usb keyboard") + b.cmdChannelDown() case "serverup": playIOMedia("usbserverup") - b.cmdConnNextServer("usb keyboard") + b.cmdConnNextServer() case "serverdown": playIOMedia("usbpreviousserver") - b.cmdConnPreviousServer("usb keyboard") + b.cmdConnPreviousServer() case "mute": playIOMedia("usbmute") - b.cmdMuteUnmute("mute", "usb keyboard") + b.cmdMuteUnmute("mute") case "unmute": - b.cmdMuteUnmute("unmute", "usb keyboard") + b.cmdMuteUnmute("unmute") playIOMedia("usbunmute") case "mute-toggle": playIOMedia("usbmutetoggle") - b.cmdMuteUnmute("toggle", "usb keyboard") + b.cmdMuteUnmute("toggle") playIOMedia("usbmutetoggle") case "stream-toggle": playIOMedia("usbstreamtoggle") - b.cmdPlayback("usb keyboard") + b.cmdPlayback() case "volumeup": playIOMedia("usbvolup") - b.cmdVolumeUp("usb keyboard") + b.cmdVolumeUp() case "volumedown": playIOMedia("usbvoldown") - b.cmdVolumeDown("usbvoldown") + b.cmdVolumeDown() case "setcomment": if USBKeyMap[rune(ke.Scancode)].ParamName == "setcomment" { log.Println("info: Set Commment ", USBKeyMap[rune(ke.Scancode)].ParamValue) @@ -103,14 +103,14 @@ func (b *Talkkonnect) USBKeyboard() { } case "transmitstart": playIOMedia("usbstarttx") - b.cmdStartTransmitting("usb keyboard") + b.cmdStartTransmitting() case "transmitstop": playIOMedia("usbstoptx") - b.cmdStopTransmitting("usb keyboard") + b.cmdStopTransmitting() case "record": playIOMedia("usbrecord") - b.cmdAudioTrafficRecord("usb keyboard") - b.cmdAudioMicRecord("usb keyboard") + b.cmdAudioTrafficRecord() + b.cmdAudioMicRecord() case "voicetargetset": voicetarget, err := strconv.Atoi(USBKeyMap[rune(ke.Scancode)].ParamValue) if err != nil { @@ -126,7 +126,7 @@ func (b *Talkkonnect) USBKeyboard() { } case "repeatertoneplay": playIOMedia("iorepeatertone") - b.cmdPlayRepeaterTone("usb keyboard") + b.cmdPlayRepeaterTone() default: log.Println("error: Command Not Defined ", strings.ToLower(USBKeyMap[rune(ke.Scancode)].Command)) } diff --git a/version.go b/version.go index 0d98d5c..4bf03fd 100644 --- a/version.go +++ b/version.go @@ -31,12 +31,12 @@ package talkkonnect const ( - talkkonnectVersion string = "2.08.06" - talkkonnectReleased string = "Jan 19 2022" + talkkonnectVersion string = "2.08.07" + talkkonnectReleased string = "Jan 20 2022" ) /* Release Notes -1. Commit Changs in GPS gps.gp from zoran -2. Add setting variables to xmlparser -3. Added new sample config for usbkeybopard and ttykeyboard and goio repeatertonebutton +1. Removed ability to show where command function was called from this was creating havoc with httapi and mqtt calls +2. httpapi working +3. mqtt working */ diff --git a/xmlparser.go b/xmlparser.go index ffbd1a9..8d109a6 100644 --- a/xmlparser.go +++ b/xmlparser.go @@ -485,8 +485,8 @@ type ConfigStruct struct { Value time.Duration `xml:"value,attr"` Enabled bool `xml:"enabled,attr"` } `xml:"postdelay"` - Playintostream bool `xml:"playintostream"` - Voicetarget string `xml:"voicetarget"` + Playintostream bool `xml:"playintostream"` + Voicetarget bool `xml:"voicetarget"` } `xml:"params"` Media struct { Source []struct {