Skip to content

Commit

Permalink
rename function for code readability
Browse files Browse the repository at this point in the history
  • Loading branch information
talkkonnect committed Jan 21, 2021
1 parent 237eae8 commit bcf054d
Show file tree
Hide file tree
Showing 5 changed files with 42 additions and 42 deletions.
18 changes: 9 additions & 9 deletions client.go
Original file line number Diff line number Diff line change
Expand Up @@ -465,23 +465,23 @@ keyPressListenerLoop:
case term.KeyDelete:
b.commandKeyDel()
case term.KeyF1:
b.commandKeyF1()
b.KeyChannelUp()
case term.KeyF2:
b.commandKeyF2()
b.KeyChannelDown()
case term.KeyF3:
b.commandKeyF3("toggle")
b.KeyMuteUnmute("toggle")
case term.KeyF4:
b.commandKeyF4()
b.KeyCurrentVolume()
case term.KeyF5:
b.commandKeyF5()
b.KeyVolumeUp()
case term.KeyF6:
b.commandKeyF6()
b.KeyVolumeDown()
case term.KeyF7:
b.commandKeyF7()
b.KeyListServerChannels()
case term.KeyF8:
b.commandKeyF8()
b.KeyStartTransmitting()
case term.KeyF9:
b.commandKeyF9()
b.KeyStopTransmitting()
case term.KeyF10:
b.cmdListOnlineUsers()
case term.KeyF11:
Expand Down
18 changes: 9 additions & 9 deletions commandkeys.go
Original file line number Diff line number Diff line change
Expand Up @@ -56,17 +56,17 @@ func (b *Talkkonnect) commandKeyDel() {
b.ParticipantLEDUpdate(true)
}

