polar-prost 0.1.0

Protobuf bindings to interact with Polar watches
Documentation

Polar Prost

polar-prost is a library with pre-generated protobuf Rust bindings to interact with Polar watches. It uses Prost to generate the bindings.

Why pre-generated? Because it's easier to use and avoids autocompletion bugs like this one.

Warning: This library has barely been tested and the definitions might not match the ones on the watch. Use at your own risk.

Usage

cargo.toml

[dependencies]
polar-prost = "0.1.0"

your_code.rs

extern crate polar_prost;

use polar_prost::{encode, types, Message};

fn main() {
    let text = "Hello, World!";

    // Manually create a polar line text object
    let line = types::PbOneLineText {
        text: text.to_string()
    };

    // Encode it into a buffer
    let buffer = encode(line).unwrap();

    // Decode it again
    let new_line = types::PbOneLineText::decode(buffer).unwrap();

    // Make sure the text didn't change
    assert_eq!(text, new_line.text);
}

Thanks

@cmaion for writting a Ruby tool to interact with Polar watches. The proto files on this library are based on his.