internal delegate void BtGattServerReadValueRequestedCallback(string clientAddress, int requestId, IntPtr serverHandle, IntPtr gattHandle, int offset, IntPtr userData);
[UnmanagedFunctionPointerAttribute(CallingConvention.Cdecl)]
- internal delegate void BtGattServerWriteValueRequestedCallback(string clientAddress, int requestId, IntPtr serverHandle, IntPtr gattHandle, bool response_needed, int offset, byte[] value, int len, IntPtr userData);
+ internal delegate void BtGattServerWriteValueRequestedCallback(string clientAddress, int requestId, IntPtr serverHandle, IntPtr gattHandle, bool response_needed, int offset, IntPtr value, int len, IntPtr userData);
[UnmanagedFunctionPointerAttribute(CallingConvention.Cdecl)]
internal delegate void BtClientCharacteristicValueChangedCallback(IntPtr characteristicHandle, IntPtr value, int len, IntPtr userData);
/// <since_tizen> 3 </since_tizen>
public void SendNotification(BluetoothGattCharacteristic characteristic, string clientAddress)
{
- _impl.SendNotification(characteristic, clientAddress);
+ _ = _impl.SendIndicationAsync(this, characteristic, clientAddress);
}
/// <summary>
{
_writeValueRequestedCallback = (clientAddress, requestId, serverHandle, gattHandle, response_needed, offset, valueToWrite, len, userData) =>
{
- _writeValueRequested?.Invoke(this, new WriteRequestedEventArgs(Server, clientAddress, requestId, valueToWrite, offset, response_needed));
+ byte[] writeValue = new byte[len];
+ Marshal.Copy(valueToWrite, writeValue, 0, len);
+ _writeValueRequested?.Invoke(this, new WriteRequestedEventArgs(Server, clientAddress, requestId, writeValue, offset, response_needed));
};
Impl.SetWriteValueRequestedEventCallback(_writeValueRequestedCallback);
}
GattUtil.ThrowForError(err, string.Format("Failed to send response for request Id {0}", requestId));
}
- internal void SendNotification(BluetoothGattCharacteristic characteristic, string clientAddress)
- {
- int err = Interop.Bluetooth.BtGattServerNotify(characteristic.GetHandle(), null, clientAddress, IntPtr.Zero);
- GattUtil.ThrowForError(err, string.Format("Failed to send value changed notification for characteristic uuid {0}", characteristic.Uuid));
- }
-
void SendIndicationCallback(int result, string clientAddress, IntPtr serverHandle, IntPtr characteristicHandle, bool completed, IntPtr userData)
{
int requestId = (int)userData;