wiki:Docs/Prog/Manual/ApplicationLibraries/lib825ev/ccomm

Version 1 (modified by Don Wilson, 6 years ago) ( diff )

--

CComm

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).

Examples

Member Functions

Open

Opens a specified file, or using the filename already stored in the object.

Remarks

Example

CComm *pComm;
// pComm is a pointer that can point to a CCommSerial, CCommClient, or CCommServer instance

if(commTypeSelection == SERIAL)
{
    int comport = 2;
    CCommSerial *pSerial = new CCommSerial(commPort);
    pComm = pSerial;
}
else if(commTypeSelection == CLIENT)
{
    string svrIP = "192.168.1.25";
    int svrPort = 8001;
    CCommClient *pClient = new CCommClient(svrIP, svrPort);
    pComm = pClient;
}

pComm->Open();

// Now the app can call pComm->Send to send data without regard for whether it is serial or TCP/IP.

Note: See TracWiki for help on using the wiki.