aboutsummaryrefslogtreecommitdiffstats
path: root/include
diff options
context:
space:
mode:
Diffstat (limited to 'include')
-rw-r--r--include/asterisk.h1
-rw-r--r--include/asterisk/devicestate.h40
-rw-r--r--include/asterisk/event_defs.h26
-rw-r--r--include/asterisk/pbx.h2
4 files changed, 39 insertions, 30 deletions
diff --git a/include/asterisk.h b/include/asterisk.h
index bdd59402e..6e20c16a9 100644
--- a/include/asterisk.h
+++ b/include/asterisk.h
@@ -87,6 +87,7 @@ void dnsmgr_start_refresh(void); /*!< Provided by dnsmgr.c */
int dnsmgr_reload(void); /*!< Provided by dnsmgr.c */
void threadstorage_init(void); /*!< Provided by threadstorage.c */
void ast_event_init(void); /*!< Provided by event.c */
+int ast_device_state_engine_init(void); /*!< Provided by devicestate.c */
/* Many headers need 'ast_channel' to be defined */
struct ast_channel;
diff --git a/include/asterisk/devicestate.h b/include/asterisk/devicestate.h
index dd7b939be..b13547a16 100644
--- a/include/asterisk/devicestate.h
+++ b/include/asterisk/devicestate.h
@@ -19,6 +19,18 @@
/*! \file
* \brief Device state management
*
+ * To subscribe to device state changes, use the generic ast_event_subscribe
+ * method. For an example, see apps/app_queue.c.
+ *
+ * \todo Currently, when the state of a device changes, the device state provider
+ * calls one of the functions defined here to queue an object to say that the
+ * state of a device has changed. However, this does not include the new state.
+ * Another thread processes these device state change objects and calls the
+ * device state provider's callback to figure out what the new state is. It
+ * would make a lot more sense for the new state to be included in the original
+ * function call that says the state of a device has changed. However, it
+ * will take a lot of work to change this.
+ *
* \arg See \ref AstExtState
*/
@@ -29,7 +41,11 @@
extern "C" {
#endif
-/*! Device States */
+/*! Device States
+ * \note The order of these states may not change because they are included
+ * in Asterisk events which may be transmitted across the network to
+ * other servers.
+ */
enum ast_device_state {
AST_DEVICE_UNKNOWN, /*!< Device is valid but channel didn't know state */
AST_DEVICE_NOT_INUSE, /*!< Device is not used */
@@ -42,9 +58,6 @@ enum ast_device_state {
AST_DEVICE_ONHOLD, /*!< Device is on hold */
};
-/*! \brief Devicestate watcher call back */
-typedef int (*ast_devstate_cb_type)(const char *dev, enum ast_device_state state, void *data);
-
/*! \brief Devicestate provider call back */
typedef enum ast_device_state (*ast_devstate_prov_cb_type)(const char *data);
@@ -93,7 +106,6 @@ enum ast_device_state ast_device_state(const char *device);
int ast_device_state_changed(const char *fmt, ...)
__attribute__ ((format (printf, 1, 2)));
-
/*! \brief Tells Asterisk the State for Device is changed
* \param device devicename like a dialstring
* Asterisk polls the new extensionstates and calls the registered
@@ -102,22 +114,6 @@ int ast_device_state_changed(const char *fmt, ...)
*/
int ast_device_state_changed_literal(const char *device);
-/*! \brief Registers a device state change callback
- * \param callback Callback
- * \param data to pass to callback
- * The callback is called if the state for extension is changed
- * Return -1 on failure, ID on success
- */
-int ast_devstate_add(ast_devstate_cb_type callback, void *data);
-
-/*! \brief Unregisters a device state change callback
- * \param callback Callback
- * \param data to pass to callback
- * The callback is called if the state for extension is changed
- * Return -1 on failure, ID on success
- */
-void ast_devstate_del(ast_devstate_cb_type callback, void *data);
-
/*! \brief Add device state provider
* \param label to use in hint, like label:object
* \param callback Callback
@@ -132,8 +128,6 @@ int ast_devstate_prov_add(const char *label, ast_devstate_prov_cb_type callback)
*/
int ast_devstate_prov_del(const char *label);
-int ast_device_state_engine_init(void);
-
#if defined(__cplusplus) || defined(c_plusplus)
}
#endif
diff --git a/include/asterisk/event_defs.h b/include/asterisk/event_defs.h
index b1e27c981..2627bae8d 100644
--- a/include/asterisk/event_defs.h
+++ b/include/asterisk/event_defs.h
@@ -37,13 +37,15 @@ enum ast_event_type {
unique to the event itself, not necessarily across all events. */
AST_EVENT_CUSTOM = 0x01,
/*! Voicemail message waiting indication */
- AST_EVENT_MWI = 0x02,
+ AST_EVENT_MWI = 0x02,
/*! Someone has subscribed to events */
- AST_EVENT_SUB = 0x03,
+ AST_EVENT_SUB = 0x03,
/*! Someone has unsubscribed from events */
- AST_EVENT_UNSUB = 0x04,
+ AST_EVENT_UNSUB = 0x04,
+ /*! The state of a device has changed */
+ AST_EVENT_DEVICE_STATE = 0x05,
/*! Number of event types. This should be the last event type + 1 */
- AST_EVENT_TOTAL = 0x05,
+ AST_EVENT_TOTAL = 0x06,
};
/*! \brief Event Information Element types */
@@ -82,11 +84,25 @@ enum ast_event_ie_type {
*/
AST_EVENT_IE_EVENTTYPE = 0x05,
/*!
- * \brief Hint that someone cares than an IE exists
+ * \brief Hint that someone cares that an IE exists
* Used by: AST_EVENT_SUB
* Payload type: UINT (ast_event_ie_type)
*/
AST_EVENT_IE_EXISTS = 0x06,
+ /*!
+ * \brief Device Name
+ * Used by AST_EVENT_DEVICE_STATE
+ * Payload type: STR
+ */
+ AST_EVENT_IE_DEVICE = 0x07,
+ /*!
+ * \brief Generic State IE
+ * Used by AST_EVENT_DEVICE_STATE
+ * Payload type: UINT
+ * The actual state values depend on the event which
+ * this IE is a part of.
+ */
+ AST_EVENT_IE_STATE = 0x08,
};
/*!
diff --git a/include/asterisk/pbx.h b/include/asterisk/pbx.h
index 2759b36d1..e7468c6ef 100644
--- a/include/asterisk/pbx.h
+++ b/include/asterisk/pbx.h
@@ -877,8 +877,6 @@ int ast_func_read(struct ast_channel *chan, const char *function, char *workspac
*/
int ast_func_write(struct ast_channel *chan, const char *function, const char *value);
-void ast_hint_state_changed(const char *device);
-
#if defined(__cplusplus) || defined(c_plusplus)
}
#endif