source: trunk/XSUCLWF/cxfel.h@ 45

Last change on this file since 45 was 37, checked in by marrucho, 11 years ago

version du 16 mai 2014 utilisée

File size: 9.8 KB
Line 
1#ifndef _CXFEL_H
2#define _CXFEL_H
3
4#include "stdafx.h"
5
6
7#include <modbus.h>
8#include "modbus-private.h"
9#include "stdint.h"
10#include "unit-test.h"
11
12#include "alloulibere.h"
13
14//#define _INC_WINDOWS
15//#include <winsock2.h>
16//#include <windows.h>
17
18#using <mscorlib.dll>
19#using <System.dll>
20#using <System.Windows.Forms.dll>
21#using <System.Drawing.dll>//pour les controles bouton
22
23using namespace System;
24using namespace System::ComponentModel;//contient des classes pour les composants et les contrôles
25using namespace System::Windows::Forms;//contient des classes dédiées à la génération des formulaires
26using namespace System::Drawing;//contient les classes Point et Size du bouton
27
28using namespace System::Threading;
29using namespace System::Collections;
30
31
32
33#define NB_BANCS 4
34#define NB_COUPLEURS 8
35#define NB_ETAPES 12
36#define MAX_NB_LABEL_TEXTBOX 500
37
38#define MODBUS_SIZE_READ_COILS 13
39#define MODBUS_SIZE_READ_HOLDINGS_LOW 82
40#define MODBUS_SIZE_READ_HOLDINGS_HIGH 125
41
42#define MODBUS_BASEADR_COILS 3000
43#define MODBUS_BASEADR_LOW_HOLDINGS 2000
44#define MODBUS_BASEADR_HIGH_HOLDINGS 2082
45
46__gc public class CGroupBox : public Form {
47private:
48 String* name;
49// int labPosX, labPosY;
50 Label* labNumP;
51 Label* labNumC1;
52 Label* labNumC2;
53 TextBox* valNumP;
54 TextBox* valNumC1;
55 TextBox* valNumC2;
56 GroupBox* gbox;
57
58 Button* appliquerBtn;
59
60 void AppliquerBtn_Clicked(Object* pSender,EventArgs* pArgs);
61public:
62 CGroupBox(String* gname, int posX, int posY);
63 //CGROUPBox(uint16_t *tab_rp_registers_low,uint16_t *tab_rp_registers_high);
64
65 GroupBox* GetGroupBox();
66 Label* GetLabelNumP();
67 Label* GetLabelNumC1();
68 Label* GetLabelNumC2();
69// TextBox* GetTextBox();
70// void SetVal(String*);
71 void SetValNumP(String*);
72 void SetValNumC1(String*);
73 void SetValNumC2(String*);
74
75 String* GetValNumP();
76 String* GetValNumC1();
77 String* GetValNumC2();
78
79protected:
80 static int nbInstance=0;//variable de classe
81};
82
83//classe boite de dialogue avec utilisation de données
84__gc public class CDialogConfig : public Form {
85public:
86 CDialogConfig();
87 CDialogConfig(uint16_t *tab_rp_registers_low,uint16_t *tab_rp_registers_high);
88 String* getTp_max();
89 String* getN_cur();
90
91protected ://privé sauf au niveau des classes dérivées
92 String* name;
93 static String* gname[] = {"a","b","c","d" };
94 int indexGroupBox;//nb de GroupBox
95
96private://données avec controle, label, bouton OK, textBox...
97 Button* sortirBtn;
98
99 GroupBox* gboxPtr;
100 static ArrayList* pal;
101
102 Label* labTp_max;
103 TextBox* valTp_max;
104 Label* labN_cur;
105 ComboBox* valN_cur;
106 Button* btnAppliquer;
107 Label* labN_cur4Reprise;
108 TextBox* valN_cur4Reprise;
109 Button* btnN_curAppliquer;
110
111 static int lectBddFic=true;//bdd=true, fichier=false
112
113 GroupBox* gboxAuto;
114 RadioButton* rbAutoBdd;//lecture bdd
115 RadioButton* rbAutoFichier;//lecture fichier
116 Button* BtnAppliquerAuto;
117
118private:
119 void SortirBtn_Clicked(Object* pSender,EventArgs* pArgs);//gestionnaire d'evenement de la boite dialogue
120 void BtnAppliquer_Clicked(Object* pSender,EventArgs* pArgs);//gestionnaire d'evenement de la boite dialogue
121
122 void BtnAppliquerAuto_Clicked(Object* pSender,EventArgs* pArgs);//gestionnaire d'evenement de la boite dialogue
123 void Radio_Clicked(Object* pSender, EventArgs* pArgs);//remplit automatiquement la zone de texte
124
125 void btnN_curAppliquer_Clicked(Object* pSender,EventArgs* pArgs);//gestionnaire d'evenement de la boite dialogue
126};
127
128
129__gc public class CLabelTextBox : public Form {
130private:
131 String* name;
132 int labPosX, labPosY;
133 int labSizeX, labSizeY;
134 Label* lab;
135 TextBox* val;
136public:
137 CLabelTextBox(String* lab, int posX, int posY, int sizeX, int sizeY, int sizeText);
138 Label* GetLabel();
139 TextBox* GetTextBox();
140 void SetVal(String*);
141 String* GetVal();
142 String* GetName();
143 void SetColor(int);
144protected:
145 static int nbInstance=0;//variable de classe
146};
147
148//classe boite de dialogue avec utilisation de données
149__gc public class MaDialogUser : public Form {
150public:
151 MaDialogUser();
152
153protected ://privé sauf au niveau des classes dérivées
154 String* name;
155 static String* nameLab_1[] = { "dtp(min)","dt(sec)","dP(dB)","dPSecu(dB)","Nbal",
156 "P_cde(dBm)","Pp(kW)","Nbal_max","Fr(Hz)","N_cur",
157 "SVd(10-10mbar)","SVfin(10-10mbar)","SV1(10-10mbar)","SV2(10-10mbar)","V_cur(10-10mbar)",
158 "Pi_min(kW)","Timer(min)","SVil(10-10mbar)","Sleil(mA)","STc(°C)",
159 "Eil","Nil","Nil_stat","P_last(dBm)","N_last","dPil(dB)"};
160
161 static String* nameLab_2[] = {"1a","2a","1b","2b","1c","2c","1d","2d" };
162
163 static String* nameLab_3[] = {"a","b","c","d" };
164
165 static String* nameLab_4[] = {"a","a","a","b","b","b","c","c","c","d","d","d" };
166
167 static String* nameLab_5[] = {"N_cur","Ln(us)","Tp_max(min)","Pi_max(kW)"};
168
169 static String* nameLab_6[] = {"1","2","3","4","5","6","7","8"};
170
171 int indexTextBox;//nb de TextBox
172 int indexTextBoxSave;//nb de TextBox après conditionning
173
174private://données avec controle, label, bouton OK, textBox...
175 Button* OKBtn;
176 Button* CancelBtn;
177 Button* EcritureBtn;
178
179 GroupBox* gbox;
180 RadioButton* rb1;//oui
181 RadioButton* rb2;//non
182
183 Thread* uThread;
184
185 static ArrayList* pal;
186 Label* lblPtr;
187 TextBox* tbxPtr;
188
189 static Button* btnStart;
190 static Button* btnStop;
191 static Button* btnPause;
192 static Button* btnReprise;//ces 4 controles bouton sont membres de System::Windows::Forms
193
194private:
195 void OKMaDBtn_Clicked(Object* pSender,EventArgs* pArgs);//gestionnaire d'evenement de la boite dialogue
196 void Radio_Clicked(Object* pSender, EventArgs* pArgs);//remplit automatiquement la zone de texte
197 void Setup_Group ();//creation et configuration d'un groupe d'options
198 void Setup_Group_Conditionning ();//creation et configuration d'un groupe d'options
199 void Setup_Buttons_Conditionning();//creation et definition des boutons
200 void BtnStart_Clicked(Object* pSender, EventArgs* pArgs);//gestionnaire d'evenements associés au bouton 1
201 void BtnStop_Clicked(Object* pSender, EventArgs* pArgs);//gestionnaire d'evenements associés au bouton 2
202 void BtnPause_Clicked(Object* pSender, EventArgs* pArgs);//gestionnaire d'evenements associés au bouton 3
203 void BtnReprise_Clicked(Object* pSender, EventArgs* pArgs);//gestionnaire d'evenements associés au bouton 4
204
205 void EcritureBtn_Clicked(Object* pSender,EventArgs* pArgs);//gestionnaire d'evenement de la boite dialogue
206
207 static void ThreadProc();
208 static float PermutToReversed(uint16_t* tab_rp_registers,int index);//permut le float32 en float32 Reverse
209};
210
211
212//classe boite de dialogue : c'est un formulaire comme un autre.. à l'affichage près
213__gc public class AboutBox : public Form {
214
215private:
216 void OKButton_Clicked(Object* pSender,EventArgs* pArgs);//gestionnaire d'evenement de la boite dialogue
217
218private:
219 Button* OKButton;
220
221public:
222 AboutBox();//constructeur
223
224};
225
226//classe boite de dialogue avec utilisation de données
227__gc public class MaDialog : public Form {
228public:
229 MaDialog();
230
231public://permet au code appelant de recuperer et modifier les données
232 void setIp(String* theIp);
233 String* getIp();
234 void setPort(String* thePort);
235 String* getPort();
236 void setTimeout(int theTimeout);
237 int getTimeout();
238
239private://données (ip/port/tiemout) avec controle, label, bouton OK et Cancel
240 Label* ipLabel;
241 TextBox* ipBox;
242 Label* portLabel;
243 TextBox* portBox;
244 Label* timeoutLabel;
245 ComboBox* timeoutCombo;
246
247 Button* OKBtn;
248 Button* CancelBtn;
249
250private:
251 void OKMaDBtn_Clicked(Object* pSender,EventArgs* pArgs);//gestionnaire d'evenement de la boite dialogue
252
253 };
254
255//classe managée du formulaire : __gc hérite de la classe System::Windows::Forms::Form
256__gc public class CppForm : public Form {
257private:
258 Button* btn1;//ces controles bouton sont membres de System::Windows::Forms
259 Button* btn2;
260 Button* btn3;
261 Button* btn4;
262
263 Label* theLabel;
264
265 //groupe d'options avec 3 cases
266 GroupBox* gbox;
267 RadioButton* rb1;
268 RadioButton* rb2;
269 RadioButton* rb3;
270 RadioButton* rb4;
271
272 ComboBox* combo1;
273
274 TextBox* text1;
275
276 MainMenu* menuBar;//barre de menu
277 MenuItem* fileMenu;//menu deroulant
278 MenuItem* item1;//element du menu
279 MenuItem* item2;//element du menu
280 System::Windows::Forms::ContextMenu* popupMenu;
281 MenuItem* item_p1;
282 MenuItem* item_p2;
283 MenuItem* item_p3;
284
285 MenuItem* item11;//pour afficher la boite de dialogue
286
287 MenuItem* fontDlgItem;//élément du menu Fichier
288
289 //ss menus
290 MenuItem* actionMenu;
291 MenuItem* subMenu1;
292 MenuItem* anotherItem;
293 MenuItem* item1_1;
294 MenuItem* item1_2;
295
296 System::Drawing::Font* labelFont;//pour afficher unr boite de dialogue Font pour choisir une police
297
298public:
299 CppForm();//constructeur
300
301private:
302 void Btn1_Clicked(Object* pSender, EventArgs* pArgs);//gestionnaire d'evenements associés au bouton 1
303 void Btn2_Clicked(Object* pSender, EventArgs* pArgs);//gestionnaire d'evenements associés au bouton 2
304 void Btn3_Clicked(Object* pSender, EventArgs* pArgs);//gestionnaire d'evenements associés au bouton 3
305 void Btn4_Clicked(Object* pSender, EventArgs* pArgs);//gestionnaire d'evenements associés au bouton 4
306 void Combo1_SelChanged(Object* pSender, EventArgs* pArgs);//gestionnaire d'evenement associé à la liste deroulante
307 void MenuItem_Clicked(Object* pSender, EventArgs* pArgs);//gestionnaire des elements de menu
308 void Radio_Clicked(Object* pSender, EventArgs* pArgs);//remplit automatiquement la zone de texte
309 void Setup_Buttons();//creation et definition du bouton
310 void Setup_Combo ();//configuration de la liste deroulmnte
311 void Setup_Context_Menu ();//menu contextuel
312 void Setup_Group ();//creation et configuration d'un groupe d'options
313 void Setup_Label();//description textuelle dans le formulaire
314 void Setup_Menu();//barre de menu
315 void Setup_Text();//controle d'edition
316};
317
318
319#endif
320
321
322
Note: See TracBrowser for help on using the repository browser.