title: How to send array via Bluetooth Low Energy in Windows Desktop APP?
body: <p>I'm having enormous trouble communicating with my arduino over BLE in my Windows desktop application. I did understand that i have to enable WinRT API in my application to access GATT and to use win 8.1 etc. (I followed this tutorial <a href="https://software.intel.com/en-us/articles/using-winrt-apis-from-desktop-applications" rel="nofollow">https://software.intel.com/en-us/articles/using-winrt-apis-from-desktop-applications</a>). I don't understand how to communicate with my device from this point. </p>
  
  <p>So i have this values for the device (adafruit nrf8001):</p>
  
  <p>UART Service UUID: 6E400001-B5A3-F393-E0A9-E50E24DCCA9E
  TX Characteristic UUID: 6E400002-B5A3-F393-E0A9-E50E24DCCA9E
  RX Characteristic UUID: 6E400003-B5A3-F393-E0A9-E50E24DCCA9E</p>
  
  <p>how do i send a simple array - or easier a simple ASCII value to the device? On iOS and android i find plenty of examples, but not for a windows desktop app ...</p>
  
  <p>would be super happy if someone can help!</p>
  
  <p>phil
  edit: i thought this should do the job... but the app crashes on the last point:</p>
  
  <pre><code>using System;
  using System.Collections.Generic;
  using System.ComponentModel;
  using System.Data;
  using System.Drawing;
  using System.Linq;
  using System.Text;
  using System.Windows.Forms;
  using Windows.Devices.Bluetooth.GenericAttributeProfile;
  using Windows.Devices.Enumeration;
  using Windows.UI.Xaml;
  
  namespace LucidMobileCCproto
  {
      public partial class LucidMIControlPanel : Form
      {
  
          GattDeviceService service2 = null;
  
  
          private async void Discover_Click(object sender, EventArgs e)
          {
              var Services = await Windows.Devices.Enumeration.DeviceInformation.FindAllAsync(GattDeviceService.GetDeviceSelectorFromUuid(new Guid("6E400001-B5A3-F393-E0A9-E50E24DCCA9E")), null);
              GattDeviceService Service = await GattDeviceService.FromIdAsync(Services[0].Id);
  
              //Check Service Name
              textBox1.Text = "Using service: " + Services[0].Name;
  
              GattReliableWriteTransaction gattTransaction = new GattReliableWriteTransaction(); //Orientation on MSDN Article
  
              GattCharacteristic gattCharacteristic = Service.GetCharacteristics(new Guid("6E400002-B5A3-F393-E0A9-E50E24DCCA9E"))[0];
  
              //Check Characteristic 
              textBox2.Text = Convert.ToString(gattCharacteristic.CharacteristicProperties);
  
              //initialize Buffer
              var writer = new Windows.Storage.Streams.DataWriter();
              writer.WriteByte(2);
              gattTransaction.WriteValue(gattCharacteristic, writer.DetachBuffer());
  
  
              //Programm Crashes here
              GattCommunicationStatus status = await gattTransaction.CommitAsync();
          }
      }
  </code></pre>
  
  <p>The crash: Exception:Thrown: "The attribute cannot be written. (Exception from HRESULT: 0x80650003)" (System.Exception)
  A System.Exception was thrown: "The attribute cannot be written. (Exception from HRESULT: 0x80650003)"</p>