Common functionality used by bt-app and bt-protocol