DAS  3.1.6 - 18/09/2017
Functions | Variables
Errors.c File Reference

Error messages for DAS. Error management and messages for CCD Camera, AMS Drivers, ADConverter and Serial Communications. More...

#include <windows.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include "mgui.h"
#include "DAS_Spatram.h"
+ Include dependency graph for Errors.c:

Go to the source code of this file.

Functions

void AMS_Error (int w)
 Alerts for AMS errors
Creates a message window reporting the number of the error. More...
 
void CCD_Error (char *str)
 Alerts for CCD errors
Creates a message window reporting the number of the error. More...
 
void ComErrors (int w)
 Alerts for COM errors
Creates a message window reporting the number of the error. More...
 
void DAS_Error (int c)
 
void DAS_Message (char *str, int er)
 
void Master_Error (int w)
 

Variables

const char * AMS_Err []
 
const char * CCD_Err []
 
const char * DAS_Err []
 
const char * DE_Err [] = {{" DE Not Found "}}
 
const char * Master_Err []
 

Detailed Description

Error messages for DAS. Error management and messages for CCD Camera, AMS Drivers, ADConverter and Serial Communications.

Author
Daniele Bortoli

Definition in file Errors.c.

Function Documentation

§ AMS_Error()

void AMS_Error ( int  w)

Alerts for AMS errors
Creates a message window reporting the number of the error.

Parameters
w= code of the error

Definition at line 254 of file Errors.c.

References AMS_Err, D_WriteInitLog(), palette::DB_BG, palette::DB_BG_Albl, palette::DB_FG_Albl, DPAL, HELV_SMALL, lbl, MCreateLabel(), MCreateShell(), MObjectSetBackgroundRGB(), MObjectSetForegroundRGB(), MObjectSetShadow(), MShellRealize(), and WS_SHADOW_OUT.

Referenced by DB_InitAMS().

255 {
256  MOBJECT sh, lbl;
257  char buf[80];
258 
259  if(w < 0 || w > 7) return;
260  //sh = MCreateShell("AMS_Error", SF_MODAL);
261  sh = MCreateShell("AMS_Error", 0);
263 
264  lbl = MCreateLabel(sh, AMS_Err[w], HELV_SMALL);
267  MObjectSetShadow(lbl, WS_SHADOW_OUT, 1, 0);
268  MShellRealize(sh);
269 
270  sprintf(buf, AMS_Err[w]);
271  D_WriteInitLog(buf);
272 
273 
274 
275 
276 }
void MObjectSetBackgroundRGB(MOBJECT obj, int r, int g, int b)
MOBJECT lbl
Definition: DFileMan.c:42
void MObjectSetShadow(MOBJECT obj, int type, int in, int out)
void MShellRealize(MOBJECT obj)
MOBJECT MCreateLabel(MOBJECT parent, const char *text, MTFont font)
short DB_BG_Albl[3]
Background ACTIVE Label Colors.
palette DPAL
Definition: 2DPlot.c:27
#define HELV_SMALL
Definition: Mguidefs.h:881
short DB_FG_Albl[3]
Foreground ACTIVE Label Colors.
const char * AMS_Err[]
Definition: Errors.c:36
MOBJECT MCreateShell(const char *title, int flags)
short DB_BG[3]
Default Background Color.
int D_WriteInitLog(char *str)
writes devices errors(AMS, CCD...) on the Devices.log file.
Definition: Save.c:144
void * MOBJECT
Definition: Mguidefs.h:192
void MObjectSetForegroundRGB(MOBJECT obj, int r, int g, int b)
#define WS_SHADOW_OUT
Definition: Mguidefs.h:957
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

§ CCD_Error()

void CCD_Error ( char *  str)

Alerts for CCD errors
Creates a message window reporting the number of the error.

Parameters
w= code of the error

Definition at line 279 of file Errors.c.

References D_WriteInitLog(), palette::DB_BG, palette::DB_BG_Albl, palette::DB_FG_Albl, DPAL, HELV_SMALL, lbl, MCreateLabel(), MCreateShell(), MObjectSetBackgroundRGB(), MObjectSetForegroundRGB(), MObjectSetShadow(), MShellRealize(), and WS_SHADOW_OUT.

Referenced by InitCCD_AMS(), and ShutCB().

