diff --git a/Assets/CoreBluetooth/Samples/12_Debug/SampleDebug_Central.cs b/Assets/CoreBluetooth/Samples/12_Debug/SampleDebug_Central.cs index b62a7b1..0dbfa60 100644 --- a/Assets/CoreBluetooth/Samples/12_Debug/SampleDebug_Central.cs +++ b/Assets/CoreBluetooth/Samples/12_Debug/SampleDebug_Central.cs @@ -140,6 +140,16 @@ public void DidUpdateNotificationStateForCharacteristic(CBPeripheral peripheral, } } + public void DidReadRSSI(CBPeripheral peripheral, int rssi, CBError error) + { + Debug.Log($"[DidReadRSSI] rssi: {rssi}"); + if (error != null) + { + Debug.LogError($"[DidReadRSSI] error: {error}"); + return; + } + } + public void OnClickWrite() { if (_peripheral == null) @@ -181,6 +191,17 @@ public void OnClickRead() _peripheral.ReadValue(_remoteCharacteristic); } + public void OnClickReadRSSI() + { + if (_peripheral == null) + { + Debug.Log("peripheral is null."); + return; + } + + _peripheral.ReadRSSI(); + } + void OnDestroy() { if (_centralManager != null) diff --git a/Assets/CoreBluetooth/Samples/12_Debug/SampleDebug_CentralScene.unity b/Assets/CoreBluetooth/Samples/12_Debug/SampleDebug_CentralScene.unity index 3158e06..3e94540 100644 --- a/Assets/CoreBluetooth/Samples/12_Debug/SampleDebug_CentralScene.unity +++ b/Assets/CoreBluetooth/Samples/12_Debug/SampleDebug_CentralScene.unity @@ -324,6 +324,139 @@ CanvasRenderer: m_PrefabAsset: {fileID: 0} m_GameObject: {fileID: 167323285} m_CullTransparentMesh: 1 +--- !u!1 &185931679 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 185931680} + - component: {fileID: 185931683} + - component: {fileID: 185931682} + - component: {fileID: 185931681} + m_Layer: 5 + m_Name: ReadRSSIButton + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!224 &185931680 +RectTransform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 185931679} + m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} + m_LocalPosition: {x: 0, y: 0, z: 0} + m_LocalScale: {x: 1, y: 1, z: 1} + m_ConstrainProportionsScale: 0 + m_Children: + - {fileID: 1469846735} + m_Father: {fileID: 994619686} + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} + m_AnchorMin: {x: 0.5, y: 0.5} + m_AnchorMax: {x: 0.5, y: 0.5} + m_AnchoredPosition: {x: 363, y: -99.8} + m_SizeDelta: {x: 320, y: 60} + m_Pivot: {x: 0.5, y: 0.5} +--- !u!114 &185931681 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 185931679} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: 4e29b1a8efbd4b44bb3f3716e73f07ff, type: 3} + m_Name: + m_EditorClassIdentifier: + m_Navigation: + m_Mode: 3 + m_WrapAround: 0 + m_SelectOnUp: {fileID: 0} + m_SelectOnDown: {fileID: 0} + m_SelectOnLeft: {fileID: 0} + m_SelectOnRight: {fileID: 0} + m_Transition: 1 + m_Colors: + m_NormalColor: {r: 1, g: 1, b: 1, a: 1} + m_HighlightedColor: {r: 0.9607843, g: 0.9607843, b: 0.9607843, a: 1} + m_PressedColor: {r: 0.78431374, g: 0.78431374, b: 0.78431374, a: 1} + m_SelectedColor: {r: 0.9607843, g: 0.9607843, b: 0.9607843, a: 1} + m_DisabledColor: {r: 0.78431374, g: 0.78431374, b: 0.78431374, a: 0.5019608} + m_ColorMultiplier: 1 + m_FadeDuration: 0.1 + m_SpriteState: + m_HighlightedSprite: {fileID: 0} + m_PressedSprite: {fileID: 0} + m_SelectedSprite: {fileID: 0} + m_DisabledSprite: {fileID: 0} + m_AnimationTriggers: + m_NormalTrigger: Normal + m_HighlightedTrigger: Highlighted + m_PressedTrigger: Pressed + m_SelectedTrigger: Selected + m_DisabledTrigger: Disabled + m_Interactable: 1 + m_TargetGraphic: {fileID: 185931682} + m_OnClick: + m_PersistentCalls: + m_Calls: + - m_Target: {fileID: 1378470629} + m_TargetAssemblyTypeName: CoreBluetoothSample.SampleDebug_Central, Assembly-CSharp + m_MethodName: OnClickReadRSSI + m_Mode: 1 + m_Arguments: + m_ObjectArgument: {fileID: 0} + m_ObjectArgumentAssemblyTypeName: UnityEngine.Object, UnityEngine + m_IntArgument: 0 + m_FloatArgument: 0 + m_StringArgument: + m_BoolArgument: 0 + m_CallState: 2 +--- !u!114 &185931682 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 185931679} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: fe87c0e1cc204ed48ad3b37840f39efc, type: 3} + m_Name: + m_EditorClassIdentifier: + m_Material: {fileID: 0} + m_Color: {r: 1, g: 1, b: 1, a: 1} + m_RaycastTarget: 1 + m_RaycastPadding: {x: 0, y: 0, z: 0, w: 0} + m_Maskable: 1 + m_OnCullStateChanged: + m_PersistentCalls: + m_Calls: [] + m_Sprite: {fileID: 10905, guid: 0000000000000000f000000000000000, type: 0} + m_Type: 1 + m_PreserveAspect: 0 + m_FillCenter: 1 + m_FillMethod: 4 + m_FillAmount: 1 + m_FillClockwise: 1 + m_FillOrigin: 0 + m_UseSpriteMesh: 0 + m_PixelsPerUnitMultiplier: 1 +--- !u!222 &185931683 +CanvasRenderer: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 185931679} + m_CullTransparentMesh: 1 --- !u!1 &268526162 GameObject: m_ObjectHideFlags: 0 @@ -843,6 +976,7 @@ RectTransform: m_Children: - {fileID: 1464279507} - {fileID: 2085064255} + - {fileID: 185931680} - {fileID: 1878487716} m_Father: {fileID: 0} m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} @@ -1028,6 +1162,85 @@ CanvasRenderer: m_PrefabAsset: {fileID: 0} m_GameObject: {fileID: 1464279506} m_CullTransparentMesh: 1 +--- !u!1 &1469846734 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 1469846735} + - component: {fileID: 1469846737} + - component: {fileID: 1469846736} + m_Layer: 5 + m_Name: Text (Legacy) + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!224 &1469846735 +RectTransform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1469846734} + m_LocalRotation: {x: -0, y: -0, z: -0, w: 1} + m_LocalPosition: {x: 0, y: 0, z: 0} + m_LocalScale: {x: 1, y: 1, z: 1} + m_ConstrainProportionsScale: 0 + m_Children: [] + m_Father: {fileID: 185931680} + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} + m_AnchorMin: {x: 0, y: 0} + m_AnchorMax: {x: 1, y: 1} + m_AnchoredPosition: {x: 0, y: 0} + m_SizeDelta: {x: 0, y: 0} + m_Pivot: {x: 0.5, y: 0.5} +--- !u!114 &1469846736 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1469846734} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: 5f7201a12d95ffc409449d95f23cf332, type: 3} + m_Name: + m_EditorClassIdentifier: + m_Material: {fileID: 0} + m_Color: {r: 0.19607843, g: 0.19607843, b: 0.19607843, a: 1} + m_RaycastTarget: 1 + m_RaycastPadding: {x: 0, y: 0, z: 0, w: 0} + m_Maskable: 1 + m_OnCullStateChanged: + m_PersistentCalls: + m_Calls: [] + m_FontData: + m_Font: {fileID: 10102, guid: 0000000000000000e000000000000000, type: 0} + m_FontSize: 31 + m_FontStyle: 0 + m_BestFit: 0 + m_MinSize: 10 + m_MaxSize: 40 + m_Alignment: 4 + m_AlignByGeometry: 0 + m_RichText: 1 + m_HorizontalOverflow: 0 + m_VerticalOverflow: 0 + m_LineSpacing: 1 + m_Text: Read RSSI +--- !u!222 &1469846737 +CanvasRenderer: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1469846734} + m_CullTransparentMesh: 1 --- !u!1 &1878487715 GameObject: m_ObjectHideFlags: 0 diff --git a/Packages/com.teach310.core-bluetooth-for-unity/Plugins/iOS/CoreBluetoothForUnity.framework/CoreBluetoothForUnity b/Packages/com.teach310.core-bluetooth-for-unity/Plugins/iOS/CoreBluetoothForUnity.framework/CoreBluetoothForUnity index 175ca79..1efbd65 100755 Binary files a/Packages/com.teach310.core-bluetooth-for-unity/Plugins/iOS/CoreBluetoothForUnity.framework/CoreBluetoothForUnity and b/Packages/com.teach310.core-bluetooth-for-unity/Plugins/iOS/CoreBluetoothForUnity.framework/CoreBluetoothForUnity differ diff --git a/Packages/com.teach310.core-bluetooth-for-unity/Plugins/macOS/libCoreBluetoothForUnity.dylib b/Packages/com.teach310.core-bluetooth-for-unity/Plugins/macOS/libCoreBluetoothForUnity.dylib index 9a8160f..a14f60c 100755 Binary files a/Packages/com.teach310.core-bluetooth-for-unity/Plugins/macOS/libCoreBluetoothForUnity.dylib and b/Packages/com.teach310.core-bluetooth-for-unity/Plugins/macOS/libCoreBluetoothForUnity.dylib differ diff --git a/Packages/com.teach310.core-bluetooth-for-unity/Runtime/CBPeripheral.cs b/Packages/com.teach310.core-bluetooth-for-unity/Runtime/CBPeripheral.cs index b523257..41998d7 100644 --- a/Packages/com.teach310.core-bluetooth-for-unity/Runtime/CBPeripheral.cs +++ b/Packages/com.teach310.core-bluetooth-for-unity/Runtime/CBPeripheral.cs @@ -21,6 +21,7 @@ void DidUpdateValueForCharacteristic(CBPeripheral peripheral, CBCharacteristic c void DidWriteValueForCharacteristic(CBPeripheral peripheral, CBCharacteristic characteristic, CBError error) { } void IsReadyToSendWriteWithoutResponse(CBPeripheral peripheral) { } void DidUpdateNotificationStateForCharacteristic(CBPeripheral peripheral, CBCharacteristic characteristic, CBError error) { } + void DidReadRSSI(CBPeripheral peripheral, int rssi, CBError error) { } } /// @@ -152,6 +153,15 @@ public bool CanSendWriteWithoutResponse } } + /// + /// Retrieves the current RSSI value for the peripheral while connected to the central manager. + /// + public void ReadRSSI() + { + ExceptionUtils.ThrowObjectDisposedExceptionIf(_disposed, this); + _nativePeripheral.ReadRSSI(); + } + internal CBCharacteristic FindCharacteristic(string serviceUUID, string characteristicUUID) { if (string.IsNullOrEmpty(serviceUUID)) @@ -231,6 +241,12 @@ void INativePeripheralDelegate.DidUpdateNotificationStateForCharacteristic(strin Delegate?.DidUpdateNotificationStateForCharacteristic(this, characteristic, error); } + void INativePeripheralDelegate.DidReadRSSI(int rssi, CBError error) + { + if (_disposed) return; + Delegate?.DidReadRSSI(this, rssi, error); + } + public override string ToString() { return $"CBPeripheral: identifier = {Identifier}, name = {Name}, state = {State}"; diff --git a/Packages/com.teach310.core-bluetooth-for-unity/Runtime/NativeMethods.cs b/Packages/com.teach310.core-bluetooth-for-unity/Runtime/NativeMethods.cs index a651482..3b9e215 100644 --- a/Packages/com.teach310.core-bluetooth-for-unity/Runtime/NativeMethods.cs +++ b/Packages/com.teach310.core-bluetooth-for-unity/Runtime/NativeMethods.cs @@ -76,6 +76,7 @@ int serviceUUIDsCount internal delegate void CB4UPeripheralDidWriteValueForCharacteristicHandler(IntPtr peripheralPtr, IntPtr serviceUUIDPtr, IntPtr characteristicUUIDPtr, int errorCode); internal delegate void CB4UPeripheralIsReadyToSendWriteWithoutResponseHandler(IntPtr peripheralPtr); internal delegate void CB4UPeripheralDidUpdateNotificationStateForCharacteristicHandler(IntPtr peripheralPtr, IntPtr serviceUUIDPtr, IntPtr characteristicUUIDPtr, int notificationState, int errorCode); + internal delegate void CB4UPeripheralDidReadRSSIHandler(IntPtr peripheralPtr, int rssi, int errorCode); [DllImport(DLL_NAME, CallingConvention = CallingConvention.Cdecl)] internal static extern void cb4u_peripheral_register_handlers( @@ -85,7 +86,8 @@ internal static extern void cb4u_peripheral_register_handlers( CB4UPeripheralDidUpdateValueForCharacteristicHandler didUpdateValueForCharacteristicHandler, CB4UPeripheralDidWriteValueForCharacteristicHandler didWriteValueForCharacteristicHandler, CB4UPeripheralIsReadyToSendWriteWithoutResponseHandler isReadyToSendWriteWithoutResponseHandler, - CB4UPeripheralDidUpdateNotificationStateForCharacteristicHandler didUpdateNotificationStateForCharacteristicHandler + CB4UPeripheralDidUpdateNotificationStateForCharacteristicHandler didUpdateNotificationStateForCharacteristicHandler, + CB4UPeripheralDidReadRSSIHandler didReadRSSIHandler ); [DllImport(DLL_NAME, CallingConvention = CallingConvention.Cdecl)] @@ -152,6 +154,9 @@ internal static extern int cb4u_peripheral_set_notify_value( [return: MarshalAs(UnmanagedType.I1)] internal static extern bool cb4u_peripheral_can_send_write_without_response(SafeNativePeripheralHandle handle); + [DllImport(DLL_NAME, CallingConvention = CallingConvention.Cdecl)] + internal static extern void cb4u_peripheral_read_rssi(SafeNativePeripheralHandle handle); + [DllImport(DLL_NAME, CallingConvention = CallingConvention.Cdecl)] internal static extern int cb4u_peripheral_characteristic_properties( SafeNativePeripheralHandle handle, diff --git a/Packages/com.teach310.core-bluetooth-for-unity/Runtime/NativePeripheralProxy.cs b/Packages/com.teach310.core-bluetooth-for-unity/Runtime/NativePeripheralProxy.cs index 17ae967..8a19f29 100644 --- a/Packages/com.teach310.core-bluetooth-for-unity/Runtime/NativePeripheralProxy.cs +++ b/Packages/com.teach310.core-bluetooth-for-unity/Runtime/NativePeripheralProxy.cs @@ -140,5 +140,10 @@ internal bool CanSendWriteWithoutResponse return NativeMethods.cb4u_peripheral_can_send_write_without_response(_handle); } } + + internal void ReadRSSI() + { + NativeMethods.cb4u_peripheral_read_rssi(_handle); + } } } diff --git a/Packages/com.teach310.core-bluetooth-for-unity/Runtime/SafeNativePeripheralHandle.cs b/Packages/com.teach310.core-bluetooth-for-unity/Runtime/SafeNativePeripheralHandle.cs index 9b6cffb..ba6cc96 100644 --- a/Packages/com.teach310.core-bluetooth-for-unity/Runtime/SafeNativePeripheralHandle.cs +++ b/Packages/com.teach310.core-bluetooth-for-unity/Runtime/SafeNativePeripheralHandle.cs @@ -12,6 +12,7 @@ void DidUpdateValueForCharacteristic(string serviceUUID, string characteristicUU void DidWriteValueForCharacteristic(string serviceUUID, string characteristicUUID, CBError error) { } void IsReadyToSendWriteWithoutResponse() { } void DidUpdateNotificationStateForCharacteristic(string serviceUUID, string characteristicUUID, bool enabled, CBError error) { } + void DidReadRSSI(int rssi, CBError error) { } } internal class SafeNativePeripheralHandle : SafeHandle @@ -34,7 +35,8 @@ void RegisterHandlers() DidUpdateValueForCharacteristic, DidWriteValueForCharacteristic, IsReadyToSendWriteWithoutResponse, - DidUpdateNotificationStateForCharacteristic + DidUpdateNotificationStateForCharacteristic, + DidReadRSSI ); } @@ -130,5 +132,14 @@ internal static void DidUpdateNotificationStateForCharacteristic(IntPtr peripher CBError.CreateOrNullFromCode(errorCode) ); } + + [AOT.MonoPInvokeCallback(typeof(NativeMethods.CB4UPeripheralDidReadRSSIHandler))] + internal static void DidReadRSSI(IntPtr peripheralPtr, int rssi, int errorCode) + { + GetDelegate(peripheralPtr)?.DidReadRSSI( + rssi, + CBError.CreateOrNullFromCode(errorCode) + ); + } } } diff --git a/Plugins/CoreBluetoothForUnity/Sources/CoreBluetoothForUnity/CB4UPeripheral.swift b/Plugins/CoreBluetoothForUnity/Sources/CoreBluetoothForUnity/CB4UPeripheral.swift index aceb531..37788f6 100644 --- a/Plugins/CoreBluetoothForUnity/Sources/CoreBluetoothForUnity/CB4UPeripheral.swift +++ b/Plugins/CoreBluetoothForUnity/Sources/CoreBluetoothForUnity/CB4UPeripheral.swift @@ -9,6 +9,7 @@ public class CB4UPeripheral : NSObject { public var didWriteValueForCharacteristicHandler: CB4UPeripheralDidWriteValueForCharacteristicHandler? public var isReadyToSendWriteWithoutResponseHandler: CB4UPeripheralIsReadyToSendWriteWithoutResponseHandler? public var didUpdateNotificationStateForCharacteristicHandler: CB4UPeripheralDidUpdateNotificationStateForCharacteristicHandler? + public var didReadRSSIHandler: CB4UPeripheralDidReadRSSIHandler? let success: Int32 = 0 let serviceNotFound: Int32 = -2 @@ -98,6 +99,10 @@ public class CB4UPeripheral : NSObject { public var canSendWriteWithoutResponse: Bool { return peripheral.canSendWriteWithoutResponse } + + public func readRSSI() { + peripheral.readRSSI() + } } extension CB4UPeripheral : CBPeripheralDelegate { @@ -164,4 +169,8 @@ extension CB4UPeripheral : CBPeripheralDelegate { } } } + + public func peripheral(_ peripheral: CBPeripheral, didReadRSSI RSSI: NSNumber, error: Error?) { + didReadRSSIHandler?(selfPointer(), Int32(RSSI.intValue), errorToCode(error)) + } } diff --git a/Plugins/CoreBluetoothForUnity/Sources/CoreBluetoothForUnity/CoreBluetoothForUnity.swift b/Plugins/CoreBluetoothForUnity/Sources/CoreBluetoothForUnity/CoreBluetoothForUnity.swift index 54e3f88..3acd57a 100644 --- a/Plugins/CoreBluetoothForUnity/Sources/CoreBluetoothForUnity/CoreBluetoothForUnity.swift +++ b/Plugins/CoreBluetoothForUnity/Sources/CoreBluetoothForUnity/CoreBluetoothForUnity.swift @@ -118,6 +118,7 @@ public typealias CB4UPeripheralDidUpdateValueForCharacteristicHandler = @convent public typealias CB4UPeripheralDidWriteValueForCharacteristicHandler = @convention(c) (UnsafeRawPointer, UnsafePointer, UnsafePointer, Int32) -> Void public typealias CB4UPeripheralIsReadyToSendWriteWithoutResponseHandler = @convention(c) (UnsafeRawPointer) -> Void public typealias CB4UPeripheralDidUpdateNotificationStateForCharacteristicHandler = @convention(c) (UnsafeRawPointer, UnsafePointer, UnsafePointer, Int32, Int32) -> Void +public typealias CB4UPeripheralDidReadRSSIHandler = @convention(c) (UnsafeRawPointer, Int32, Int32) -> Void @_cdecl("cb4u_peripheral_register_handlers") public func cb4u_peripheral_register_handlers( @@ -127,7 +128,8 @@ public func cb4u_peripheral_register_handlers( _ didUpdateValueForCharacteristicHandler: @escaping CB4UPeripheralDidUpdateValueForCharacteristicHandler, _ didWriteValueForCharacteristicHandler: @escaping CB4UPeripheralDidWriteValueForCharacteristicHandler, _ isReadyToSendWriteWithoutResponseHandler: @escaping CB4UPeripheralIsReadyToSendWriteWithoutResponseHandler, - _ didUpdateNotificationStateForCharacteristicHandler: @escaping CB4UPeripheralDidUpdateNotificationStateForCharacteristicHandler + _ didUpdateNotificationStateForCharacteristicHandler: @escaping CB4UPeripheralDidUpdateNotificationStateForCharacteristicHandler, + _ didReadRSSIHandler: @escaping CB4UPeripheralDidReadRSSIHandler ) { let instance = Unmanaged.fromOpaque(peripheralPtr).takeUnretainedValue() @@ -137,6 +139,7 @@ public func cb4u_peripheral_register_handlers( instance.didWriteValueForCharacteristicHandler = didWriteValueForCharacteristicHandler instance.isReadyToSendWriteWithoutResponseHandler = isReadyToSendWriteWithoutResponseHandler instance.didUpdateNotificationStateForCharacteristicHandler = didUpdateNotificationStateForCharacteristicHandler + instance.didReadRSSIHandler = didReadRSSIHandler } @_cdecl("cb4u_peripheral_identifier") @@ -268,6 +271,13 @@ public func cb4u_peripheral_can_send_write_without_response(_ peripheralPtr: Uns return instance.canSendWriteWithoutResponse } +@_cdecl("cb4u_peripheral_read_rssi") +public func cb4u_peripheral_read_rssi(_ peripheralPtr: UnsafeRawPointer) { + let instance = Unmanaged.fromOpaque(peripheralPtr).takeUnretainedValue() + + instance.readRSSI() +} + @_cdecl("cb4u_peripheral_characteristic_properties") public func cb4u_peripheral_characteristic_properties( _ peripheralPtr: UnsafeRawPointer,