rllib  1
rldataacquisitionprovider.h
Go to the documentation of this file.
1 /***************************************************************************
2  rldataacquisitionprovider.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_PROVIDER_H_
17 #define _RL_DAQ_PROVIDER_H_
18 
19 #include "rldefine.h"
20 #include "rlsharedmemory.h"
21 
28 {
29 public:
30  // shared memory header
31  typedef struct
32  {
33  char ident[4]; // must be "daq"
34  int maxItemNameLength; // maximum length of an item name
35  int maxNameLength; // maximum length of the item value
36  int numItems; // number of items in shared memory
37  int readErrorCount; // 0...65536 incremented by each read error
38  int writeErrorCount; // 0...65536 incremented by each write error
39  int lifeCounter; // 0...65536 incremented each cycle
40  int spare[7]; // for future use
41  char cspare[32]; // for future use
42  }SHM_HEADER;
43 
45  {
46  DAQ_PROVIDER_ERROR = 256*256*128
47  };
48 
49 #ifdef RLWIN32
50  rlDataAcquisitionProvider(int maxNameLength=31, const char *shared_memory="c:\\automation\\shm\\dataacquisition.shm", long shared_memory_size=65536);
51 #else
52  rlDataAcquisitionProvider(int maxNameLength=31, const char *shared_memory="/srv/automation/shm/dataacquisition.shm", long shared_memory_size=65536);
53 #endif
55  int readItemList(const char *filename); // return DAQ_PROVIDER_ERROR | num_items
56  const char *firstItem();
57  const char *nextItem();
58  const char *stringValue(const char *variable);
59  int intValue(const char *variable);
60  float floatValue(const char *variable);
61  int setStringValue(const char *variable, const char *value);
62  int setIntValue(const char *variable, int value);
63  int setFloatValue(const char *variable, float value);
64  int readErrorCount();
65  int writeErrorCount();
66  int lifeCounter();
67  int setReadErrorCount(int count);
68  int setWriteErrorCount(int count);
69  int setLifeCounter(int count);
70  int shmStatus(); // 0 if shared memory is ok | DAQ_PROVIDER_ERROR if shared memory is not ok
71  int setAllowAddValues(int allow, int maxItemNameLength);
72 
73 private:
75  char *shmvalues;
79 };
80 
81 #endif
82 
int intValue(const char *variable)
int setIntValue(const char *variable, int value)
const char * stringValue(const char *variable)
int readItemList(const char *filename)
int setFloatValue(const char *variable, float value)
rlDataAcquisitionProvider(int maxNameLength=31, const char *shared_memory="c:\utomation\hm\ataacquisition.shm", long shared_memory_size=65536)
int setAllowAddValues(int allow, int maxItemNameLength)
float floatValue(const char *variable)
int setStringValue(const char *variable, const char *value)