Skip to content
/ sACN Public

sACN (E1.31) protocol implementation in Swift to send DMX Data over UDP using Network.framework

Notifications You must be signed in to change notification settings

dnadoba/sACN

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

41 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

sACN (E1.31) Documentation

Swift Package for macOS, iOS, and tvOS to send sACN (E1.31) DMX Data over UDP using Network.framework.

Usage

You only need to initiate a Connection for a universe and you can start sending DMX Data.

let connection = Connection(universe: 1)
connection.sendDMXData(Data([0, 10, 255, 0, 0, 0, 255]))

If you want to use UDP Unicast instead of Multicast, you can simply specify an endpoint yourself:

let connection = Connection(endpoint: .hostPort(host: "192.168.2.102", .sACN), universe: 2)
connection.sendDMXData(Data([0, 10, 255, 0, 0, 0, 255]))

Features

  • Sending DMX Data via UDP Multicast and Unicast on IPv4/IPv6
  • sACN Package Priority
  • Preview Data
  • Depends only on Foundation and Network.framework

Advanced Usage

Using IPv6

For Unicast, you need to specify an IPv6 Endpoint. For Multicast, you need to specify the IP version you want to use:

let connection = Connection(universe: 1, ipVersion: .v6)

Priority

After you created a connection, you can set the priority per packet using the Connection.sendDMXData(_:priority:isPreviewData:) method. The default priority is 100.

connection.sendDMXData(data, priority: 200)

Preview Data

After you created a connection, you can choose per packet if it is preview data or not using the Connection.sendDMXData(_:priority:isPreviewData:) method. isPreviewData defaults to false.

connection.sendDMXData(data, isPreviewData: true)

Other Connection Initialization Configuration

Connection does support customizing the port, component identifier (CID), source name, DispatchQueue, and NWConneciton.Parameter. Look into the Documentation for more information.

public convenience init(
    universe: UInt16,
    ipVersion: IPVersion = .v4,
    port: NWEndpoint.Port = .sACN,
    cid: UUID = .init(),
    sourceName: String = getDeviceName(),
    queue: DispatchQueue? = nil,
    parameters: NWParameters? = nil
)

Known Limitations

About

sACN (E1.31) protocol implementation in Swift to send DMX Data over UDP using Network.framework

Topics

Resources

Code of conduct

Security policy

Stars

Watchers

Forks

Packages

No packages published

Languages