Rev | Line | |
---|
[16] | 1 |
|
---|
| 2 | // mbxfel.h: interface for the CMb class.
|
---|
| 3 |
|
---|
| 4 |
|
---|
| 5 | #ifndef _MB_H_
|
---|
| 6 | #define _MB_H_
|
---|
| 7 |
|
---|
| 8 | #include "stdafx.h"
|
---|
| 9 |
|
---|
| 10 | #include <modbus.h>
|
---|
| 11 | #include "stdint.h"
|
---|
| 12 | #include "unit-test.h"
|
---|
| 13 |
|
---|
| 14 | //#include "RemoteModbus.h"
|
---|
| 15 | #using <mscorlib.dll>
|
---|
| 16 | #using <System.dll>
|
---|
| 17 |
|
---|
| 18 | using namespace System;
|
---|
| 19 | //using namespace System::Net::Sockets;//contient des classes pour les sockets
|
---|
| 20 |
|
---|
| 21 | #define DIM_HOLDING 10
|
---|
| 22 | #define DIM_COIL 10
|
---|
| 23 |
|
---|
| 24 |
|
---|
| 25 | /*
|
---|
| 26 | class CMb : public CRemoteModbus
|
---|
| 27 | {
|
---|
| 28 | CString serverHost;
|
---|
| 29 | WORD numberPort;
|
---|
| 30 | DWORD noResponseTimeout;
|
---|
| 31 | BOOL coilArray[DIM_COIL];
|
---|
| 32 | DWORD registerArray[DIM_HOLDING];
|
---|
| 33 |
|
---|
| 34 | public://interface publique
|
---|
| 35 | CMb();//1er constructeur
|
---|
| 36 | CMb(CString sHost,WORD nPort,DWORD nrTimeout);//2eme constructeur
|
---|
| 37 | CString errorMessage(WORD errorCode);
|
---|
| 38 |
|
---|
| 39 | ~CMb();//destructeur
|
---|
| 40 | };
|
---|
| 41 | */
|
---|
| 42 | __gc class CMb
|
---|
| 43 | {
|
---|
| 44 | String* serverHost;
|
---|
| 45 | int numberPort;
|
---|
| 46 | unsigned noResponseTimeout;
|
---|
| 47 | bool coilArray __nogc [DIM_COIL];//bool coilArray[DIM_COIL];
|
---|
| 48 | int registerArray __nogc [DIM_HOLDING];//unsigned int registerArray[DIM_HOLDING];
|
---|
| 49 | // TcpClient* client;
|
---|
| 50 | // int socket;
|
---|
| 51 |
|
---|
| 52 | modbus_t *ctx;
|
---|
| 53 |
|
---|
| 54 |
|
---|
| 55 | public://interface publique
|
---|
| 56 | CMb();//1er constructeur
|
---|
| 57 | CMb(String* sHost,int nPort,unsigned nrTimeout);//2eme constructeur
|
---|
| 58 | String* errorMessage(int errorCode);
|
---|
| 59 | bool openConnection(String* sHost, int nPort, String* message);
|
---|
| 60 | bool closeConnection();
|
---|
| 61 | void setServerHost(String* sHost);
|
---|
| 62 | void setNumberPort(int nPort);
|
---|
| 63 | void setNrTimeout(unsigned nrTimeout);
|
---|
| 64 |
|
---|
| 65 | ~CMb();//destructeur
|
---|
| 66 | };
|
---|
| 67 |
|
---|
| 68 |
|
---|
| 69 | #endif // !defined(_MB_H_)
|
---|
Note:
See
TracBrowser
for help on using the repository browser.