Roll forward to cl/338482889

Signed-off-by: Alexey Polyudov <apolyudov@google.com>
Change-Id: I9850950db8bd84f0904ea1a413151887f52098cf
This commit is contained in:
Alexey Polyudov
2020-10-22 10:47:34 -07:00
parent d68e53cf03
commit 2155b3ddeb
542 changed files with 15219 additions and 42295 deletions
+30 -13
View File
@@ -5,24 +5,41 @@ namespace location {
namespace nearby {
namespace connections {
// Protocol operation result: kSuccess, if operation was successful;
// descriptive error code otherwise.
struct Status {
// Status is a struct, so it is possible to pass some context about failure,
// by adding extra fields to it when necessary, and not change any of the
// method signatures.
enum Value {
SUCCESS,
ERROR,
OUT_OF_ORDER_API_CALL,
ALREADY_HAVE_ACTIVE_STRATEGY,
ALREADY_ADVERTISING,
ALREADY_DISCOVERING,
ENDPOINT_IO_ERROR,
ENDPOINT_UNKNOWN,
CONNECTION_REJECTED,
ALREADY_CONNECTED_TO_ENDPOINT,
NOT_CONNECTED_TO_ENDPOINT,
BLUETOOTH_ERROR,
PAYLOAD_UNKNOWN,
kSuccess,
kError,
kOutOfOrderApiCall,
kAlreadyHaveActiveStrategy,
kAlreadyAdvertising,
kAlreadyDiscovering,
kEndpointIoError,
kEndpointUnknown,
kConnectionRejected,
kAlreadyConnectedToEndpoint,
kNotConnectedToEndpoint,
kBluetoothError,
kBleError,
kWifiLanError,
kPayloadUnknown,
};
Value value {kError};
bool Ok() const { return value == kSuccess; }
};
inline bool operator==(const Status& a, const Status& b) {
return a.value == b.value;
}
inline bool operator!=(const Status& a, const Status& b) {
return !(a == b);
}
} // namespace connections
} // namespace nearby
} // namespace location