| 24 | }; |
| 25 | |
| 26 | pub fn to_error(status: GattCommunicationStatus) -> Result<()> { |
| 27 | if status == GattCommunicationStatus::AccessDenied { |
| 28 | Err(Error::PermissionDenied) |
| 29 | } else if status == GattCommunicationStatus::Unreachable { |
| 30 | Err(Error::NotConnected) |
| 31 | } else if status == GattCommunicationStatus::Success { |
| 32 | Ok(()) |
| 33 | } else if status == GattCommunicationStatus::ProtocolError { |
| 34 | Err(Error::NotSupported("ProtocolError".to_string())) |
| 35 | } else { |
| 36 | Err(Error::Other("Communication Error:".to_string().into())) |
| 37 | } |
| 38 | } |
| 39 | |
| 40 | pub fn to_descriptor_value( |
| 41 | properties: GattCharacteristicProperties, |