diff --git a/PacketLib.xcodeproj/project.xcworkspace/xcshareddata/PacketLib.xccheckout b/PacketLib.xcodeproj/project.xcworkspace/xcshareddata/PacketLib.xccheckout index 29758294a28ae4b9ac1ea3719062078118f63c7d..46757d4fb62aea3c299f5d6f017512068a3f5a32 100644 --- a/PacketLib.xcodeproj/project.xcworkspace/xcshareddata/PacketLib.xccheckout +++ b/PacketLib.xcodeproj/project.xcworkspace/xcshareddata/PacketLib.xccheckout @@ -5,7 +5,7 @@ IDESourceControlProjectFavoriteDictionaryKey IDESourceControlProjectIdentifier - C0D7884D-D58B-4D06-B8C5-B1FECC0AA1D1 + E78724CD-2D6E-4FB5-8CA7-AC2C1C56AE1B IDESourceControlProjectName PacketLib IDESourceControlProjectOriginsDictionary diff --git a/PacketLib.xcodeproj/project.xcworkspace/xcuserdata/bulgarelli.xcuserdatad/UserInterfaceState.xcuserstate b/PacketLib.xcodeproj/project.xcworkspace/xcuserdata/bulgarelli.xcuserdatad/UserInterfaceState.xcuserstate index 61f0f56dc3bcede999e319d2d6962bd9e8a72a94..4f72555a58e0e34791eba6cb7eae71acac84e691 100644 Binary files a/PacketLib.xcodeproj/project.xcworkspace/xcuserdata/bulgarelli.xcuserdatad/UserInterfaceState.xcuserstate and b/PacketLib.xcodeproj/project.xcworkspace/xcuserdata/bulgarelli.xcuserdatad/UserInterfaceState.xcuserstate differ diff --git a/include/InputPacketStream.h b/include/InputPacketStream.h index 334f68842e59d1bf78a3a69ae8ae2579c22dfc74..19d9c347ecba6d40323618790f74f4987139d225 100644 --- a/include/InputPacketStream.h +++ b/include/InputPacketStream.h @@ -42,8 +42,7 @@ public: /// This method read a telemetry packet /// \pre The setInput method must be invocated - /// \param bDecode if true decode the method will decode the data fields. - /// \return A pointer telemetry packet. Make attention: the object returned is one of the TM packet object of the array of this object. Don't delete it! + /// \return A pointer of the packet. Make attention: the object returned is one of the TM packet object of the array of this object. Don't delete it! Packet* readPacket() throw(PacketExceptionIO*); diff --git a/include/Packet.h b/include/Packet.h index e8152b6c6f4cbad6b9ba68b5f1e39ccab420a467..271b382fdab9e0418514d245ac1a757cffe7f4e5 100644 --- a/include/Packet.h +++ b/include/Packet.h @@ -56,26 +56,27 @@ public: virtual bool createPacketType(char* fileName, bool prefix, word dimprefix) throw (PacketException*); - /// Sets the ByteStream. + /// Decode the packet /// \param stream A pointer to the stream of byte, with prefix and packet /// \param checkPacketLenght if true check the packet lenght and set the packet stream, if false do not check the packet lenght virtual bool decode(ByteStreamPtr stream, bool checkPacketLenght = false); - /// Sets the ByteStream. + /// Decode the packet /// \param prefix A pointer to the stream of byte, with the prefix /// \param packet A pointer to the stream of byte, with the packet /// \param checkPacketLenght if true check the packet lenght and set the packet stream, if false do not check the packet lenght virtual bool decode(ByteStreamPtr prefix, ByteStreamPtr packet, bool checkPacketLenght = false); - /// Sets the ByteStream. + /// Decode the packet /// \param prefix A pointer to the stream of byte, with the prefix /// \param packetHeader A pointer to the stream of byte, with the packet header /// \param packetHeader A pointer to the stream of byte, with the packet data field /// \param checkPacketLenght if true check the packet lenght and set the packet stream, if false do not check the packet lenght virtual bool decode(ByteStreamPtr prefix, ByteStreamPtr packetHeader, ByteStreamPtr packetDataField, bool checkPacketLenght = false); + /// Verify the content of the packet (after the decode) ///\return true is the packet contained into the stream is recognized using identifiers. - ///\pre the ByteStream is set with one of set(ByteStream) methods + ///\pre the ByteStream is set with one of decode(ByteStream) methods virtual bool verify(); ///\return compress the data section and change the packet (the variable part of the "source data field") @@ -85,10 +86,13 @@ public: ///\return decompress the data section without changing the packet (the variable part of the "source data field") virtual ByteStreamPtr decompressData(); + ///Get the compression algorithm used for this packet virtual enum CompressionAlgorithms getCompressionAlgorithm(); + ///Get the compression level used for this packet virtual word getCompressionLevel(); + ///\return true if the packet is compressed bool isCompressed() { if(compressible && getCompressionAlgorithm() != NONE) return true; @@ -96,6 +100,7 @@ public: return false; } + ///\return true is the packet is compressible, i.e. there are the useful fields that can store the information of the compression bool isCompressible() { return compressible; } @@ -127,16 +132,16 @@ public: ///Get the tail as a ByteStream ByteStreamPtr getBSTail(); - /// + ///Get the header PacketHeader* getPacketHeader(); - /// + ///Get the data field header DataFieldHeader* getPacketDataFieldHeader(); - /// + ///Get the source data field SourceDataField* getPacketSourceDataField(); - /// + ///Get the tail PartOfPacket* getPacketTail(); /// Gets the dimension in byte of the current packet (header + datafield (data field header + sdf + tail) diff --git a/include/PacketStream.h b/include/PacketStream.h index 526222a10a5821d7db9d586d444e577a909b0f67..4749ddb429e8fa7dbdb02aecc7b3efba98de8934 100644 --- a/include/PacketStream.h +++ b/include/PacketStream.h @@ -37,27 +37,28 @@ public: ~PacketStream(); - /// get a Packet* from a ByteStream - /// \pre the prefix has been removed - /// \param packet the stream that contains the source packet without the prefix - /// \param decodeType (0) do not decode anything (1) decode only sections (prefix, header, data field header, source data field fixed part, source data field variable part) (2) decode blocks (all sections + all blocks of the ‘source data field variable part’) + /// Get a Packet* from a ByteStream + /// \param stream the stream that contains the source packet with the prefix Packet* getPacket(ByteStreamPtr stream) throw(PacketException*); + /// Decode a packet and return its pointer /// \return The index of packet type if it's recognized. 0 if packet isn't recognized. /// \param prefix A ByteStream that contains the prefix of packet (if present). /// \param packetHeader A ByteStream that contains the packet header. /// \param packetDataField A ByteStream that contains the packet data field. int detPacketType(ByteStreamPtr prefix, ByteStreamPtr packetHeader, ByteStreamPtr packetDataField); + /// Decode a packet and return its pointer /// \return The index of packet type if it's recognized. 0 if packet isn't recognized. /// \param prefix A ByteStream that contains the prefix of packet (if present). /// \param packet A ByteStream that contains the packet. int detPacketType(ByteStreamPtr prefix, ByteStreamPtr packet); - ///It returns the index of the packet type contained in the stream. The stream* contains also the prefix (if present) + /// Decode a packet and return its pointer + /// It returns the index of the packet type contained in the stream. The stream* contains also the prefix (if present) /// \return The index of packet type if it's recognized. 0 if packet isn't recognized. - /// \param packet A ByteStream pointer that contains the packet. - int detPacketType(ByteStreamPtr packet); + /// \param stream A ByteStream pointer that contains the packet + prefix. + int detPacketType(ByteStreamPtr stream); ///It returns the total dimension of the packet contained in the stream (without prefix). The stream* contains also the prefix (if present) ///\param The stream with the prefix (if present) diff --git a/include/PartOfPacket.h b/include/PartOfPacket.h index dba523fcb8200bdd88d5b78e721e55209814c56e..3841c4a35bc42a71b1da12b7625b9c2f3d38d84c 100644 --- a/include/PartOfPacket.h +++ b/include/PartOfPacket.h @@ -219,8 +219,6 @@ public: /// \param value The real double precision value virtual void setFieldValue_64f(word index, double value); - //-------------------------------- - /// Returns the value of a field in the list of fields of this part of packet. /// The value returned is interpreted as a unsigned integer of less of equal 16 bits dimension /// (depends by the size of the field in bits) @@ -280,7 +278,6 @@ public: virtual void setFieldValue_16ui(string fieldname, word value); /// Sets the value of a field. The value is interpreted as a 32 bit signed integer. - /// --------------------------------- /// This corresponds with the PTC=4, PFC = 14. /// See setFieldValue(word index, word value) for general considerations. /// \param fieldname Represent the name of the field. @@ -310,6 +307,7 @@ public: /// \param value The real double precision value virtual void setFieldValue_64f(string fieldname, double value); + /// Return the physical index of a field virtual word getFieldIndex(string fieldname);