func (b *Talkkonnect) commandKeyF1() {
func (b *Talkkonnect) KeyChannelUp() {
log.Println("debug: F1 pressed Channel Up (+) Requested")
b.ChannelUp()
}

func (b *Talkkonnect) commandKeyF2() {
func (b *Talkkonnect) KeyChannelDown() {
log.Println("debug: F2 pressed Channel Down (-) Requested")
b.ChannelDown()
}

func (b *Talkkonnect) commandKeyF3(subCommand string) {
func (b *Talkkonnect) KeyMuteUnmute(subCommand string) {
log.Println("debug: ", TTSMuteUnMuteSpeakerFilenameAndPath)

//any other subcommand besides mute and unmute will get the current status of mute from volume.go
Expand Down Expand Up @@ -139,7 +139,7 @@ func (b *Talkkonnect) commandKeyF3(subCommand string) {

}

func (b *Talkkonnect) commandKeyF4() {
func (b *Talkkonnect) KeyCurrentVolume() {
origVolume, err := volume.GetVolume(OutputDevice)
if err != nil {
log.Println("error: Unable to get current volume: %+v", err)
Expand Down Expand Up @@ -167,7 +167,7 @@ func (b *Talkkonnect) commandKeyF4() {
}
}

func (b *Talkkonnect) commandKeyF5() {
func (b *Talkkonnect) KeyVolumeUp() {
origVolume, err := volume.GetVolume(OutputDevice)
if err != nil {
log.Println("warn: unable to get original volume: %+v", err)
Expand Down Expand Up @@ -214,7 +214,7 @@ func (b *Talkkonnect) commandKeyF5() {

}

func (b *Talkkonnect) commandKeyF6() {
func (b *Talkkonnect) KeyVolumeDown() {
origVolume, err := volume.GetVolume(OutputDevice)
if err != nil {
log.Println("error: unable to get original volume: %+v", err)
Expand Down Expand Up @@ -263,7 +263,7 @@ func (b *Talkkonnect) commandKeyF6() {

}

func (b *Talkkonnect) commandKeyF7() {
func (b *Talkkonnect) KeyListServerChannels() {
log.Println("debug: F7 pressed Channel List Requested")

if TTSEnabled && TTSListServerChannels {
Expand All @@ -278,7 +278,7 @@ func (b *Talkkonnect) commandKeyF7() {
b.ParticipantLEDUpdate(true)
}

func (b *Talkkonnect) commandKeyF8() {
func (b *Talkkonnect) KeyStartTransmitting() {
log.Println("debug: F8 pressed TX Mode Requested (Start Transmitting)")
log.Println("info: Start Transmitting")

Expand All @@ -305,7 +305,7 @@ func (b *Talkkonnect) commandKeyF8() {
}
}

func (b *Talkkonnect) commandKeyF9() {
func (b *Talkkonnect) KeyStopTransmitting() {
log.Println("debug: F9 pressed RX Mode Request (Stop Transmitting)")
log.Println("info: Stop Transmitting")

Expand Down
22 changes: 11 additions & 11 deletions httpapi.go
Original file line number Diff line number Diff line change
Expand Up @@ -57,77 +57,77 @@ func (b *Talkkonnect) httpAPI(w http.ResponseWriter, r *http.Request) {
}
case "F1":
if APIChannelUp {
b.commandKeyF1()
b.KeyChannelUp()
fmt.Fprintf(w, "API Channel Up Request Processed Succesfully\n")
} else {
fmt.Fprintf(w, "API Channel Up Request Denied\n")
}
case "F2":
if APIChannelDown {
b.commandKeyF2()
b.KeyChannelDown()
fmt.Fprintf(w, "API Channel Down Request Processed Succesfully\n")
} else {
fmt.Fprintf(w, "API Channel Down Request Denied\n")
}
case "F3":
if APIMute {
b.commandKeyF3("toggle")
b.KeyMuteUnmute("toggle")
fmt.Fprintf(w, "API Mute/UnMute Speaker Request Processed Succesfully\n")
} else {
fmt.Fprintf(w, "API Mute/Unmute Speaker Request Denied\n")
}
case "F3-mute":
if APIMute {
b.commandKeyF3("mute")
b.KeyMuteUnmute("mute")
fmt.Fprintf(w, "API Mute/UnMute Speaker Request Processed Succesfully\n")
} else {
fmt.Fprintf(w, "API Mute/Unmute Speaker Request Denied\n")
}
case "F3-unmute":
if APIMute {
b.commandKeyF3("unmute")
b.KeyMuteUnmute("unmute")
fmt.Fprintf(w, "API Mute/UnMute Speaker Request Processed Succesfully\n")
} else {
fmt.Fprintf(w, "API Mute/Unmute Speaker Request Denied\n")
}
case "F4":
if APICurrentVolumeLevel {
b.commandKeyF4()
b.KeyCurrentVolume()
fmt.Fprintf(w, "API Current Volume Level Request Processed Succesfully\n")
} else {
fmt.Fprintf(w, "API Current Volume Level Request Denied\n")
}
case "F5":
if APIDigitalVolumeUp {
b.commandKeyF5()
b.KeyVolumeUp()
fmt.Fprintf(w, "API Digital Volume Up Request Processed Succesfully\n")
} else {
fmt.Fprintf(w, "API Digital Volume Up Request Denied\n")
}
case "F6":
if APIDigitalVolumeDown {
b.commandKeyF6()
b.KeyVolumeDown()
fmt.Fprintf(w, "API Digital Volume Down Request Processed Succesfully\n")
} else {
fmt.Fprintf(w, "API Digital Volume Down Request Denied\n")
}
case "F7":
if APIListServerChannels {
b.commandKeyF7()
b.KeyListServerChannels()
fmt.Fprintf(w, "API List Server Channels Request Processed Succesfully\n")
} else {
fmt.Fprintf(w, "API List Server Channels Request Denied\n")
}
case "F8":
if APIStartTransmitting {
b.commandKeyF8()
b.KeyStartTransmitting()
fmt.Fprintf(w, "API Start Transmitting Request Processed Succesfully\n")
} else {
fmt.Fprintf(w, "API Start Transmitting Request Denied\n")
}
case "F9":
if APIStopTransmitting {
b.commandKeyF9()
b.KeyStopTransmitting()
fmt.Fprintf(w, "API Stop Transmitting Request Processed Succesfully\n")
} else {
fmt.Fprintf(w, "API Stop Transmitting Request Denied\n")
Expand Down
22 changes: 11 additions & 11 deletions mqtt.go
Original file line number Diff line number Diff line change
Expand Up @@ -208,37 +208,37 @@ func (b *Talkkonnect) onMessageReceived(client MQTT.Client, message MQTT.Message
b.commandKeyDel()
case "F1":
log.Println("info: MQTT Channel Up Request Processed Succesfully\n")
b.commandKeyF1()
b.KeyChannelUp()
case "F2":
log.Println("info: MQTT Channel Down Request Processed Succesfully\n")
b.commandKeyF2()
b.KeyChannelDown()
case "F3":
log.Println("info: MQTT Mute/UnMute Speaker Request Processed Succesfully\n")
b.commandKeyF3("toggle")
b.KeyMuteUnmute("toggle")
case "F3-mute":
log.Println("info: MQTT Mute/UnMute Speaker Request Processed Succesfully\n")
b.commandKeyF3("mute")
b.KeyMuteUnmute("mute")
case "F3-unmute":
log.Println("info: MQTT Mute/UnMute Speaker Request Processed Succesfully\n")
b.commandKeyF3("unmute")
b.KeyMuteUnmute("unmute")
case "F4":
log.Println("info: MQTT Current Volume Level Request Processed Succesfully\n")
b.commandKeyF4()
b.KeyCurrentVolume()
case "F5":
log.Println("info: MQTT Digital Volume Up Request Processed Succesfully\n")
b.commandKeyF5()
b.KeyVolumeUp()
case "F6":
log.Println("info: MQTT Digital Volume Down Request Processed Succesfully\n")
b.commandKeyF6()
b.KeyVolumeDown()
case "F7":
log.Println("info: MQTT List Server Channels Request Processed Succesfully\n")
b.commandKeyF7()
b.KeyListServerChannels()
case "F8":
log.Println("info: MQTT Start Transmitting Request Processed Succesfully\n")
b.commandKeyF8()
b.KeyStartTransmitting()
case "F9":
log.Println("info: MQTT Stop Transmitting Request Processed Succesfully\n")
b.commandKeyF9()
b.KeyStopTransmitting()
case "F10":
log.Println("info: MQTT List Online Users Request Processed Succesfully\n")
b.cmdListOnlineUsers()
Expand Down
4 changes: 2 additions & 2 deletions xmlparser.go
Original file line number Diff line number Diff line change
Expand Up @@ -51,8 +51,8 @@ import (

//version and release date
const (
talkkonnectVersion string = "1.56.01"
talkkonnectReleased string = "January 20 2021"
talkkonnectVersion string = "1.56.02"
talkkonnectReleased string = "January 21 2021"
)

var (
Expand Down

0 comments on commit bcf054d

Please sign in to comment.