OpenCyphal / nunaweb

A web UI for transcompiling DSDL via Nunavut.
https://nunaweb.opencyphal.org/
MIT License
4 stars 1 forks source link

Serialization code is not generated #4

Closed pavel-kirienko closed 3 years ago

pavel-kirienko commented 3 years ago

Generated code looks as if it was generated with --omit-serialization-support.

Steps to reproduce: generate code for any namespace and open the resulting archive. You will see that the serialization logic is missing.

Here is an example; you can see that functions like reg_drone_physics_acoustics_Note_0_1_serialize_(), etc. are missing:

// This is an AUTO-GENERATED UAVCAN DSDL data type implementation. Curious? See https://uavcan.org.
// You shouldn't attempt to edit this file.
//
// Checking this file under version control is not recommended unless it is used as part of a high-SIL
// safety-critical codebase. The typical usage scenario is to generate it as part of the build process.
//
// To avoid conflicts with definitions given in the source DSDL file, all entities created by the code generator
// are named with an underscore at the end, like foo_bar_().
//
// Generator:     nunavut-1.0.1 (serialization was not enabled)
// Source file:   /tmp/pyuavcan-cli-dsdladjbkrxs/public_regulated_data_types-master/reg/drone/physics/acoustics/Note.0.1.uavcan
// Generated at:  2021-02-04 10:11:32.297428 UTC
// Is deprecated: no
// Fixed port-ID: None
// Full name:     reg.drone.physics.acoustics.Note
// Version:       0.1
//
// Language Options
//     target_endianness:  any
//     omit_float_serialization_support:  false
//     enable_serialization_asserts:  false

#ifndef REG_DRONE_PHYSICS_ACOUSTICS_NOTE_0_1_INCLUDED_
#define REG_DRONE_PHYSICS_ACOUSTICS_NOTE_0_1_INCLUDED_

#include <uavcan/si/unit/duration/Scalar_1_0.h>
#include <uavcan/si/unit/frequency/Scalar_1_0.h>
#include <uavcan/si/unit/power/Scalar_1_0.h>
#include <stdlib.h>

static_assert( NUNAVUT_SUPPORT_LANGUAGE_OPTION_TARGET_ENDIANNESS == 1693710260,
              "/tmp/pyuavcan-cli-dsdladjbkrxs/public_regulated_data_types-master/reg/drone/physics/acoustics/Note.0.1.uavcan is trying to use a serialization library that was compiled with "
              "different language options. This is dangerous and therefore not allowed." );
static_assert( NUNAVUT_SUPPORT_LANGUAGE_OPTION_OMIT_FLOAT_SERIALIZATION_SUPPORT == 734881840,
              "/tmp/pyuavcan-cli-dsdladjbkrxs/public_regulated_data_types-master/reg/drone/physics/acoustics/Note.0.1.uavcan is trying to use a serialization library that was compiled with "
              "different language options. This is dangerous and therefore not allowed." );
static_assert( NUNAVUT_SUPPORT_LANGUAGE_OPTION_ENABLE_SERIALIZATION_ASSERTS == 734881840,
              "/tmp/pyuavcan-cli-dsdladjbkrxs/public_regulated_data_types-master/reg/drone/physics/acoustics/Note.0.1.uavcan is trying to use a serialization library that was compiled with "
              "different language options. This is dangerous and therefore not allowed." );

#ifdef __cplusplus
extern "C" {
#endif

/// This type does not have a fixed port-ID. See https://forum.uavcan.org/t/choosing-message-and-service-ids/889
#define reg_drone_physics_acoustics_Note_0_1_HAS_FIXED_PORT_ID_ false

#define reg_drone_physics_acoustics_Note_0_1_FULL_NAME_             "reg.drone.physics.acoustics.Note"
#define reg_drone_physics_acoustics_Note_0_1_FULL_NAME_AND_VERSION_ "reg.drone.physics.acoustics.Note.0.1"

/// Extent is the minimum amount of memory required to hold any serialized representation of any compatible
/// version of the data type; or, on other words, it is the the maximum possible size of received objects of this type.
/// The size is specified in bytes (rather than bits) because by definition, extent is an integer number of bytes long.
/// When allocating a deserialization (RX) buffer for this data type, it should be at least extent bytes large.
/// When allocating a serialization (TX) buffer, it is safe to use the size of the largest serialized representation
/// instead of the extent because it provides a tighter bound of the object size; it is safe because the concrete type
/// is always known during serialization (unlike deserialization). If not sure, use extent everywhere.
#define reg_drone_physics_acoustics_Note_0_1_EXTENT_BYTES_                    12UL
#define reg_drone_physics_acoustics_Note_0_1_SERIALIZATION_BUFFER_SIZE_BYTES_ 12UL
static_assert(reg_drone_physics_acoustics_Note_0_1_EXTENT_BYTES_ >= reg_drone_physics_acoustics_Note_0_1_SERIALIZATION_BUFFER_SIZE_BYTES_,
              "Internal constraint violation");

typedef struct
{
    /// uavcan.si.unit.frequency.Scalar.1.0 frequency
    uavcan_si_unit_frequency_Scalar_1_0 frequency;

    /// uavcan.si.unit.duration.Scalar.1.0 duration
    uavcan_si_unit_duration_Scalar_1_0 duration;

    /// uavcan.si.unit.power.Scalar.1.0 acoustic_power
    uavcan_si_unit_power_Scalar_1_0 acoustic_power;
} reg_drone_physics_acoustics_Note_0_1;

#ifdef __cplusplus
}
#endif
#endif // REG_DRONE_PHYSICS_ACOUSTICS_NOTE_0_1_INCLUDED_
bbworld1 commented 3 years ago

Apologies for not noticing this beforehand. Fixed in #5 .