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 bcf054d commit d6e420a
Show file tree
Hide file tree
Showing 5 changed files with 46 additions and 46 deletions.
20 changes: 10 additions & 10 deletions client.go
Original file line number Diff line number Diff line change
Expand Up @@ -463,25 +463,25 @@ keyPressListenerLoop:
reset()
break keyPressListenerLoop
case term.KeyDelete:
b.commandKeyDel()
b.cmdKeyDel()
case term.KeyF1:
b.KeyChannelUp()
b.cmdChannelUp()
case term.KeyF2:
b.KeyChannelDown()
b.cmdChannelDown()
case term.KeyF3:
b.KeyMuteUnmute("toggle")
b.cmdMuteUnmute("toggle")
case term.KeyF4:
b.KeyCurrentVolume()
b.cmdCurrentVolume()
case term.KeyF5:
b.KeyVolumeUp()
b.cmdVolumeUp()
case term.KeyF6:
b.KeyVolumeDown()
b.cmdVolumeDown()
case term.KeyF7:
b.KeyListServerChannels()
b.cmdListServerChannels()
case term.KeyF8:
b.KeyStartTransmitting()
b.cmdStartTransmitting()
case term.KeyF9:
b.KeyStopTransmitting()
b.cmdStopTransmitting()
case term.KeyF10:
b.cmdListOnlineUsers()
case term.KeyF11:
Expand Down
20 changes: 10 additions & 10 deletions commandkeys.go
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ import (
"time"
)

func (b *Talkkonnect) commandKeyDel() {
func (b *Talkkonnect) cmdKeyDel() {
log.Println("debug: Delete Key Pressed Menu and Session Information Requested")

if TTSEnabled && TTSDisplayMenu {
Expand All @@ -56,17 +56,17 @@ func (b *Talkkonnect) commandKeyDel() {
b.ParticipantLEDUpdate(true)
}

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

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

func (b *Talkkonnect) KeyMuteUnmute(subCommand string) {
func (b *Talkkonnect) cmdMuteUnmute(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) KeyMuteUnmute(subCommand string) {

}

func (b *Talkkonnect) KeyCurrentVolume() {
func (b *Talkkonnect) cmdCurrentVolume() {
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) KeyCurrentVolume() {
}
}

func (b *Talkkonnect) KeyVolumeUp() {
func (b *Talkkonnect) cmdVolumeUp() {
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) KeyVolumeUp() {

}

func (b *Talkkonnect) KeyVolumeDown() {
func (b *Talkkonnect) cmdVolumeDown() {
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) KeyVolumeDown() {

}

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

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

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

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

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

Expand Down
24 changes: 12 additions & 12 deletions httpapi.go
Original file line number Diff line number Diff line change
Expand Up @@ -50,84 +50,84 @@ func (b *Talkkonnect) httpAPI(w http.ResponseWriter, r *http.Request) {
switch string(command) {
case "DEL":
if APIDisplayMenu {
b.commandKeyDel()
b.cmdKeyDel()
fmt.Fprintf(w, "API Display Menu Request Processed Succesfully\n")
} else {
fmt.Fprintf(w, "API Display Menu Request Denied\n")
}
case "F1":
if APIChannelUp {
b.KeyChannelUp()
b.cmdChannelUp()
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.KeyChannelDown()
b.cmdChannelDown()
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.KeyMuteUnmute("toggle")
b.cmdMuteUnmute("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.KeyMuteUnmute("mute")
b.cmdMuteUnmute("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.KeyMuteUnmute("unmute")
b.cmdMuteUnmute("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.KeyCurrentVolume()
b.cmdCurrentVolume()
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.KeyVolumeUp()
b.cmdVolumeUp()
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.KeyVolumeDown()
b.cmdVolumeDown()
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.KeyListServerChannels()
b.cmdListServerChannels()
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.KeyStartTransmitting()
b.cmdStartTransmitting()
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.KeyStopTransmitting()
b.cmdStopTransmitting()
fmt.Fprintf(w, "API Stop Transmitting Request Processed Succesfully\n")
} else {
fmt.Fprintf(w, "API Stop Transmitting Request Denied\n")
Expand Down
24 changes: 12 additions & 12 deletions mqtt.go
Original file line number Diff line number Diff line change
Expand Up @@ -205,40 +205,40 @@ func (b *Talkkonnect) onMessageReceived(client MQTT.Client, message MQTT.Message
switch string(message.Payload()) {
case "DEL":
log.Println("info: MQTT Display Menu Request Processed Succesfully")
b.commandKeyDel()
b.cmdKeyDel()
case "F1":
log.Println("info: MQTT Channel Up Request Processed Succesfully\n")
b.KeyChannelUp()
b.cmdChannelUp()
case "F2":
log.Println("info: MQTT Channel Down Request Processed Succesfully\n")
b.KeyChannelDown()
b.cmdChannelDown()
case "F3":
log.Println("info: MQTT Mute/UnMute Speaker Request Processed Succesfully\n")
b.KeyMuteUnmute("toggle")
b.cmdMuteUnmute("toggle")
case "F3-mute":
log.Println("info: MQTT Mute/UnMute Speaker Request Processed Succesfully\n")
b.KeyMuteUnmute("mute")
b.cmdMuteUnmute("mute")
case "F3-unmute":
log.Println("info: MQTT Mute/UnMute Speaker Request Processed Succesfully\n")
b.KeyMuteUnmute("unmute")
b.cmdMuteUnmute("unmute")
case "F4":
log.Println("info: MQTT Current Volume Level Request Processed Succesfully\n")
b.KeyCurrentVolume()
b.cmdCurrentVolume()
case "F5":
log.Println("info: MQTT Digital Volume Up Request Processed Succesfully\n")
b.KeyVolumeUp()
b.cmdVolumeUp()
case "F6":
log.Println("info: MQTT Digital Volume Down Request Processed Succesfully\n")
b.KeyVolumeDown()
b.cmdVolumeDown()
case "F7":
log.Println("info: MQTT List Server Channels Request Processed Succesfully\n")
b.KeyListServerChannels()
b.cmdListServerChannels()
case "F8":
log.Println("info: MQTT Start Transmitting Request Processed Succesfully\n")
b.KeyStartTransmitting()
b.cmdStartTransmitting()
case "F9":
log.Println("info: MQTT Stop Transmitting Request Processed Succesfully\n")
b.KeyStopTransmitting()
b.cmdStopTransmitting()
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.02"
talkkonnectReleased string = "January 21 2021"
talkkonnectVersion string = "1.56.03"
talkkonnectReleased string = "January 22 2021"
)

var (
Expand Down

0 comments on commit d6e420a

Please sign in to comment.