import bluetooth
import time
bt = bluetooth.BLE()               # singleton
bt.active(True)                          # activate BT stack
UART_UUID = bluetooth.UUID('6E400001-B5A3-F393-E0A9-E50E24DCCA9E')
UART_TX = (bluetooth.UUID('6E400003-B5A3-F393-E0A9-E50E24DCCA9E'), bluetooth.FLAG_READ | bluetooth.FLAG_NOTIFY,)
UART_RX = (bluetooth.UUID('6E400002-B5A3-F393-E0A9-E50E24DCCA9E'), bluetooth.FLAG_WRITE,)
UART_SERVICE = (UART_UUID, (UART_TX, UART_RX,),)
SERVICES = (UART_SERVICE,)
( (tx, rx,), ) = bt.gatts_register_services(SERVICES)
bt.gap_advertise(100)
[(3, 'bluetooth.BLE', 'bluetooth.BLE', False, 'import bluetooth\n'), (5, 'bluetooth.UUID', 'bluetooth.UUID', False, 'import bluetooth\n'), (6, 'bluetooth.UUID', 'bluetooth.UUID', False, 'import bluetooth\n'), (7, 'bluetooth.UUID', 'bluetooth.UUID', False, 'import bluetooth\n')]