Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions Fw/Com/ComPacket.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -28,12 +28,12 @@ SerializeStatus ComPacket::deserializeBase(SerializeBufferBase& buffer) {

SerializeStatus ComPacket::serializeTo(SerializeBufferBase& buffer) const {
// Default implementation for base class - derived classes should override this method
return FW_SERIALIZE_FORMAT_ERROR;
return FW_SERIALIZE_UNIMPLEMENTED;
}

SerializeStatus ComPacket::deserializeFrom(SerializeBufferBase& buffer) {
// Default implementation for base class - derived classes should override this method
return FW_DESERIALIZE_FORMAT_ERROR;
return FW_DESERIALIZE_UNIMPLEMENTED;
}

// Deprecated methods for backward compatibility
Expand Down
8 changes: 4 additions & 4 deletions Fw/Time/Time.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -77,11 +77,11 @@ namespace Fw {

SerializeStatus Time::serializeTo(SerializeBufferBase& buffer) const {
// Fallback approach for backward compatibility:
// Try new interface first, but if it returns FORMAT_ERROR (indicating default implementation),
// Try new interface first, but if it returns UNIMPLEMENTED (indicating default implementation),
// fall back to old interface. This bridges auto-generated enums/structs (old interface only)
// with new serialization infrastructure.
SerializeStatus status = this->m_val.serializeTo(buffer);
if (status == FW_SERIALIZE_FORMAT_ERROR) {
if (status == FW_SERIALIZE_UNIMPLEMENTED) {
// Fallback to old interface for backward compatibility
status = this->m_val.serialize(buffer);
}
Expand All @@ -90,10 +90,10 @@ namespace Fw {

SerializeStatus Time::deserializeFrom(SerializeBufferBase& buffer) {
// Fallback approach for backward compatibility:
// Try new interface first, but if it returns FORMAT_ERROR (indicating default implementation),
// Try new interface first, but if it returns UNIMPLEMENTED (indicating default implementation),
// fall back to old interface.
SerializeStatus status = this->m_val.deserializeFrom(buffer);
if (status == FW_DESERIALIZE_FORMAT_ERROR) {
if (status == FW_DESERIALIZE_UNIMPLEMENTED) {
// Fallback to old interface for backward compatibility
status = this->m_val.deserialize(buffer);
}
Expand Down
12 changes: 6 additions & 6 deletions Fw/Types/Serializable.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -26,12 +26,12 @@ Serializable::~Serializable() {}

SerializeStatus Serializable::serializeTo(SerializeBufferBase& buffer) const {
// Default implementation for base class - derived classes should override this method
return FW_SERIALIZE_FORMAT_ERROR;
return FW_SERIALIZE_UNIMPLEMENTED;
}

SerializeStatus Serializable::deserializeFrom(SerializeBufferBase& buffer) {
// Default implementation for base class - derived classes should override this method
return FW_DESERIALIZE_FORMAT_ERROR;
return FW_DESERIALIZE_UNIMPLEMENTED;
}

// ----------------------------------------------------------------------
Expand Down Expand Up @@ -268,11 +268,11 @@ SerializeStatus SerializeBufferBase::serializeFrom(const U8* buff, FwSizeType le

SerializeStatus SerializeBufferBase::serializeFrom(const Serializable& val) {
// Smart fallback approach for backward compatibility:
// Try new interface first, but if it returns FORMAT_ERROR (indicating default implementation),
// Try new interface first, but if it returns UNIMPLEMENTED (indicating default implementation),
// fall back to old interface. This bridges auto-generated enums (old interface only)
// with new serialization infrastructure.
SerializeStatus status = val.serializeTo(*this);
if (status == FW_SERIALIZE_FORMAT_ERROR) {
if (status == FW_SERIALIZE_UNIMPLEMENTED) {
// Fallback to old interface for backward compatibility
status = val.serialize(*this);
}
Expand Down Expand Up @@ -560,11 +560,11 @@ SerializeStatus SerializeBufferBase::deserializeTo(U8* buff, Serializable::SizeT
}

SerializeStatus SerializeBufferBase::deserializeTo(Serializable& val) {
// Try new interface first, but if it returns FORMAT_ERROR (indicating default implementation),
// Try new interface first, but if it returns UNIMPLEMENTED (indicating default implementation),
// fall back to old interface. This bridges auto-generated enums (old interface only)
// with new serialization infrastructure.
SerializeStatus status = val.deserializeFrom(*this);
if (status == FW_DESERIALIZE_FORMAT_ERROR) {
if (status == FW_DESERIALIZE_UNIMPLEMENTED) {
// Fallback to old interface for backward compatibility
status = val.deserialize(*this);
}
Expand Down
4 changes: 3 additions & 1 deletion Fw/Types/Serializable.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,9 @@ typedef enum {
FW_DESERIALIZE_BUFFER_EMPTY, //!< Deserialization buffer was empty when trying to read more data
FW_DESERIALIZE_FORMAT_ERROR, //!< Deserialization data had incorrect values (unexpected data types)
FW_DESERIALIZE_SIZE_MISMATCH, //!< Data was left in the buffer, but not enough to deserialize
FW_DESERIALIZE_TYPE_MISMATCH //!< Deserialized type ID didn't match
FW_DESERIALIZE_TYPE_MISMATCH, //!< Deserialized type ID didn't match
FW_SERIALIZE_UNIMPLEMENTED, //!< Serialization function called is not implemented
FW_DESERIALIZE_UNIMPLEMENTED, //!< Deserialization function called is not implemented
} SerializeStatus;
class SerializeBufferBase; //!< forward declaration

Expand Down
Loading