AudioManager
7.6.6
Native Application Runtime Environment
|
The am::CAmSocketHandler implements a mainloop for the AudioManager. More...
#include <CAmSocketHandler.h>
Public Member Functions | |
CAmSocketHandler () | |
~CAmSocketHandler () | |
am_Error_e | listenToSignals (const std::vector< uint8_t > &listSignals) |
install the signal fd More... | |
am_Error_e | addFDPoll (const int fd, const short event, std::function< void(const sh_pollHandle_t handle, void *userData)> prepare, std::function< void(const pollfd pollfd, const sh_pollHandle_t handle, void *userData)> fired, std::function< bool(const sh_pollHandle_t handle, void *userData)> check, std::function< bool(const sh_pollHandle_t handle, void *userData)> dispatch, void *userData, sh_pollHandle_t &handle) |
Adds a filedescriptor to the polling loop. More... | |
am_Error_e | addFDPoll (const int fd, const short event, IAmShPollPrepare *prepare, IAmShPollFired *fired, IAmShPollCheck *check, IAmShPollDispatch *dispatch, void *userData, sh_pollHandle_t &handle) |
Adds a filedescriptor to the polling loop. More... | |
am_Error_e | removeFDPoll (const sh_pollHandle_t handle) |
removes a filedescriptor from the poll loop More... | |
am_Error_e | updateEventFlags (const sh_pollHandle_t handle, const short events) |
updates the eventFlags of a poll More... | |
am_Error_e | addSignalHandler (std::function< void(const sh_pollHandle_t handle, const signalfd_siginfo &info, void *userData)> callback, sh_pollHandle_t &handle, void *userData) |
Adds a callback for any signals. More... | |
am_Error_e | removeSignalHandler (const sh_pollHandle_t handle) |
removes a signal handler from the list More... | |
am_Error_e | addTimer (const timespec &timeouts, IAmShTimerCallBack *callback, sh_timerHandle_t &handle, void *userData, const bool __attribute__((__unused__)) repeats=false) |
am_Error_e | addTimer (const timespec &timeouts, std::function< void(const sh_timerHandle_t handle, void *userData)> callback, sh_timerHandle_t &handle, void *userData, const bool __attribute__((__unused__)) repeats=false) |
am_Error_e | removeTimer (const sh_timerHandle_t handle) |
removes a timer from the list of timers More... | |
am_Error_e | restartTimer (const sh_timerHandle_t handle) |
restarts a timer with the original value More... | |
am_Error_e | updateTimer (const sh_timerHandle_t handle, const timespec &timeouts) |
restarts a timer and updates with a new interva More... | |
am_Error_e | stopTimer (const sh_timerHandle_t handle) |
stops a timer More... | |
void | start_listenting () |
start the block listening for filedescriptors. More... | |
void | stop_listening () |
exits the loop More... | |
void | exit_mainloop () |
bool | fatalErrorOccurred () |
The am::CAmSocketHandler implements a mainloop for the AudioManager.
Plugins and different parts of the AudioManager add their filedescriptors to the handler to get called on communication of the filedescriptors.
More information can be found here : Mainloop concept
Definition at line 216 of file CAmSocketHandler.h.
am::CAmSocketHandler::CAmSocketHandler | ( | ) |
Definition at line 45 of file CAmSocketHandler.cpp.
am::CAmSocketHandler::~CAmSocketHandler | ( | ) |
Definition at line 81 of file CAmSocketHandler.cpp.
am_Error_e am::CAmSocketHandler::addFDPoll | ( | const int | fd, |
const short | event, | ||
std::function< void(const sh_pollHandle_t handle, void *userData)> | prepare, | ||
std::function< void(const pollfd pollfd, const sh_pollHandle_t handle, void *userData)> | fired, | ||
std::function< bool(const sh_pollHandle_t handle, void *userData)> | check, | ||
std::function< bool(const sh_pollHandle_t handle, void *userData)> | dispatch, | ||
void * | userData, | ||
sh_pollHandle_t & | handle | ||
) |
Adds a filedescriptor to the polling loop.
fd | the filedescriptor |
event | the event flags |
prepare | a std::function that is called before the loop is entered |
fired | a std::function that is called when the filedescriptor needs to be read |
check | a std::function that is called to check if further actions are neccessary |
dispatch | a std::function that is called to dispatch the received data |
userData | a pointer to userdata that is always passed around |
handle | the handle of this poll |
Definition at line 353 of file CAmSocketHandler.cpp.
am::am_Error_e am::CAmSocketHandler::addFDPoll | ( | const int | fd, |
const short | event, | ||
IAmShPollPrepare * | prepare, | ||
IAmShPollFired * | fired, | ||
IAmShPollCheck * | check, | ||
IAmShPollDispatch * | dispatch, | ||
void * | userData, | ||
sh_pollHandle_t & | handle | ||
) |
Adds a filedescriptor to the polling loop.
fd | the filedescriptor |
event | the event flags |
prepare | a callback that is called before the loop is entered |
fired | a callback that is called when the filedescriptor needs to be read |
check | a callback that is called to check if further actions are neccessary |
dispatch | a callback that is called to dispatch the received data |
userData | a pointer to userdata that is always passed around |
handle | the handle of this poll |
Definition at line 399 of file CAmSocketHandler.cpp.
am_Error_e am::CAmSocketHandler::addSignalHandler | ( | std::function< void(const sh_pollHandle_t handle, const signalfd_siginfo &info, void *userData)> | callback, |
sh_pollHandle_t & | handle, | ||
void * | userData | ||
) |
Adds a callback for any signals.
callback | |
handle | the handle of this poll |
userData | a pointer to userdata that is always passed around |
Definition at line 448 of file CAmSocketHandler.cpp.
am_Error_e am::CAmSocketHandler::addTimer | ( | const timespec & | timeouts, |
IAmShTimerCallBack * | callback, | ||
sh_timerHandle_t & | handle, | ||
void * | userData, | ||
const bool __attribute__((__unused__)) | repeats = false |
||
) |
am_Error_e am::CAmSocketHandler::addTimer | ( | const timespec & | timeouts, |
std::function< void(const sh_timerHandle_t handle, void *userData)> | callback, | ||
sh_timerHandle_t & | handle, | ||
void * | userData, | ||
const bool __attribute__((__unused__)) | repeats = false |
||
) |
void am::CAmSocketHandler::exit_mainloop | ( | ) |
Definition at line 214 of file CAmSocketHandler.cpp.
bool am::CAmSocketHandler::fatalErrorOccurred | ( | ) |
Definition at line 224 of file CAmSocketHandler.cpp.
am_Error_e am::CAmSocketHandler::listenToSignals | ( | const std::vector< uint8_t > & | listSignals | ) |
install the signal fd
Adds a signal handler filedescriptor to the polling loop.
Definition at line 247 of file CAmSocketHandler.cpp.
am_Error_e am::CAmSocketHandler::removeFDPoll | ( | const sh_pollHandle_t | handle | ) |
removes a filedescriptor from the poll loop
handle |
Definition at line 424 of file CAmSocketHandler.cpp.
am_Error_e am::CAmSocketHandler::removeSignalHandler | ( | const sh_pollHandle_t | handle | ) |
removes a signal handler from the list
handle | is signal handler id |
Definition at line 470 of file CAmSocketHandler.cpp.
am_Error_e am::CAmSocketHandler::removeTimer | ( | const sh_timerHandle_t | handle | ) |
removes a timer from the list of timers
handle | the handle to the timer |
Definition at line 596 of file CAmSocketHandler.cpp.
am_Error_e am::CAmSocketHandler::restartTimer | ( | const sh_timerHandle_t | handle | ) |
restarts a timer with the original value
handle |
<the original timer value
Definition at line 720 of file CAmSocketHandler.cpp.
void am::CAmSocketHandler::start_listenting | ( | ) |
start the block listening for filedescriptors.
This is the mainloop.
<the polling array for ppoll
Definition at line 95 of file CAmSocketHandler.cpp.
void am::CAmSocketHandler::stop_listening | ( | ) |
exits the loop
Definition at line 198 of file CAmSocketHandler.cpp.
am_Error_e am::CAmSocketHandler::stopTimer | ( | const sh_timerHandle_t | handle | ) |
stops a timer
handle |
Definition at line 798 of file CAmSocketHandler.cpp.
am_Error_e am::CAmSocketHandler::updateEventFlags | ( | const sh_pollHandle_t | handle, |
const short | events | ||
) |
updates the eventFlags of a poll
handle | |
events |
Definition at line 841 of file CAmSocketHandler.cpp.
am_Error_e am::CAmSocketHandler::updateTimer | ( | const sh_timerHandle_t | handle, |
const timespec & | timeouts | ||
) |
restarts a timer and updates with a new interva
handle | handle to the timer |
timeouts | new timout time |
Definition at line 636 of file CAmSocketHandler.cpp.