// Copyright 2021 The Chromium Authors // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. #ifndef DEVICE_BLUETOOTH_BLUEZ_METRICS_RECORDER_H_ #define DEVICE_BLUETOOTH_BLUEZ_METRICS_RECORDER_H_ #include <optional> #include <string> namespace bluetooth { // Result types for ConnectToServiceInsecurely(). Numerical values are used for // metrics and should not be changed or reused. enum class ConnectToServiceInsecurelyResult { … }; // Failure reasons for connection failures. Numerical values are used for // metrics and should not be changed or reused. enum class ConnectToServiceFailureReason { … }; // Returns the ConnectToServiceInsecurelyResult type associated with // |error_string|, or null if no result could be found. std::optional<ConnectToServiceInsecurelyResult> ExtractResultFromErrorString( const std::string& error_string); // Returns the ConnectToServiceFailureReason type associated with // |error_string|. Returns |kReasonUnknown| if the error is not recognized. ConnectToServiceFailureReason ExtractFailureReasonFromErrorString( const std::string& error_string); void RecordConnectToServiceInsecurelyResult( ConnectToServiceInsecurelyResult result); void RecordConnectToServiceFailureReason(ConnectToServiceFailureReason reason); // Records a specific scenario in which we fail to connect to a remote device // that is considered to be bonded. void RecordBondedConnectToServiceFailureReason( ConnectToServiceFailureReason reason); } // namespace bluetooth #endif // DEVICE_BLUETOOTH_BLUEZ_METRICS_RECORDER_H_