Main Page | Namespace List | Class Hierarchy | Alphabetical List | Compound List | File List | Compound Members | File Members

Messages.hh

Go to the documentation of this file.
00001 /*
00002 
00003     Messaging
00004     Copyright (C) 1999-2002 Jussi Laako
00005 
00006     This program is free software; you can redistribute it and/or modify
00007     it under the terms of the GNU General Public License as published by
00008     the Free Software Foundation; either version 2 of the License, or
00009     (at your option) any later version.
00010 
00011     This program is distributed in the hope that it will be useful,
00012     but WITHOUT ANY WARRANTY; without even the implied warranty of
00013     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00014     GNU General Public License for more details.
00015 
00016     You should have received a copy of the GNU General Public License
00017     along with this program; if not, write to the Free Software
00018     Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
00019 
00020 */
00021 
00022 
00023 #include <sys/time.h>
00024 
00025 
00026 #ifndef MESSAGES_HH
00027     #define MESSAGES_HH
00028 
00029     #define MSG_FALSE               0
00030     #define MSG_TRUE                1
00031 
00032 
00036     enum
00037     {
00038         MSG_SOUND_COMPRESS_NONE = 0,
00039         MSG_SOUND_COMPRESS_FLAC = 1
00040     };
00041 
00045     enum
00046     {
00047         MSG_SPECT_TYPE_FFT = 0,
00048         MSG_SPECT_TYPE_MRFFT = 1,
00049         MSG_SPECT_TYPE_GABOR = 2,
00050         MSG_SPECT_TYPE_WVD = 3,
00051         MSG_SPECT_TYPE_HANKEL = 4,
00052         MSG_SPECT_TYPE_AUTOCORR = 5,
00053         MSG_SPECT_TYPE_CEPSTRUM = 6
00054     };
00055 
00059     enum
00060     {
00061         MSG_SPECT_WND_RECT = 0,
00062         MSG_SPECT_WND_BARTLETT = 1,
00063         MSG_SPECT_WND_BLACKMAN = 2,
00064         MSG_SPECT_WND_BM_HAR = 3,
00065         MSG_SPECT_WND_COS_TAPER = 4,
00066         MSG_SPECT_WND_EXP = 5,
00067         MSG_SPECT_WND_FLATTOP = 6,
00068         MSG_SPECT_WND_GEN_COS = 7,
00069         MSG_SPECT_WND_HAMMING = 8,
00070         MSG_SPECT_WND_HANNING = 9,
00071         MSG_SPECT_WND_KAISER = 10,
00072         MSG_SPECT_WND_KAI_BES = 11,
00073         MSG_SPECT_WND_TUKEY = 12
00074     };
00075 
00079     enum
00080     {
00081         MSG_SPECT_BNER_NONE = 0,
00082         MSG_SPECT_BNER_TPSW = 1,
00083         MSG_SPECT_BNER_OTA = 2,
00084         MSG_SPECT_BNER_DIFF = 3,
00085         MSG_SPECT_BNER_IDIFF = 4
00086     };
00087 
00091     enum
00092     {
00093         MSG_DIR_ALG_BEAM = 1,
00094         MSG_DIR_ALG_CORR = 2,
00095         MSG_DIR_ALG_SPECT = 4
00096     };
00097 
00101     enum
00102     {
00103         MSG_DIR_SCAL_LIN = 0,
00104         MSG_DIR_SCAL_LOG = 1,
00105         MSG_DIR_SCAL_EXP = 2,
00106         MSG_DIR_SCAL_SIN = 3
00107     };
00108 
00112     enum
00113     {
00114         MSG_DIR_BNER_NONE = 0,
00115         MSG_DIR_BNER_TPSW = 1,
00116         MSG_DIR_BNER_OTA = 2,
00117         MSG_DIR_BNER_DIFF = 3,
00118         MSG_DIR_BNER_IDIFF = 4
00119     };
00120 
00124     enum
00125     {
00126         MSG_LOFAR_TYPE_FFT = 0,
00127         MSG_LOFAR_TYPE_CEPSTRUM = 1,
00128         MSG_LOFAR_TYPE_AUTOCORR = 2
00129     };
00130 
00134     enum
00135     {
00136         MSG_LOFAR_WIN_RECT = 0,
00137         MSG_LOFAR_WIN_BARTLETT = 1,
00138         MSG_LOFAR_WIN_BLACKMAN = 2,
00139         MSG_LOFAR_WIN_BM_HARRIS = 3,
00140         MSG_LOFAR_WIN_COS_TAPER = 4,
00141         MSG_LOFAR_WIN_EXP = 5,
00142         MSG_LOFAR_WIN_FLATTOP = 6,
00143         MSG_LOFAR_WIN_HAMMING = 7,
00144         MSG_LOFAR_WIN_HANNING = 8,
00145         MSG_LOFAR_WIN_KAISER = 9,
00146         MSG_LOFAR_WIN_KAI_BES = 10,
00147         MSG_LOFAR_WIN_TUKEY = 11
00148     };
00149 
00153     enum
00154     {
00155         MSG_LOFAR_BNER_NONE = 0,
00156         MSG_LOFAR_BNER_TPSW = 1,
00157         MSG_LOFAR_BNER_OTA = 2,
00158         MSG_LOFAR_BNER_DIFF = 3,
00159         MSG_LOFAR_BNER_IDIFF = 4,
00160         MSG_LOFAR_BNER_STDDEV = 5
00161     };
00162 
00166     enum
00167     {
00168         MSG_LOFAR_CLIP_NONE = 0,
00169         MSG_LOFAR_CLIP_LOW = 1,
00170         MSG_LOFAR_CLIP_BOTH = 2,
00171         MSG_LOFAR_CLIP_MEAN = 3,
00172         MSG_LOFAR_CLIP_MEDIAN = 4,
00173         MSG_LOFAR_CLIP_10DB = 5,
00174         MSG_LOFAR_CLIP_20DB = 6,
00175         MSG_LOFAR_CLIP_50P = 7,
00176         MSG_LOFAR_CLIP_75P = 8,
00177         MSG_LOFAR_CLIP_OFFSET = 9,
00178         MSG_LOFAR_CLIP_OFFSET2 = 10,
00179         MSG_LOFAR_CLIP_OFFSET3 = 11,
00180         MSG_LOFAR_CLIP_SLIDING = 12
00181     };
00182 
00186     enum
00187     {
00188         MSG_LEVEL_ALG_PEAK = 0,
00189         MSG_LEVEL_ALG_RMS = 1,
00190         MSG_LEVEL_ALG_MEAN = 2,
00191         MSG_LEVEL_ALG_MEDIAN = 3,
00192         MSG_LEVEL_ALG_STDDEV = 4
00193     };
00194 
00195 
00199     typedef struct _stSoundStart
00200     {
00201         int iChannels;          
00202         double dSampleRate;     
00203         int iFragmentSize;      
00204         int iCompress;          
00205     } stSoundStart, *stpSoundStart;
00206 
00210     typedef struct _stSpectReq
00211     {
00212         int iChannel;           
00213         int iType;              
00214         int iWindow;            
00215         float fWinParam;        
00216         long lLength;           
00217         int iLowFreq;           
00218         int iHighFreq;          
00219         float fGain;            
00220         float fSlope;           
00221         int iOverlap;           
00222         bool bLinear;           
00223         bool bNormalize;        
00224         int iRemoveNoise;       
00225         float fAlpha;           
00226         long lMeanLength;       
00227         long lGapLength;        
00228         float fDynRange;        
00229     } stSpectReq, *stpSpectReq;
00230 
00234     typedef struct _stSpectRes
00235     {
00236         struct timeval sTimeStamp;  
00237         int iChannel;           
00238         long lLength;           
00239         int iLowFreq;           
00240         int iHighFreq;          
00241         int iSampleRate;        
00242         bool bLinear;           
00243         float fPeakLevel;       
00244         float fLineTime;        
00245     } stSpectRes, *stpSpectRes;
00246 
00250     typedef struct _stDirReq
00251     {
00252         int iAlgorithm;         
00253         float fSoundSpeed;      
00254         float fLowFreqLimit;    
00255         float fIntegrationTime; 
00256         int iScaling;           
00257         float fScalingExp;      
00258         bool bNormalize;        
00259         float fLeftDir;         
00260         float fRightDir;        
00261         long lSectorCount;      
00262         int iRemoveNoise;       
00263         float fAlpha;           
00264         long lMeanLength;       
00265         long lGapLength;        
00266         bool bDisableFilter;    
00267     } stDirReq, *stpDirReq;
00268 
00272     typedef struct _stDirRes
00273     {
00274         struct timeval sTimeStamp;  
00275         float fIntegrationTime; 
00276         float fHighFreqLimit;   
00277         float fPeakLevel;       
00278         long lSectorCount;      
00279         bool b3DArray;          
00280     } stDirRes, *stpDirRes;
00281 
00287     typedef struct _stDirReq2
00288     {
00289         long lWindowSize;       
00290         float fSoundSpeed;      
00291         float fLowFreqLimit;    
00292         float fIntegrationTime; 
00293         int iScaling;           
00294         float fScalingExp;      
00295         int iRemoveNoise;       
00296         float fAlpha;           
00297         long lMeanLength;       
00298         long lGapLength;        
00299     } stDirReq2, *stpDirReq2;
00300 
00306     typedef struct _stDirRes2
00307     {
00308         struct timeval sTimeStamp; 
00309         long lMinBin;           
00310         long lMaxBin;           
00311         float fFreqResolution;  
00312         long lResultCount;      
00313         float fPeakLevel;       
00314         float fIntegrationTime; 
00315     } stDirRes2, *stpDirRes2;
00316 
00320     typedef struct _stLofarReq
00321     {
00322         int iChannel;           
00323         int iType;              
00324         int iWindow;            
00325         float fWinParameter;    
00326         long lWinLength;        
00327         float fLowFreq;         
00328         float fHighFreq;        
00329         int iOverlap;           
00330         bool bLinear;           
00331         int iRemoveNoise;       
00332         float fAlpha;           
00333         long lMeanLength;       
00334         long lGapLength;        
00335         bool bDemon;            
00336         int iClip;              
00337         long lAvgCount;         
00338     } stLofarReq, *stpLofarReq;
00339 
00343     typedef struct _stLofarRes
00344     {
00345         struct timeval sTimeStamp; 
00346         long lSpectLength;      
00347         float fLowFreq;         
00348         float fHighFreq;        
00349         float fDemonBand;       
00350         float fLineTime;        
00351         float fPeakLevel;       
00352     } stLofarRes, *stpLofarRes;
00353 
00357     typedef struct _stBeamAudioReq
00358     {
00359         float fDirection;       
00360         float fSoundSpeed;      
00361         bool bHighFreq;         
00362     } stBeamAudioReq, *stpBeamAudioReq;
00363 
00367     typedef struct _stBeamAudioFirst
00368     {
00369         long lBufLength;        
00370         int iSampleRate;        
00371     } stBeamAudioFirst, *stpBeamAudioFirst;
00372 
00376     typedef struct _stBeamAudioRes
00377     {
00378         struct timeval sTimeStamp; 
00379         long lBufLength;        
00380         float fPeakLevel;       
00381         float fDirection;       
00382     } stBeamAudioRes, *stpBeamAudioRes;
00383 
00387     typedef struct _stLevelReq
00388     {
00389         int iChannel;           
00390         int iAlgorithm;         
00391         float fIntegrationTime; 
00392         float fLowFrequency;    
00393         float fHighFrequency;   
00394     } stLevelReq, *stpLevelReq;
00395 
00399     typedef struct _stLevelRes
00400     {
00401         struct timeval sTimeStamp; 
00402         float fIntegrationTime; 
00403         float fPeakLevel;       
00404         float fResult;          
00405     } stLevelRes, *stpLevelRes;
00406 
00410     typedef struct _stLocateHdr
00411     {
00412         int iWidth;             
00413         int iHeight;            
00414     } stLocateHdr, *stpLocateHdr;
00415 
00419     typedef struct _stLocateRes
00420     {
00421         long lPointCount;       
00422     } stLocateRes, *stpLocateRes;
00423 
00424 
00437     class clBaseMsg
00438     {
00439         protected:
00446             inline void EndianConv (float *, const float *);
00448             inline void EndianConv (double *, const double *);
00449     };
00450 
00451 
00455     class clSoundMsg : public clBaseMsg
00456     {
00457         public:
00464             void SetStart (char *, const stpSoundStart);
00466             void GetStart (const char *, stpSoundStart);
00475             void SetData (void *, const struct timeval *, const float *,
00476                 int);
00478             void SetData (void *, const struct timeval *, const double *,
00479                 int);
00481             void SetData (void *, const float *, int);
00483             void SetData (void *, const double *, int);
00485             int GetData (const void *, struct timeval *, float *);
00487             int GetData (const void *, struct timeval *, double *);
00489             void GetData (const void *, float *, int);
00491             void GetData (const void *, double *, int);
00492     };
00493 
00494 
00498     class clSpectMsg : public clBaseMsg
00499     {
00500         public:
00501             // Request message to server
00502             void SetRequest (char *, const stpSpectReq);
00503             void GetRequest (const char *, stpSpectReq);
00504             // Result message from server
00505             void SetResult (void *, const stpSpectRes, const float *);
00506             void SetResult (void *, const stpSpectRes, const double *);
00507             void GetResult (const void *, stpSpectRes, float *);
00508             void GetResult (const void *, stpSpectRes, double *);
00509     };
00510 
00511 
00515     class clDirMsg : public clBaseMsg
00516     {
00517         public:
00518             // Request message to server
00519             void SetRequest (char *, const stpDirReq);
00520             void GetRequest (const char *, stpDirReq);
00521             // Result message from server
00522             void SetResult (void *, const stpDirRes, const float *);
00523             void SetResult (void *, const stpDirRes, const double *);
00524             void GetResult (const void *, stpDirRes, float *);
00525             void GetResult (const void *, stpDirRes, double *);
00526     };
00527 
00528 
00532     class clDirMsg2 : public clBaseMsg
00533     {
00534         public:
00535             // Request message to server
00536             void SetRequest (char *, const stpDirReq2);
00537             void GetRequest (const char *, stpDirReq2);
00538             // Result message from server
00539             void SetResult (void *, const stpDirRes2, 
00540                 const float *, const float *);
00541             void SetResult (void *, const stpDirRes2,
00542                 const double *, const double *);
00543             void GetResult (const void *, stpDirRes2, float *, float *);
00544             void GetResult (const void *, stpDirRes2, double *, double *);
00545     };
00546 
00547 
00551     class clLofarMsg : public clBaseMsg
00552     {
00553         public:
00554             // Request message to server
00555             void SetRequest (char *, const stpLofarReq);
00556             void GetRequest (const char *, stpLofarReq);
00557             // Result message from server
00558             void SetResult (void *, const stpLofarRes, const float *);
00559             void SetResult (void *, const stpLofarRes, const double *);
00560             void GetResult (const void *, stpLofarRes, float *);
00561             void GetResult (const void *, stpLofarRes, double *);
00562     };
00563 
00564 
00568     class clBeamAudioMsg : public clBaseMsg
00569     {
00570         public:
00571             // Request message to server
00572             void SetRequest (char *, const stpBeamAudioReq);
00573             void GetRequest (const char *, stpBeamAudioReq);
00574             // First message from server
00575             void SetFirst (char *, const stpBeamAudioFirst);
00576             void GetFirst (const char *, stpBeamAudioFirst);
00577             // Result message from server
00578             void SetResult (void *, const stpBeamAudioRes, const float *);
00579             void SetResult (void *, const stpBeamAudioRes, const double *);
00580             void GetResult (const void *, stpBeamAudioRes, float *);
00581             void GetResult (const void *, stpBeamAudioRes, double *);
00582     };
00583 
00584 
00588     class clLevelMsg : public clBaseMsg
00589     {
00590         public:
00591             // Request message to server
00592             void SetRequest (char *, const stpLevelReq);
00593             void GetRequest (const char *, stpLevelReq);
00594             // Result message from server
00595             void SetResult (void *, const stpLevelRes);
00596             void GetResult (const void *, stpLevelRes);
00597     };
00598 
00599 
00603     class clLocateMsg : public clBaseMsg
00604     {
00605         public:
00606             // Header message from server
00607             void SetHeader (char *, const stpLocateHdr);
00608             void GetHeader (const char *, stpLocateHdr);
00609             // Result message from server
00610             void SetResult (void *, const stpLocateRes, const float *);
00611             void SetResult (void *, const stpLocateRes, const double *);
00612             void GetResult (const void *, stpLocateRes, float *);
00613             void GetResult (const void *, stpLocateRes, double *);
00614     };            
00615 
00616 #endif
00617 

Generated on Sun Oct 26 19:11:21 2003 for HASAS by doxygen 1.3.3