Home > ALS > StorageRing > mysqldatalogger.m

mysqldatalogger

PURPOSE ^

MYSQLDATALOGGER M-file for mysqldatalogger.fig

SYNOPSIS ^

function varargout = mysqldatalogger(varargin)

DESCRIPTION ^

 MYSQLDATALOGGER M-file for mysqldatalogger.fig
      MYSQLDATALOGGER by itself, creates a new MYSQLDATALOGGER or raises the
      existing singleton*.

      H = MYSQLDATALOGGER returns the handle to a new MYSQLDATALOGGER or the handle to
      the existing singleton*.

      MYSQLDATALOGGER('CALLBACK',hObject,eventData,handles,...) calls the local
      function named CALLBACK in MYSQLDATALOGGER.M with the given input arguments.

      MYSQLDATALOGGER('Property','Value',...) creates a new MYSQLDATALOGGER or raises the
      existing singleton*.  Starting from the left, property value pairs are
      applied to the GUI before mysqldatalogger_OpeningFunction gets called.  An
      unrecognized property name or invalid value makes property application
      stop.  All inputs are passed to mysqldatalogger_OpeningFcn via varargin.

      *See GUI Options on GUIDE's Tools menu.  Choose "GUI allows only one
      instance to run (singleton)".

 See also: GUIDE, GUIDATA, GUIHANDLES

CROSS-REFERENCE INFORMATION ^

This function calls: This function is called by:

SUBFUNCTIONS ^

SOURCE CODE ^

