diff options
author | Russell Bryant <russell@russellbryant.com> | 2008-06-10 14:06:29 +0000 |
---|---|---|
committer | Russell Bryant <russell@russellbryant.com> | 2008-06-10 14:06:29 +0000 |
commit | 42c1e3601e58474efbd7081c6bfaafc0ea370a4f (patch) | |
tree | 09b6f1c8beeb38a06eabef0e249351347d1e4009 /include/asterisk/devicestate.h | |
parent | 51602928e3069889a0b9bcbe492b52bd969b772b (diff) |
Merge another change from team/russell/events
This commit breaks out some logic from pbx.c into a simple API. The hint
processing code had logic for taking the state from multiple devices and
turning that into the state for a single extension. So, I broke this out
and made an API that lets you take multiple device states and determine
the aggregate device state. I needed this for some core device state changes
to support distributed device state.
git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@121501 65c4cc65-6c06-0410-ace0-fbb531ad65f3
Diffstat (limited to 'include/asterisk/devicestate.h')
-rw-r--r-- | include/asterisk/devicestate.h | 48 |
1 files changed, 48 insertions, 0 deletions
diff --git a/include/asterisk/devicestate.h b/include/asterisk/devicestate.h index d52430301..69470a9f7 100644 --- a/include/asterisk/devicestate.h +++ b/include/asterisk/devicestate.h @@ -196,6 +196,54 @@ int ast_devstate_prov_add(const char *label, ast_devstate_prov_cb_type callback) */ int ast_devstate_prov_del(const char *label); +/*! + * \brief An object to hold state when calculating aggregate device state + */ +struct ast_devstate_aggregate; + +/*! + * \brief Initialize aggregate device state + * + * \arg agg the state object + * + * \return nothing + */ +void ast_devstate_aggregate_init(struct ast_devstate_aggregate *agg); + +/*! + * \brief Add a device state to the aggregate device state + * + * \arg agg the state object + * \arg state the state to add + * + * \return nothing + */ +void ast_devstate_aggregate_add(struct ast_devstate_aggregate *agg, enum ast_device_state state); + +/*! + * \brief Get the aggregate device state result + * + * \arg agg the state object + * + * \return the aggregate device state after adding some number of device states. + */ +enum ast_device_state ast_devstate_aggregate_result(struct ast_devstate_aggregate *agg); + +/*! + * \brief You shouldn't care about the contents of this struct + * + * This struct is only here so that it can be easily declared on the stack. + */ +struct ast_devstate_aggregate { + unsigned int all_unavail:1; + unsigned int all_busy:1; + unsigned int all_free:1; + unsigned int all_on_hold:1; + unsigned int busy:1; + unsigned int in_use:1; + unsigned int ring:1; +}; + #if defined(__cplusplus) || defined(c_plusplus) } #endif |