diff options
-rw-r--r-- | nrf-softdevice-macro/src/lib.rs | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/nrf-softdevice-macro/src/lib.rs b/nrf-softdevice-macro/src/lib.rs index 8ac6a7e..53d50f3 100644 --- a/nrf-softdevice-macro/src/lib.rs +++ b/nrf-softdevice-macro/src/lib.rs @@ -360,6 +360,8 @@ pub fn gatt_client(args: TokenStream, item: TokenStream) -> TokenStream { let cccd_handle = format_ident!("{}_cccd_handle", ch.name); let read_fn = format_ident!("{}_read", ch.name); let write_fn = format_ident!("{}_write", ch.name); + let write_wor_fn = format_ident!("{}_write_without_response", ch.name); + let write_try_wor_fn = format_ident!("{}_try_write_without_response", ch.name); let uuid = ch.args.uuid; let read = ch.args.read; @@ -435,6 +437,14 @@ pub fn gatt_client(args: TokenStream, item: TokenStream) -> TokenStream { let buf = #ty_as_val::to_gatt(&val); #ble::gatt_client::write(&self.conn, self.#value_handle, buf).await } + async fn #write_wor_fn(&self, val: #ty) -> Result<(), #ble::gatt_client::WriteError> { + let buf = #ty_as_val::to_gatt(&val); + #ble::gatt_client::write_without_response(&self.conn, self.#value_handle, buf).await + } + fn #write_try_wor_fn(&self, val: #ty) -> Result<(), #ble::gatt_client::TryWriteError> { + let buf = #ty_as_val::to_gatt(&val); + #ble::gatt_client::try_write_without_response(&self.conn, self.#value_handle, buf) + } )); } |