Skip to content

slysherz/polar-prost

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

2 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

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.

About

Protobuf bindings to interact with Polar watches

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages