|
rllib
1
|
#include <rlopcxmlda.h>

Classes | |
| struct | SHM_HEADER |
Public Types | |
| enum | OPC_XML_DA_ENUM { OPCXMLDA_ERROR = 256*256*128 } |
Public Member Functions | |
| rlOpcXmlDa (const char *mailbox="c:\\automation\\mbx\\opcxmlda.mbx", const char *shared_memory="c:\\automation\\shm\\opcxmlda.shm", long shared_memory_size=65536) | |
| virtual | ~rlOpcXmlDa () |
| const char * | stringValue (const char *variable) |
| int | intValue (const char *variable) |
| float | floatValue (const char *variable) |
| int | writeStringValue (const char *variable, const char *value) |
| int | writeIntValue (const char *variable, int value) |
| int | writeFloatValue (const char *variable, float value) |
| int | readErrorCount () |
| int | writeErrorCount () |
| int | shmStatus () |
Private Attributes | |
| SHM_HEADER * | shmheader |
| const char * | shmvalues |
| rlMailbox * | mbx |
| rlSharedMemory * | shm |
use this class together with opcxmlda_client. opcxmlda_client will fill the shared memory with variables read over opc xml-da. opcxmlda_client will receive outgoing writes through it's mailbox.
This class is for data acquisition within pvserver according to the pvbrowser principle. It communicates with the daemon opcxmlda_client by the means of a shared memory and a mailbox.
Definition at line 33 of file rlopcxmlda.h.
Definition at line 49 of file rlopcxmlda.h.
{
OPCXMLDA_ERROR = 256*256*128
};
| rlOpcXmlDa::rlOpcXmlDa | ( | const char * | mailbox = "c:\\automation\\mbx\\opcxmlda.mbx", |
| const char * | shared_memory = "c:\\automation\\shm\\opcxmlda.shm", |
||
| long | shared_memory_size = 65536 |
||
| ) |
Definition at line 21 of file rlopcxmlda.cpp.
{
mbx = new rlMailbox(mailbox);
shm = new rlSharedMemory(shared_memory,shared_memory_size);
shmheader = (SHM_HEADER *) shm->getUserAdr();
shmvalues = ((const char *)shmheader) + sizeof(SHM_HEADER);
}
| rlOpcXmlDa::~rlOpcXmlDa | ( | ) | [virtual] |
Definition at line 29 of file rlopcxmlda.cpp.
| float rlOpcXmlDa::floatValue | ( | const char * | variable | ) |
Definition at line 74 of file rlopcxmlda.cpp.
{
const char *cptr;
float ret;
cptr = stringValue(variable);
if(isdigit(*cptr) || *cptr == '-')
{
ret = OPCXMLDA_ERROR;
sscanf(cptr,"%f",&ret);
return ret;
}
return OPCXMLDA_ERROR;
}
| int rlOpcXmlDa::intValue | ( | const char * | variable | ) |
Definition at line 59 of file rlopcxmlda.cpp.
{
const char *cptr;
int ret;
cptr = stringValue(variable);
if(isdigit(*cptr))
{
ret = OPCXMLDA_ERROR;
sscanf(cptr,"%d",&ret);
return ret;
}
return OPCXMLDA_ERROR;
}
| int rlOpcXmlDa::readErrorCount | ( | ) |
Definition at line 107 of file rlopcxmlda.cpp.
{
if(shmheader == NULL) return OPCXMLDA_ERROR;
return shmheader->readErrorCount;
}
| int rlOpcXmlDa::shmStatus | ( | ) |
Definition at line 119 of file rlopcxmlda.cpp.
{
if(shmheader == NULL) return OPCXMLDA_ERROR;
if(shm->status == rlSharedMemory::OK) return 0;
return OPCXMLDA_ERROR;
}
| const char * rlOpcXmlDa::stringValue | ( | const char * | variable | ) |
Definition at line 35 of file rlopcxmlda.cpp.
{
int value_offset, delta_index, nmax, i;
const char *cptr;
if(shmheader == NULL) return "OPCXMLDA_ERROR";
if(strcmp(shmheader->ident,"opc") != 0) return "OPCXMLDA_ERROR";
value_offset = shmheader->maxItemNameLength + 1;
delta_index = value_offset + shmheader->maxNameLength + 1;
nmax = shmheader->numItems;
cptr = shmvalues;
for(i=0; i<nmax; i++)
{
if(strcmp(cptr,variable) == 0)
{
return cptr + value_offset;
}
cptr += delta_index;
}
return "OPCXMLDA_ERROR";
}
| int rlOpcXmlDa::writeErrorCount | ( | ) |
Definition at line 113 of file rlopcxmlda.cpp.
{
if(shmheader == NULL) return OPCXMLDA_ERROR;
return shmheader->writeErrorCount;
}
| int rlOpcXmlDa::writeFloatValue | ( | const char * | variable, |
| float | value | ||
| ) |
Definition at line 101 of file rlopcxmlda.cpp.
| int rlOpcXmlDa::writeIntValue | ( | const char * | variable, |
| int | value | ||
| ) |
Definition at line 95 of file rlopcxmlda.cpp.
| int rlOpcXmlDa::writeStringValue | ( | const char * | variable, |
| const char * | value | ||
| ) |
Definition at line 89 of file rlopcxmlda.cpp.
rlMailbox* rlOpcXmlDa::mbx [private] |
Definition at line 73 of file rlopcxmlda.h.
rlSharedMemory* rlOpcXmlDa::shm [private] |
Definition at line 74 of file rlopcxmlda.h.
SHM_HEADER* rlOpcXmlDa::shmheader [private] |
Definition at line 71 of file rlopcxmlda.h.
const char* rlOpcXmlDa::shmvalues [private] |
Definition at line 72 of file rlopcxmlda.h.
1.7.5.1