Contents

literally-anything/ddskit

*DDSKit* is an inter-process and inter-device communication library built using [FastDDS](https://fast-dds.docs.eprosima.com/en/latest/index.html).

Supported Platforms

| Platform | Support | | --------------- | -------------------------- | | Linux | Supported[^1][^3] | | MacOS | Supported[^2][^3] | | Other Apple OSs | Supported[^2][^3] | | Windows | Absolutely no clue, but it might work*[^3] |

[^1]: FastDDS must be installed and it needs to findable using pkg-config for it to work with no exta setup.

[^2]: Prebuilt dylibs of fastdds and fastcdr are used by default on Apple platforms. On MacOS, this can be disabled by disabling the DarwinDDSPrebuild package trait.

[^3]: Needs tests

Example

The following code publishes a message on a topic

import DDSKit

DDSParticipant.setIntraProcessDelivery(enabled: false)  // Without this fastdds crashes. I don't know why yet; I haven't had a change to check.

@DDSMessage
struct HelloWorld {
    var index: Int
    var message: String
}

let participant = DDSParticipant()
let publisher = participant.publish(to: "hello/world", type: HelloWorld.self)
publisher.publish(
    HelloWorld(index: 27, message: "Hello World)
)

To recieve this message, the following code subscribes to the topic and prints each message as it arrives

import DDSKit

let participant = DDSParticipant()
let subscriber = participant.subscribe(to: "hello/world", type: HelloWorld.self)
for await message in subscriber.messages {
    print(message)
}

Using DDSKit

If you are on Linux, you need to install FastDDS as well. Apple platforms default to using a prebuilt version. DDSKit is available as a Swift Package Manager package. To use it in a package, add the following dependency in your Package.swift

.package(
    url: "https://github.com/literally-anything/DDSKit.git",
    from: "1.0.0"
)

Replace "tag" with any release number: tags. To use the DDSKit library, add

.product(name: "DDSKit", package: "DDSKit")

to your target's dependencies.

Package Metadata

Repository: literally-anything/ddskit

Default branch: main

README: README.md