Fix miscellaneous typos in the comments or logging.

PiperOrigin-RevId: 454649199
This commit is contained in:
hai007
2022-06-13 10:55:57 -07:00
committed by Copybara-Service
parent a852817f0e
commit 2d4cc75dfa
21 changed files with 35 additions and 35 deletions
+1 -1
View File
@@ -223,7 +223,7 @@ struct DLL_API DiscoveryListenerW {
// Called when a remote endpoint is discovered.
//
// endpoint_id - The ID of the remote endpoint that was discovered.
// endpoint_info - The info of the remote endpoint representd by ByteArray.
// endpoint_info - The info of the remote endpoint represented by ByteArray.
// service_id - The ID of the service advertised by the remote endpoint.
EndpointFoundCB endpoint_found_cb = DefaultConstructor;
@@ -132,12 +132,12 @@ BleAdvertisement::BleAdvertisement(bool fast_advertisement,
break;
default:
NEARBY_LOG(INFO,
"Cannot deserialize BleAdvertisement: uunsupported V1 PCP %d",
"Cannot deserialize BleAdvertisement: unsupported V1 PCP %d",
pcp_);
}
// The next 3 bytes are supposed to be the service_id_hash if not fast
// advertisment.
// advertisement.
if (!fast_advertisement_)
service_id_hash_ = base_input_stream.ReadBytes(kServiceIdHashLength);
@@ -161,12 +161,12 @@ BleAdvertisement::BleAdvertisement(bool fast_advertisement,
fast_advertisement_, expected_endpoint_info_length,
endpoint_info_.size());
// Clear enpoint_id for validity.
// Clear endpoint_id for validity.
endpoint_id_.clear();
return;
}
// The next 6 bytes are the bluetooth mac address if not fast advertisment.
// The next 6 bytes are the bluetooth mac address if not fast advertisement.
if (!fast_advertisement_) {
auto bluetooth_mac_address_bytes =
base_input_stream.ReadBytes(BluetoothUtils::kBluetoothMacAddressLength);
@@ -189,7 +189,7 @@ BleAdvertisement::BleAdvertisement(bool fast_advertisement,
"expected uwbAddress size to be %d bytes, got %" PRIu64,
expected_uwb_address_length, uwb_address_.size());
// Clear enpoint_id for validity.
// Clear endpoint_id for validity.
endpoint_id_.clear();
return;
}
@@ -107,7 +107,7 @@ BluetoothDeviceName::BluetoothDeviceName(
// The next 3 bytes are supposed to be the service_id_hash.
service_id_hash_ = base_input_stream.ReadBytes(kServiceIdHashLength);
// The next 1 byte is field containning WebRtc state.
// The next 1 byte is field containing WebRtc state.
auto field_byte = static_cast<char>(base_input_stream.ReadUint8());
web_rtc_state_ = (field_byte & kWebRtcConnectableFlagBitmask) == 1
? WebRtcState::kConnectable
@@ -129,7 +129,7 @@ BluetoothDeviceName::BluetoothDeviceName(
"endpoint info to be %d bytes, got %" PRIu64,
expected_endpoint_info_length, endpoint_info_.size());
// Clear enpoint_id for validadity.
// Clear endpoint_id for validity.
endpoint_id_.clear();
return;
}
@@ -150,7 +150,7 @@ BluetoothDeviceName::BluetoothDeviceName(
"expected uwbAddress size to be %d bytes, got %" PRIu64,
expected_uwb_address_length, uwb_address_.size());
// Clear enpoint_id for validadity.
// Clear endpoint_id for validity.
endpoint_id_.clear();
return;
}
+1 -1
View File
@@ -223,7 +223,7 @@ bool Ble::StopScanning(const std::string& service_id) {
MutexLock lock(&mutex_);
if (!IsScanningLocked(service_id)) {
NEARBY_LOGS(INFO) << "Can't turn off BLE sacanning because we never "
NEARBY_LOGS(INFO) << "Can't turn off BLE scanning because we never "
"started scanning.";
return false;
}
@@ -145,13 +145,13 @@ class BluetoothClassic {
// Returns true, if discoverability is enabled with TurnOnDiscoverability().
bool IsDiscoverable() const ABSL_EXCLUSIVE_LOCKS_REQUIRED(mutex_);
// Assignes a different name to BT adapter.
// Assigns a different name to BT adapter.
// Returns true if successful. Stores original device name.
bool ModifyDeviceName(const std::string& device_name)
ABSL_EXCLUSIVE_LOCKS_REQUIRED(mutex_);
// Changes current scan mode. This is an implementation of
// Turn<On/Off>Discoveradility() method. Stores original scan mode.
// Turn<On/Off>Discoverability() method. Stores original scan mode.
bool ModifyScanMode(ScanMode scan_mode) ABSL_EXCLUSIVE_LOCKS_REQUIRED(mutex_);
// Restores original device name (the one before the very first call to
+1 -1
View File
@@ -30,7 +30,7 @@
namespace location {
namespace nearby {
// Common Pipe implenentation.
// Common Pipe implementation.
// It does not depend on platform implementation, and this allows it to
// be used in the platform implementation itself.
// Concrete class must be derived from it, as follows:
+1 -1
View File
@@ -74,7 +74,7 @@ bool BleV2Medium::StartScanning(const Uuid& service_uuid,
// Clear the `peripherals_` after succeeded in StartScanning and before the
// advertisement_found callback has been reached. This prevents deleting the
// existing `peripherals_` if the scanning is not started successfully. If
// sanning is started successfully, we need to clear `peripherals_` to
// scanning is started successfully, we need to clear `peripherals_` to
// prevent the stale data in cache.
peripherals_.clear();
scanning_enabled_ = true;
+1 -1
View File
@@ -57,7 +57,7 @@ class BleV2Socket final {
// the BleSocket object is destroyed.
OutputStream& GetOutputStream() { return impl_->GetOutputStream(); }
// Sets the close notifier by cient side.
// Sets the close notifier by client side.
void SetCloseNotifier(std::function<void()> notifier) {
close_notifier_ = std::move(notifier);
}
+1 -1
View File
@@ -51,7 +51,7 @@ class CancellationFlag {
// The registration inserts the pointer of caller's listener callback into
// `listeners_`, a flat hash set which support the pointer type for hashing
// function. It conducts that 2 different pointers might point to the same
// callback function which is unusal and should avoid. Hence we make it as
// callback function which is unusual and should avoid. Hence we make it as
// private and use `CancellationFlagListener` as a RAII to wrap the function.
// The caller should register listener as lambda or std::function
// via `CancellationFlagListener`.
+2 -2
View File
@@ -30,7 +30,7 @@ struct Exception {
kInterrupted = 2, // Operation was interrupted.
kInvalidProtocolBuffer = 3, // Couldn't parse.
kExecution = 4, // Couldn't execute.
kTimeout = 5, // Operarion did not finish within specified time.
kTimeout = 5, // Operation did not finish within specified time.
kIllegalCharacters = 6, // File name or parent path contained
// illegal chars
};
@@ -79,7 +79,7 @@ class ExceptionOr {
: result_{result}, exception_{Exception::kSuccess} {} // NOLINT
ExceptionOr(Exception::Value exception) : exception_{exception} {} // NOLINT
ExceptionOr(Exception exception) : exception_{exception} {} // NOLINT
// If there exists explicit conversion from from U to T,
// If there exists explicit conversion from U to T,
// then allow explicit conversion from ExceptionOr<U> to ExceptionOr<T>.
template <typename U, typename = absl::void_t<decltype(T{std::declval<U>()})>>
explicit ExceptionOr<T>(ExceptionOr<U> value) {
+1 -1
View File
@@ -67,7 +67,7 @@ class FeatureFlags {
private:
FeatureFlags() = default;
// MediumEnvironment is testing uitl class. Use friend class here to enable
// MediumEnvironment is testing util class. Use friend class here to enable
// SetFlags for feature controlling need in test environment.
friend class MediumEnvironment;
void SetFlags(const Flags& flags) ABSL_LOCKS_EXCLUDED(mutex_) {
+1 -1
View File
@@ -49,7 +49,7 @@ class InputFile final {
// Returns Exception::kIo on error, or end of file.
ExceptionOr<ByteArray> Read(std::int64_t size);
// Returns a string that uniqely identifies this file.
// Returns a string that uniquely identifies this file.
std::string GetFilePath() const;
// Returns total size of this file in bytes.
+2 -2
View File
@@ -196,7 +196,7 @@ class BleV2Medium : public api::ble_v2::BleMedium {
BluetoothAdapter& GetAdapter() { return *adapter_; }
private:
// A concrete implemenation for GattServer.
// A concrete implementation for GattServer.
class GattServer : public api::ble_v2::GattServer {
public:
std::optional<api::ble_v2::GattCharacteristic> CreateCharacteristic(
@@ -213,7 +213,7 @@ class BleV2Medium : public api::ble_v2::BleMedium {
void Stop() override;
};
// A concrete implemenation for GattClient.
// A concrete implementation for GattClient.
class GattClient : public api::ble_v2::GattClient {
public:
bool DiscoverServiceAndCharacteristics(
@@ -95,7 +95,7 @@ class WifiHotspotMedium {
int port) = 0;
// Start a softAP as Hotspot with platform dependent APIs and set the
// SSID/password pair back to the credentials. BWU module will retieve these
// SSID/password pair back to the credentials. BWU module will retrieve these
// credentials and send to the client device through established channel and
// then client may connect to this Hotspot with these credentials.
virtual bool StartWifiHotspot(HotspotCredentials* hotspot_credentials) = 0;
@@ -203,7 +203,7 @@ bool BleV2Medium::StartScanning(const Uuid& service_uuid,
advertisement_received_token_ =
watcher_.Received({this, &BleV2Medium::AdvertisementReceivedHandler});
// Active mode indicates that scan request packes will be sent to query for
// Active mode indicates that scan request packets will be sent to query for
// Scan Response
watcher_.ScanningMode(BluetoothLEScanningMode::Active);
watcher_.Start();
@@ -36,7 +36,7 @@ namespace windows {
// https://docs.microsoft.com/en-us/uwp/api/windows.foundation.iasyncoperation-1?view=winrt-20348
using winrt::Windows::Foundation::IAsyncOperation;
// The result of an Rfcomm device service request.
// The result of a Rfcomm device service request.
// https://docs.microsoft.com/en-us/uwp/api/windows.devices.bluetooth.rfcomm.rfcommdeviceservicesresult?view=winrt-20348
using winrt::Windows::Devices::Bluetooth::Rfcomm::RfcommDeviceServicesResult;
@@ -115,7 +115,7 @@ class WifiMedium : public api::WifiMedium {
private:
// Since the WiFi interface capability won't change in the connection session,
// we only need to querry it once at the beginning
// we only need to query it once at the beginning
void InitCapability();
bool wifi_interface_valid_;
@@ -229,7 +229,7 @@ class WifiHotspotMedium : public api::WifiHotspotMedium {
std::unique_ptr<api::WifiHotspotServerSocket> ListenForService(
int port) override;
// Advertiser start WiFi Hotspot with specific Crendentials
// Advertiser start WiFi Hotspot with specific Credentials.
bool StartWifiHotspot(HotspotCredentials* hotspot_credentials_) override;
// Advertiser stop the current WiFi Hotspot
bool StopWifiHotspot() override;
+6 -6
View File
@@ -104,7 +104,7 @@ class MediumEnvironment {
// If enabled_notifications is false, future event notifications will not be
// sent to registered instances. This is useful for protocol shutdown,
// where we no longer care about notifications, and where notifications may
// otherwise be delivered after the notification source or target lifeteme has
// otherwise be delivered after the notification source or target lifetime has
// ended, and cause undefined behavior.
void Sync(bool enable_notifications = true);
@@ -116,7 +116,7 @@ class MediumEnvironment {
api::BluetoothAdapter::ScanMode mode);
// Adds medium-related info to allow for adapter discovery to work.
// This provides acccess to this medium from other mediums, when protocol
// This provides access to this medium from other mediums, when protocol
// expects they should communicate.
void RegisterBluetoothMedium(api::BluetoothClassicMedium& medium,
api::BluetoothAdapter& medium_adapter);
@@ -169,7 +169,7 @@ class MediumEnvironment {
absl::Duration GetPeerConnectionLatency();
// Adds medium-related info to allow for scanning/advertising to work.
// This provides acccess to this medium from other mediums, when protocol
// This provides access to this medium from other mediums, when protocol
// expects they should communicate.
void RegisterBleMedium(api::BleMedium& medium);
@@ -209,7 +209,7 @@ class MediumEnvironment {
const std::string& service_id);
// Adds medium-related info to allow for scanning/advertising to work.
// This provides acccess to this medium from other mediums, when protocol
// This provides access to this medium from other mediums, when protocol
// expects they should communicate.
// The registered `medium` must refer to a valid instance that outlives this
// object.
@@ -262,7 +262,7 @@ class MediumEnvironment {
void UnregisterBleV2Medium(api::ble_v2::BleMedium& mediumum);
// Adds medium-related info to allow for discovery/advertising to work.
// This provides acccess to this medium from other mediums, when protocol
// This provides access to this medium from other mediums, when protocol
// expects they should communicate.
void RegisterWifiLanMedium(api::WifiLanMedium& medium);
@@ -295,7 +295,7 @@ class MediumEnvironment {
api::WifiLanMedium* GetWifiLanMedium(const std::string& ip_address, int port);
// Adds medium-related info to allow for start/connect Hotspot to work.
// This provides acccess to this medium from other mediums, when protocol
// This provides access to this medium from other mediums, when protocol
// expects they should communicate.
void RegisterWifiHotspotMedium(api::WifiHotspotMedium& medium);
+1 -1
View File
@@ -96,7 +96,7 @@ class WifiHotspotSocket final {
std::shared_ptr<api::WifiHotspotSocket> impl_;
};
// Server socket class for SoftAP when it listen to connection request
// Server socket class for SoftAP when it listens to connection request.
class WifiHotspotServerSocket final {
public:
WifiHotspotServerSocket() = default;
+1 -1
View File
@@ -198,7 +198,7 @@ class WifiLanMedium {
// this Medium
if (impl_ == nullptr) return false;
// A network connection to a primary router exist, also implied that HW is
// exist and enabled
// existed and enabled.
return impl_->IsNetworkConnected();
}