Refactor common functionality in peripheral kits

Separate the RN42-specific functionality and that common to all
peripheral kits. (More or less. This is a first pass.) This refactor
will allow other Bluetooth peripheral emulation kits to duplicate less
code. This is in preparation for adding Bluetooth LE HID peripheral
emulation functionality.

This commit also changes the API slightly to try and make it more
kit-agnostic, and resolves the misunderstandings in EnterCommandMode.
Notably, it preserved the exception handling style, which is re-raising
exceptions, but wrapping them in a kit-specific exception, to make
handling exceptions easier.

Note that the Keyboard/Mouse API is still in flux, and is not handled in
this stage of the refactor, except for a small simplification.

Churn location of constants relating to kits, as the intended location
of BluetoothHID caused cyclic dependency with BluetoothHID using RN42
using PerpheralKit using BluetoothHID. Ideally, we want to eliminate the
RN42 link in BluetoothHID, (possibly moving the self-tests elsewhere,)
but for now, churn the location and add a TODO.

BUG=chromium:752719
TEST=Run this code on the Chameleon board:
$ make && make remote-install CHAMELEON_HOST=$CHAMELEON_IP
Execute the non-flaky non-stress tests that use this code,
see that the tests pass:
$ test_that --board ${BOARD} --args "chameleon_host=${CHAMELEON_IP}" \
${DUT_IP} bluetooth_AdapterPairing.mouse \
bluetooth_AdapterPairing.mouse.pairing_twice \
bluetooth_AdapterHIDReports.mouse

Change-Id: I967b62f780b394079873a5c6d352f14c591611f3
Reviewed-on: https://chromium-review.googlesource.com/602899
Commit-Ready: Alexander Lent <alent@google.com>
Tested-by: Alexander Lent <alent@google.com>
Reviewed-by: Miao-chen Chou <mcchou@chromium.org>
4 files changed