diff options
author | zork <zork@chromium.org> | 2015-04-30 20:20:13 -0700 |
---|---|---|
committer | Commit bot <commit-bot@chromium.org> | 2015-05-01 03:20:43 +0000 |
commit | 01205e6c626677993322a481beec2a038bf8be57 (patch) | |
tree | 2cca5a38eca15350d79e7156e62a806f28def772 /components/pairing | |
parent | 0a91bd01ecfce5c752ded50c704d971af52db814 (diff) | |
download | chromium_src-01205e6c626677993322a481beec2a038bf8be57.zip chromium_src-01205e6c626677993322a481beec2a038bf8be57.tar.gz chromium_src-01205e6c626677993322a481beec2a038bf8be57.tar.bz2 |
Add permanent_id to pairing protocol.
BUG=483304
Review URL: https://codereview.chromium.org/1118173002
Cr-Commit-Position: refs/heads/master@{#327873}
Diffstat (limited to 'components/pairing')
6 files changed, 18 insertions, 0 deletions
diff --git a/components/pairing/bluetooth_host_pairing_controller.cc b/components/pairing/bluetooth_host_pairing_controller.cc index 580d92f..c8246b1 100644 --- a/components/pairing/bluetooth_host_pairing_controller.cc +++ b/components/pairing/bluetooth_host_pairing_controller.cc @@ -87,6 +87,8 @@ void BluetoothHostPairingController::SendHostStatus() { host_status.set_api_version(kPairingAPIVersion); if (!enrollment_domain_.empty()) host_status.mutable_parameters()->set_domain(enrollment_domain_); + if (!permanent_id_.empty()) + host_status.mutable_parameters()->set_permanent_id(permanent_id_); // TODO(zork): Get these values from the UI. (http://crbug.com/405744) host_status.mutable_parameters()->set_connectivity( @@ -420,6 +422,11 @@ void BluetoothHostPairingController::OnEnrollmentStatusChanged( SendHostStatus(); } +void BluetoothHostPairingController::SetPermanentId( + const std::string& permanent_id) { + permanent_id_ = permanent_id; +} + void BluetoothHostPairingController::RequestPinCode( device::BluetoothDevice* device) { // Disallow unknown device. diff --git a/components/pairing/bluetooth_host_pairing_controller.h b/components/pairing/bluetooth_host_pairing_controller.h index 20ba506..1873935 100644 --- a/components/pairing/bluetooth_host_pairing_controller.h +++ b/components/pairing/bluetooth_host_pairing_controller.h @@ -71,6 +71,7 @@ class BluetoothHostPairingController std::string GetEnrollmentDomain() override; void OnUpdateStatusChanged(UpdateStatus update_status) override; void OnEnrollmentStatusChanged(EnrollmentStatus enrollment_status) override; + void SetPermanentId(const std::string& permanent_id) override; // ProtoDecoder::Observer: void OnHostStatusMessage(const pairing_api::HostStatus& message) override; @@ -102,6 +103,7 @@ class BluetoothHostPairingController std::string enrollment_domain_; UpdateStatus update_status_; EnrollmentStatus enrollment_status_; + std::string permanent_id_; scoped_refptr<device::BluetoothAdapter> adapter_; scoped_refptr<device::BluetoothSocket> service_socket_; diff --git a/components/pairing/fake_host_pairing_controller.cc b/components/pairing/fake_host_pairing_controller.cc index 25250d02..ebd7084 100644 --- a/components/pairing/fake_host_pairing_controller.cc +++ b/components/pairing/fake_host_pairing_controller.cc @@ -130,6 +130,10 @@ void FakeHostPairingController::OnEnrollmentStatusChanged( EnrollmentStatus enrollment_status) { } +void FakeHostPairingController::SetPermanentId( + const std::string& permanent_id) { +} + void FakeHostPairingController::PairingStageChanged(Stage new_stage) { switch (new_stage) { case STAGE_WAITING_FOR_CONTROLLER: { diff --git a/components/pairing/fake_host_pairing_controller.h b/components/pairing/fake_host_pairing_controller.h index 17d6884..fcca881 100644 --- a/components/pairing/fake_host_pairing_controller.h +++ b/components/pairing/fake_host_pairing_controller.h @@ -47,6 +47,7 @@ class FakeHostPairingController std::string GetEnrollmentDomain() override; void OnUpdateStatusChanged(UpdateStatus update_status) override; void OnEnrollmentStatusChanged(EnrollmentStatus enrollment_status) override; + void SetPermanentId(const std::string& permanent_id) override; // HostPairingController::Observer: void PairingStageChanged(Stage new_stage) override; diff --git a/components/pairing/host_pairing_controller.h b/components/pairing/host_pairing_controller.h index 731707a..b360d07 100644 --- a/components/pairing/host_pairing_controller.h +++ b/components/pairing/host_pairing_controller.h @@ -93,6 +93,9 @@ class HostPairingController { virtual void OnEnrollmentStatusChanged( EnrollmentStatus enrollment_status) = 0; + // Set the permanent id assigned during enrollment. + virtual void SetPermanentId(const std::string& permanent_id) = 0; + virtual void AddObserver(Observer* observer) = 0; virtual void RemoveObserver(Observer* observer) = 0; diff --git a/components/pairing/pairing_api.proto b/components/pairing/pairing_api.proto index 856feae..f0af859 100644 --- a/components/pairing/pairing_api.proto +++ b/components/pairing/pairing_api.proto @@ -38,6 +38,7 @@ message HostStatusParameters { optional UpdateStatus update_status = 3; optional EnrollmentStatus enrollment_status = 4; repeated string paired_controllers = 5; + optional string permanent_id = 6; } message HostStatus { |