title: Data format for sending/receiving UART rx characteristic in distriqt Bluetooth LE ANE
body: <p>I'm connecting to an arduino via Adafruit's Bluefruit UART device, using distriqt's bluetooth ANE.</p>
  
  <p>I can connect, find the UART service, find the characteristics etc.</p>
  
  <p>However, when I send data to the device's tx characteristic, I don't get the expected responses - all updates give me zero length for the length of the rx characteristic's value.</p>
  
  <p>I have the Bluefruit app and can see the correct responses when I send the commands via the UART messaging tool in there. I only get a zero length response if I send it a nonsense command.</p>
  
  <p>This makes me wonder whether the data is being sent in the correct format. The AS3 code doing that is:</p>
  
  <pre><code>var value:ByteArray = new ByteArray();
  value.writeUTFBytes( msg );
  sendUpdateMsg("trying to write to tx - value: " + msg);
  
  var readSuccess:Boolean = _peripheral.readValueForCharacteristic(_rxChannel);
  sendUpdateMsg("trying to read from rx before tx - outcome: " + readSuccess);
  
  var success:Boolean = _peripheral.writeValueForCharacteristic( _txChannel, value );
  sendUpdateMsg("trying to write to tx - outcome: " + success);
  </code></pre>
  
  <p>The <code>sendUpdateMsg</code> function simply writes messages to a log on the screen. When the rx characteristic is updated, the event hander is:</p>
  
  <pre><code>private function peripheral_characteristic_updatedHandler( event:CharacteristicEvent ):void
  {
      sendUpdateMsg( "peripheral characteristic updated: " + event.characteristic.uuid );
      sendUpdateMsg( "length="+ event.characteristic.value.length.toString()  );
      sendUpdateMsg( "value="+ event.characteristic.value.readUTFBytes( event.characteristic.value.length )  );
  }
  </code></pre>
  
  <p>This always outputs zero for the length and nothing for the value.</p>
  
  <p>If I send "!D", for example, do I need to treat it differently from:</p>
  
  <pre><code>var value:ByteArray = new ByteArray();
  value.writeUTFBytes( "!D" );
  </code></pre>
  
  <p>in order for it to be correctly received by the UART service?</p>
  
  <p>I don't have immediate access to the arduino side of things - I can ask the developer to add some debugging for me - to echo back what it feels to be nonsense messages - but that's not going to be quick.</p>