Quantcast
Channel: Recent Threads — Xamarin Community Forums
Viewing all articles
Browse latest Browse all 204402

Not able to send data over BLE

$
0
0

Hello
I am using the plugin bluetoothle from Allan Ritchie.
At first I search for my BLE-Device, connect to them, check my services and characteristics.
But when I try to send some data, my BLE-Device got nothing.

Here ist my code:
`
public static void WriteDataToBle(IGattCharacteristic c, byte[] value)
{

        System.Diagnostics.Debug.WriteLine($"**** Writing to Ble: {value[0]:X}{value[1]:X}");
        if (c.CanWriteWithoutResponse())
        {
            System.Diagnostics.Debug.WriteLine("**** Writing to Ble CanWriteWithoutResponse");
            c.WriteWithoutResponse(value);
        }
        else
        {
            if (c.CanWriteWithResponse())
            {
                System.Diagnostics.Debug.WriteLine("**** Writing to Ble CanWriteWithResponse");
                c.Write(value);
            }
            else
            {
                if (c.CanWrite())
                {
                    System.Diagnostics.Debug.WriteLine("**** Writing to Ble CanWrite");
                    c.Write(value);
                }
                else
                {
                    System.Diagnostics.Debug.WriteLine("**** Writing to Ble ????");
                }
            }
        }
    }

}

}

other function:
byte[] data = new byte[2];
data[0] = Convert.ToByte(0x62);
data[1] = Convert.ToByte(0x42);
WriteDataToBle(Helper.TheCharacteristicReceived, data);
`
Do you have any Idea what is missing??


Viewing all articles
Browse latest Browse all 204402

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>