280 {
281  MOBJECT sh, lbl;
282 // char buf[80];
283 
284 // if(w == 0 || w > 16) return;
285 // sh = MCreateShell("CCD_Error", SF_MODAL);
286  sh = MCreateShell("CCD_Error", 0);
288 
289  //lbl = MCreateLabel(sh, CCD_Err[--w], HELV_SMALL);
290  lbl = MCreateLabel(sh, str, HELV_SMALL);
293  MObjectSetShadow(lbl, WS_SHADOW_OUT, 1, 0);
294  MShellRealize(sh);
295 
296  //sprintf(buf, CCD_Err[w]);
297  //D_WriteInitLog(buf);
298  D_WriteInitLog(str);
299 
300 
301 }
void MObjectSetBackgroundRGB(MOBJECT obj, int r, int g, int b)
MOBJECT lbl
Definition: DFileMan.c:42
void MObjectSetShadow(MOBJECT obj, int type, int in, int out)
void MShellRealize(MOBJECT obj)
MOBJECT MCreateLabel(MOBJECT parent, const char *text, MTFont font)
short DB_BG_Albl[3]
Background ACTIVE Label Colors.
palette DPAL
Definition: 2DPlot.c:27
#define HELV_SMALL
Definition: Mguidefs.h:881
short DB_FG_Albl[3]
Foreground ACTIVE Label Colors.
MOBJECT MCreateShell(const char *title, int flags)
short DB_BG[3]
Default Background Color.
int D_WriteInitLog(char *str)
writes devices errors(AMS, CCD...) on the Devices.log file.
Definition: Save.c:144
void * MOBJECT
Definition: Mguidefs.h:192
void MObjectSetForegroundRGB(MOBJECT obj, int r, int g, int b)
#define WS_SHADOW_OUT
Definition: Mguidefs.h:957
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

§ ComErrors()

void ComErrors ( int  w)

Alerts for COM errors
Creates a message window reporting the number of the error.

Parameters
w= code of the error

Definition at line 164 of file Errors.c.

References palette::DB_BG, palette::DB_BG_Albl, palette::DB_FG_Albl, DPAL, HELV_SMALL, lbl, MCreateLabel(), MCreateShell(), MObjectSetBackgroundRGB(), MObjectSetForegroundRGB(), MObjectSetShadow(), MShellRealize(), and WS_SHADOW_OUT.

Referenced by DB_InitMotor().

165 {
166  int c = w;
167  char buf[64];
168  MOBJECT sh, lbl;
169 
170 
171  switch (c)
172  {
173  case -1:
174  {
175  sprintf(buf, "IE_BADID");
176  break;
177  }
178  case -2:
179  {
180  sprintf(buf, "IE_OPEN");
181  break;
182  }
183  case -3:
184  {
185  sprintf(buf, "IE_NOPEN");
186  break;
187  }
188  case -4:
189  {
190  sprintf(buf, "IE_MEMORY");
191  break;
192  }
193  case -5:
194  {
195  sprintf(buf, "IE_DEFAULT");
196  break;
197  }
198  case -10:
199  {
200  sprintf(buf, "IE_HARDWARE");
201  break;
202  }
203  case -11:
204  {
205  sprintf(buf, "IE_BYTESIZE");
206  break;
207  }
208  case -12:
209  {
210  sprintf(buf, "IE_BAUDRATE");
211  break;
212  }
213  case -100:
214  {
215  sprintf(buf, "WSC_NO_DATA");
216  break;
217  }
218  case -101:
219  {
220  sprintf(buf, "WSC_RANGE ");
221  break;
222  }
223  case -102:
224  {
225  sprintf(buf, "WSC_ABORTED");
226  break;
227  }
228  case -103:
229  {
230  sprintf(buf, "WSC_WIN32ERR");
231  break;
232  }
233  case -104:
234  {
235  sprintf(buf, "WSC_EXPIRED");
236  break;
237  }
238  }
239 
240 
241  sh = MCreateShell("COM_Error", 0);
243 
244  lbl = MCreateLabel(sh, buf, HELV_SMALL);
247  MObjectSetShadow(lbl, WS_SHADOW_OUT, 1, 0);
248  MShellRealize(sh);
249 
250 
251 }
void MObjectSetBackgroundRGB(MOBJECT obj, int r, int g, int b)
MOBJECT lbl
Definition: DFileMan.c:42
void MObjectSetShadow(MOBJECT obj, int type, int in, int out)
void MShellRealize(MOBJECT obj)
MOBJECT MCreateLabel(MOBJECT parent, const char *text, MTFont font)
short DB_BG_Albl[3]
Background ACTIVE Label Colors.
palette DPAL
Definition: 2DPlot.c:27
#define HELV_SMALL
Definition: Mguidefs.h:881
short DB_FG_Albl[3]
Foreground ACTIVE Label Colors.
MOBJECT MCreateShell(const char *title, int flags)
short DB_BG[3]
Default Background Color.
void * MOBJECT
Definition: Mguidefs.h:192
void MObjectSetForegroundRGB(MOBJECT obj, int r, int g, int b)
#define WS_SHADOW_OUT
Definition: Mguidefs.h:957
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

