00001
00002
00003
00004
00005
00006
00007
00008
00009
00011
00012 #ifndef _GENERIC_BOARD_H_
00013 #define _GENERIC_BOARD_H_
00014
00015 #if defined(__GNUG__) && !defined(__APPLE__)
00016 #pragma interface "generic_board.h"
00017 #endif
00018
00022 #include <wx/arrimpl.cpp>
00023 extern "C"
00024 {
00025 #include "CAENVMETool/cvt_board_commons.h"
00026 }
00027 #include "generic_board_channel.h"
00028 #include "virtual_board_channel.h"
00029
00030 class BoardWorkerThread;
00031 class AppSettings;
00032
00033 class GenericBoard
00034 {
00035 public:
00036 GenericBoard( int board_index, void (* scope_refresh)( int, bool), wxMutex *p_data_mutex, AppSettings *p_app_settings);
00037 virtual ~GenericBoard(void);
00038
00039
00040
00041 wxArrayPtrVoid m_channel_array;
00042 wxArrayPtrVoid m_virtual_channel_array;
00043 wxMutex *m_p_data_mutex;
00044 void (* ScopeRefresh)( int, bool);
00045
00046
00047
00048 virtual bool LoadConfig( wxConfigBase* p_config, const wxString& base_section);
00049 virtual bool SaveConfig( wxConfigBase* p_config, const wxString& base_section);
00050 virtual GenericBoardChannel* CreateVirtualChannel( int ch_index, void (* scope_refresh)( int, bool), wxMutex *p_data_mutex);
00051 virtual bool GetPhysicalChannelValue( int ch_index, int sample_index, double &result);
00052 virtual bool GetPhysicalChannelValueVolt( int ch_index, int sample_index, double &result);
00053 virtual bool GetPhysicalChannelBufferCount( int ch_index, UINT32 &result);
00054
00055
00056
00057 virtual wxString GetType()= 0;
00058 virtual bool Open( long vme_handle)= 0;
00059 virtual GenericBoardChannel* CreateChannel( int ch_index, void (* scope_refresh)( int, bool), wxMutex *p_data_mutex)= 0;
00060 virtual bool WriteSampleBufferSize( void) = 0;
00061 virtual bool WriteTriggerMode( bool started) = 0;
00062 virtual bool WriteSoftwareTrigger( void) = 0;
00063 virtual bool SetFrontPanelIO( bool use_TTL)= 0;
00064 virtual bool ReadBoardData( UINT32 *p_max_num_samples, UINT32* p_num_events)= 0;
00065 virtual bool DoStartAcquisition( void)= 0;
00066 virtual bool DoStopAcquisition( void)= 0;
00067
00068 virtual bool Init( long ){ return true;};
00069
00070 void DrawTrigger( int scope_index, wxDC &dc);
00071 void DrawCursor( int scope_index, wxDC &dc);
00072 void DrawSamples( int scope_index, wxDC &dc);
00073 void SetDiv2Pix( int scope_index, double div_2_pix_Y);
00074 void SetLeftDiv2Pix( int scope_index, double div_2_pix_Y);
00075 void SetSec2Div( int scope_index, double sec_2_div);
00076 void SetPix( int scope_index, int pix_X, int pix_Y);
00077 void SetLeftPix( int scope_index, int pix_X, int pix_Y);
00078 void DrawPosition( int scope_index, wxDC &dc);
00079
00080 bool DoStartRunning( void);
00081 void DoStopRunning( void);
00082 bool ToggleRecordStatus( const wxString &path, const wxString &file_name, const wxString ×tamp, bool start);
00083 bool IsRunning( void);
00084 void SetRunning( bool value);
00085 bool m_thread_exited;
00086 protected:
00087 cvt_board_data* m_p_data;
00088 BoardWorkerThread *m_p_worker_thread;
00089 bool m_is_running;
00090 AppSettings *m_p_app_settings;
00091 int m_board_index;
00092 bool m_is_recording;
00093 friend class BoardWorkerThread;
00094 };
00095
00096
00097 #endif // _GENERIC_BOARD_H_
00098