function [ExpertSettingFields,l1,l2,co]=JgetLampsAndOffset(deviceName)
%function [p,imageArray,imagePositionSet1,imagePositionsSet2]=Jgetimage(deviceName)
% Initialise RDA
javaMethod('setProperty', 'java.lang.System', 'cmw.names', 'abcmw.cern.ch:5020');
rda = cern.cmw.rda.client.RDAService.init();

cycle = 'SCT:USER:SETUP';

%'CL.MTV1026.new'
device = rda.getDeviceHandle(deviceName);

ExpertSettingProp='ExpertSetting';
ExpertSettingFields=device.get(ExpertSettingProp,cycle);
l1=ExpertSettingFields.extractShort('firstLamp')
l1min=ExpertSettingFields.extractShort('firstLamp_min')
l1max=ExpertSettingFields.extractShort('firstLamp_max')
l2=ExpertSettingFields.extractShort('secondLamp')
l2min=ExpertSettingFields.extractShort('secondLamp_min')
l2max=ExpertSettingFields.extractShort('secondLamp_max')
co=ExpertSettingFields.extractShort('cameraOffset')
comin=ExpertSettingFields.extractShort('cameraOffset_min')
comax=ExpertSettingFields.extractShort('cameraOffset_max')
ExpertSettingFields.insert('firstLamp',int16(l1min))
ExpertSettingFields.insert('secondLamp',int16(l2min))
device.set(ExpertSettingProp,cycle,ExpertSettingFields);
