move some code from gaia/dev_apps/test-agent to let all unit tests of bluetooth passed