| 1 | /**************************************************************************** |
|---|
| 2 | |
|---|
| 3 | Copyright 2006 Virginia Polytechnic Institute and State University |
|---|
| 4 | |
|---|
| 5 | This file is part of the OSSIE Depacketizer. |
|---|
| 6 | |
|---|
| 7 | OSSIE Depacketizer is free software; you can redistribute it and/or modify |
|---|
| 8 | it under the terms of the GNU General Public License as published by |
|---|
| 9 | the Free Software Foundation; either version 2 of the License, or |
|---|
| 10 | (at your option) any later version. |
|---|
| 11 | |
|---|
| 12 | OSSIE Depacketizer is distributed in the hope that it will be useful, |
|---|
| 13 | but WITHOUT ANY WARRANTY; without even the implied warranty of |
|---|
| 14 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|---|
| 15 | GNU General Public License for more details. |
|---|
| 16 | |
|---|
| 17 | You should have received a copy of the GNU General Public License |
|---|
| 18 | along with OSSIE Depacketizer; if not, write to the Free Software |
|---|
| 19 | Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA |
|---|
| 20 | |
|---|
| 21 | ****************************************************************************/ |
|---|
| 22 | |
|---|
| 23 | |
|---|
| 24 | #ifndef DEPACKETIZER_IMPL_H |
|---|
| 25 | #define DEPACKETIZER_IMPL_H |
|---|
| 26 | |
|---|
| 27 | #include <stdlib.h> |
|---|
| 28 | #include "ossie/cf.h" |
|---|
| 29 | #include "ossie/debug.h" |
|---|
| 30 | #include "ossie/Resource_impl.h" |
|---|
| 31 | |
|---|
| 32 | #include "ossie/PortTypes.h" |
|---|
| 33 | #include "standardinterfaces/realChar.h" |
|---|
| 34 | #include "standardinterfaces/realChar_u.h" |
|---|
| 35 | #include "standardinterfaces/realChar_p.h" |
|---|
| 36 | |
|---|
| 37 | #include "PacketizerDSP.h" |
|---|
| 38 | |
|---|
| 39 | class Depacketizer_i : public virtual Resource_impl, public PacketizerDSP |
|---|
| 40 | { |
|---|
| 41 | public: |
|---|
| 42 | Depacketizer_i(const char *uuid, omni_condition *sem); |
|---|
| 43 | ~Depacketizer_i(void); |
|---|
| 44 | |
|---|
| 45 | void start() throw (CF::Resource::StartError, CORBA::SystemException); |
|---|
| 46 | void stop() throw (CF::Resource::StopError, CORBA::SystemException); |
|---|
| 47 | void static run( void * data ); |
|---|
| 48 | |
|---|
| 49 | CORBA::Object_ptr getPort( const char* portName ) throw (CF::PortSupplier::UnknownPort, CORBA::SystemException); |
|---|
| 50 | |
|---|
| 51 | void releaseObject() throw (CF::LifeCycle::ReleaseError, CORBA::SystemException); |
|---|
| 52 | |
|---|
| 53 | void initialize() throw (CF::LifeCycle::InitializeError, CORBA::SystemException); |
|---|
| 54 | void configure(const CF::Properties&) throw (CORBA::SystemException, CF::PropertySet::InvalidConfiguration, CF::PropertySet::PartialConfiguration); |
|---|
| 55 | |
|---|
| 56 | |
|---|
| 57 | private: |
|---|
| 58 | Depacketizer_i(); |
|---|
| 59 | Depacketizer_i(Depacketizer_i&); |
|---|
| 60 | |
|---|
| 61 | void run_loop(); |
|---|
| 62 | |
|---|
| 63 | omni_condition *component_running; // for component shutdown |
|---|
| 64 | omni_thread *processing_thread; // for component writer function |
|---|
| 65 | omni_mutex accessPrivateData; // for asynchronous configure() invocation |
|---|
| 66 | |
|---|
| 67 | CORBA::Long simple_0_value; |
|---|
| 68 | CORBA::Long simple_1_value; |
|---|
| 69 | CORBA::Long simple_2_value; |
|---|
| 70 | |
|---|
| 71 | |
|---|
| 72 | //list components provides and uses ports |
|---|
| 73 | standardInterfaces_i::realChar_p *dataIn; |
|---|
| 74 | standardInterfaces_i::realChar_u *dataOut; |
|---|
| 75 | standardInterfaces::MetaData *metadata; |
|---|
| 76 | |
|---|
| 77 | // ----- algorithm methods ----- |
|---|
| 78 | |
|---|
| 79 | unsigned int numControlCodesExtracted; |
|---|
| 80 | unsigned int numBitsExtracted; |
|---|
| 81 | int pnSyncCodeThreshold; ///< |
|---|
| 82 | bool invertBits; ///< negative correlation indicator |
|---|
| 83 | |
|---|
| 84 | /// Operational mode |
|---|
| 85 | enum { |
|---|
| 86 | EXTRACT_PN_SYNC_CODE, |
|---|
| 87 | EXTRACT_PACKET_TYPE, |
|---|
| 88 | EXTRACT_CONTROL_CODES, |
|---|
| 89 | EXTRACT_HEADER, |
|---|
| 90 | EXTRACT_DATA_BLOCK, |
|---|
| 91 | EXTRACT_EOM_CODE |
|---|
| 92 | } operationalMode; |
|---|
| 93 | |
|---|
| 94 | }; |
|---|
| 95 | #endif |
|---|
| 96 | |
|---|