34 #include <boost/python.hpp>
35namespace bp = boost::python;
39rpr::ApplicationPtr rpr::Application::create() {
40 rpr::ApplicationPtr r = std::make_shared<rpr::Application>();
44void rpr::Application::setup_python() {
47 bp::class_<rpr::Application, rpr::ApplicationPtr, bp::bases<ris::Master, ris::Slave>, boost::noncopyable>(
51 bp::implicitly_convertible<rpr::ApplicationPtr, ris::MasterPtr>();
52 bp::implicitly_convertible<rpr::ApplicationPtr, ris::SlavePtr>();
57rpr::Application::Application() {}
60rpr::Application::~Application() {
65void rpr::Application::stop() {
67 if (threadEn_.exchange(
false) && thread_ !=
nullptr) {
72 rpr::ControllerPtr cntl = cntl_.lock();
73 if (cntl) cntl->stopQueue();
81void rpr::Application::setController(rpr::ControllerPtr cntl) {
86 thread_ =
new std::thread(&rpr::Application::runThread,
this);
90 pthread_setname_np(thread_->native_handle(),
"RssiApp");
95ris::FramePtr rpr::Application::acceptReq(uint32_t size,
bool zeroCopyEn) {
96 rpr::ControllerPtr cntl = cntl_.lock();
98 return (cntl->reqFrame(size));
103 rpr::ControllerPtr cntl = cntl_.lock();
104 if (cntl) cntl->applicationRx(frame);
108void rpr::Application::runThread() {
110 Logging log(
"rssi.Application");
114 rpr::ControllerPtr cntl = cntl_.lock();
116 frame = cntl->applicationTx();
118 if (frame) sendFrame(frame);
static GeneralError create(std::string src, const char *fmt,...)
Creates a formatted error instance.
RAII helper that releases the Python GIL for a scope.
Structured Rogue logging helper.
std::shared_ptr< rogue::interfaces::stream::Frame > FramePtr
Shared pointer alias for Frame.