source: Feedback/Feedback.h@ 9223

Last change on this file since 9223 was 269, checked in by ogrimm, 14 years ago
First commit of separated Feedback program
File size: 1.7 KB
Line 
1#ifndef FEEDBACK_H_SEEN
2#define FEEDBACK_H_SEEN
3
4#define SERVER_NAME "Feedback" // Name to use in DIM
5#include "Evidence.h"
6
7#define BUF_LENGTH 1000
8
9#include <stdio.h>
10#include <readline/readline.h>
11#include <readline/history.h>
12#include <math.h>
13#include <sstream>
14#include <vector>
15
16enum FBState {Off, Active, Targets, ResponseFirst, ResponseSecond};
17
18class Feedback: public EvidenceServer {
19
20 struct {
21 int State;
22 char Text[BUF_LENGTH];
23 } State;
24
25 class PixelMap *PixMap;
26 FBState FBMode;
27 std::vector<std::string> fIDTable;
28 unsigned int *Multiplicity;
29
30 float *Average;
31 float *Sigma;
32 float *Response;
33 float *Target;
34 float *Buffer;
35 float *DIMAverage;
36 float *DIMSigma;
37
38 DimService *FeedbackAverage;
39 DimService *FeedbackSigma;
40 DimService *FeedbackResponse;
41 DimService *FeedbackTarget;
42 DimService *CountService;
43 DimService *FeedbackState;
44 DimCommand *Command;
45 DimService *ConsoleOut;
46 char *ConsoleText;
47 int LastServiceUpdate;
48
49 int fDefaultNumAverage;
50 int NumAverages; // Events before feedback acts
51 int Count; // Current number of events
52 float Gain;
53 float DiffVoltage; // for response measurement
54 std::vector<std::string> Parameter;
55 int TimeBarrier;
56
57 void SetFBMode(FBState);
58 void MeasureResponse(float);
59 void ClearAverages();
60 void PrintMessage(const char*, ...);
61 bool Match(std::string, std::string);
62 void PrintUsage();
63 void commandHandler();
64
65 public:
66 Feedback();
67 ~Feedback();
68
69 void cmd_mode(); void cmd_average();
70 void cmd_target(); void cmd_gain();
71 void cmd_response(); void cmd_config();
72 void cmd_data(); void cmd_clear();
73 void cmd_help(); void cmd_exit();
74};
75
76#endif
Note: See TracBrowser for help on using the repository browser.