Commit Graph
8 Commits
Author SHA1 Message Date
Janusz Sobczak 7a99b5e0a3 Specialize ExceptionOr<bool>
ExceptionOr<T>::ok() returns true if the value is set. This can be misleading
for boolean types.
ExceptionOr<bool> result = SomeFunction();
if (result.ok()) {
 if (result.result() {
  // Case 1: SomeFunction returned true
 } else {
  // Case 2: SomeFunction returned false
} else {
  // Case 3: SomeFunction returned an exception
}
It's easy to overlook case 2.
The specialized ExceptionOr<bool>::ok() returns false in Case 2, which allows
us to write:
if (result) {
 // SomeFunction returned true
} else {
 // SomeFunction returned false or an exception
 // result.GetException() can be used if we need to handle different exceptions
 // differenty
}

PiperOrigin-RevId: 544715641
2023-06-30 11:59:43 -07:00
Qin Wang 363d2a819e Pure refactor set/get functions in FastPairDevice
PiperOrigin-RevId: 533218929
2023-05-18 12:45:55 -07:00
Janusz Sobczak 013bf1f420 Add retroactive pairing
PiperOrigin-RevId: 531637311
2023-05-12 16:56:55 -07:00
Janusz Sobczak f1f15bd967 Use canonical MAC address in tests.
PiperOrigin-RevId: 531601021
2023-05-12 14:12:25 -07:00
Qin Wang 69f4feaf55 Add g3 implementation for BluetoothPairing
PiperOrigin-RevId: 530965844
2023-05-10 11:47:00 -07:00
Janusz Sobczak 4bd7da967a Add MessageStream fuzzing test
PiperOrigin-RevId: 518920458
2023-03-23 11:41:39 -07:00
Janusz Sobczak b2da1efbbf Parse events from message stream.
Adds parsing for standard events, everything except audio switch.

PiperOrigin-RevId: 518425430
2023-03-21 17:23:42 -07:00
Janusz Sobczak 02ffb5d45e Add Message Stream
Define MessageStream class for exchanging messages betweek the seeker and the
provider over rfcomm.

PiperOrigin-RevId: 516986541
2023-03-15 18:42:39 -07:00