Changeset 3671 in Sophya for trunk/AddOn/TAcq/brpaqu.h
- Timestamp:
- Nov 13, 2009, 11:54:04 AM (16 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/AddOn/TAcq/brpaqu.h
r3659 r3671 9 9 #include <stdio.h> 10 10 #include <iostream> 11 #include <exception> 11 12 #include <string> 12 13 #include "brtypes.h" … … 14 15 15 16 using namespace std; 17 18 // --------------------------------------------------------- 19 // ----- Classe d'exception pour Acquisition BAORadio ------ 20 #define BREX_MAXMSGLEN 160 21 22 class BAORadioException : public std::exception { 23 public: 24 explicit BAORadioException(const char * m) throw() ; 25 explicit BAORadioException(const string& m) throw() ; 26 virtual ~BAORadioException() throw() ; 27 //! Implementation of std::exception what() method, returning the exception message 28 virtual const char* what() const throw(); 29 virtual string const Msg() const ; 30 private: 31 char msg_[BREX_MAXMSGLEN]; 32 }; 33 34 16 35 17 36 // ------------------------------------------------ … … 38 57 39 58 inline double realD() { return (double)(val_)[0]; } 40 59 inline double imagD() { return (double)(val_)[1]; } 41 60 42 61 SByte val_[2]; 43 62 }; 44 63 45 // ------------------------------------------------ 64 // -------------------------------------------------------- 65 // ----- Classe BRPaquet , constante et enum associe ------ 66 // Representation, manipulation des paquets/frames 67 // envoyes par les cartes ADC 68 // -------------------------------------------------------- 46 69 47 70 // OFFSET : au cas ou le firmware reception ajoute des mots avant le header … … 68 91 //#define BRPCOFF 16 69 92 70 enum ChannelID 71 { 72 None=0, 73 Ch1, 74 Ch2, 75 Ch1_2, 76 Ch3, 77 Ch4, 78 Ch3_4 79 }; 80 enum ModeAcq 81 { 82 RawData=1, 83 FFT 84 }; 93 enum ChannelID { None=0, Ch1, Ch2, Ch1_2, Ch3, Ch4, Ch3_4 }; 94 enum ModeAcq { RawData=1, FFT }; 85 95 86 96 // Definition des actions sur la conversion de format (swap...) des donnees arrivant 87 97 enum BRDataFmtConv { 88 BR_DoNothing, 89 BR_Copy, 90 BR_SwapAll, 91 BR_SwapHDR, 92 BR_FFTOneChan, 93 BR_FFTTwoChan, 94 BR_Swap32, 95 BR_FFTOneChan32, 96 BR_FFTTwoChan32, 97 BR_FFTOneChanNoSwap, 98 BR_FFTTwoChanNoSwap, 99 BR_CpHdrTrl, 100 BR_Copy_Reduc, 101 BR_FFTOneChanNoSwapReduct, 102 BR_FFTTwoChanNoSwapReduct 103 }; 104 98 BR_DoNothing, BR_Copy, BR_SwapAll, BR_Swap32, BR_CopyHDR, BR_SwapHDR, 99 BR_FFTOneChan, BR_FFTTwoChan, 100 BR_FFTOneChanSwapAll, BR_FFTTwoChanSwapAll, 101 BR_FFTOneChanSwap32, BR_FFTTwoChanSwap32, 102 }; 103 104 // Definition des action pour recopie de paquet avec reduction de taille de paquet 105 // Copie complete (--> egalite de taille, 1,2 canaux, K0 -> Keep first two bytes (Continu/Nyquist) 106 enum BRPaqReducAction { 107 BR_CopyRA, BR_OneChanReduc, BR_TwoChanReduc, BR_OneChanReducK0, BR_TwoChanReducK0 108 }; 109 110 //---- Classe BRPaquet 105 111 // Structure correspondant a HEADER-DATA-TRAILER 106 112 class BRPaquet { 107 113 public: 108 114 // Cree d'un objet BRPaquet avec copie/swap depuis src -> dst (si src != NULL) 109 BRPaquet(Byte* src, Byte* dst, int paqsz =16424, BRDataFmtConv fgswap=BR_Copy,int minBin=0,int nbBin=0);115 BRPaquet(Byte* src, Byte* dst, int paqsz, BRDataFmtConv fgconv=BR_Copy); 110 116 // Cree d'un objet BRPaquet de taille paqsz sur la zone dst 111 BRPaquet(Byte* srcdst, int paqsz=16424); 117 BRPaquet(Byte* srcdst, int paqsz); 118 BRPaquet(int paqsz); 119 112 120 // ~BRPaquet(); 121 122 // Pour la copie/reduction de taille de paquet 123 void CopyFrom(BRPaquet& pq, BRPaqReducAction ract=BR_CopyRA, int offset=0); 113 124 114 125 // Acces diverses tailles … … 175 186 176 187 // fonction appelee par le constructeur pour reordonner les donnees FFT 188 // --- Remise en ordre avec swap complet sur 8 bytes 189 static void ReorderFFTDataSwapAll(SByte* src, SByte* dst, int sz); 190 // --- Remise en ordre avec echanges des mots de 4 bytes 191 static void ReorderFFTDataSwap32(SByte* src, SByte* dst, int sz); 192 // --- Remise en ordre seulement 177 193 static void ReorderFFTData(SByte* src, SByte* dst, int sz); 178 static void ReorderFFTData32(SByte* src, SByte* dst, int sz); 179 static void ReorderFFTDataNoSwap(SByte* src, SByte* dst, int sz); 180 static const char* FmtConvToString(BRDataFmtConv fgswap); 194 static const char* FmtConvToString(BRDataFmtConv fgconv); 181 195 // protected: 182 196 // donnees membres … … 209 223 ostream & Print(ostream& os) const; 210 224 inline ostream & Print() const { return Print(cout); } 225 // renvoie le resume de la statistique paquets sous forme de chaine 226 string Summary(bool detail=false) const; 211 227 212 228 // Acces aux differents compteurs
Note:
See TracChangeset
for help on using the changeset viewer.