menu "RTPS"

    choice RTPS_LIMITS_PROFILE
        prompt "RTPS static limits profile"
        default RTPS_LIMITS_PROFILE_EMBEDDED
        help
            Selects the compile-time capacity limits (profile header) used by the
            rtps engine. Only the capacity caps differ between profiles.
            The storage MODEL (static vs dynamic) is a separate knob
            (RTPS_STORAGE_DYNAMIC below) and defaults to fully-static on ESP for
            every profile - selecting a relaxed profile does NOT enable heap
            storage. These caps are pure capacity limits and do NOT change any
            bytes on the wire.

            Note: the builtin discovery endpoints draw from the same pools, so
            the USABLE per-participant counts are lower than the raw caps:
            1 stateless writer + 1 stateless reader are reserved for SPDP, and
            2 stateful writers + 2 stateful readers for SEDP. E.g. the embedded
            profile's NUM_STATELESS_WRITERS=5 leaves 4 usable BEST_EFFORT
            writers. add_writer()/add_reader() name the exhausted pool and its
            cap when a creation fails.

        config RTPS_LIMITS_PROFILE_EMBEDDED
            bool "embedded (tight MCU caps)"
            help
                Tight caps sized for an ESP32-class MCU
                (rtps/config_esp32.hpp). This is the default and the smallest
                footprint.

        config RTPS_LIMITS_PROFILE_HOST
            bool "host (relaxed static caps)"
            help
                Relaxed static caps suitable for small-to-medium DDS graphs
                (rtps/config_desktop.hpp). Larger footprint than embedded.

        config RTPS_LIMITS_PROFILE_HOST_LARGE
            bool "host_large (generous static caps)"
            help
                Generous static caps for large DDS graphs
                (rtps/config_host_large.hpp). Significantly larger footprint;
                only appropriate on targets with plenty of RAM.
    endchoice

    menu "Custom capacity overrides (advanced)"
        # Each option below overrides ONE capacity cap of the selected limits
        # profile (0 = keep the profile's default). This gives fine-grained
        # control - e.g. raise only NUM_STATELESS_WRITERS instead of paying the
        # RAM for a whole relaxed profile. All values are capacity-only and do
        # NOT change any bytes on the wire. The builtin discovery endpoints
        # consume slots from these same pools (see the profile help above), so
        # size them as "usable + builtins". For a FULLY custom profile, a
        # source-level escape hatch also exists: define RTPS_CONFIG_HEADER to
        # your own header path.
        config RTPS_LIMIT_NUM_STATELESS_WRITERS
            int "NUM_STATELESS_WRITERS (0 = profile default)"
            default 0
            range 0 255
            help
                Stateless (BEST_EFFORT) writer pool; 1 slot is reserved for the builtin SPDP writer. 0 keeps the selected profile's value.

        config RTPS_LIMIT_NUM_STATELESS_READERS
            int "NUM_STATELESS_READERS (0 = profile default)"
            default 0
            range 0 255
            help
                Stateless (BEST_EFFORT) reader pool; 1 slot is reserved for the builtin SPDP reader. 0 keeps the selected profile's value.

        config RTPS_LIMIT_NUM_STATEFUL_WRITERS
            int "NUM_STATEFUL_WRITERS (0 = profile default)"
            default 0
            range 0 255
            help
                Stateful (RELIABLE) writer pool; 2 slots are reserved for the builtin SEDP writers. 0 keeps the selected profile's value.

        config RTPS_LIMIT_NUM_STATEFUL_READERS
            int "NUM_STATEFUL_READERS (0 = profile default)"
            default 0
            range 0 255
            help
                Stateful (RELIABLE) reader pool; 2 slots are reserved for the builtin SEDP readers. 0 keeps the selected profile's value.

        config RTPS_LIMIT_MAX_NUM_PARTICIPANTS
            int "MAX_NUM_PARTICIPANTS (0 = profile default)"
            default 0
            range 0 255
            help
                Maximum domain participants per process. 0 keeps the selected profile's value.

        config RTPS_LIMIT_NUM_WRITERS_PER_PARTICIPANT
            int "NUM_WRITERS_PER_PARTICIPANT (0 = profile default)"
            default 0
            range 0 255
            help
                Per-participant writer cap; the 3 builtin discovery writers count against it. 0 keeps the selected profile's value.

        config RTPS_LIMIT_NUM_READERS_PER_PARTICIPANT
            int "NUM_READERS_PER_PARTICIPANT (0 = profile default)"
            default 0
            range 0 255
            help
                Per-participant reader cap; the 3 builtin discovery readers count against it. 0 keeps the selected profile's value.

        config RTPS_LIMIT_NUM_WRITER_PROXIES_PER_READER
            int "NUM_WRITER_PROXIES_PER_READER (0 = profile default)"
            default 0
            range 0 255
            help
                Remote writers a single reader can match. 0 keeps the selected profile's value.

        config RTPS_LIMIT_NUM_READER_PROXIES_PER_WRITER
            int "NUM_READER_PROXIES_PER_WRITER (0 = profile default)"
            default 0
            range 0 255
            help
                Remote readers a single writer can match. 0 keeps the selected profile's value.

        config RTPS_LIMIT_MAX_NUM_UNMATCHED_REMOTE_WRITERS
            int "MAX_NUM_UNMATCHED_REMOTE_WRITERS (0 = profile default)"
            default 0
            range 0 255 if RTPS_LIMITS_PROFILE_EMBEDDED
            range 0 65535
            help
                Registry of discovered-but-unmatched remote writers. 0 keeps the selected profile's value.

        config RTPS_LIMIT_MAX_NUM_UNMATCHED_REMOTE_READERS
            int "MAX_NUM_UNMATCHED_REMOTE_READERS (0 = profile default)"
            default 0
            range 0 255 if RTPS_LIMITS_PROFILE_EMBEDDED
            range 0 65535
            help
                Registry of discovered-but-unmatched remote readers. 0 keeps the selected profile's value.

        config RTPS_LIMIT_MAX_NUM_READER_CALLBACKS
            int "MAX_NUM_READER_CALLBACKS (0 = profile default)"
            default 0
            range 0 255
            help
                Callback registrations per reader. 0 keeps the selected profile's value.

        config RTPS_LIMIT_HISTORY_SIZE_STATELESS
            int "HISTORY_SIZE_STATELESS (0 = profile default)"
            default 0
            range 0 255
            help
                History depth (samples) per stateless endpoint. 0 keeps the selected profile's value.

        config RTPS_LIMIT_HISTORY_SIZE_STATEFUL
            int "HISTORY_SIZE_STATEFUL (0 = profile default)"
            default 0
            range 0 255
            help
                History depth (samples) per stateful endpoint. 0 keeps the selected profile's value.

        config RTPS_LIMIT_MAX_TYPENAME_LENGTH
            int "MAX_TYPENAME_LENGTH (0 = profile default)"
            default 0
            range 0 255
            help
                Maximum DDS type-name length. 0 keeps the selected profile's value.

        config RTPS_LIMIT_MAX_TOPICNAME_LENGTH
            int "MAX_TOPICNAME_LENGTH (0 = profile default)"
            default 0
            range 0 255
            help
                Maximum DDS topic-name length. 0 keeps the selected profile's value.

        config RTPS_LIMIT_MAX_NUM_UDP_CONNECTIONS
            int "MAX_NUM_UDP_CONNECTIONS (0 = profile default)"
            default 0
            range 0 255
            help
                Transport channel pool: 2 shared multicast channels + 2 unicast
                channels per participant are permanently bound, and dedicated
                endpoint ports draw from the same pool at runtime. Must be at
                least 2 + 2*MAX_NUM_PARTICIPANTS (cross-checked at build time).
                0 keeps the selected profile's value.

    endmenu

    config RTPS_STORAGE_DYNAMIC
        bool "Use dynamic (heap) history/queue storage"
        default n
        help
            By default the engine uses fully-static, zero-heap history and queue
            storage on ESP targets (std::array), independent of the limits
            profile above: when a history fills it drops the oldest sample.
            Enable this to use heap-backed storage (std::deque) that instead
            GROWS on demand to retain samples. Off by default so the MCU keeps
            deterministic, zero-heap storage; enable only on targets that can
            afford heap growth. Does not change any bytes on the wire.

    config RTPS_ENABLE_FRAGMENTATION
        bool "Enable best-effort DATA_FRAG fragmentation"
        default n
        help
            Enables sending and receiving samples larger than a single RTPS DATA
            submessage (> ~64 KB) by splitting them into best-effort DATA_FRAG
            submessages and reassembling them on receive (interoperates with
            FastDDS / ROS 2). Default OFF so the MCU pays no code or memory cost
            for it in the common (small-sample) case. When ON, reassembly is
            bounded by RTPS_MAX_SAMPLE_SIZE (256 KB on the embedded profile) and
            the participant's max payload size rises accordingly.

    config RTPS_ENABLE_RPC
        bool "Enable RPC: services + actions (RMI/AMI)"
        default y
        help
            Compiles in the request/reply (services) and goal (actions) layers of
            the RtpsParticipant facade - both the ROS 2-interoperable
            (add_service_*/add_action_*) and native (add_native_*) variants.
            Disable to drop all of that code (and its std::thread/std::future use)
            when the device only needs pub/sub, saving flash. Pure pub/sub is
            unaffected either way. Default ON.

endmenu
