OSDN Git Service
Arman Uguray [Fri, 4 Sep 2015 19:57:37 +0000 (12:57 -0700)]
service: Added RemoteCallbackMap
Added the RemoteCallbackMap template class which allows storing
IInterface subclasses in an associative array while tracking the
death of the remote process that owns the associated binder. This is
similar to RemoteCallbackList but stores entries in key-value pairs.
Also fixed some RemoteCallbackList documentation and change the code to
use std::unordered_map rather than std::map.
Bug:
23793954
Change-Id: I205c0491d21fef3bc5eeb5c4a7356dab4b6eb8dc
Arman Uguray [Wed, 2 Sep 2015 00:22:29 +0000 (17:22 -0700)]
service: Add IBluetoothLowEnergy interface
Introduce the IBluetoothLowEnergy and IBluetoothLowEnergyCallback
interfaces with stub implementations for three methods only. Added
the definition and implementation for IBluetooth.GetLowEnergyInterface.
Bug:
23395353
Change-Id: Iba4d9aa20779956b486c0b46e752e0e00be3aeea
Arman Uguray [Thu, 3 Sep 2015 22:09:41 +0000 (15:09 -0700)]
service: Introduce bluetooth::LowEnergyClient
Added the LowEnergyClient class which manages a per-application BLE
API client instance. This currently only supports getting registered
with the stack and obtaining a client_if handle but will expose APIs
in the future for various BLE operations.
Bug:
23793954
Change-Id: I423f6d12321877826525e5e52136682fa9d5a441
Arman Uguray [Thu, 3 Sep 2015 22:00:52 +0000 (15:00 -0700)]
service: Add UUID::GetRandom
Added a static class method to UUID that returns a random 128-bit UUID.
Also converted the enum constants to pure integer constants to make
their meaning more explicit.
Bug:
23395353
Change-Id: If8b97d40c020fdfc8b460b537b2da7c62b0c24ad
Arman Uguray [Mon, 31 Aug 2015 23:29:07 +0000 (16:29 -0700)]
service: Add hal::BluetoothGattInterface
Added hal::BluetoothGattInterface which is a C++ wrapper around the
HAL Bluetooth GATT interfaces. This follows the current pattern of hal/*
wrappers and is meant to be fakeable.
Bug:
23395353
Change-Id: Ib11afba9fe2f4632591d5db384edf32ca788bf2c
Arman Uguray [Fri, 21 Aug 2015 21:59:57 +0000 (14:59 -0700)]
service: Implement IBluetooth.isMultiAdvertisementSupported()
Added the Binder bindings, bluetoothtbd implementation, and new
bluetooth-cli command for testing it.
Bug:
23227962
Change-Id: I2de62e49e5d8b0bcc118ccb654d72fdd9f11f748
Arman Uguray [Fri, 28 Aug 2015 19:15:09 +0000 (12:15 -0700)]
gn-build: Add secondary build tree for gmock
Added a BUILD.gn file for gmock under third_party/gmock.
Change-Id: Icbe93f118142ab8e0ea3a46672a74dd2d7466868
Marie Janssen [Tue, 25 Aug 2015 22:07:09 +0000 (15:07 -0700)]
brillo: add and install system startup files
Add files necessary to start bluetoothtbd at startup.
BUG=
23120355
Change-Id: Ibdacee621909b9d7fc9af2935343e581693ed010
Arman Uguray [Mon, 24 Aug 2015 18:00:25 +0000 (11:00 -0700)]
service: Check for NULL IBinder in registerCallback
Added checks for NULL binder in IBluetooth.registerCallback and
IBluetooth.unregisterCallback.
Change-Id: I6136ad08d83696ad0e94cc2425667df9310f2b96
Arman Uguray [Mon, 24 Aug 2015 17:08:19 +0000 (10:08 -0700)]
service: Return SUCCESS from Acquire|ReleaseWakeLock
Added code back to lie and return BT_STATUS_SUCCESS from the
AcquireWakeLock and ReleaseWakeLock OS callouts, since without these
the adapter cannot be properly disabled.
Bug:
23390297
Change-Id: I9801ccc7f72d83d132363fc888319bfb9b2eff29
Ian Coolidge [Mon, 24 Aug 2015 17:22:45 +0000 (17:22 +0000)]
Merge "Improve adv_data transfer between contexts."
Dennis Cheng [Fri, 21 Aug 2015 03:32:01 +0000 (20:32 -0700)]
test_vendor_lib: Clean up controller documentation and address style
issues
This upload cleans up the command documentation in the controller's
header file and also fixes a few logical errors related to command
status event packets. Some style fixes are also included, such as
removing braces for single line conditionals to conform to remain
consistent with the rest of the project.
Bug:
21586676
Change-Id: Ife5e608e43c3030e76eff8ea79ce6cad0b2c10a3
Dennis Cheng [Tue, 18 Aug 2015 23:44:08 +0000 (16:44 -0700)]
test_vendor_lib: Add tests
This upload adds unit tests for the packet_stream and hci_transport
objects.
Bug:
21586676
Change-Id: Ica99be959cdd801ea10631d31fc0f0b8ea1d8456
Chih-hung Hsieh [Fri, 21 Aug 2015 20:25:29 +0000 (20:25 +0000)]
Merge "Enable clang compilation, use stdatomic.h."
Arman Uguray [Thu, 20 Aug 2015 22:40:31 +0000 (15:40 -0700)]
service: Don't lie about supporting wake locks
Changed the code to return error rather than success from the native
bt_os_callout_t hooks.
Bug:
23390297
Change-Id: I0a4e2678ace88072294b82e57cf1e1bd3edd08cd
Chih-Hung Hsieh [Thu, 13 Aug 2015 19:27:32 +0000 (12:27 -0700)]
Enable clang compilation, use stdatomic.h.
* Remove old atomic.h and atomic_test.cpp.
Use stdatomi.h in counter.c.
* Suppress warnings on unused variables/parameters.
* Suppress warnings on redefined typedef.
Change-Id: Ic7ec652608f2c9423984a3631fb58efea5a835e7
Dennis Cheng [Fri, 14 Aug 2015 20:15:31 +0000 (13:15 -0700)]
test_vendor_lib: Add working post delayed task
This upload fixes the post delayed task functionality so that it uses
a custom time stamped event object instead of posting callbacks to the
vendor manager's task runner (which does not support delayed tasks for
MessageLoopForIO).
Bug:
21586676
Change-Id: Ib5d9019d8c8dd5c9ad865df82eac16b0ecf50268
Arman Uguray [Thu, 20 Aug 2015 19:47:55 +0000 (12:47 -0700)]
service/client: Register IBluetoothCallback
bluetooth-cli now registers an IBluetoothCallback to receive adapter
state updates, which gets automatically unregistered when bluetooth-cli
exits.
Bug:
23328384
Change-Id: I4f190e91ecd8401b9f5eb1cffdfb26cd9d5cecb0
Arman Uguray [Thu, 20 Aug 2015 19:36:20 +0000 (12:36 -0700)]
service: Introduce IBluetoothCallback.h
This CL introduces the native bindings for the IBluetoothCallback
Binder interface and implements the IBluetooth registerCallback and
unregisterCallback methods.
Bug:
23328384
Change-Id: I6fbf72cff7e3f037a412be8678ea97f3a7ada0c8
Arman Uguray [Thu, 20 Aug 2015 19:31:50 +0000 (12:31 -0700)]
service: Add native RemoteCallbackList
This CL introduces a native port of the android.os.RemoteCallbackList
Java class. This is in preparation of the upcoming IBluetoothCallback
implementation.
Bug:
23328384
Change-Id: Icebf5c286ced820fa631da35f50cdf5d244fdded
Arman Uguray [Thu, 20 Aug 2015 19:12:56 +0000 (12:12 -0700)]
service: Add complete IBluetooth transaction enums
This CL completes the IBluetooth transaction codes based on the
latest IBluetooth.aidl file from goog/mnc-dev.
Bug:
23227962
Change-Id: I76d58647a0467cd0eb18f9bd0d3eceb36ce2abcf
Arman Uguray [Thu, 20 Aug 2015 21:06:57 +0000 (21:06 +0000)]
Revert "service: Move UNIX IPC code into ipc/unix/"
It turns out "unix" is defined to be 1 somewhere, which breaks compilation of this CL (since I added "namespace unix").
This reverts commit
93e66a66464aa30ca7184e4a7378c8e8d752cbe1.
Change-Id: I00b0a59a35024ccf78297117916d12031a6346a5
Arman Uguray [Thu, 20 Aug 2015 18:38:49 +0000 (11:38 -0700)]
service: Introduce bluetooth::Adapter::Observer
This CL introduces a new Observer interface for the Adapter class.
This meant to serve as the top-level API for receiving Adapter state
notifications, property updates, etc, in a format that doesn't use
the native HAL types.
Bug:
23328384
Change-Id: Ibf29063a169ad5e986d433d0901b3b973af0aa56
Arman Uguray [Thu, 20 Aug 2015 18:49:00 +0000 (11:49 -0700)]
service: Support base switches::kV
This is a libbase built-in command-line flag to set log verbosity,
so that the VLOG macro does the right thing. This CL enables that for
the daemon. To enable VLOGs with a given verbosity level and below, do
bluetoothtbd --v=<level>
Change-Id: I128a42c52425c37640c016c3c6158419cc1c0f66
Arman Uguray [Thu, 20 Aug 2015 20:07:18 +0000 (13:07 -0700)]
service: Move UNIX IPC code into ipc/unix/
Moved the UNIX IPC related code into a new ipc/unix subdirectory.
Added new namespace levels for unix and binder that mimic the
directory structure.
Change-Id: I58954d0c3dd1a6fe9c141c3122d42530385265f6
Dennis Cheng [Mon, 10 Aug 2015 16:29:41 +0000 (09:29 -0700)]
test_vendor_lib: Read controller properties from file.
This upload lets the controller be configured via a JSON file that
specifies the controller attributes. A default configuration is not
currently provided but will be included in a future upload. Also fixes
a few mistakes in test_channel.py.
Bug:
21586676
Change-Id: I9d0e65a9664e179ddb97664a748c766f4f8a554e
Arman Uguray [Tue, 18 Aug 2015 00:25:04 +0000 (17:25 -0700)]
service/client: Add support for the latest methods
Added support for calling the IBluetooth getAddress, setName,
and getName methods.
Bug:
23227962
Change-Id: Ib8c3f609b02e953a2989c18d614b5f52a56421c2
Arman Uguray [Tue, 18 Aug 2015 00:23:42 +0000 (17:23 -0700)]
service: Implement IBluetooth getAddress, getName, and setName
This CL implements the IBluetooth getAddress, getName, and setName
API methods.
Bug:
23227962
Change-Id: I5ba8395a08bdbcf6a882ea8f413448cf0a1f331a
Miao Chou [Tue, 11 Aug 2015 18:41:58 +0000 (11:41 -0700)]
Fix typo in main/bte_main.c.
Change-Id: If16dd316545b485f3a92c9700f9af35bf97fdd42
Arman Uguray [Sat, 15 Aug 2015 01:32:48 +0000 (18:32 -0700)]
service: Add four more IBluetooth API definitions
Added bindings for the following IBluetooth API methods:
String getAddress();
ParcelUuid[] getUuids();
boolean setName(in String name);
String getName();
Bug:
23227962
Change-Id: Ia5f57056486bb832b2c9e7fc82837626716992ed
Arman Uguray [Sat, 15 Aug 2015 01:28:42 +0000 (18:28 -0700)]
service: Rename Uuid to UUID
This is more consistent with the ancronym naming convention in the
framework code (e.g. java.util.UUID) and elsewhere in the Bluetooth
daemon.
Change-Id: I3461cf12d563e00ba5e0b0b390bd9ef94e6d7418
Arman Uguray [Sat, 15 Aug 2015 00:23:47 +0000 (17:23 -0700)]
service: Implement IBluetooth::GetState
This CL implements the GetState method of the IBluetooth interface:
1. A new file, adapter_state.h has been added, which defines the
STATE_* values from BluetoothAdapter.java in the framework layer.
This is done this way so that a client library can be built with
minimal dependency on core service code (e.g. Adapter).
2. Implemented the GetState method.
3. Refactored the fake BluetoothInterface such that multiple unit
test modules can make use of it by centralizing fake behavior
to hal/.
4. Added new commands to client/.
Bug:
23227962
Change-Id: Id403094f6fe34cd5cef0577f319309169f74ddf3
Arman Uguray [Fri, 14 Aug 2015 00:05:03 +0000 (17:05 -0700)]
service: Implement IBluetooth IsEnabled, Enable, and Disable
Implemented the IsEnabled, Enable, and Disable methods of the IBluetooth
interface. Added a simple REPL logic to client/main.cpp so that these commands
can be tested real-time via command-line.
Bug:
23169366
Change-Id: Id27a82e5cdadc5ea0b6f88d3ab3a6b7882f6212a
Arman Uguray [Fri, 14 Aug 2015 00:01:07 +0000 (17:01 -0700)]
service: Replace CoreStack with Adapter
This CL removes the CoreStack class. Code that depended on a CoreStack instance
now depend on Adapter and hal::BluetoothInterface instead.
Bug:
23169364
Change-Id: Ide008cc7d3f9e74656f6bfa4df2dfee511e55b90
Arman Uguray [Thu, 13 Aug 2015 23:09:35 +0000 (16:09 -0700)]
service: Introduce Adapter
This CL introduces the Adapter class, which is meant to replace the CoreStack
class. Adapter interfaces with hal::BluetoothInterface rather than calling into
libhardware directly.
Bug:
23169364
Change-Id: Id0a19277d55e83ec3bee3653d5d8795efbd5781b
Arman Uguray [Thu, 13 Aug 2015 22:49:47 +0000 (15:49 -0700)]
service: Introduce hal::BluetoothInterface
This CL introduces the bluetooth::hal::BluetoothInterface class. This is meant
to be an abstraction over the underlying bt_interface_t and bt_callbacks_t
interfaces from libhardware. BluetoothInterface is defined as an abstract
singleton that allows a fake/mock implementation to be injected for testing.
Bug:
23169364
Change-Id: Ia6f21f505dca08651b9a83e30287f638e8ec9a8e
Dennis Cheng [Sun, 9 Aug 2015 00:07:50 +0000 (17:07 -0700)]
test_vendor_lib: Remove handlers
This upload removes the HciHandler and TestChannelHandler classes.
Removing these classes simplifies logic and also allows the
controller to do preprocessing before executing commands.
Bug:
21586676
Change-Id: I3f2711349dd2c86794538edc632b4f5f49b5169b
Dennis Cheng [Fri, 7 Aug 2015 23:58:13 +0000 (16:58 -0700)]
test_vnd_lib: Discover devices
This upload allows the user to send fake inquiry responses to the
controller at run-time via the test channel.
Bug:
21586676
Change-Id: Ieae24d496115f19716fcaaffa627a9c22ffade21
Dennis Cheng [Tue, 4 Aug 2015 23:51:59 +0000 (16:51 -0700)]
test_vendor_lib: Add test channel command transport and handler
This upload adds the transport and handler functionality for the test
channel. Test channel commands will be sent by the test channel
program and processed by library objects in a manner analogous to how
packets are received and handled from the HCI. The actual
implementation for the 4 test channel commands included here will be
in the next upload.
Bug:
21586676
Change-Id: I9354baedcbd6e48b8920a3ebf1afa69eb89834d9
Dennis Cheng [Mon, 3 Aug 2015 01:25:17 +0000 (18:25 -0700)]
test_vendor_lib: Add test channel for run-time input
This change adds a test channel for receiving user-specified commands
and data at run-time. Specifically, the channel is intended to be used
for additional debugging capabilities and for fine-tuned control over
the test controller. Implementation-wise, the test channel is simply
another socket that the vendor manager watches on. The handling of test
channel input goes through the pipeline as normal HCI data after it is
received by the HciTransport.
A script for building and running the test vendor library and
(optionally) the test channel has been added in scripts/.
Bug:
21586676
Change-Id: I55bdeedbcd81effbe009aa62a19031637374a1e6
Ian Coolidge [Thu, 13 Aug 2015 19:50:05 +0000 (19:50 +0000)]
Merge "Restore LOG_NDEBUG condition on verbose logging."
Ian Coolidge [Thu, 13 Aug 2015 05:47:45 +0000 (22:47 -0700)]
Restore LOG_NDEBUG condition on verbose logging.
Change-Id: I86c5e03954c5f0a2dad88db5d6fbda3ec9e11e96
Ian Coolidge [Wed, 12 Aug 2015 21:53:15 +0000 (14:53 -0700)]
service: Allow manufacturer data to be set.
Plumbs IPC and stack code for manufacturer data
on advertisement or scan response.
Change-Id: I4b70506e35f51479bdf4073c31e4cb4f88fa2c98
Ian Coolidge [Wed, 12 Aug 2015 22:33:47 +0000 (22:33 +0000)]
Merge "service: Fix permissions/properties argument order."
Ian Coolidge [Wed, 12 Aug 2015 22:19:51 +0000 (15:19 -0700)]
service: Fix permissions/properties argument order.
These were swapped, resulting in a bad configuration
of the control attribute.
Change-Id: I93dd69da1ace70a249d3a8d1856b173a52462a6c
Arman Uguray [Thu, 6 Aug 2015 04:22:39 +0000 (21:22 -0700)]
service: Introduce a command-line client
This CL introduces a CLI for the Bluetooth daemon. The code currently
doesn't do much, other than demonstrate how a native Binder client code
can be placed to the Bluetooth daemon. This objective here is to
extend this with a REPL and send commands to the daemon based on user
input.
Bug:
22743129
Change-Id: I41015e4b639e7099dd9f7086dbe86b01f3a61786
Arman Uguray [Thu, 6 Aug 2015 04:19:02 +0000 (21:19 -0700)]
service: Add IPCHandlerBinder
This CL integrates Binder IPC into the daemon. This introduces
IPCHandlerBinder and BluetoothBinderServer which is the Binder server
proxy for IBluetooth. A new command-line switch is introduced to
optionally disable Binder on platforms that do not use it.
BluetoothBinderServer currently does not fully implement any of the IPC
calls and consists of stubs.
Bug:
22743677
Change-Id: I3e4ba7a3211898bab0c9c8061f4e4db3854711ed
Ian Coolidge [Sat, 8 Aug 2015 03:36:13 +0000 (20:36 -0700)]
Improve adv_data transfer between contexts.
- Drops some unused members from btgatt_multi_adv_inst_cb.
- Flatten tBTA_BLE_ADV_DATA to only require one allocation.
- Copy all of tBTA_BLE_ADV_DATA contents to bt_workqueue_thread.
Bug:
23042223
Change-Id: I5f4d25d5cdd39731a2dfe64394928b7fb77c7c7c
Arman Uguray [Thu, 6 Aug 2015 04:06:17 +0000 (21:06 -0700)]
service: Add IBluetooth interface definition
This CL adds the initial IBluetooth interface definition. Client and server
proxy classes have been added, which would normally be autogenerated in Android
Framework Land. This currently only includes the first five methods from
IBluetooth.aidl but will be extended in the future.
Bug:
22743677
Change-Id: I32be9801e91877c2961e24232cdfaecd80ee2368
Marie Janssen [Fri, 7 Aug 2015 06:29:29 +0000 (23:29 -0700)]
build: fix missing include
fatfingered this needed include out of this file
Change-Id: Id4c8d3223b25d0747a2739891e43652c475d399c
Marie Janssen [Fri, 7 Aug 2015 01:30:45 +0000 (18:30 -0700)]
build: fixes for breakages on tilapia
Only include advertising when we can actually advertise on LE.
Change-Id: I380c67db4391650591b94611c4d522bf49fac750
Marie Janssen [Wed, 8 Jul 2015 18:48:57 +0000 (11:48 -0700)]
build: LOG_TAG consistency, include order, build fixes
Fix the order of includes across a bunch of files, and declare LOG_TAG
at the top of every file in which it is used.
Consistently use bt_ as a LOG_TAG prefix.
Fix issues with LOG macro usage.
Remove unused includes and double-includes (when in related .h)
Add includes as necessary to compile cleanly (problems surfaced by
reordering includes)
Change-Id: Ic55520c8302b06bbc1942c10c448b20844669da6
Dennis Cheng [Thu, 30 Jul 2015 17:06:40 +0000 (10:06 -0700)]
test_vendor_lib: Implement event loop with libbase
Adds event loop functionality by handling IO in the Watcher class,
HciTransport. Also fixes a bug where the vendor's file descriptor was
closed early and another where an object was mistakingly being passed
by value.
Bug:
21586676
Change-Id: I2ec30b68c0ede47bf1ad78ec13beee93d0f8ab9d
Dennis Cheng [Wed, 29 Jul 2015 18:47:55 +0000 (11:47 -0700)]
test_vendor_lib: Use base::Thread
This upload starts the replacement of the event loop in HciTransport
with libbase's MessageLoopForIO. A global instance of the new
VendorManager class now manages the trio of previously global objects
(i.e. HciTransport, HciHandler, and BREDRController). Note that the new
libbase event loop structure doesn't actually handle anything right now
and the functionality will come in a future change.
Bug:
21586676
Change-Id: Id74392e2a566e06445eb65269f0142265087d47d
Arman Uguray [Thu, 6 Aug 2015 03:54:44 +0000 (03:54 +0000)]
Merge "service: Clean up IPC shutdown and add unit tests"
Dennis Cheng [Mon, 27 Jul 2015 22:55:15 +0000 (15:55 -0700)]
test_vendor_lib: Use libbase's CHECK/DCHECK
This upload pulls in libchrome to the test vendor library and uses CHECK
and DCHECK from base/logging.h.
Bug:
21586676
Change-Id: Ia88b4aa3728493d798e8d36076a351a00fad7c6b
Dennis Cheng [Thu, 23 Jul 2015 22:22:50 +0000 (15:22 -0700)]
test_vendor_lib: Dummy inquiry result
This upload mainly consists of stub command implementations to get
Bluetooth into the enabled state. The last command handled is the
inquiry command. Upon inquiry, the controller currently sends back a
dummy inquiry result for a fake device. This fake device appears under
the "Available devices" list in the UI. Bluetooth is able to be toggled
off and on from the UI as well (i.e. it doesn't crash after switching to
on for a few seconds).
Bug:
21586676
Change-Id: Ifd42a6ab4b9338afd461d2ef4f809bdd62fcf79f
Arman Uguray [Wed, 5 Aug 2015 01:59:27 +0000 (18:59 -0700)]
service: Clean up IPC shutdown and add unit tests
This CL reworks the IPCHandlerUnix shutdown routine to be more robust
and adds a test suite for the basic thread creation and shutdown sanity.
Bug:
22532180
Change-Id: I22d119d6514f2ceb1460c0925b4e92b71ec87e06
Arman Uguray [Tue, 4 Aug 2015 19:56:56 +0000 (12:56 -0700)]
service: Add Mock support for Daemon and CoreStack
This patch turns the Daemon and CoreStack classes into abstract
interfaces. Mock and real implementations are implemented in special
subclasses and obtained via a factory method. Other test implementations
(e.g. stub) can be provided in the future.
Bug:
22532180
Change-Id: Ic3000518e5cef1c867dd803cd0bba6aab49dc596
Ian Coolidge [Fri, 31 Jul 2015 23:18:18 +0000 (16:18 -0700)]
Drop obsolete libpower dependency.
Wakelock activity is delegated to depending module.
Change-Id: I368bb9287f208fed3a674423e82fb2a8cb9e8268
Arman Uguray [Sat, 1 Aug 2015 02:14:39 +0000 (19:14 -0700)]
Compile libbtcore and libosi for host
The static libraries now also compile for a Linux host as libbtcore-host and
libosi-host. The unittests are compiled for the target against Bionic libc and
for the host against glibc.
Bug:
22884515
Change-Id: Iac1310a48cfd2ff43c356cb31165fd176d0e1d39
Dennis Cheng [Tue, 16 Jun 2015 19:44:55 +0000 (12:44 -0700)]
test_vendor_lib: Use EPOLLOUT
HciTransport checks for write-readiness before sending any packets
back to the HCI. Packets are maintained on a queue and only written
when the EPOLLOUT flag is set in the epoll_event.
Bug:
21586676
Change-Id: Iebd9599286b62746e2be7e424c522058ae978bb1
Ian Coolidge [Mon, 3 Aug 2015 20:45:39 +0000 (20:45 +0000)]
Merge "bluedroidtest: drop obsolete libhardware_legacy dependency."
Ian Coolidge [Fri, 31 Jul 2015 22:36:07 +0000 (15:36 -0700)]
bluedroidtest: drop obsolete libhardware_legacy dependency.
Change-Id: Iecd7839aa52debb14c6fc10da2d7f838f8d05327
Dennis Cheng [Tue, 16 Jun 2015 19:44:55 +0000 (12:44 -0700)]
test_vendor_lib: Initial commit
Basic vendor library for a test Bluetooth controller. Currently consists
of mostly stub functions and objects and can only handle the reset
command (by immediately responding with a command complete event).
Implemented through a global EventDispatcher object which waits for data
from the HCI and directly returns the appropriate response.
Eventually, the dispatcher will manage a fake controller object that
will provide callbacks to be executed whenever events are processed by
the dispatcher. Unit tests are still in progress and will be in the next
upload.
Bug:
21586676
Change-Id: I1c6746f8b0f1732b89a1da13facecdd49b5ac1b6
Ian Coolidge [Fri, 31 Jul 2015 03:51:47 +0000 (20:51 -0700)]
Provide --android-ipc-socket-suffix.
This allows Android init to create a socket
for the service, and have consolidated access control.
Android init creates the socket and passes the FD through
an environment variable, so we must use OSI to decode it.
Bug:
22807533
Change-Id: I7ec0a14b8f3b44277ce99faad68623d6691f7863
Arman Uguray [Sat, 25 Jul 2015 02:14:42 +0000 (19:14 -0700)]
service: Refactor IPC and singletons
This CL makes the following major refactors to the system service code:
1. A new global Daemon object is introduced, which manages the main event
loop and all other subsystems of the Bluetooth daemon. This object is the only
singleton class and initializes and owns everything else.
2. Everything that was a singleton and/or was initialized directly in main.cpp
is now a) no longer a singleton; b) now initialized and owned by the global
Daemon instance.
3. All of the Chromecast specific IPC code has been moved into the ipc/
subdirectory. This directory is meant for everything that is IPC related,
paving the way for enabling multiple IPC systems (domain-socket based, Binder
based, etc) simultaneously in the future. Main changes to the Chromecast IPC
code are:
a. All files and classes have been renamed to reflect the
UNIX-domain-socket-specific nature of the IPC mechanism.
b. The code no longer hogs up the main thread while listening for
connections. All of this logic has been moved to a dedicated thread with
its own MessageLoopForIO, so that it can use the built-in mechanisms for
polling on client sockets in the future.
Bug:
22532180
Change-Id: I42db06dba6cff3bc8f8101a1ea2b6787a69409fd
Ian Coolidge [Thu, 11 Jun 2015 03:34:43 +0000 (20:34 -0700)]
service: Add null initialization for new scan cb.
scan_parameter_setup_completed_cb was added to
btgatt_client_callbacks_t.
Change-Id: If0aa113df7cf3db742fa64244bbb7a849c877525
Miao-chen Chou [Tue, 28 Jul 2015 23:55:28 +0000 (23:55 +0000)]
Merge "build: Eliminate cutils/str_parms dependency from system/bt"
Arman Uguray [Tue, 28 Jul 2015 01:32:05 +0000 (18:32 -0700)]
Add GN files for vendor_libs
Added BUILD.gn files for vendor_libs and vendor_libs/linux.
Bug:
21585592
Change-Id: I33f98421a94a4b4f530e48c94711775d776d02d7
Miao Chou [Wed, 8 Jul 2015 21:50:32 +0000 (14:50 -0700)]
build: Eliminate cutils/str_parms dependency from system/bt
Eliminate cutils/str_parmss dependency from system/bt by adding osi_str_parms:
- Added hash_map_utils which implements partial functions of cutils/str_parms
and uses osi/hash_map instead of cutils/hashmap.
- Updated osi/Android.mk, osi/BUILD.gn and the includes in audio_a2dp to use
osi_str_parms.
- Added unittest for hash_map_utils.
Bug:
21957864
Change-Id: I8458d9e45df6cab2b71840d24d17b9d75de9842c
Christopher Wiley [Mon, 27 Jul 2015 00:31:00 +0000 (17:31 -0700)]
Only build bt_service_unittests for linux
libchrome-host doesn't build on Mac, and while we get that sorted out,
let us not try and build this for Mac either.
Change-Id: I01d27391539d5c345d29a4ce949d0c3bcc931a7f
Samuel Ortiz [Fri, 24 Jul 2015 21:05:27 +0000 (14:05 -0700)]
Add HCI user channel based bluedroid vendor adaptation
This libbt vendor library creates and binds an HCI user channel
instead of talking to a serial port file descriptor. HCI frames
generated by the Android Bluetooth HAL are passed down as is to the
Linux kernel Bluetooth drivers through those sockets.
By pushing all the hardware dependencies down to the kernel, this
architecture supports all existing Linux Bluetooth drivers with
one single AOSP Bluetooth HAL implementation, Bluedroid.
Change-Id: I7197016b556e5d985843dd4f626db5d0f596f996
Arman Uguray [Fri, 17 Jul 2015 01:12:13 +0000 (18:12 -0700)]
service: Introduce a global Settings object
Introduced a global Settings object that will store all runtime properties that
would be associated with a config file, Android system properties, etc. Added a
mechanism to parse command-line options which can be used to pass paths to
configuration files, file path for UNIX domain socket based IPC mechanism, and
any other property that is dynamic in nature. This will help us remove hardcoded
paths, strings, and other such values in the future.
Bug:
22532366
Change-Id: I8e790363ed31d44369f7991a8ea7132d1cace70b
Arman Uguray [Wed, 8 Jul 2015 22:47:39 +0000 (15:47 -0700)]
gn-build: Add bluetooth-service target
This patch makes the Bluetooth system service (service/) buildable using GN:
1. Added new BUILD.gn file for service/
2. Added conditional compilation for global config paths, with TODOs for
generalizing them later.
3. Added a shim for loading the Bluetooth library that calls hw_get_module on
Android and explicitly calls dlopen on OS_GENERIC.
4. Fixed compile warnings and errors.
5. Did some minor clean up in gatt_server.cpp for better readability.
Bug:
22124644
Change-Id: I3226537a3a5211a6762651a35707638df29956b0
Ian Coolidge [Tue, 14 Jul 2015 01:22:46 +0000 (18:22 -0700)]
service: Some fixes from end-to-end/user testing.
* Send responses to ExecWrite requests.
* Provide valid data on write responses.
* Properly destruct Gatt::Server objects.
* Synchronize CoreStack 'enable' calls properly.
Change-Id: I4e9eed1979b10abccc7ae487e2c7d90d491e38d9
Arman Uguray [Wed, 8 Jul 2015 22:33:05 +0000 (15:33 -0700)]
service: Remove local copies of base and modp_b64
Since libbase is now available on AOSP (under libchrome) Bluetooth code can
depend on it rather than maintain its own copy a subset of base sources (and
modp_b64 dependencies).
Dependent CL: http://r.android.com/158335
Bug:
22175181
Change-Id: I3a301e49353598633ad857ac4345d0361c273beb
Arman Uguray [Wed, 8 Jul 2015 00:00:09 +0000 (17:00 -0700)]
gn-build: Add BUILD files for libchrome
This CL adds GN build files for libchrome, which is the ChromeOS/Brillo library
for many C++ tools, include libbase. I added a new GN build target for "base"
under secondary sources with a GN build file for libchrome which currently lives
in platform/external/libchrome in AOSP.
To build, clone libchrome into third_party/libchrome and remove
third_party/libchrome/base/BUILD.gn. Also clone external/modp_b64 into
third_party/modp_b64. Eventually I will have scripts set up to do
this automatically.
This means that we can start developing against libbase while running GN builds
on Goobuntu but this would break the tree until libchrome is buildable within
the Android build system (http://r.android.com/158392). So Brillo/Android builds
will depend on libchrome using the conventional Android.mk means.
Bug:
22175181
Change-Id: I9a737aa785488e5bc0ca1adc087d1d5dfcdf3bea
Marie Janssen [Tue, 7 Jul 2015 23:47:20 +0000 (16:47 -0700)]
build: Fix LOG_TAG define breakage, macro usage
Fixes build breakages related to r.android.com/156982
Change-Id: Ib1143c41fe05a17c296226998afdb41a8cb6294a
Marie Janssen [Fri, 26 Jun 2015 21:53:46 +0000 (14:53 -0700)]
build: Update osi log functions, use consistently
Update the LOG_* functions to take a tag argument which makes them more
consistent with the Android Log.*(TAG, s) common syntax and removes
some #define-dependency with osi/include/log.h.
Also update to never use Android log functions directly.
Also contains minor cleanup of some header includes.
Bug:
21569831
Change-Id: If07385cafbea062232ecdbc7c673f908d5ef8921
Evgenii Stepanov [Mon, 29 Jun 2015 20:59:44 +0000 (13:59 -0700)]
Add missing library dependency.
Fixes the following link error in SANITIZE_TARGET=address build for
hammerhead:
system/bt/audio_a2dp_hw/audio_a2dp_hw.c:208: error: undefined reference
to 'osi_socket_local_client_connect'
Bug:
21785137
Change-Id: Ie29a2772e7f1a4f697d895eb29b01d39d6f9c651
Miao Chou [Wed, 10 Jun 2015 00:39:46 +0000 (17:39 -0700)]
build: Eliminate cutils/sockets dependencies from system/bt
Eliminate cutils/sockets dependencies by pulling sources files from
core/libcutils into osi/.
- Pulled source files from cutils/ into osi/ and modified GN files and
Android.mk
- Updated includes to use the headers in osi/ and removed unused/duplicated
headers.
- Renamed the functions of osi/sockets and updated wherever they are called
to avoid usign symbols from cutils/sockets, since other cutils
dependencies have not been eliminated yet.
Bug:
21667795
Change-Id: I3dd4371d585f120d97ac0433ab1f35edb820dbb9
Sharvil Nanavati [Sat, 13 Jun 2015 09:12:08 +0000 (02:12 -0700)]
Reduce CPU utilization from ~60% to ~10% on busy HCI reads.
This patch improves RFCOMM throughput and reduces CPU utilization.
Instead of using a counting semaphore to measure bytes and reading
one at a time from the eager reader's buffer, read in bulk based
on the incoming read request size.
Change-Id: I17046bfbc3ca49576a9c82b38911aeb84234881a
Sharvil Nanavati [Sun, 14 Jun 2015 23:02:08 +0000 (23:02 +0000)]
Merge "Rename alarm->creation to alarm->creation_time for readability."
Arman Uguray [Sat, 13 Jun 2015 00:33:34 +0000 (17:33 -0700)]
service: Fix clang warnings in uuid_test.cpp
This CL fixes some clang compile warnings and errors and style issues in
service/uuid_test.cpp
Bug: none
Change-Id: I2d1ecf6e21fe4d6b1741f2a113ed5834518a29c6
Ian Coolidge [Fri, 12 Jun 2015 22:50:56 +0000 (22:50 +0000)]
Merge "Add bthost, a simple BLE GATT server."
Ian Coolidge [Thu, 4 Jun 2015 00:20:30 +0000 (17:20 -0700)]
Add bthost, a simple BLE GATT server.
This is accessible via Unix socket.
It only has a couple of interesting features:
* Built in support for large blob attributes (>512 octets)
* Attribute caching (avoid frame-level IO for IPC clients)
Some string utilies are taken from modp_b64 and Chromium base.
Bug:
21076037
Change-Id: I6a29959159de76f8dd68d6bbaabe2100daabb6fa
Arman Uguray [Wed, 3 Jun 2015 04:11:07 +0000 (21:11 -0700)]
build: Fix ptr <-> integer cast warnings
This CL removes the -Wno-pointer-to-integer-cast and
-Wno-integer-to-pointer-cast flags from GN build files. The resulting errors
were fixed using the following:
1. All ptr <-> integer casts are now done by using the new
PTR_TO_INT/INT_TO_PTR macros defined in osi.h
2. The TIMER_PARAM_TYPE macro, defined in gki/common/gki.h and
include/bt_target.h have been redefined as void* rather than UINT32. This
is better, since "void*" can act as a simple container without any
precision loss that would be caused by a type such as UINT32 on 64-bit
systems. void* inherently is a safer container for all pointer types but
UINT32 isn't.
BUG=
21570302
Change-Id: I4a82c4a40c91caa31e372382c40d424be220cbe3
Arman Uguray [Wed, 3 Jun 2015 02:48:51 +0000 (19:48 -0700)]
osi: Introduce ptr <-> integer conversion macros
This CL introduces macros for safe pointer to integer conversion (and vice
versa). Also fixed a small style issue in log.h
Bug:
21570302
Change-Id: If76bf5e35970f9b33f9bef53fbd03a7effae08dc
Arman Uguray [Tue, 2 Jun 2015 21:56:45 +0000 (14:56 -0700)]
gn-build: Remove all -Wno-unused-* flags from build files
This CL removes the -Wno-unused-variable, -Wno-unused-value, and
-Wno-unused-function flags from all GN build and Android.mk files
(except in test/ & tools/, which are not built using GN yet). Compile
warnings, caused by the newly enabled flags, have been fixed throughout
the code base.
Bug:
21570302
Change-Id: I1c128b62256faa17668124798341005bcd0f7315
Evgenii Stepanov [Thu, 11 Jun 2015 22:34:12 +0000 (15:34 -0700)]
Revert previous commit and disable net_test_hci under sanitizers.
Change-Id: Ifd544ef241f622c647ecea1026025049a470bd16
Evgenii Stepanov [Thu, 11 Jun 2015 21:30:41 +0000 (14:30 -0700)]
Fix ASan build.
Not sure why, but with ASan I get missing symbol GKI_freebuf.
Indeed, it is defined in a library that's not in the target's deps.
Bug:
21785137
Change-Id: I595f3e3df6ad5dde3f4f8570426479050b1552fa
Sharvil Nanavati [Thu, 11 Jun 2015 05:00:16 +0000 (22:00 -0700)]
Rename alarm->creation to alarm->creation_time for readability.
Change-Id: I007b2211d9b52422b4442765bb97c0ba90613c50
Arman Uguray [Wed, 10 Jun 2015 23:21:12 +0000 (16:21 -0700)]
gn-build: Fix GN build after the merges
This CL fixes the GN build after the recent merges to aosp/master.
Change-Id: I0c9d8178986165d5a4a67261532e8a08b6923d22
Andre Eisenbach [Wed, 10 Jun 2015 23:37:05 +0000 (16:37 -0700)]
Fix more BLE_INCLUDED == FALSE build breakage
Change-Id: I2da6dcdaced78d3a3bce6002fc3885c7480fba82
Dan Albert [Tue, 9 Jun 2015 23:53:45 +0000 (16:53 -0700)]
Add missing include.
osi_malloc was never included, so it was implicitly defined as
returning an integer (thank you, C). Clang caught the int to pointer
conversion error.
Change-Id: I0d8a3363d92cb72a22780d049a53e193d2e50ec5
Andre Eisenbach [Fri, 29 May 2015 21:05:30 +0000 (14:05 -0700)]
Check transport before subscribing for service changes
Don't subscribe to the service changed characteristic if SMP pairing
was a result of cross-key pairing.
Change-Id: Ieb4901e82060e2fa2d9d0e909e384de5f6890222
Author: Chaojing Sun <cjsun@broadcom.com>
Bug:
20894154
Hemant Gupta [Wed, 15 Oct 2014 14:29:23 +0000 (19:59 +0530)]
Add proper checks for PAN & BNEP in BD stack
This patch fixes issues for PAN & BNEP in BD stack identified
by static analysis tool.
Change-Id: I29417dae982abb5cef11379f8d03baad11ffde8b
Mallikarjuna GB [Fri, 7 Nov 2014 11:22:25 +0000 (16:52 +0530)]
Fix issues in A2dp, Avrcp, HF and AG reported by static analysis tool
- Fixes to validate Array Index Value and Null Pointer
Dereference reported by static analysis tool.
Change-Id: Id1492315f68378fdcfa517bd0a5cacefc8ebfddb
Anubhav Gupta [Mon, 17 Nov 2014 01:02:45 +0000 (17:02 -0800)]
Ignore STOP command if A2DP stream is suspended
Ignore STOP command if A2DP stream is already suspended.
Some carkits send STOP command before VOIP call initiation
but don't send PLAY when call ends which hinders DUT to resume
audio playback after call termination.
Change-Id: I41cc1fc6f4b6cfaa1560d729baa0ca27f6dfe8c8