| | 1 | [[TOC]] |
| | 2 | |
| | 3 | = CComm = |
| | 4 | |
| | 5 | CComm is a C++ class that is provided to simplify 825 serial and ethernet operations. CComm is a base class for the inherited classes CCommSerial (serial ports), CCommClient (TCP/IP client), and CCommServer (TCP/IP Server). |
| | 6 | |
| | 7 | ==== Examples ==== |
| | 8 | |
| | 9 | |
| | 10 | == Member Functions == |
| | 11 | |
| | 12 | === Open === |
| | 13 | Opens a specified file, or using the filename already stored in the object. |
| | 14 | |
| | 15 | |
| | 16 | ==== Remarks ==== |
| | 17 | |
| | 18 | ==== Example ==== |
| | 19 | |
| | 20 | {{{ |
| | 21 | CComm *pComm; |
| | 22 | // pComm is a pointer that can point to a CCommSerial, CCommClient, or CCommServer instance |
| | 23 | |
| | 24 | if(commTypeSelection == SERIAL) |
| | 25 | { |
| | 26 | int comport = 2; |
| | 27 | CCommSerial *pSerial = new CCommSerial(commPort); |
| | 28 | pComm = pSerial; |
| | 29 | } |
| | 30 | else if(commTypeSelection == CLIENT) |
| | 31 | { |
| | 32 | string svrIP = "192.168.1.25"; |
| | 33 | int svrPort = 8001; |
| | 34 | CCommClient *pClient = new CCommClient(svrIP, svrPort); |
| | 35 | pComm = pClient; |
| | 36 | } |
| | 37 | |
| | 38 | pComm->Open(); |
| | 39 | |
| | 40 | // Now the app can call pComm->Send to send data without regard for whether it is serial or TCP/IP. |
| | 41 | |
| | 42 | }}} |
| | 43 | |