It's my understanding that bt101 prefers an available solution (which I don't know).
My personal favorite for this type of work is Tcl/Tk.
Code:
#! /usr/bin/wish
# procedure to read IR data from a file and send it over an interface
proc send_cmd cmd {
tk_messageBox -title "send command" -message $cmd
# todo:
# 1) open,read and close commandfile containing IR data
# 2) open device and write command
# 3) close device
}
# keys
# a list of available keys
# format:
# category keyname value2display IRdatafile
set keys[list\[list "num" "K1" "1" "cmd_1.dta"] \[list "num" "K2" "2" "cmd_2.dta"] \[list "num" "K3" "3" "cmd_3.dta"] \[list "num" "K4" "4" "cmd_4.dta"] \[list "num" "K5" "5" "cmd_5.dta"] \[list "num" "K6" "6" "cmd_6.dta"] \[list "num" "K7" "7" "cmd_7.dta"] \[list "num" "K8" "8" "cmd_8.dta"] \[list "num" "K9" "9" "cmd_9.dta"] \[list "num" "K0" "0" "cmd_0.dta"] \[list "prog" "Pplus" "P+" "cmd_pplus.dta"] \[list "prog" "Pminus" "P-" "cmd_pminus.dta"] \[list "vol" "Vplus" "V+" "cmd_vplus.dta"] \[list "vol" "Vminus" "V-" "cmd_vminus.dta"] \
]
# main code to draw buttons
# all keys
foreach key $keys {
if { [winfo exists .f_[lindex $key 0]] == 0 } {
frame .f_[lindex $key 0] -relief sunken
pack .f_[lindex $key 0] -in . -fill x -side top
}
button .b_[lindex $key 1] -text [lindex $key 2] -command "send_cmd [lindex $key 3]"
pack .b_[lindex $key 1] -in .f_[lindex $key 0] -side left
}
The above assumes that for each key a datafile is available that defines the data to be transmitted to the IR device for a specific button.
It's reasonable easy to read the list of keys from a file rather then hardcode them.
It's also reasonable easy to read the command file and send the data to a device (the TODO part)
PS I see that in my browser the list of keys is one long line; the code tags don't seem to prevent <backslash><enter> from being removed. Sorry for that. You can quote my message and next copy the code.