We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
Libhexabus provides you with an abstraction class to make the emulation of hexabus devices on a linux machine simple.
A hello world example could look like this:
#include <iostream> #include <boost/asio/io_service.hpp> #include <libhexabus/device.hpp> boost::asio::io_service io_service; std::string myDeviceName = "example"; std::string readDeviceName() { return myDeviceName; } void writeDeviceName(const std::string& name) { myDeviceName = name; } std::string helloWorld() { return "Hello, World!"; } int main() { hexabus::Device device(io_service, "eth1", "bbbb::1"); device.onReadName(&readDeviceName); device.onWriteName(&writeDeviceName); hexabus::EndpointRegistry ep_registry; hexabus::EndpointRegistry::const_iterator ep_it; ep_it = ep_registry.find(90); hexabus::TypedEndpointFunctions<std::string>::Ptr helloWorldEP = ep_it != ep_registry.end() ? hexabus::TypedEndpointFunctions<std::string>::fromEndpointDescriptor(ep_it->second) : hexabus::TypedEndpointFunctions<std::string>::Ptr(new hexabus::TypedEndpointFunctions<std::string>(90, "Hello World!")); helloWorldEP->onRead(&helloWorld); device.addEndpoint(helloWorldEP); io_service.run(); }