Skip to content

Commit c63d551

Browse files
committed
more review
1 parent 4e8e7ff commit c63d551

7 files changed

Lines changed: 52 additions & 3 deletions

File tree

bindings/node/src/fake_ble/radio.rs

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff 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]
1832
pub struct FakeBle {
1933
radio: Reference<RF24>,

bindings/python/src/fake_ble/radio.rs

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff 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")]
1731
pub struct FakeBle {
1832
radio: Py<RF24>,

crates/rf24ble-rs/Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
[package]
22
name = "rf24ble-rs"
33
description = "A fake BLE implementation for the nRF24L01"
4-
version = "0.1.0"
4+
version = "0.0.0"
55
repository.workspace = true
66
homepage.workspace = true
77
edition.workspace = true

crates/rf24ble-rs/README.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,3 +24,9 @@ Original research was done by [Dmitry Grinberg and his write-up (including C
2424
source code) can be found here][fake-ble-research].
2525
As this technique can prove invaluable in certain project designs, the code
2626
here 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

crates/rf24ble-rs/src/radio.rs

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff 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+
/// ```
6983
pub 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

crates/rf24ble-rs/src/services.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ const EDDYSTONE_UUID: u16 = 0xFEAA;
1818
/// Some common traits related to BLE service data structs.
1919
pub 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

cspell.config.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -55,6 +55,7 @@ words:
5555
- mkdocs
5656
- mkdocstrings
5757
- mosi
58+
- MSRV
5859
- msvc
5960
- multiceiver
6061
- musleabihf

0 commit comments

Comments
 (0)