mirror of
https://github.com/kidfromjupiter/nearby.git
synced 2026-09-16 15:36:12 -04:00
Roll forward to cl/338482889
Signed-off-by: Alexey Polyudov <apolyudov@google.com> Change-Id: Ic2bdb234e89f3c5860d1b483dd4bce689f13d057
This commit is contained in:
+30
-13
@@ -19,24 +19,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
|
||||
|
||||
Reference in New Issue
Block a user