code: function startLuxometerNotifications()
  {
  	showMessage('Scanning...')
  
  	bleat.requestDevice(
  	{
  		filters:[{ name: 'CC2650 SensorTag' }]
  	})
  	.then(function(device)
  	{
  		showMessage('Found device: ' + device.name)
  		return device.gatt.connect()
  	})
  	.then(function(server)
  	{
  		gattServer = server
  		showMessage('Connected')
  		return gattServer.getPrimaryService(LUXOMETER_SERVICE)
  	})
  	.then(function(service)
  	{
  		// Get config characteristic.
  		luxometerService = service
  		return luxometerService.getCharacteristic(LUXOMETER_CONFIG)
  	})
  	.then(function(characteristic)
  	{
  		// Turn luxometer config to ON.
  		return characteristic.writeValue(new Uint8Array([1]))
  	})
  	.then(function()
  	{
  		// Get data characteristic.
  		return luxometerService.getCharacteristic(LUXOMETER_DATA)
  	})
  	.then(function(characteristic)
  	{
  		// Start sensor notification.
  		showMessage('Starting notfications')
  		characteristic.addEventListener('characteristicvaluechanged', onLuxometerChanged)
    		return characteristic.startNotifications()
  	})
  	.catch(function(error)
  	{
  		showMessage(error)
  	})
  }
docs: Main application function.