0001 function varargout = mysqldatalogger(varargin)
0002 % MYSQLDATALOGGER M-file for mysqldatalogger.fig
0003 %      MYSQLDATALOGGER by itself, creates a new MYSQLDATALOGGER or raises the
0004 %      existing singleton*.
0005 %
0006 %      H = MYSQLDATALOGGER returns the handle to a new MYSQLDATALOGGER or the handle to
0007 %      the existing singleton*.
0008 %
0009 %      MYSQLDATALOGGER('CALLBACK',hObject,eventData,handles,...) calls the local
0010 %      function named CALLBACK in MYSQLDATALOGGER.M with the given input arguments.
0011 %
0012 %      MYSQLDATALOGGER('Property','Value',...) creates a new MYSQLDATALOGGER or raises the
0013 %      existing singleton*.  Starting from the left, property value pairs are
0014 %      applied to the GUI before mysqldatalogger_OpeningFunction gets called.  An
0015 %      unrecognized property name or invalid value makes property application
0016 %      stop.  All inputs are passed to mysqldatalogger_OpeningFcn via varargin.
0017 %
0018 %      *See GUI Options on GUIDE's Tools menu.  Choose "GUI allows only one
0019 %      instance to run (singleton)".
0020 %
0021 % See also: GUIDE, GUIDATA, GUIHANDLES
0022 
0023 % Edit the above text to modify the response to help mysqldatalogger
0024 
0025 % Last Modified by GUIDE v2.5 17-Mar-2006 17:12:25
0026 
0027 % Begin initialization code - DO NOT EDIT
0028 gui_Singleton = 1;
0029 gui_State = struct('gui_Name',       mfilename, ...
0030                    'gui_Singleton',  gui_Singleton, ...
0031                    'gui_OpeningFcn', @mysqldatalogger_OpeningFcn, ...
0032                    'gui_OutputFcn',  @mysqldatalogger_OutputFcn, ...
0033                    'gui_LayoutFcn',  [] , ...
0034                    'gui_Callback',   []);
0035 if nargin && ischar(varargin{1})
0036     gui_State.gui_Callback = str2func(varargin{1});
0037 end
0038 
0039 if nargout
0040     [varargout{1:nargout}] = gui_mainfcn(gui_State, varargin{:});
0041 else
0042     gui_mainfcn(gui_State, varargin{:});
0043 end
0044 % End initialization code - DO NOT EDIT
0045 
0046 % --- Executes just before mysqldatalogger is made visible.
0047 function mysqldatalogger_OpeningFcn(hObject, eventdata, handles, varargin)
0048 % This function has no output args, see OutputFcn.
0049 % hObject    handle to figure
0050 % eventdata  reserved - to be defined in a future version of MATLAB
0051 % handles    structure with handles and user data (see GUIDATA)
0052 % varargin   command line arguments to mysqldatalogger (see VARARGIN)
0053 
0054 % Choose default command line output for mysqldatalogger
0055 handles.output = 'Yes';
0056 
0057 % Update handles structure
0058 guidata(hObject, handles);
0059 
0060 % Insert custom Title and Text if specified by the user
0061 % Hint: when choosing keywords, be sure they are not easily confused
0062 % with existing figure properties.  See the output of set(figure) for
0063 % a list of figure properties.
0064 if(nargin > 3)
0065     for index = 1:2:(nargin-3),
0066         if nargin-3==index, break, end
0067         switch lower(varargin{index})
0068          case 'title'
0069           set(hObject, 'Name', varargin{index+1});
0070          case 'string'
0071           set(handles.text1, 'String', varargin{index+1});
0072         end
0073     end
0074 end
0075 
0076 % Determine the position of the dialog - centered on the callback figure
0077 % if available, else, centered on the screen
0078 FigPos=get(0,'DefaultFigurePosition');
0079 OldUnits = get(hObject, 'Units');
0080 set(hObject, 'Units', 'pixels');
0081 OldPos = get(hObject,'Position');
0082 FigWidth = OldPos(3);
0083 FigHeight = OldPos(4);
0084 if isempty(gcbf)
0085     ScreenUnits=get(0,'Units');
0086     set(0,'Units','pixels');
0087     ScreenSize=get(0,'ScreenSize');
0088     set(0,'Units',ScreenUnits);
0089 
0090     FigPos(1)=1/2*(ScreenSize(3)-FigWidth);
0091     FigPos(2)=2/3*(ScreenSize(4)-FigHeight);
0092 else
0093     GCBFOldUnits = get(gcbf,'Units');
0094     set(gcbf,'Units','pixels');
0095     GCBFPos = get(gcbf,'Position');
0096     set(gcbf,'Units',GCBFOldUnits);
0097     FigPos(1:2) = [(GCBFPos(1) + GCBFPos(3) / 2) - FigWidth / 2, ...
0098                    (GCBFPos(2) + GCBFPos(4) / 2) - FigHeight / 2];
0099 end
0100 FigPos(3:4)=[FigWidth FigHeight];
0101 set(hObject, 'Position', FigPos);
0102 set(hObject, 'Units', OldUnits);
0103 
0104 % Show a question icon from dialogicons.mat - variables questIconData
0105 % and questIconMap
0106 load dialogicons.mat
0107 
0108 IconData=questIconData;
0109 questIconMap(256,:) = get(handles.figure1, 'Color');
0110 IconCMap=questIconMap;
0111 
0112 set(handles.figure1, 'Colormap', IconCMap);
0113 
0114 % Make the GUI modal
0115 set(handles.figure1,'WindowStyle','modal')
0116 
0117 
0118 
0119 % UIWAIT makes mysqldatalogger wait for user response (see UIRESUME)
0120 uiwait(handles.figure1);
0121 
0122 % --- Outputs from this function are returned to the command line.
0123 function varargout = mysqldatalogger_OutputFcn(hObject, eventdata, handles)
0124 % varargout  cell array for returning output args (see VARARGOUT);
0125 % hObject    handle to figure
0126 % eventdata  reserved - to be defined in a future version of MATLAB
0127 % handles    structure with handles and user data (see GUIDATA)
0128 
0129 % Get default command line output from handles structure
0130 varargout{1} = handles.output;
0131 
0132 % The figure can be deleted now
0133 delete(handles.figure1);
0134 
0135 
0136 % --- Executes on button press in pushbutton1.
0137 function pushbutton1_Callback(hObject, eventdata, handles)
0138 % hObject    handle to pushbutton1 (see GCBO)
0139 % eventdata  reserved - to be defined in a future version of MATLAB
0140 % handles    structure with handles and user data (see GUIDATA)
0141 
0142 % handles.output = get(hObject,'String');
0143 %
0144 % % Update handles structure
0145 % guidata(hObject, handles);
0146 
0147 % Use UIRESUME instead of delete because the OutputFcn needs
0148 % to get the updated handles structure.
0149 %uiresume(handles.figure1);
0150 
0151 
0152 if strcmpi(get(hObject, 'String'), 'Start') 
0153 
0154     set(hObject, 'String', 'Stop');
0155     set(handles.pushbutton2, 'Enable', 'Off');   
0156     pause(0);
0157     
0158     % Run initialization if it has not been run (like standalone)
0159     checkforao;
0160     
0161     archive_sr;
0162     
0163     set(hObject, 'String', 'Start');
0164     set(handles.pushbutton2, 'Enable', 'On');    
0165     fprintf('\n   Writing to mysql database stopped. \n');
0166     
0167 else
0168     
0169     fprintf('\n   Trying to stop.   This might take 10 seconds.');
0170     set(hObject, 'String', 'Stopping');
0171     global StopMySQLDataLogger
0172     StopMySQLDataLogger = 1;
0173  
0174 end
0175 
0176 
0177 
0178 % --- Executes on button press in pushbutton2.
0179 function pushbutton2_Callback(hObject, eventdata, handles)
0180 % hObject    handle to pushbutton2 (see GCBO)
0181 % eventdata  reserved - to be defined in a future version of MATLAB
0182 % handles    structure with handles and user data (see GUIDATA)
0183 
0184 
0185 %handles.output = get(hObject,'String');
0186 
0187 % Update handles structure
0188 %guidata(hObject, handles);
0189 
0190 %clear functions
0191 
0192 % Use UIRESUME instead of delete because the OutputFcn needs to get the updated handles structure.
0193 uiresume(handles.figure1);
0194 
0195 
0196 
0197 % --- Executes when user attempts to close figure1.
0198 function figure1_CloseRequestFcn(hObject, eventdata, handles)
0199 % hObject    handle to figure1 (see GCBO)
0200 % eventdata  reserved - to be defined in a future version of MATLAB
0201 % handles    structure with handles and user data (see GUIDATA)
0202 
0203 global StopMySQLDataLogger
0204 StopMySQLDataLogger = 1;
0205 
0206 
0207 if isequal(get(handles.figure1, 'waitstatus'), 'waiting')
0208     % The GUI is still in UIWAIT, us UIRESUME
0209     uiresume(handles.figure1);
0210 else
0211     % The GUI is no longer waiting, just close it
0212     %  delete(handles.figure1);  % Get done in mysqldatalogger_OutputFcn  (GJP)
0213 end
0214 
0215 
0216 % --- Executes on key press over figure1 with no controls selected.
0217 function figure1_KeyPressFcn(hObject, eventdata, handles)
0218 % hObject    handle to figure1 (see GCBO)
0219 % eventdata  reserved - to be defined in a future version of MATLAB
0220 % handles    structure with handles and user data (see GUIDATA)
0221 
0222 % Check for "enter" or "escape"
0223 if isequal(get(hObject,'CurrentKey'),'escape')
0224     % User said no by hitting escape
0225     handles.output = 'No';
0226     
0227     % Update handles structure
0228     guidata(hObject, handles);
0229     
0230     uiresume(handles.figure1);
0231 end    
0232     
0233 if isequal(get(hObject,'CurrentKey'),'return')
0234     uiresume(handles.figure1);
0235 end

Generated on Thu 02-Aug-2007 13:16:07 by m2html © 2003