Giter VIP home page Giter VIP logo

bluedroid's Introduction

Bluedroid Rust wrapper

crates.io build docs.rs crates.io crates.io

This is a Rust wrapper for the Bluedroid Bluetooth stack for ESP32. It allows you to build a GATT server with a declarative API and supports multithreading.

Usage

Declare a characteristic:

  let manufacturer_name_characteristic = Characteristic::new(BleUuid::Uuid16(0x2A29))
        .name("Manufacturer Name String")
        .permissions(AttributePermissions::new().read().write())
        .properties(CharacteristicProperties::new().read().write().notify())
        .max_value_length(20)
        .on_write(|data, param| {
            info!("Received write request: {:?} {:?}", data, param);
        })
        .show_name()
        .set_value("Hello, world!".as_bytes().to_vec())
        .build();

Declare a service:

let device_information_service = Service::new(BleUuid::Uuid16(0x180A))
    .name("Device Information")
    .primary()
    .characteristic(&manufacturer_name_characteristic)
    .build();

Declare a profile and start the server:

let profile = Profile::new(0x0001)
    .name("Device Information")
    .service(&device_information_service)
    .build();

GLOBAL_GATT_SERVER
    .lock()
    .unwrap()
    .profile(profile)
    .device_name("ESP32-GATT-Server")
    .appearance(Appearance::WristWornPulseOximeter)
    .advertise_service(&device_information_service)
    .start();

Features

  • GATT server
    • Advertisement
      • Custom name
      • Custom appearance
    • Multiple applications
    • Services
      • Declaration
      • Advertisement
    • Characteristics
      • Declaration
      • Broadcast
      • Read
        • Static (by stack)
        • Dynamic (by application, with callback)
        • Long
      • Write
        • With response
        • Without response
        • Long
      • Notify
      • Indicate
    • Descriptors
      • Declaration
      • Read
      • Write
    • Encryption
  • GATT client

    There are currently no plans to implement the GATT client API. Contributions are welcome.

  • BR/EDR

    There are currently no plans to implement the Bluetooth Classic API. Contributions are welcome.

bluedroid's People

Contributors

persello avatar taks avatar fabiocragnolini avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.