12.07.2015 Views

PLCHandler Programming Guide - Esco Drives & Automation

PLCHandler Programming Guide - Esco Drives & Automation

PLCHandler Programming Guide - Esco Drives & Automation

SHOW MORE
SHOW LESS
  • No tags were found...

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

<strong>PLCHandler</strong> <strong>Programming</strong> <strong>Guide</strong>unsigned long ulLogFilter; Filter for log actions};The PlcDeviceDesc structure contains data to connect to a device:struct PlcDeviceDesc{PlcDeviceDesc(void);~PlcDeviceDesc(void);char* pszName; name of the device / protocolchar* pszInstance; instance name of the devicechar* pszProject; name of the project running on that device (only ofinterest for gateway)unsigned long ulNumParams; number of the device parametersPlcParameterDesc* ppd; pointer to an array of parameter descriptions};To get the definition of the PlcParameterDesc please have a look at the <strong>PLCHandler</strong> headerPlcConfig.h.3. C<strong>PLCHandler</strong>(SysLog *pLogFile = NULL):This constructor is used to create a <strong>PLCHandler</strong> object with default configuration (Interface:ARTI).But in each case before connection establishment the communication device must beconfigured (with SetConfig() or directly by opening the configuration with GetConfig() andsetting the appropriate values).2.2 Destructor (and connection termination)As soon as the <strong>PLCHandler</strong> object has been deleted, the connection to the PLC gets terminated (ifthere was one), all resources are deallocated and all internal threads are terminated.2.3 Connection establishmentMethod: long ::Connect(unsigned long ulTimeout = PLCHANDLER_USE_DEFAULT,unsigned long hStateChangedEvent = 0, int bLoadSymbols = 1)After the configuration has been done, via this method a connection to the PLC can be established.The method will return RESULT_OK (=0) as soon as the connection has been built up successfully. Incase of an error the current state of the communication resp. The last occurred error can be get by theGetStatus() resp. GetLastError().If a connection could not be established, the method returns an error and internally a thread will bestarted, trying to reconnect to the PLC in the defined reconnect interval.ulTimeout: This value specifies how long the connection establishment maximally can take,before the function returns. At 0 the value set actually in the configuration will be used (see:WaitTime). At ulTimeout = –1 the method will not return until a connection to the PLC will be set upsuccessfully. This can take any time.hStateChangedEvent: Here optionally the handle of an event can be passed which can be used toinform the client at each status change.bLoadSymbols: This parameter can be used to specify whether at a connection establishment thesymbols of the PLC should be loaded or not.Return value: If no error occurs, the function returns RESULT_OK. Otherwise, it returns …RESULT_FAILED: common error in the underlying interfaces. A specific error code can beretrieved by GetStatus() resp. GetLastError().RESULT_NO_CONFIGURATION: no configuration for this <strong>PLCHandler</strong> instance (Id unknown). 3S - Smart Software Solutions GmbH<strong>PLCHandler</strong> Programmming <strong>Guide</strong>.doc Page 5 of 17

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!