File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -14,6 +14,20 @@ use super::services::BlePayload;
1414/// !!! note "See also"
1515/// This implementation is subject to
1616/// [Limitations](https://docs.rs/rf24ble-rs/latest/rf24ble/index.html#limitations).
17+ ///
18+ /// Use {@link bleConfig} to properly configure the radio for
19+ /// BLE compatibility.
20+ ///
21+ /// ```ts
22+ /// import { bleConfig, FakeBle, RF24 } from "@rf24/rf24";
23+ ///
24+ /// const radio = new RF24(22, 0);
25+ /// radio.begin();
26+ /// radio.withConfig(bleConfig());
27+ /// const ble = new FakeBle(radio);
28+ ///
29+ /// radio.printDetails();
30+ /// ```
1731#[ napi]
1832pub struct FakeBle {
1933 radio : Reference < RF24 > ,
Original file line number Diff line number Diff line change @@ -13,6 +13,20 @@ use super::services::BlePayload;
1313/// See also:
1414/// This implementation is subject to
1515/// [Limitations](https://docs.rs/rf24ble-rs/latest/rf24ble/index.html#limitations).
16+ ///
17+ /// Use [`ble_config()`][rf24_py.ble_config] to properly configure the radio for
18+ /// BLE compatibility.
19+ ///
20+ /// ```py
21+ /// from rf24_py import RF24, FakeBle, ble_config
22+ ///
23+ /// radio = RF24(22, 0)
24+ /// radio.begin()
25+ /// radio.with_config(ble_config())
26+ /// ble = FakeBle(radio)
27+ ///
28+ /// radio.print_details()
29+ /// ```
1630#[ pyclass( module = "rf24_py" ) ]
1731pub struct FakeBle {
1832 radio : Py < RF24 > ,
Original file line number Diff line number Diff line change 11[package ]
22name = " rf24ble-rs"
33description = " A fake BLE implementation for the nRF24L01"
4- version = " 0.1 .0"
4+ version = " 0.0 .0"
55repository.workspace = true
66homepage.workspace = true
77edition.workspace = true
Original file line number Diff line number Diff line change @@ -24,3 +24,9 @@ Original research was done by [Dmitry Grinberg and his write-up (including C
2424source code) can be found here] [ fake-ble-research ] .
2525As this technique can prove invaluable in certain project designs, the code
2626here has been adapted to work with Rust.
27+
28+ ## Example
29+
30+ See the [ example located in the nRF24/rf24-rs repository] [ ble-example ] .
31+
32+ [ ble-example ] : https://github.com/nRF24/rf24-rs/blob/main/examples/rust/src/bin/fake_ble.rs
Original file line number Diff line number Diff line change @@ -66,6 +66,20 @@ pub fn ble_config() -> RadioConfig {
6666/// A struct that implements BLE functionality.
6767///
6868/// This implementation is subject to [Limitations](index.html#limitations).
69+ ///
70+ /// Use [`ble_config()`] to properly configure the radio for BLE compatibility.
71+ ///
72+ /// ```ignore
73+ /// use rf24::radio::{prelude::*, RF24};
74+ /// use rf24ble::{ble_config, radio::FakeBle};
75+ ///
76+ /// let mut radio = RF24::new(ce_pin, spi_device, delay_impl);
77+ /// radio.init()?;
78+ /// radio.withConfig(&ble_config())?;
79+ /// let mut ble = FakeBle::new();
80+ ///
81+ /// radio.print_details()?;
82+ /// ```
6983pub struct FakeBle {
7084 pub ( crate ) name : [ u8 ; 12 ] ,
7185 /// Enable or disable the inclusion of the radio's PA level in advertisements.
@@ -142,7 +156,7 @@ impl FakeBle {
142156
143157 /// How many bytes are available in an advertisement payload?
144158 ///
145- /// The `hypothetical` parameter shall be the same value passed to [`FakeBle::send()`].
159+ /// The `hypothetical` parameter shall be the same `buf` value passed to [`FakeBle::send()`].
146160 ///
147161 /// In addition to the given `hypothetical` payload length, this function also
148162 /// accounts for the current state of [`FakeBle::get_name()`] and
Original file line number Diff line number Diff line change @@ -18,7 +18,7 @@ const EDDYSTONE_UUID: u16 = 0xFEAA;
1818/// Some common traits related to BLE service data structs.
1919pub mod prelude {
2020 /// A trait to define the factory method of constructing BLE service data from a buffer.
21- pub trait FromBuffer {
21+ pub ( super ) trait FromBuffer {
2222 fn from_buffer ( buf : & [ u8 ] ) -> Self ;
2323 }
2424
Original file line number Diff line number Diff line change 5555 - mkdocs
5656 - mkdocstrings
5757 - mosi
58+ - MSRV
5859 - msvc
5960 - multiceiver
6061 - musleabihf
You can’t perform that action at this time.
0 commit comments