
; The device is mostly SCPI, but as default it will echo all commands, to handle this I uses a ascii device driver with definitions to remove the echo and fix a few other things

#idString GOSSEN,M 503,
#name Gossen M5032
#handle M5032
#port comfixedbaud
#driver ascii
; Alternate port types: comnobaud or com, com lets the user define baudrate on the "Load devices" page
#baudrate 9600E72

#scpiCmd value? txrx? phot?
:readmath: replace(replace(replace(value,"LX",""),"PHOT","")," ","");
#scpiCmd unit txrx uni:phot (value)
#scpiCmd *idn? txrx? *idn?
:readmath: replace(replace(value,"*IDN ",""),",V"," V");

#scpiCmd range txrx range (value)
#scpiCmd range? txrx? range?
:readmath: replace(value,"RANGE ","");
#scpiCmd rangeAuto txrx range:auto (value)
#scpiCmd rangeAuto? txrx? range:auto?
:readmath: replace(value,"RANGE:AUTO ","");
#scpiCmd display txrx dis (value)
#scpiCmd keys txrx key (value)
#scpiCmd reset txrx *rst
;#scpiCmd light txrx DIS:BAC (value)

; A list of possible column name with unit and formatter (SI, Time, Int, D0..D6) 
; Format: #value ColumnName Unit Format {Selector}
; Selector is only used when column layout varies with mode, this often require the use of #cmdMode
#value Brightness Lux D2

; How to poll for data, this is used for table and #values?
; a #askMode, #cmdMode and #prepareSample is used before this is string is used.
; Number of returned values must match number of columns defined with #value
; This is a single line command
#askValues value?


; Format of answer: f=float, u=remove trailing letters, x=skip, *=Zero upper case values if this value is 0
;#askValuesReadFormat

; Accept this delay when reading values (seconds)
#readingDelay 2

; Mode change have a longer delay on reading values (seconds)
#modeChangeDelay 10


; String to ask about actual meter mode, it is mostly used for DMM's
; This is a single line command
;#askMode 


; When one of these commands are used through the command interface a new configuration will be done before using #askMode
; Only one word for each #mayModifyMode
; Specify command without initial colon and in the shortest possible form
;#mayModifyMode 


; Prepare the meter to response to #askValues
;#prepareSample 

; Initial commands to meter when establishing connection, used to disable local control
#initCmd unit lx

; Final command to meter before breaking connection, used to restore local control
#finalCmd reset

; Used to turn output off for power supplies, generators and electronic loads
;#outputOff 

#cmdSetup radio Range
:write: rangeAuto
:read: rangeAuto?
:string: 
Manual OFF
Auto ON

#cmdSetup combobox Range
:write: rangeAuto off;range
:read: range?
20_lux 0 
200_lux 1
2000_lux 2
20k_lux 3
200k_lux 4

#cmdSetup buttons Display
:write: display
Off OFF
On ON

#cmdSetup buttons Keys
:write: keys
Disabled OFF
Enabled ON

