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