internal delegate void BtGattServerWriteValueRequestedCallback(string clientAddress, int requestId, IntPtr serverHandle, IntPtr gattHandle, int offset, bool response_needed, byte[] value, int len, IntPtr userData);
[UnmanagedFunctionPointerAttribute(CallingConvention.Cdecl)]
- internal delegate void BtClientCharacteristicValueChangedCallback(IntPtr characteristicHandle, byte[] value, int len, IntPtr userData);
+ internal delegate void BtClientCharacteristicValueChangedCallback(IntPtr characteristicHandle, IntPtr value, int len, IntPtr userData);
[UnmanagedFunctionPointerAttribute(CallingConvention.Cdecl)]
internal delegate void BtGattServerNotificationStateChangeCallback(bool notify, IntPtr serverHandle, IntPtr characteristicHandle, IntPtr userData);
/// <since_tizen> 3 </since_tizen>
public class ValueChangedEventArgs : EventArgs
{
- internal ValueChangedEventArgs(byte[] value)
+ internal ValueChangedEventArgs(IntPtr value, int len)
{
- Value = value;
+ Value = new byte[len];
+ unsafe
+ {
+ for (int i = 0; i < len; i++)
+ {
+ Value[i] = *((byte*)value.ToPointer() + i);
+ }
+ }
}
/// <summary>
{
_characteristicValueChangedCallback = (gattHandle, characteristicValue, len, userData) =>
{
- _characteristicValueChanged?.Invoke(this, new ValueChangedEventArgs(characteristicValue));
+ _characteristicValueChanged?.Invoke(this, new ValueChangedEventArgs(characteristicValue, len));
};
_impl.SetCharacteristicValueChangedEvent(_characteristicValueChangedCallback);