title: Bluetooth Low Energy: Use BlueZ stack as a peripheral (with custom services and characteristics)
body: <p>I am trying to use the BlueZ stack on a Linux machine to create a GATT server with custom services and characteristics. The final goal is to use any central device (e.g. iOS or Android device) to connect to the GATT server, discover the services and characteristics, and manipulate the data in the characteristics.</p>
  
  <p>Example:</p>
  
  <ul>
  <li>Peripheral with 1 service which contains 3 characteristics.</li>
  <li>Service uuid = 0xFFFF</li>
  <li>Char 1 uuid = 0xAAAA, properties = readable</li>
  <li>Char 2 uuid = 0xBBBB, properties = readable &amp; writable</li>
  <li>Char 3 uuid = 0xCCCC, properties = notifiable</li>
  </ul>
  
  <p>From the central device, I should see the the peripheral device, connect to it and discover one service (0xFFFF) which has three characteristics (0xAAAA, 0xBBBB, 0xCCCC). I should then be able to read the value of 0xAAAA, read and write to the value of 0xBBBB, and enable notifications on 0xCCCC.</p>
  
  <p>Please note that I am aware that a <a href="https://stackoverflow.com/questions/16151360/use-bluez-stack-as-a-peripheral-advertiser?lq=1">similar question</a> exists, but it only explains how to use the peripheral as an advertiser. <a href="https://stackoverflow.com/questions/20682294/bluez-advertise-service-gatt-server-example">Another solved question</a> explains how to create a GATT server, but does not explain how to play with the properties of the characteristics (e.g. readable, notifiable, etc.), or maybe I'm missing something.</p>
  
  <p>Thank you in advance. </p>