AudioManager
7.5.11
Native Application Runtime Environment
|
The am::CAmSocketHandler implements a mainloop for the AudioManager. More...
#include <CAmSocketHandler.h>
Classes | |
class | TAmShPollCheck |
class | TAmShPollFired |
Public Member Functions | |
CAmSocketHandler () | |
~CAmSocketHandler () | |
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 | addTimer (const timespec timeouts, IAmShTimerCallBack *callback, sh_timerHandle_t &handle, void *userData) |
adds a timer to the list of timers. More... | |
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 () |
void | receiverCallback (const pollfd pollfd, const sh_pollHandle_t handle, void *userData) |
bool | checkerCallback (const sh_pollHandle_t handle, void *userData) |
Public Attributes | |
TAmShPollFired< CAmSocketHandler > | receiverCallbackT |
TAmShPollCheck< CAmSocketHandler > | checkerCallbackT |
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 94 of file CAmSocketHandler.h.
am::CAmSocketHandler::CAmSocketHandler | ( | ) |
Definition at line 39 of file CAmSocketHandler.cpp.
am::CAmSocketHandler::~CAmSocketHandler | ( | ) |
Definition at line 64 of file CAmSocketHandler.cpp.
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 195 of file CAmSocketHandler.cpp.
am_Error_e am::CAmSocketHandler::addTimer | ( | const timespec | timeouts, |
IAmShTimerCallBack * | callback, | ||
sh_timerHandle_t & | handle, | ||
void * | userData | ||
) |
adds a timer to the list of timers.
The callback will be fired when the timer is up. This is not a high precise timer, it is very coarse. It is meant to be used for timeouts when waiting for an answer via a filedescriptor. One time timer. If you need again a timer, you need to add a new timer in the callback of the old one.
timeouts | timeouts time until the callback is fired |
callback | callback the callback |
handle | handle the handle that is created for the timer is returned. Can be used to remove the timer |
userData | pointer always passed with the call |
Definition at line 272 of file CAmSocketHandler.cpp.
|
inline |
Definition at line 151 of file CAmSocketHandler.h.
void am::CAmSocketHandler::exit_mainloop | ( | ) |
Definition at line 558 of file CAmSocketHandler.cpp.
|
inline |
Definition at line 145 of file CAmSocketHandler.h.
am_Error_e am::CAmSocketHandler::removeFDPoll | ( | const sh_pollHandle_t | handle | ) |
removes a filedescriptor from the poll loop
handle |
Definition at line 244 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 321 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 399 of file CAmSocketHandler.cpp.
void am::CAmSocketHandler::start_listenting | ( | ) |
start the block listening for filedescriptors.
This is the mainloop.
Definition at line 74 of file CAmSocketHandler.cpp.
void am::CAmSocketHandler::stop_listening | ( | ) |
exits the loop
Definition at line 168 of file CAmSocketHandler.cpp.
am_Error_e am::CAmSocketHandler::stopTimer | ( | const sh_timerHandle_t | handle | ) |
stops a timer
handle |
Definition at line 451 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 472 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 347 of file CAmSocketHandler.cpp.
TAmShPollCheck<CAmSocketHandler> am::CAmSocketHandler::checkerCallbackT |
Definition at line 159 of file CAmSocketHandler.h.
TAmShPollFired<CAmSocketHandler> am::CAmSocketHandler::receiverCallbackT |
Definition at line 156 of file CAmSocketHandler.h.