0001 function varargout = softsynchro(varargin)
0002
0003
0004
0005
0006
0007
0008
0009
0010
0011
0012
0013
0014 gui_Singleton = 1;
0015 gui_State = struct('gui_Name', mfilename, ...
0016 'gui_Singleton', gui_Singleton, ...
0017 'gui_OpeningFcn', @softsynchro_OpeningFcn, ...
0018 'gui_OutputFcn', @softsynchro_OutputFcn, ...
0019 'gui_LayoutFcn', [] , ...
0020 'gui_Callback', []);
0021 if nargin && ischar(varargin{1})
0022 gui_State.gui_Callback = str2func(varargin{1});
0023 end
0024
0025 if nargout
0026 [varargout{1:nargout}] = gui_mainfcn(gui_State, varargin{:});
0027 else
0028 gui_mainfcn(gui_State, varargin{:});
0029 end
0030
0031
0032
0033
0034 function softsynchro_OpeningFcn(hObject, eventdata, handles, varargin)
0035
0036
0037
0038
0039
0040
0041
0042 handles.output = hObject;
0043
0044
0045 handles.periode = 1.333;
0046 set(handles.edit1,'String',num2str(handles.periode));
0047
0048
0049 timer1=timer('StartDelay',1,...
0050 'ExecutionMode','fixedRate','Period',handles.periode,'TasksToExecute',Inf);
0051 timer1.TimerFcn = {@fonction_alex, hObject,eventdata, handles};
0052 setappdata(handles.figure1,'Timer',timer1);
0053
0054
0055 h = uibuttongroup('visible','off','Position',[0.1 0.1 0.8 0.45],...
0056 'Title','Trigger','TitlePosition','centertop',...
0057 'BackgroundColor',[0.696 1.0 0.924]);
0058 u1 = uicontrol('Style','Radio','String','OFF','Tag','radiobutton1',...
0059 'pos',[80 25 90 25],'parent',h,'HandleVisibility','off',...
0060 'BackgroundColor',[0.696 1.0 0.924]);
0061 u2 = uicontrol('Style','Radio','String','ON','Tag','radiobutton2',...
0062 'pos',[80 65 90 25],'parent',h,'HandleVisibility','off',...
0063 'BackgroundColor',[0.696 1.0 0.924]);
0064 set(h,'SelectionChangeFcn',...
0065 {@uibuttongroup_SelectionChangeFcn,handles});
0066
0067 set(h,'SelectedObject',u1);
0068 set(h,'Visible','on');
0069
0070
0071 set(handles.figure1,'CloseRequestFcn',{@Closinggui,timer1,handles.figure1});
0072
0073
0074 guidata(hObject, handles);
0075
0076
0077
0078
0079
0080
0081 function varargout = softsynchro_OutputFcn(hObject, eventdata, handles)
0082
0083
0084
0085
0086
0087
0088 varargout{1} = handles.output;
0089
0090
0091
0092 function edit1_Callback(hObject, eventdata, handles)
0093
0094
0095
0096
0097
0098
0099
0100 handles.periode = str2double(get(hObject,'String'));
0101
0102
0103 timer1=timer('StartDelay',1,...
0104 'ExecutionMode','fixedRate','Period',handles.periode,'TasksToExecute',Inf);
0105 timer1.TimerFcn = {@fonction_alex, hObject,eventdata, handles};
0106 setappdata(handles.figure1,'Timer',timer1);
0107
0108
0109 guidata(hObject, handles);
0110
0111
0112 function edit1_CreateFcn(hObject, eventdata, handles)
0113
0114
0115
0116
0117
0118
0119 if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
0120 set(hObject,'BackgroundColor','white');
0121 end
0122
0123 function uibuttongroup_SelectionChangeFcn(hObject,eventdata,handles)
0124
0125
0126
0127
0128 timer1 = getappdata(handles.figure1,'Timer');
0129 switch get(get(hObject,'SelectedObject'),'Tag')
0130 case 'radiobutton1'
0131
0132 stop(timer1);
0133
0134 case 'radiobutton2'
0135
0136 start(timer1);
0137
0138 end
0139
0140 function fonction_alex(arg1,arg2,hObject,eventdata,handles)
0141
0142
0143
0144
0145
0146 disp('ça marche !!')
0147 tango_command_inout('ANS/SY/CENTRAL','FireSoftEvent')
0148
0149
0150
0151
0152
0153
0154
0155
0156 function Closinggui(obj, event, handles, figure1)
0157
0158
0159 answer = questdlg('Fermer softsynchro ?',...
0160 'Exit softsynchro',...
0161 'Yes','No','Yes');
0162
0163 switch answer
0164 case 'Yes'
0165 delete(handles);
0166 delete(figure1);
0167 otherwise
0168 disp('Closing aborted')
0169 end