Bug 55473 - Incorrect generated enum for OnServiceAdded in BluetoothGattServerCallback
Summary: Incorrect generated enum for OnServiceAdded in BluetoothGattServerCallback
Status: VERIFIED FIXED
Alias: None
Product: Android
Classification: Xamarin
Component: Android+BCL Integration (show other bugs)
Version: unspecified
Hardware: PC Windows
: --- normal
Target Milestone: 15.4
Assignee: Atsushi Eno
URL:
Depends on:
Blocks:
 
Reported: 2017-04-21 18:10 UTC by Kyle
Modified: 2017-10-05 18:24 UTC (History)
2 users (show)

Tags:
Is this bug a regression?: ---
Last known good build:

Notice (2018-05-24): bugzilla.xamarin.com is now in read-only mode.

Please join us on Visual Studio Developer Community and in the Xamarin and Mono organizations on GitHub to continue tracking issues. Bugzilla will remain available for reference in read-only mode. We will continue to work on open Bugzilla bugs, copy them to the new locations as needed for follow-up, and add the new items under Related Links.

Our sincere thanks to everyone who has contributed on this bug tracker over the years. Thanks also for your understanding as we make these adjustments and improvements for the future.


Please create a new report on Developer Community or GitHub with your current version information, steps to reproduce, and relevant error messages or log files if you are hitting an issue that looks similar to this resolved bug and you do not yet see a matching new report.

Related Links:
Status:
VERIFIED FIXED

Description Kyle 2017-04-21 18:10:28 UTC
The generated enum for the function OnServiceAdded is incorrect. The enum being generated is ProfileState, but it should actually be GattStatus.

According to the android documentation:
status 	int: Returns GATT_SUCCESS if the service was added successfully.

Source: https://developer.android.com/reference/android/bluetooth/BluetoothGattServerCallback.html#onServiceAdded(int,%20android.bluetooth.BluetoothGattService)

Xamarin documentation:
status   Returns BluetoothGatt.GattSuccess if the service was added successfully.

Source:
https://developer.xamarin.com/api/member/Android.Bluetooth.BluetoothGattServerCallback.OnServiceAdded/p/Android.Bluetooth.ProfileState/Android.Bluetooth.BluetoothGattService/

I am running the most up to date install of Visual Studio 2017 15.1 (26403.7)
Comment 1 Atsushi Eno 2017-06-19 17:39:56 UTC
You're right,this should be changed to return GattStatus.
Comment 2 Peter Collins 2017-10-05 18:05:23 UTC
The first parameter in the signature of BluetoothGatServerCallback.OnServiceAdded has been changed from ProfileState to GattStatus:

D15-3:
> [Register ("onServiceAdded", "(ILandroid/bluetooth/BluetoothGattService;)V", "GetOnServiceAdded_ILandroid_bluetooth_BluetoothGattService_Handler")]
> public unsafe virtual void OnServiceAdded ([GeneratedEnum] ProfileState status, BluetoothGattService service)
>{
>	JniArgumentValue* ptr = stackalloc JniArgumentValue[2];
>	*ptr = new JniArgumentValue ((int)status);
>	ptr [1] = new JniArgumentValue ((service == null) ? IntPtr.Zero : service.Handle);
>	BluetoothGattServerCallback._members.InstanceMethods.InvokeVirtualVoidMethod ("onServiceAdded.(ILandroid/bluetooth/BluetoothGattService;)V", this, ptr);
>}

D15-4:
> Register ("onServiceAdded", "(ILandroid/bluetooth/BluetoothGattService;)V", "GetOnServiceAdded_ILandroid_bluetooth_BluetoothGattService_Handler")]
>public unsafe virtual void OnServiceAdded ([GeneratedEnum] GattStatus status, BluetoothGattService service)
>{
>	JniArgumentValue* ptr = stackalloc JniArgumentValue[2];
>	*ptr = new JniArgumentValue ((int)status);
>	ptr [1] = new JniArgumentValue ((service == null) ? IntPtr.Zero : service.Handle);
>       BluetoothGattServerCallback._members.InstanceMethods.InvokeVirtualVoidMethod ("onServiceAdded.(ILandroid/bluetooth/BluetoothGattService;)V", this, ptr);
>}
Comment 3 Peter Collins 2017-10-05 18:24:29 UTC
Confirmed against XA 8.0.0.33.