DAS  3.1.6 - 18/09/2017
Errors.c
Go to the documentation of this file.
1 #include <windows.h>
2 #include <stdio.h>
3 #include <stdlib.h>
4 #include <string.h>
5 #include "mgui.h"
6 #include "DAS_Spatram.h"
7 
15 const char *CCD_Err[] = {{" Camera Not Found "}, // 1
16  {" Link Failure "}, // 2
17  {" Unsupported Platform"}, // 3
18  {" Interface Locked"}, // 4
19  {" Platform Definition File not found '.cfg' "}, // 5
20  {" CCD Definition not found '.cfg' "}, // 6
21  {" FW error, zero position not found"}, // 7
22  {" Pattern generator overflow"}, // 8
23  {" Memory allocation error in DMA"}, // 9
24  {" Serializer not linked"}, // 10
25  {" Invalid serial decoder identifier"}, // 11
26  {" Unsupported platform in array mode"}, // 12
27  {" Invalid Handle in WD_Open()"}, // 13
28  {" Windriver license string not valid"}, // 14
29  {" FDL-PCI card not found"}, // 15
30  {" Memory (image) allocation error"}}; // 16
31 
32 
33 
34 const char *DE_Err[] = {{" DE Not Found "}};
35 
36 const char *AMS_Err[] = {{" AMS1 Not Found "},
37  {" AMS2 Not Found "},
38  {" Power Not Sent "},
39  {" Step Not Sent "},
40  {" Slope Not Sent "},
41  {" Speed Not Sent "},
42  {" Slope Not Enabled "},
43  {" AMS3 Not Found "}};
44 
45 
46 const char *DAS_Err[] = {{" File 'PARAM.INI' loaded OK "}, // 0
47  {" File 'AMS.INI' loaded OK "}, // 1
48  {" File 'Param.INI' not found "}, // 2
49  {" Init CCD and or AMS failed "}, // 3
50  {" Platform Definition File not found '.cfg' "}, // 5
51  {" CCD Definition not found '.cfg' "}, // 6
52  {" FW error, zero position not found"}, // 7
53  {" Pattern generator overflow"}, // 8
54  {" Memory allocation error in DMA"}, // 9
55  {" Serializer not linked"}, // 10
56  {" Invalid serial decoder identifier"}, // 11
57  {" Unsupported platform in array mode"}, // 12
58  {" Invalid Handle in WD_Open()"}, // 13
59  {" Windriver license string not valid"}, // 14
60  {" FDL-PCI card not found"}, // 15
61  {" Memory (image) allocation error"}}; // 16
62 
63 
64 
65 const char *Master_Err[] = {{" OK "},
66  {" MASTER file Not Found "},
67  {" MASTERSZA file Not Found"},
68  {" SZAPRG file Not Found "}};
69 
70 
71 
72 
73 
74 void DAS_Message(char *str, int er)
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 }
96 
97 
98 void Master_Error(int w)
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 }
121 
122 
123 
124 void DAS_Error(int c)
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 }
163 
164 void ComErrors(int w)
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 }
252 
253 
254 void AMS_Error(int w)
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 }
277 
278 
279 void CCD_Error(char *str)
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 }
302 
303 /*
304 void DE_Error(int w)
305 {
306  MOBJECT sh, lbl;
307 
308  if(w == 0 || w > 1) return;
309  sh = MCreateShell("DE_Error", SF_MODAL);
310  MObjectSetBackgroundRGB(sh, DPAL.DB_BG[0], DPAL.DB_BG[1], DPAL.DB_BG[2]);
311  lbl = MCreateLabel(sh, DE_Err[--w], HELV_SMALL);
312  MObjectSetBackgroundRGB(lbl, DPAL.DB_BG_Albl[0], DPAL.DB_BG_Albl[1], DPAL.DB_BG_Albl[2]);
313  MObjectSetShadow(lbl, WS_SHADOW_OUT, 1, 0);
314  MShellRealize(sh);
315 }
316 */
317 // fprintf( stderr, "%s %s\n", ERROR_PREFIX, errorParams.errstring );
318 
void MObjectSetBackgroundRGB(MOBJECT obj, int r, int g, int b)
gui Gui
Graphic User Interface Structure.
shells Shells
Shells structure.
MOBJECT lbl
Definition: DFileMan.c:42
short DB_FG_Plbl[3]
Foreground PASSIVE Label Colors.
void MObjectSetShadow(MOBJECT obj, int type, int in, int out)
void MShellRealize(MOBJECT obj)
MOBJECT MCreateLabel(MOBJECT parent, const char *text, MTFont font)
const char * CCD_Err[]
Definition: Errors.c:15
MOBJECT Sh_Main
Main shell for control panel.
short DB_BG_Albl[3]
Background ACTIVE Label Colors.
das DAS
Definition: Chktemp.c:26
void DAS_Message(char *str, int er)
Definition: Errors.c:74
void MShellUnrealize(MOBJECT obj)
palette DPAL
Definition: 2DPlot.c:27
void MShellDestroy(MOBJECT obj)
void DAS_Error(int c)
Definition: Errors.c:124
const char * Master_Err[]
Definition: Errors.c:65
void MGUITerm(void)
#define HELV_SMALL
Definition: Mguidefs.h:881
#define DEFAULT_FONT
Definition: Mguidefs.h:877
#define SF_MODAL
Definition: Mguidefs.h:1019
void Status(char *tit)
Writes information&#39;s on the Status label .
Definition: Load.c:1556
short DB_FG_Albl[3]
Foreground ACTIVE Label Colors.
const char * AMS_Err[]
Definition: Errors.c:36
short DB_BG_Plbl[3]
Background PASSIVE Label Colors.
MOBJECT MCreateShell(const char *title, int flags)
int MMessageDialog(const char *t, const char *msg, const char *btn1, const char *btn2,...)
void ComErrors(int w)
Alerts for COM errors Creates a message window reporting the number of the error. ...
Definition: Errors.c:164
short DB_BG[3]
Default Background Color.
Function prototypes.
void MLabelSetAlignment(MOBJECT p, int align)
void AMS_Error(int w)
Alerts for AMS errors Creates a message window reporting the number of the error. ...
Definition: Errors.c:254
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
#define LEFT_ALIGN
Definition: Mguidefs.h:915
const char * DAS_Err[]
Definition: Errors.c:46
void CCD_Error(char *str)
Alerts for CCD errors Creates a message window reporting the number of the error. ...
Definition: Errors.c:279
void MObjectSetForegroundRGB(MOBJECT obj, int r, int g, int b)
const char * DE_Err[]
Definition: Errors.c:34
#define WS_SHADOW_OUT
Definition: Mguidefs.h:957
void Master_Error(int w)
Definition: Errors.c:98
______________________________________________________________________________________
Generated on Mon Sep 18 2017 11:44:08 for DAS - Rel. 3.1.6 - 18/09/2017.