versadac  1
versadac - Scalable Recorder Firmware
uhh_navigator_cpp.h
1 #include "uhh_msgiface.h" // Provides insertion macros and constant values
2 #include "uhh_dataitem.h" // Data structures
3 #include "uhh_messageitem.h" // Data Structures
4 #include "uhh_heap.h"
5 #include "ENUM_Uhh_RecStatus.h"
6 #include "ENUM_UhhMsg_Version.h"
7 #include <stdio.h>
8 #include <iolib.h>
9 #include <socklib.h>
10 #include <inetlib.h>
11 #include <time.h>
12 #include <stdLib.h>
13 #include <taskLib.h>
14 #include <string.h>
15 
16 extern "C"
17 {
18 #include "unicodestringhandler.h"
19 }
20 
21 #define SERVER_PORT 50010
22 #define DIR_MAX 256
23 
25 {
26  private:
27  int m_Soc; // File descriptor for socket I/O
28  char* m_ayReq; // Request buffer
29  char* m_ayRes; // Response buffer
30  int m_ayResSize; // Size of the response buffer
31  int m_nResOffset; // Response buffer offset for reading
32  int m_nTargetVersion; // UHH Protocol version on target
33  int m_nReqExtra; // Extra bytes in request buffer
34  int m_nResExtra; // Extra bytes in response buffer
35  int m_nNavRef; // Navigator reference
36  int m_errCond; // Current error condition - 1 if it's safe to use this object, 0 otherwise
37 
38  int request();
39  void disconnect();
40  void reqInitHdr(int z_eType);
41  void resGetItem(UhhDataItem *);
42  bool resGetBool();
43  int resGetU8();
44  int resGetU8Array(uint8** target);
45  int resGetU16();
46  int resGetU24();
47  int resGetI32();
48  float resGetF32();
49  double resGetI56();
50  double resGetD56();
51  uint64 resGetI64();
52  double resGetD64();
53  uc_char* resGetString();
54  void reqSetU8(int offset, int val);
55  void reqSetU16(int offset, int val);
56  void reqSetU24(int offset, int val);
57  void reqSetI32(int offset, int val);
58  void reqSetI56(int offset, uint64 val);
59  void resGetMessageItem(UhhMessageItem* target);
60 
61  public:
62  uhh_navigator_cpp(char* z_sHost);
64 
65  static const bool FORWARD = true;
66  static const bool BACKWARD = false;
67 
68  static const int TRACE_MODE_NONE = 0;
69  static const int TRACE_MODE_NORMAL = 1;
70  static const int TRACE_MODE_NORMAL_INT = 2;
71  static const int TRACE_MODE_AVERAGE = 3;
72  static const int TRACE_MODE_AVERAGE_INT = 4;
73  static const int TRACE_MODE_MINMAX = 5;
74 
75  static const int MSG_MODE_NONE = 0;
76  static const int MSG_MODE_ALL = 1;
77  static const int MSG_MODE_EARLIEST = 2;
78  static const int MSG_MODE_LATEST = 3;
79 
80  int GetRemoteVer();
81  void navClose();
82  int getFinalRecStatus();
83  int getGroupNumbers(int* target, int max);
84  int getInstrumentNumbers(int* target, int max);
85  int getNextItem(UhhDataItem* target);
86  int getNextItems(UhhDataItem** target, int max);
87  int getNextMessage(UhhMessageItem* NextMsg, double lEarliestPtime);
88  int getPtime(double* out);
89  int getPtimeEarliest(double* out);
90  int getPtimeEarliestSameNumPoints(double* out);
91  int getPtimeLatest(double* out);
92  int getSegmentHeader(UhhSegHdr* target, bool bOther, bool bPoint);
93  int getUhhSequenceNumberSupported();
94  int getUhhSequenceNumbers(int* target, int max);
95  int navOpen(int z_nGroup, bool z_bSuspended, int z_nMaxPoints);
96  int openForMessages(int z_nGroup);
97  int refresh();
98  int resume();
99  void suspend();
100  void setDirection(bool z_bDirection);
101  int setDirectory(uc_char* z_sDirectory);
102  void setUhhSequenceNumbers(int z_nMin, int z_nMax);
103  void setInstrumentNumber(int z_n);
104  void setInterval(long z_lInterval);
105  void setMessageFilter(int z_nCategories);
106  void setMessageMode(int z_nMode);
107  int setPtime(double z_lPtime, int* confChanges);
108  int setPtimeEarliest(double* pTimeSet);
109  int setPtimeLatest(double* pTimeSet);
110  void setTraceMode(int z_nMode);
111  double subtractClockPeriod(double z_lPtime, double z_lClockPeriod);
112  double timeFromPtime(double z_lPtime);
113  int getErrorCond();
114 
115  long m_interval;
116  bool m_requireMessages;
117  uc_char* m_directory;
118  int m_instNumbers;
119  int* m_instruments;
120  int m_UhhSeqNumbers;
121  int* m_uhhSequence;
122  int m_navOpenStatus;
123  int m_NoOfSamples;
124 
125  UhhSegHdr * m_segHeader;
126 };
int getInstrumentNumbers(int *target, int max)
Definition: uhh_navigator_cpp.cpp:673
int getGroupNumbers(int *target, int max)
Definition: uhh_navigator_cpp.cpp:708
uhh_navigator_cpp(char *z_sHost)
Definition: uhh_navigator_cpp.cpp:797
Definition: uhh_seghdr.h:116
Definition: uhh_dataitem.h:53
Definition: uhh_messageitem.h:17
int getFinalRecStatus()
Definition: uhh_navigator_cpp.cpp:741
Definition: uhh_navigator_cpp.h:24
int setDirectory(uc_char *z_sDirectory)
Definition: uhh_navigator_cpp.cpp:17
Definition: uhh_heap.h:31
void navClose()
Definition: uhh_navigator_cpp.cpp:756
~uhh_navigator_cpp()
Definition: uhh_navigator_cpp.cpp:999