gs-common/modem: clock manager interface
A lot of modem code requires sleeping while vendor services do some background processing. Since we don't want to actually sleep for unit tests, an interface is provided here so that a fake sleep can be injected. Test: N/A. Directly forwards methods or does nothing. Bug: 302435001 Change-Id: I3bcf0307156d93756d69cd9f749c88b508ba9466
This commit is contained in:
parent
047f0aca49
commit
0944a8db52
7 changed files with 111 additions and 0 deletions
28
modem/clock_manager/include/clock_manager.h
Normal file
28
modem/clock_manager/include/clock_manager.h
Normal file
|
@ -0,0 +1,28 @@
|
|||
#pragma once
|
||||
|
||||
#include <cstddef>
|
||||
|
||||
namespace pixel_modem {
|
||||
|
||||
/**
|
||||
* @brief Interface for time based operations.
|
||||
*
|
||||
* This interface was intentionally not called `Clock`, like the Java side
|
||||
* counterpart since it's likely that clients would call the local variable
|
||||
* `clock(_)`, which would clash with the C defined `clock` method.
|
||||
*/
|
||||
struct ClockManager {
|
||||
virtual ~ClockManager() = default;
|
||||
|
||||
/**
|
||||
* @brief Sleep the thread for a given number of seconds.
|
||||
*
|
||||
* @param seconds Minimum number of seconds to sleep for. Note, this is
|
||||
* different than the Java android clock which accepts seconds. This was done
|
||||
* because C++ developers are likely more familiar with the `sleep` command,
|
||||
* which accepts seconds.
|
||||
*/
|
||||
virtual void Sleep(size_t seconds) const = 0;
|
||||
};
|
||||
|
||||
} // namespace pixel_modem
|
Loading…
Add table
Add a link
Reference in a new issue