rllib  1
rldataacquisition.h
Go to the documentation of this file.
1 /***************************************************************************
2  rldataacquisition.h - description
3  -------------------
4  begin : Mon Sep 03 2007
5  copyright : (C) 2007 by pvbrowser
6  email : lehrig@t-online.de
7  ***************************************************************************/
8 
9 /***************************************************************************
10  * *
11  * This library is free software; you can redistribute it and/or modify *
12  * it under the terms of the GNU LESSER GENERAL PUBLIC LICENSE as *
13  * published by the Free Software Foundation *
14  * *
15  ***************************************************************************/
16 #ifndef _RL_DAQ_H_
17 #define _RL_DAQ_H_
18 
19 #include "rldefine.h"
20 #include "rlmailbox.h"
21 #include "rlsharedmemory.h"
22 
29 {
30 public:
31  // shared memory header
32  typedef struct
33  {
34  char ident[4]; // must be "daq"
35  int maxItemNameLength; // maximum length of an item name
36  int maxNameLength; // maximum length of the item value
37  int numItems; // number of items in shared memory
38  int readErrorCount; // 0...65536 incremented by each read error
39  int writeErrorCount; // 0...65536 incremented by each write error
40  int lifeCounter; // 0...65536 incremented on each cycle
41  int spare[7]; // for future use
42  char cspare[32]; // for future use
43  }SHM_HEADER;
44 
45  enum DAQ_ENUM
46  {
47  DAQ_ERROR = 256*256*128
48  };
49 
50 #ifdef RLWIN32
51  rlDataAcquisition(const char *mailbox="c:\\automation\\mbx\\dataacquisition.mbx", const char *shared_memory="c:\\automation\\shm\\dataacquisition.shm", long shared_memory_size=65536);
52 #else
53  rlDataAcquisition(const char *mailbox="/srv/automation/mbx/dataacquisition.mbx", const char *shared_memory="/srv/automation/shm/dataacquisition.shm", long shared_memory_size=65536);
54 #endif
55  virtual ~rlDataAcquisition();
56  const char *stringValue(const char *variable);
57  int intValue(const char *variable);
58  float floatValue(const char *variable);
59  int writeStringValue(const char *variable, const char *value);
60  int writeIntValue(const char *variable, int value);
61  int writeFloatValue(const char *variable, float value);
63  int readErrorCount();
65  int writeErrorCount();
67  int lifeCounter();
68  const char *firstVariable();
69  const char *nextVariable();
70  int shmStatus(); // 0 if shared memory is ok | DAQ_ERROR if shared memory is not ok
71  int shmKey(); // key of shared memory
72  int shmId(); // id of shared memory
73 
74 private:
76  const char *shmvalues;
79  int iCurrent;
80 };
81 
82 #endif
83 
SHM_HEADER * shmheader
const char * nextVariable()
const char * stringValue(const char *variable)
const char * shmvalues
float floatValue(const char *variable)
rlDataAcquisition(const char *mailbox="c:\utomation\bx\ataacquisition.mbx", const char *shared_memory="c:\utomation\hm\ataacquisition.shm", long shared_memory_size=65536)
int writeStringValue(const char *variable, const char *value)
const char * firstVariable()
int intValue(const char *variable)
int writeIntValue(const char *variable, int value)
int writeFloatValue(const char *variable, float value)
rlSharedMemory * shm