§ DAS_Error()

void DAS_Error ( int  c)

Definition at line 124 of file Errors.c.

References D_WriteInitLog(), DAS, DAS_Err, das::Gui, MGUITerm(), MMessageDialog(), MShellDestroy(), MShellUnrealize(), shells::Sh_Main, gui::Shells, and Status().

Referenced by SZA_FirstCalc().

125 {
126 
127  char buf[256];
128 
129  sprintf(buf,DAS_Err[c]);
130  D_WriteInitLog(buf);
131 
132  if(c > 1)
133  Status(buf);
134 
135 
136  switch (c)
137  {
138  case 2:
139  MMessageDialog ("DAS ERROR", "File '.\\Config\\Param.INI' not found,\n The program will be closed.\n You have to build the DAS.Paramini.INI and restart the Program ", "OK",NULL);
140  exit(0);
141  break;
142  case 3:
143  MMessageDialog ("DAS ERROR", "Init CCD and or AMS failed ", "OK",NULL);
146  MGUITerm();
147  exit(0);
148  break;
149 
150  }
151 /* if(c == 2)
152  {
153  MMessageDialog ("DAS ERROR", "File '.\\Config\\Param.INI' not found,\n The program will be closed.\n You have to build the DAS.Paramini.INI and restart the Program ", "OK",NULL);
154  exit(0);
155  }
156 
157 */
158 
159 
160 
161 
162 }
gui Gui
Graphic User Interface Structure.
shells Shells
Shells structure.
MOBJECT Sh_Main
Main shell for control panel.
das DAS
Definition: Chktemp.c:26
void MShellUnrealize(MOBJECT obj)
void MShellDestroy(MOBJECT obj)
void MGUITerm(void)
void Status(char *tit)
Writes information&#39;s on the Status label .
Definition: Load.c:1556
int MMessageDialog(const char *t, const char *msg, const char *btn1, const char *btn2,...)
int D_WriteInitLog(char *str)
writes devices errors(AMS, CCD...) on the Devices.log file.
Definition: Save.c:144
const char * DAS_Err[]
Definition: Errors.c:46
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

§ DAS_Message()

void DAS_Message ( char *  str,
int  er 
)

Definition at line 74 of file Errors.c.

References palette::DB_BG_Plbl, palette::DB_FG_Plbl, DEFAULT_FONT, DPAL, lbl, LEFT_ALIGN, MCreateLabel(), MCreateShell(), MLabelSetAlignment(), MObjectSetBackgroundRGB(), MObjectSetForegroundRGB(), and MShellRealize().

Referenced by LoadSetDirs().

75 {
76  char buf[80];
77  MOBJECT sh, lbl;
78 
79  sprintf(buf, "DAS WARNING");
80 
81  sh = MCreateShell(buf, 0);
82  if ((DPAL.DB_BG_Plbl[0] != 0) & (DPAL.DB_BG_Plbl[1] != 0) & (DPAL.DB_BG_Plbl[2] != 0))
84  else
85  MObjectSetBackgroundRGB(sh, 220, 220, 220);
86 
87  lbl = MCreateLabel(sh, str, DEFAULT_FONT);
88  if ((DPAL.DB_FG_Plbl[0] != 0) & (DPAL.DB_FG_Plbl[1] != 0) & (DPAL.DB_FG_Plbl[2] != 0))
90  else
91  MObjectSetForegroundRGB(lbl, 0,0,0);
93 
94  MShellRealize(sh);
95 }
void MObjectSetBackgroundRGB(MOBJECT obj, int r, int g, int b)
MOBJECT lbl
Definition: DFileMan.c:42
short DB_FG_Plbl[3]
Foreground PASSIVE Label Colors.
void MShellRealize(MOBJECT obj)
MOBJECT MCreateLabel(MOBJECT parent, const char *text, MTFont font)
palette DPAL
Definition: 2DPlot.c:27
#define DEFAULT_FONT
Definition: Mguidefs.h:877
short DB_BG_Plbl[3]
Background PASSIVE Label Colors.
MOBJECT MCreateShell(const char *title, int flags)
void MLabelSetAlignment(MOBJECT p, int align)
void * MOBJECT
Definition: Mguidefs.h:192
#define LEFT_ALIGN
Definition: Mguidefs.h:915
void MObjectSetForegroundRGB(MOBJECT obj, int r, int g, int b)
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

§ Master_Error()

void Master_Error ( int  w)

Definition at line 98 of file Errors.c.

