| 1 | /**************************************************************************** |
|---|
| 2 | |
|---|
| 3 | Copyright 2006 Virginia Polytechnic Institute and State University |
|---|
| 4 | |
|---|
| 5 | This file is part of the OSSIE Packetizer. |
|---|
| 6 | |
|---|
| 7 | OSSIE Packetizer 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 Packetizer 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 Packetizer; 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 PACKETIZER_IMPL_H |
|---|
| 25 | #define PACKETIZER_IMPL_H |
|---|
| 26 | |
|---|
| 27 | #include <stdlib.h> |
|---|
| 28 | #include "ossie/cf.h" |
|---|
| 29 | #include "ossie/debug.h" |
|---|
| 30 | #include "ossie/Resource_impl.h" |
|---|
| 31 | #include "ossie/PortTypes.h" |
|---|
| 32 | |
|---|
| 33 | #include "standardinterfaces/realChar_u.h" |
|---|
| 34 | #include "standardinterfaces/realChar_p.h" |
|---|
| 35 | |
|---|
| 36 | #include "PacketizerDSP.h" |
|---|
| 37 | |
|---|
| 38 | class Packetizer_i : public virtual Resource_impl, public PacketizerDSP |
|---|
| 39 | { |
|---|
| 40 | public: |
|---|
| 41 | /// Initializing constructor |
|---|
| 42 | Packetizer_i(const char *uuid, omni_condition *sem); |
|---|
| 43 | |
|---|
| 44 | /// Destructor |
|---|
| 45 | ~Packetizer_i(void); |
|---|
| 46 | |
|---|
| 47 | /// |
|---|
| 48 | void start() throw (CF::Resource::StartError, CORBA::SystemException); |
|---|
| 49 | |
|---|
| 50 | /// |
|---|
| 51 | void stop() throw (CF::Resource::StopError, CORBA::SystemException); |
|---|
| 52 | |
|---|
| 53 | /// Static function for omni thread |
|---|
| 54 | static void Run( void * data ); |
|---|
| 55 | |
|---|
| 56 | /// |
|---|
| 57 | CORBA::Object_ptr getPort( const char* portName ) |
|---|
| 58 | throw (CF::PortSupplier::UnknownPort, CORBA::SystemException); |
|---|
| 59 | |
|---|
| 60 | /// |
|---|
| 61 | void releaseObject() throw (CF::LifeCycle::ReleaseError, |
|---|
| 62 | CORBA::SystemException); |
|---|
| 63 | |
|---|
| 64 | /// |
|---|
| 65 | void initialize() throw (CF::LifeCycle::InitializeError, |
|---|
| 66 | CORBA::SystemException); |
|---|
| 67 | |
|---|
| 68 | /// |
|---|
| 69 | void configure(const CF::Properties&) throw (CORBA::SystemException, |
|---|
| 70 | CF::PropertySet::InvalidConfiguration, |
|---|
| 71 | CF::PropertySet::PartialConfiguration); |
|---|
| 72 | |
|---|
| 73 | |
|---|
| 74 | private: |
|---|
| 75 | /// Disallow default constructor |
|---|
| 76 | Packetizer_i(); |
|---|
| 77 | |
|---|
| 78 | /// Disallow copy constructor |
|---|
| 79 | Packetizer_i(Packetizer_i&); |
|---|
| 80 | |
|---|
| 81 | /// Main signal processing loop |
|---|
| 82 | void RunLoop(); |
|---|
| 83 | |
|---|
| 84 | omni_condition *component_running; // for component shutdown |
|---|
| 85 | omni_thread *processing_thread; // for component writer function |
|---|
| 86 | omni_mutex accessPrivateData; // for asynchronous configure() invocation |
|---|
| 87 | |
|---|
| 88 | //list components provides and uses ports |
|---|
| 89 | standardInterfaces_i::realChar_p *dataIn; // data block |
|---|
| 90 | standardInterfaces_i::realChar_u *dataOut; // output packet |
|---|
| 91 | standardInterfaces::MetaData *metadata; |
|---|
| 92 | |
|---|
| 93 | /// Writes control block data to output sequence |
|---|
| 94 | void WriteControlBlock( PortTypes::CharSequence &bitsOut ); |
|---|
| 95 | |
|---|
| 96 | /// Operational mode |
|---|
| 97 | enum { |
|---|
| 98 | ASSEMBLE_PN_PACKET_SYNC_CODE, |
|---|
| 99 | ASSEMBLE_CONTROL_CODES, |
|---|
| 100 | ASSEMBLE_PACKET |
|---|
| 101 | } operationalMode; |
|---|
| 102 | |
|---|
| 103 | }; |
|---|
| 104 | |
|---|
| 105 | #endif |
|---|
| 106 | |
|---|