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)

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


Attachments

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.

Note You need to log in before you can comment on or make changes to this bug.