Page 1 of 1

blackmagic-camera-control: Rust lib for Bluetooth control

PostPosted: Sat Aug 28, 2021 1:13 am
by Jonas Bengtson
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();