|
rllib
1
|
00001 /*************************************************************************** 00002 rldataacquisition.h - description 00003 ------------------- 00004 begin : Mon Sep 03 2007 00005 copyright : (C) 2007 by pvbrowser 00006 email : lehrig@t-online.de 00007 ***************************************************************************/ 00008 00009 /*************************************************************************** 00010 * * 00011 * This library is free software; you can redistribute it and/or modify * 00012 * it under the terms of the GNU LESSER GENERAL PUBLIC LICENSE as * 00013 * published by the Free Software Foundation * 00014 * * 00015 ***************************************************************************/ 00016 #ifndef _RL_DAQ_H_ 00017 #define _RL_DAQ_H_ 00018 00019 #include "rldefine.h" 00020 #include "rlmailbox.h" 00021 #include "rlsharedmemory.h" 00022 00028 class rlDataAcquisition 00029 { 00030 public: 00031 // shared memory header 00032 typedef struct 00033 { 00034 char ident[4]; // must be "daq" 00035 int maxItemNameLength; // maximum length of an item name 00036 int maxNameLength; // maximum length of the item value 00037 int numItems; // number of items in shared memory 00038 int readErrorCount; // 0...65536 incremented by each read error 00039 int writeErrorCount; // 0...65536 incremented by each write error 00040 int lifeCounter; // 0...65536 incremented on each cycle 00041 int spare[7]; // for future use 00042 char cspare[32]; // for future use 00043 }SHM_HEADER; 00044 00045 enum DAQ_ENUM 00046 { 00047 DAQ_ERROR = 256*256*128 00048 }; 00049 00050 #ifdef RLWIN32 00051 rlDataAcquisition(const char *mailbox="c:\\automation\\mbx\\dataacquisition.mbx", const char *shared_memory="c:\\automation\\shm\\dataacquisition.shm", long shared_memory_size=65536); 00052 #else 00053 rlDataAcquisition(const char *mailbox="/srv/automation/mbx/dataacquisition.mbx", const char *shared_memory="/srv/automation/shm/dataacquisition.shm", long shared_memory_size=65536); 00054 #endif 00055 virtual ~rlDataAcquisition(); 00056 const char *stringValue(const char *variable); 00057 int intValue(const char *variable); 00058 float floatValue(const char *variable); 00059 int writeStringValue(const char *variable, const char *value); 00060 int writeIntValue(const char *variable, int value); 00061 int writeFloatValue(const char *variable, float value); 00063 int readErrorCount(); 00065 int writeErrorCount(); 00067 int lifeCounter(); 00068 const char *firstVariable(); 00069 const char *nextVariable(); 00070 int shmStatus(); // 0 if shared memory is ok | DAQ_ERROR if shared memory is not ok 00071 int shmKey(); // key of shared memory 00072 int shmId(); // id of shared memory 00073 00074 private: 00075 SHM_HEADER *shmheader; 00076 const char *shmvalues; 00077 rlMailbox *mbx; 00078 rlSharedMemory *shm; 00079 int iCurrent; 00080 }; 00081 00082 #endif 00083
1.7.5.1