Commit dff47d94 authored by Kyle Horimoto's avatar Kyle Horimoto Committed by Commit Bot

[CrOS PhoneHub] Create NearbyInitiatorFailureType

This enum will be used to communicate potential failure types from a
Nearby Connections attempt to a PendingConnectionRequest for the
attempt.

Bug: 1106937
Change-Id: If78f7f314ceff98112b5ce8a558055baa55d6d8d
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2413305
Auto-Submit: Kyle Horimoto <khorimoto@chromium.org>
Reviewed-by: default avatarJames Vecore <vecore@google.com>
Commit-Queue: Kyle Horimoto <khorimoto@chromium.org>
Cr-Commit-Position: refs/heads/master@{#807942}
parent 9f84eb64
......@@ -104,6 +104,8 @@ static_library("secure_channel") {
"multiplexed_channel.h",
"multiplexed_channel_impl.cc",
"multiplexed_channel_impl.h",
"nearby_initiator_failure_type.cc",
"nearby_initiator_failure_type.h",
"pending_ble_connection_request_base.h",
"pending_ble_initiator_connection_request.cc",
"pending_ble_initiator_connection_request.h",
......
// Copyright 2020 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#include "chromeos/services/secure_channel/nearby_initiator_failure_type.h"
namespace chromeos {
namespace secure_channel {
std::ostream& operator<<(std::ostream& stream,
const NearbyInitiatorFailureType& failure_type) {
switch (failure_type) {
case NearbyInitiatorFailureType::kTimeoutDiscoveringDevice:
stream << "[Timeout discovering device]";
break;
case NearbyInitiatorFailureType::kNearbyApiError:
stream << "[Nearby API error]";
break;
case NearbyInitiatorFailureType::kConnectionRejected:
stream << "[Connection rejected]";
break;
case NearbyInitiatorFailureType::kConnectivityError:
stream << "[Connectivity error]";
break;
case NearbyInitiatorFailureType::kAuthenticationError:
stream << "[Authentication error]";
break;
}
return stream;
}
} // namespace secure_channel
} // namespace chromeos
// Copyright 2020 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#ifndef CHROMEOS_SERVICES_SECURE_CHANNEL_NEARBY_INITIATOR_FAILURE_TYPE_H_
#define CHROMEOS_SERVICES_SECURE_CHANNEL_NEARBY_INITIATOR_FAILURE_TYPE_H_
#include <ostream>
namespace chromeos {
namespace secure_channel {
enum class NearbyInitiatorFailureType {
// Could not detect a device nearby to initiate a connection within the
// timeout period.
kTimeoutDiscoveringDevice,
// An API call to Nearby Connections failed.
kNearbyApiError,
// The remote device rejected the connection attempt.
kConnectionRejected,
// Bluetooth or WebRTC connection failed.
kConnectivityError,
// A connection was formed successfully, but there was an error
// authenticating the connection.
kAuthenticationError,
};
std::ostream& operator<<(std::ostream& stream,
const NearbyInitiatorFailureType& failure_type);
} // namespace secure_channel
} // namespace chromeos
#endif // CHROMEOS_SERVICES_SECURE_CHANNEL_NEARBY_INITIATOR_FAILURE_TYPE_H_
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment