Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

iOS binding from Xamarin, incomplete iOSMcuManagerLibrary.framework headers #215

Open
lele4warp opened this issue Jun 11, 2024 · 2 comments

Comments

@lele4warp
Copy link

I'm trying to import the native libraries to Xamarin forms, I need for the FirmwareUpgrade section of the iOSMcuManagerLibrary.
I compile the example project correctly and I can access to the iOSMcuManagerLibrary.framework, but seems that the .h is incomplete, infact starting the sharpie process the API definition.cs doesn't contains the fw update functions.
Can you please check that the .h contains all the needed interfaces? If not the binding process cannot generate the fw update functions that I need

@boris-sclauzero-zupit
Copy link

I am working with @lele4warp
This is the file generated by sharpie command line tool.
I can find only the definition for the object: McuMgrBleTransport
We suppose there is something missing in the file iOSMcuManagerLibrary-Swift.h

using CoreBluetooth;
using Foundation;

namespace iOSMcuManagerLibrary
{
	// @interface McuMgrBleTransport : NSObject
	[BaseType (typeof(NSObject), Name = "_TtC20iOSMcuManagerLibrary18McuMgrBleTransport")]
	[DisableDefaultCtor]
	interface McuMgrBleTransport
	{
	}

	// @interface iOSMcuManagerLibrary_Swift_313 (McuMgrBleTransport) <CBPeripheralDelegate>
	[Category]
	[BaseType (typeof(McuMgrBleTransport))]
	interface McuMgrBleTransport_iOSMcuManagerLibrary_Swift_313 : ICBPeripheralDelegate
	{
		// -(void)peripheral:(CBPeripheral * _Nonnull)peripheral didDiscoverServices:(NSError * _Nullable)error;
		[Export ("peripheral:didDiscoverServices:")]
		void Peripheral (CBPeripheral peripheral, [NullAllowed] NSError error);

		// -(void)peripheral:(CBPeripheral * _Nonnull)peripheral didDiscoverCharacteristicsForService:(CBService * _Nonnull)service error:(NSError * _Nullable)error;
		[Export ("peripheral:didDiscoverCharacteristicsForService:error:")]
		void Peripheral (CBPeripheral peripheral, CBService service, [NullAllowed] NSError error);

		// -(void)peripheral:(CBPeripheral * _Nonnull)peripheral didUpdateNotificationStateForCharacteristic:(CBCharacteristic * _Nonnull)characteristic error:(NSError * _Nullable)error;
		[Export ("peripheral:didUpdateNotificationStateForCharacteristic:error:")]
		void Peripheral (CBPeripheral peripheral, CBCharacteristic characteristic, [NullAllowed] NSError error);

		// -(void)peripheral:(CBPeripheral * _Nonnull)peripheral didUpdateValueForCharacteristic:(CBCharacteristic * _Nonnull)characteristic error:(NSError * _Nullable)error;
		[Export ("peripheral:didUpdateValueForCharacteristic:error:")]
		void Peripheral (CBPeripheral peripheral, CBCharacteristic characteristic, [NullAllowed] NSError error);
	}

	// @interface iOSMcuManagerLibrary_Swift_322 (McuMgrBleTransport) <CBCentralManagerDelegate>
	[Category]
	[BaseType (typeof(McuMgrBleTransport))]
	interface McuMgrBleTransport_iOSMcuManagerLibrary_Swift_322 : ICBCentralManagerDelegate
	{
		// -(void)centralManagerDidUpdateState:(CBCentralManager * _Nonnull)central;
		[Export ("centralManagerDidUpdateState:")]
		void CentralManagerDidUpdateState (CBCentralManager central);

		// -(void)centralManager:(CBCentralManager * _Nonnull)central didConnectPeripheral:(CBPeripheral * _Nonnull)peripheral;
		[Export ("centralManager:didConnectPeripheral:")]
		void CentralManager (CBCentralManager central, CBPeripheral peripheral);

		// -(void)centralManager:(CBCentralManager * _Nonnull)central didDisconnectPeripheral:(CBPeripheral * _Nonnull)peripheral error:(NSError * _Nullable)error;
		[Export ("centralManager:didDisconnectPeripheral:error:")]
		void CentralManager (CBCentralManager central, CBPeripheral peripheral, [NullAllowed] NSError error);

		// -(void)centralManager:(CBCentralManager * _Nonnull)central didFailToConnectPeripheral:(CBPeripheral * _Nonnull)peripheral error:(NSError * _Nullable)error;
		[Export ("centralManager:didFailToConnectPeripheral:error:")]
		void CentralManager (CBCentralManager central, CBPeripheral peripheral, [NullAllowed] NSError error);
	}

	[Static]
	[Verify (ConstantsInterfaceAssociation)]
	partial interface Constants
	{
		// extern double iOSMcuManagerLibraryVersionNumber;
		[Field ("iOSMcuManagerLibraryVersionNumber", "__Internal")]
		double iOSMcuManagerLibraryVersionNumber { get; }

		// extern const unsigned char[] iOSMcuManagerLibraryVersionString;
		[Field ("iOSMcuManagerLibraryVersionString", "__Internal")]
		byte[] iOSMcuManagerLibraryVersionString { get; }
	}
}

@philips77
Copy link
Member

Try cloning the repo and modify the classes you need, for example McuManager with NSObject, like the McuMgrBleTransport has.

open class McuManager : NSObject {
   // [...]
}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants