(&self)
| 321 | } |
| 322 | |
| 323 | pub fn get_connection_parameters(&self) -> Result<Option<crate::api::ConnectionParameters>> { |
| 324 | let obj = self |
| 325 | .env |
| 326 | .call_method_unchecked( |
| 327 | self.internal, |
| 328 | self.get_connection_parameters, |
| 329 | JavaType::Array(JavaType::Primitive(Primitive::Int).into()), |
| 330 | &[], |
| 331 | )? |
| 332 | .l()?; |
| 333 | if obj.is_null() { |
| 334 | return Ok(None); |
| 335 | } |
| 336 | let arr = obj.into_inner(); |
| 337 | let len = self.env.get_array_length(arr)?; |
| 338 | if len < 3 { |
| 339 | return Ok(None); |
| 340 | } |
| 341 | let mut buf = [0i32; 3]; |
| 342 | self.env.get_int_array_region(arr, 0, &mut buf)?; |
| 343 | // interval is in 1.25ms units → microseconds: × 1250 |
| 344 | // timeout is in 10ms units → microseconds: × 10000 |
| 345 | Ok(Some(crate::api::ConnectionParameters { |
| 346 | interval_us: (buf[0] as u32) * 1250, |
| 347 | latency: buf[1] as u16, |
| 348 | supervision_timeout_us: (buf[2] as u32) * 10_000, |
| 349 | })) |
| 350 | } |
| 351 | |
| 352 | pub fn read_remote_rssi(&self) -> Result<JObject<'a>> { |
| 353 | self.env |
no test coverage detected