(
&self,
characteristic: &Characteristic,
data: &[u8],
write_type: WriteType,
)
| 360 | } |
| 361 | |
| 362 | async fn write( |
| 363 | &self, |
| 364 | characteristic: &Characteristic, |
| 365 | data: &[u8], |
| 366 | write_type: WriteType, |
| 367 | ) -> Result<()> { |
| 368 | let future = self.with_obj(|env, obj| { |
| 369 | let uuid = JUuid::new(env, characteristic.uuid)?; |
| 370 | let data_obj = super::jni_utils::arrays::slice_to_byte_array(env, data)?; |
| 371 | let write_type = match write_type { |
| 372 | WriteType::WithResponse => 2, |
| 373 | WriteType::WithoutResponse => 1, |
| 374 | }; |
| 375 | JSendFuture::try_from(obj.write(uuid, data_obj.into(), write_type)?) |
| 376 | })?; |
| 377 | let result_ref = future.await?; |
| 378 | self.with_obj(|env, _obj| { |
| 379 | let result = JPollResult::from_env(env, result_ref.as_obj())?; |
| 380 | get_poll_result(env, result).map(|_| {}) |
| 381 | }) |
| 382 | } |
| 383 | |
| 384 | async fn read(&self, characteristic: &Characteristic) -> Result<Vec<u8>> { |
| 385 | let future = self.with_obj(|env, obj| { |
nothing calls this directly
no test coverage detected