blackmagic-camera-control: Rust lib for Bluetooth control

Ask software engineering and SDK questions for developers working on Mac OS X, Windows or Linux.
  • Author
  • Message
Offline
User avatar

Jonas Bengtson

  • Posts: 537
  • Joined: Wed Aug 22, 2012 9:18 am
  • Location: San Francisco

blackmagic-camera-control: Rust lib for Bluetooth control

PostSat Aug 28, 2021 1:13 am

Hello!

Just published a Rust library that allows you to easily interface with Blackmagic cameras over BLE.
Repo: https://github.com/coral/blackmagic-camera-control
The library should work cross-platform on Mac/Linux/Windows and comes with a simple example to showcase how you can use the library you can run with
Code: Select all
cargo run --example control

I spent some time converting the BM protocol into a JSON file available here https://github.com/coral/blackmagic-camera-protocol which this library consumes and generates static rust enums for each of the commands, that means that the library is statically typed for each of the commands. Hence when you write Command::Video(Video::Iso(640)), rust knows that the value for Iso needs to be an int32.

Bringing all this together makes it a breeze to change settings on your camera:

Code: Select all
//Create a new camera with the device name
let mut camera = BluetoothCamera::new(CAMERA_NAME).await.unwrap();

//Connect with a set timeout
camera.connect(Duration::from_secs(10)).await.unwrap();

//Change the ISO to 640
camera.write(255, Operation::AssignValue, Command::Video(Video::Iso(640))).await.unwrap();

Return to Software Developers

Who is online

Users browsing this forum: No registered users and 23 guests