References D_WriteInitLog(), palette::DB_BG, palette::DB_BG_Albl, palette::DB_FG_Albl, DPAL, HELV_SMALL, lbl, Master_Err, MCreateLabel(), MCreateShell(), MObjectSetBackgroundRGB(), MObjectSetForegroundRGB(), MObjectSetShadow(), MShellRealize(), SF_MODAL, and WS_SHADOW_OUT.

Referenced by SZA_FirstCalc().

99 {
100  MOBJECT sh, lbl;
101  char buf[80];
102 
103  if(w < -4 || w > -1) return;
104  sh = MCreateShell("Error in Master", SF_MODAL);
105  //sh = MCreateShell("AMS_Error", 0);
107 
108  lbl = MCreateLabel(sh, Master_Err[-w], HELV_SMALL);
111  MObjectSetShadow(lbl, WS_SHADOW_OUT, 1, 0);
112  MShellRealize(sh);
113 
114  sprintf(buf, Master_Err[-w]);
115  D_WriteInitLog(buf);
116 
117 
118 
119 
120 }
void MObjectSetBackgroundRGB(MOBJECT obj, int r, int g, int b)
MOBJECT lbl
Definition: DFileMan.c:42
void MObjectSetShadow(MOBJECT obj, int type, int in, int out)
void MShellRealize(MOBJECT obj)
MOBJECT MCreateLabel(MOBJECT parent, const char *text, MTFont font)
short DB_BG_Albl[3]
Background ACTIVE Label Colors.
palette DPAL
Definition: 2DPlot.c:27
const char * Master_Err[]
Definition: Errors.c:65
#define HELV_SMALL
Definition: Mguidefs.h:881
#define SF_MODAL
Definition: Mguidefs.h:1019
short DB_FG_Albl[3]
Foreground ACTIVE Label Colors.
MOBJECT MCreateShell(const char *title, int flags)
short DB_BG[3]
Default Background Color.
int D_WriteInitLog(char *str)
writes devices errors(AMS, CCD...) on the Devices.log file.
Definition: Save.c:144
void * MOBJECT
Definition: Mguidefs.h:192
void MObjectSetForegroundRGB(MOBJECT obj, int r, int g, int b)
#define WS_SHADOW_OUT
Definition: Mguidefs.h:957
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

Variable Documentation

§ AMS_Err

const char* AMS_Err[]
Initial value:
= {{" AMS1 Not Found "},
{" AMS2 Not Found "},
{" Power Not Sent "},
{" Step Not Sent "},
{" Slope Not Sent "},
{" Speed Not Sent "},
{" Slope Not Enabled "},
{" AMS3 Not Found "}}

Definition at line 36 of file Errors.c.

Referenced by AMS_Error().

§ CCD_Err

const char* CCD_Err[]
Initial value:
= {{" Camera Not Found "},
{" Link Failure "},
{" Unsupported Platform"},
{" Interface Locked"},
{" Platform Definition File not found '.cfg' "},
{" CCD Definition not found '.cfg' "},
{" FW error, zero position not found"},
{" Pattern generator overflow"},
{" Memory allocation error in DMA"},
{" Serializer not linked"},
{" Invalid serial decoder identifier"},
{" Unsupported platform in array mode"},
{" Invalid Handle in WD_Open()"},
{" Windriver license string not valid"},
{" FDL-PCI card not found"},
{" Memory (image) allocation error"}}

Definition at line 15 of file Errors.c.

§ DAS_Err

const char* DAS_Err[]
Initial value:
= {{" File 'PARAM.INI' loaded OK "},
{" File 'AMS.INI' loaded OK "},
{" File 'Param.INI' not found "},
{" Init CCD and or AMS failed "},
{" Platform Definition File not found '.cfg' "},
{" CCD Definition not found '.cfg' "},
{" FW error, zero position not found"},
{" Pattern generator overflow"},
{" Memory allocation error in DMA"},
{" Serializer not linked"},
{" Invalid serial decoder identifier"},
{" Unsupported platform in array mode"},
{" Invalid Handle in WD_Open()"},
{" Windriver license string not valid"},
{" FDL-PCI card not found"},
{" Memory (image) allocation error"}}

Definition at line 46 of file Errors.c.

Referenced by DAS_Error().

§ DE_Err

const char* DE_Err[] = {{" DE Not Found "}}

Definition at line 34 of file Errors.c.

§ Master_Err

const char* Master_Err[]
Initial value:
= {{" OK "},
{" MASTER file Not Found "},
{" MASTERSZA file Not Found"},
{" SZAPRG file Not Found "}}

Definition at line 65 of file Errors.c.

Referenced by Master_Error().

______________________________________________________________________________________
Generated on Mon Sep 18 2017 11:45:10 for DAS - Rel. 3.1.6 - 18/09/2017.