Barst  2.0
A server that controls lab hardware.
rtv device.h
1 
4 #ifndef _CPL_RTV_DEVICE_H_
5 #define _CPL_RTV_DEVICE_H_
6 
7 #include "base classses.h"
8 #include "cpl queue.h"
9 #include "misc tools.h"
10 
11 
12 class CChannelRTV;
13 
15 #define RTV_MAN_STR _T("RTVMan")
16 class CManagerRTV : public CManager
17 {
18 public:
19  CManagerRTV(CComm* pcComm, const TCHAR szPipe[], int nChan, int &nError);
20  virtual ~CManagerRTV();
21  void ProcessData(const void *pHead, DWORD dwSize, __int64 llId);
22  void Result(void *pHead, bool bPass) {if (m_pcMemPool) m_pcMemPool->PoolRelease(pHead);}
23  virtual DWORD GetInfo(void* pHead, DWORD dwSize);
24 
26  void NextFrame(unsigned char* aucData, unsigned short usChan);
27 private:
28  std::vector<CChannelRTV*> m_acRTVDevices; // list of all the RTV channels acive, could be NULL
29  std::vector<CRITICAL_SECTION*> m_ahCallbackSafe; // protects each channel.
30  unsigned short m_usChans; // number of RTV ports availible for use.
31 };
32 
33 
35 #define RTV_CHAN_STR _T("RTVChan")
36 class CChannelRTV : public CDevice
37 {
38 public:
47  CChannelRTV(const TCHAR szPipe[], int nChan, SChanInitRTV &sChanInit, int &nError,
48  LARGE_INTEGER &llStart);
49  virtual ~CChannelRTV();
50  void ProcessData(const void *pHead, DWORD dwSize, __int64 llId);
51  void Result(void *pHead, bool bPass);
52  DWORD GetInfo(void* pHead, DWORD dwSize);
54  void NextFrame(unsigned char* aucData);
55 
56  const SChanInitRTV m_sChanInit; // channel initialization info
57  const std::tstring m_csPipeName; // channels pipe name
58  const unsigned short m_usChan; // channel/RTV channel for this instance
59 private:
60  CTimer m_cTimer; // timer of this channel
61  bool m_bActive; // if the channels is currently active
62  long long m_llId; // the comm ID to which we'll send new frames
63 
64  CRITICAL_SECTION m_hSentSafe; // protects access to channel memory objects
65  // true if a frame was sent to comm but comm hasn't notified us that it faild or succeeded.
66  // this means that if we don't send lossless, a new frame won't be sent while this is true.
67  // if sending lossless, we ignore this and just keep adding frames.
68  bool m_bSent;
69  // the pointer to the last frame sent if not sending lossless. This is how we keep track
70  // to know when the last frame was done sending so we can send a new frame.
71  void* m_pLastSent;
72 };
73 #endif
virtual DWORD GetInfo(void *pHead, DWORD dwSize)
Definition: rtv device.cpp:103
void NextFrame(unsigned char *aucData, unsigned short usChan)
Definition: rtv device.cpp:328
void ProcessData(const void *pHead, DWORD dwSize, __int64 llId)
Definition: rtv device.cpp:135
void Result(void *pHead, bool bPass)
Definition: rtv device.h:22