Roll forward to cl/338482889

Signed-off-by: Alexey Polyudov <apolyudov@google.com>
Change-Id: Ic2bdb234e89f3c5860d1b483dd4bce689f13d057
This commit is contained in:
Alexey Polyudov
2020-10-22 11:30:33 -07:00
parent 13f8fddfde
commit ce4807935e
564 changed files with 13720 additions and 48704 deletions
+30 -13
View File
@@ -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