generic_board_channel.h

Go to the documentation of this file.
00001 
00002 // Name:        generic_board_channel.h
00003 // Purpose:     
00004 // Author:      NDA
00005 // Modified by: 
00006 // Created:     04/03/06 14:18:40
00007 // RCS-ID:      
00008 // Copyright:   CAEN S.p.A All rights reserved.
00009 // Licence:     
00011 
00012 #ifndef _GENERIC_BOARD_CHANNEL_H_
00013 #define _GENERIC_BOARD_CHANNEL_H_
00014 
00015 #define SAMPLE_LOCK
00016 
00017 #if defined(__GNUG__) && !defined(__APPLE__)
00018 #pragma interface "generic_board_channel.h"
00019 #endif
00020 
00021 // For compilers that support precompilation, includes "wx/wx.h".
00022 #include "wx/wxprec.h"
00023 
00024 #ifdef __BORLANDC__
00025 #pragma hdrstop
00026 #endif
00027 
00028 #ifndef WX_PRECOMP
00029 #include "wx/wx.h"
00030 #endif
00031 
00035 #include <wx/colour.h>
00036 #include <wx/config.h>                  
00037 #include <wx/confbase.h>                
00038 #include <wx/fileconf.h>                
00039 #include <wx/file.h>            
00040 
00041 #include "common_defs.h"
00042 
00043 extern "C" 
00044 {
00045         #include "CAENVMETool/cvt_board_commons.h"
00046 }
00047 
00048 //#include "appsettings.h"
00049 class AppSettings;
00050 class RecordChControl;
00051 class CommonChControlBase;
00052 class CursorChControl;
00053 class GenericBoard;
00054 
00055 class GenericBoardChannel
00056 {
00057 public:
00058         typedef enum
00059         {
00060                 HEX= 0,
00061                 ASCII_DEC,
00062                 ASCII_HEX,
00063         } RECORD_FORMAT_TYPE;
00064 public:
00065         GenericBoardChannel( GenericBoard* parent, int ch_index, cvt_board_data* p_data, void (* scope_refresh)( int, bool), wxMutex *p_data_mutex, AppSettings *p_app_settings);
00066         virtual ~GenericBoardChannel( void);
00067         //
00068         // Properties
00069         bool m_enabled;
00070         bool m_scope_view_enabled[ SCOPE_NUM_PANELS];
00071         wxColour m_line_color[ SCOPE_NUM_PANELS];
00072         int m_line_width[ SCOPE_NUM_PANELS];
00073         int m_record_rate_divider;
00074         bool m_record_enabled;
00075         RECORD_FORMAT_TYPE m_record_format_type;
00076 
00077         double m_offset_y[ SCOPE_NUM_PANELS];
00078         double m_volt_2_bit, m_bit_2_volt;
00079 
00080         double m_volt_2_div[ SCOPE_NUM_PANELS], m_volt_2_pix[ SCOPE_NUM_PANELS];
00081         double m_div_2_pix_X[ SCOPE_NUM_PANELS], m_div_2_pix_Y[ SCOPE_NUM_PANELS];
00082         int m_pix_Y[ SCOPE_NUM_PANELS], m_pix_X[ SCOPE_NUM_PANELS];
00083         double m_left_div_2_pix_Y[ SCOPE_NUM_PANELS];
00084         int m_left_pix_Y[ SCOPE_NUM_PANELS], m_left_pix_X[ SCOPE_NUM_PANELS];
00085         int m_cursor_position[ SCOPE_NUM_PANELS];
00086         bool m_cursor_enabled[ SCOPE_NUM_PANELS];
00087 
00088         double m_medium_value;
00089         bool m_overload_up, m_overload_down;
00090 
00091         wxPen *m_line_pen[ SCOPE_NUM_PANELS];
00092         wxPen *m_trigger_pen[ SCOPE_NUM_PANELS];
00093         wxBrush *m_trigger_brush[ SCOPE_NUM_PANELS];
00094 
00095         RecordChControl* m_p_record_ch_control;
00096         CommonChControlBase* m_p_common_ch_control;
00097         CursorChControl* m_p_cursor_ch_control[ SCOPE_NUM_PANELS];
00098         virtual void SetEnable( bool enable);
00099         void (* ScopeRefresh)( int, bool);
00100         bool SetLinePen( int scope_index, const wxPen* line_pen, const wxPen* trigger_pen= NULL);
00101 
00102         //
00103         // Methods
00104         virtual bool LoadConfig( wxConfigBase* p_config, const wxString& base_section);
00105         virtual bool SaveConfig( wxConfigBase* p_config, const wxString& base_section);
00106 
00107         void SetSec2Pix( int scope_index, double sec_per_div);
00108 
00109         inline int Volt2Pix( int scope_index, double value){ return (int)(double)( this->m_volt_2_pix[ scope_index] * value);};
00110         inline int PixY2Dc( int scope_index, int value){ return this->m_pix_Y[ scope_index]- value;};
00111 
00112         void SetDiv2Pix( int scope_index, double div_2_pix_Y);
00113         void SetLeftDiv2Pix( int scope_index, double div_2_pix_Y);
00114 
00115         inline int Sec2Pix( int scope_index, double value);
00116         inline double Sample2Sec( int value);
00117         inline double Pix2Sec( int scope_index, int value);
00118         inline int Sec2Sample( double value);
00119 
00120         void SetVolt2Div( int scope_index, double volt_2_div);
00121         void SetVolt2Pix( int scope_index, double volt_2_pix);
00122         void SetPix( int scope_index, int pix_X, int pix_Y){ this->m_pix_X[ scope_index] = pix_X; this->m_pix_Y[ scope_index]= pix_Y;};
00123         void SetLeftPix( int scope_index, int pix_X, int pix_Y){ this->m_left_pix_X[ scope_index]= pix_X; this->m_left_pix_Y[ scope_index]= pix_Y;};
00124         void DrawCursor( int scope_index, wxDC &dc);
00125         void DrawSamples( int scope_index, wxDC &dc);
00126         void DrawPosition( int scope_index, wxDC &dc);
00127 
00128         bool ToggleRecordStatus( const wxString &path, const wxString &file_name, const wxString &timestamp, bool start);
00129         virtual bool RecordSamples( void);
00130         virtual wxString GetRecordChannelNumber( void);
00131 
00132         // Pure virtual 
00133         virtual inline double GetSampleVolt( int i) = 0;
00134         virtual inline int GetSample( int i)= 0;
00135         virtual inline UINT32 GetBufferCount( void)= 0;
00136         virtual void DrawTrigger( int scope_index, wxDC &dc)= 0;
00137 
00138         GenericBoard* GetParent( ){ return this->m_parent;};
00139 protected:
00140         GenericBoard* m_parent;
00141         bool m_is_recording;
00142         wxFile *m_p_record_file;
00143 
00144         wxMutex *m_p_data_mutex;
00145 #ifdef SAMPLE_LOCK
00146         wxMutex m_samples_mutex;
00147 #endif
00148         cvt_board_data* m_p_data;
00149         int m_ch_index;
00150         UINT32 m_record_sample_counter;
00151         AppSettings *m_p_app_settings;
00152         wxMutex m_record_mutex;
00153 
00154 };
00155 
00156 
00157 #endif  // _GENERIC_BOARD_CHANNEL_H_
00158 

Generated on Mon Mar 19 17:14:08 2007 for CAENScope by  doxygen 1.4.6-NO