Skip to content

Commit

Permalink
fixed params and values for better ux
Browse files Browse the repository at this point in the history
  • Loading branch information
talkkonnect committed Aug 23, 2021
1 parent 09379be commit dee3f07
Show file tree
Hide file tree
Showing 3 changed files with 26 additions and 11 deletions.
13 changes: 10 additions & 3 deletions client.go
Original file line number Diff line number Diff line change
Expand Up @@ -563,8 +563,10 @@ keyPressListenerLoop:
case "volumedown":
b.cmdVolumeDown()
case "setcomment":
log.Println("info: Set Commment ",TTYKeyMap[ev.Ch].ParamName)
b.Client.Self.SetComment(TTYKeyMap[ev.Ch].ParamName)
if TTYKeyMap[ev.Ch].ParamName == "setcomment" {
log.Println("info: Set Commment ", TTYKeyMap[ev.Ch].ParamValue)
b.Client.Self.SetComment(TTYKeyMap[ev.Ch].ParamValue)
}
case "transmitstart":
b.cmdStartTransmitting()
case "transmitstop":
Expand All @@ -573,7 +575,12 @@ keyPressListenerLoop:
b.cmdAudioTrafficRecord()
b.cmdAudioMicRecord()
case "voicetargetset":
b.cmdSendVoiceTargets(TTYKeyMap[ev.Ch].ParamValue)
voicetarget, err := strconv.Atoi(TTYKeyMap[ev.Ch].ParamValue)
if err != nil {
log.Println("error: Target is Non-Numeric Value")
} else {
b.cmdSendVoiceTargets(uint32(voicetarget))
}
default:
log.Println("Command Not Defined ", strings.ToLower(TTYKeyMap[ev.Ch].Command))
}
Expand Down
14 changes: 11 additions & 3 deletions usbkeyboard.go
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@ package talkkonnect

import (
"log"
"strconv"
"strings"

evdev "github.com/gvalkov/golang-evdev"
Expand Down Expand Up @@ -84,8 +85,10 @@ func (b *Talkkonnect) USBKeyboard() {
case "volumedown":
b.cmdVolumeDown()
case "setcomment":
log.Println("info: Set Commment ",USBKeyMap[rune(ke.Scancode)].ParamName)
b.Client.Self.SetComment(USBKeyMap[rune(ke.Scancode)].ParamName)
if USBKeyMap[rune(ke.Scancode)].ParamName == "setcomment" {
log.Println("info: Set Commment ", USBKeyMap[rune(ke.Scancode)].ParamValue)
b.Client.Self.SetComment(USBKeyMap[rune(ke.Scancode)].ParamValue)
}
case "transmitstart":
b.cmdStartTransmitting()
case "transmitstop":
Expand All @@ -94,7 +97,12 @@ func (b *Talkkonnect) USBKeyboard() {
b.cmdAudioTrafficRecord()
b.cmdAudioMicRecord()
case "voicetargetset":
b.cmdSendVoiceTargets(USBKeyMap[rune(ke.Scancode)].ParamValue)
voicetarget, err := strconv.Atoi(USBKeyMap[rune(ke.Scancode)].ParamValue)
if err != nil {
log.Println("error: Target is Non-Numeric Value")
} else {
b.cmdSendVoiceTargets(uint32(voicetarget))
}
default:
log.Println("Command Not Defined ", strings.ToLower(USBKeyMap[rune(ke.Scancode)].Command))
}
Expand Down
10 changes: 5 additions & 5 deletions xmlparser.go
Original file line number Diff line number Diff line change
Expand Up @@ -50,8 +50,8 @@ import (

//version and release date
const (
talkkonnectVersion string = "1.67.13"
talkkonnectReleased string = "Aug 22 2021"
talkkonnectVersion string = "1.67.14"
talkkonnectReleased string = "Aug 23 2021"
)

// Generic Global Variables
Expand Down Expand Up @@ -846,7 +846,7 @@ type DocumentStruct struct {
Params struct {
Param []struct {
Name string `xml:"name,attr"`
Value uint32 `xml:"value,attr"`
Value string `xml:"value,attr"`
} `xml:"param"`
} `xml:"params"`
Ttykeyboard struct {
Expand Down Expand Up @@ -887,15 +887,15 @@ type TTYKBStruct struct {
KeyLabel uint32
Command string
ParamName string
ParamValue uint32
ParamValue string
}

type USBKBStruct struct {
Enabled bool
KeyLabel uint32
Command string
ParamName string
ParamValue uint32
ParamValue string
}

func readxmlconfig(file string) error {
Expand Down

0 comments on commit dee3f07

Please sign in to comment.