mirror of
https://github.com/asterisk/asterisk.git
synced 2026-06-09 03:45:27 +00:00
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
This commit is contained in:
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user