From 01205e6c626677993322a481beec2a038bf8be57 Mon Sep 17 00:00:00 2001 From: zork Date: Thu, 30 Apr 2015 20:20:13 -0700 Subject: Add permanent_id to pairing protocol. BUG=483304 Review URL: https://codereview.chromium.org/1118173002 Cr-Commit-Position: refs/heads/master@{#327873} --- components/pairing/bluetooth_host_pairing_controller.cc | 7 +++++++ components/pairing/bluetooth_host_pairing_controller.h | 2 ++ components/pairing/fake_host_pairing_controller.cc | 4 ++++ components/pairing/fake_host_pairing_controller.h | 1 + components/pairing/host_pairing_controller.h | 3 +++ components/pairing/pairing_api.proto | 1 + 6 files changed, 18 insertions(+) (limited to 'components/pairing') 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 adapter_; scoped_refptr 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 { -- cgit v1.1