-
Notifications
You must be signed in to change notification settings - Fork 40
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
10 changed files
with
253 additions
and
121 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,18 +1,31 @@ | ||
#pragma once | ||
|
||
#include "config.hpp" | ||
#include <functional> | ||
|
||
namespace ecode { | ||
|
||
class Bus { | ||
public: | ||
enum class State { None, Running, Closed }; | ||
|
||
typedef std::function<void( const char* bytes, size_t n )> ReadFn; | ||
|
||
State state() const; | ||
|
||
virtual bool start() = 0; | ||
|
||
virtual bool close() = 0; | ||
|
||
virtual void startAsyncRead( ReadFn readFn ) = 0; | ||
|
||
virtual size_t write( const char* buffer, const size_t& size ) = 0; | ||
|
||
protected: | ||
void setState( State state ); | ||
|
||
void onStateChanged( State state ); | ||
|
||
State mState{ State::None }; | ||
}; | ||
|
||
} // namespace ecode |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.