[svn-commits] dvossel: branch 1.4 r204755 - in /branches/1.4: include/asterisk/ main/

SVN commits to the Digium repositories svn-commits at lists.digium.com
Thu Jul 2 13:15:42 CDT 2009


Author: dvossel
Date: Thu Jul  2 13:15:39 2009
New Revision: 204755

URL: http://svn.asterisk.org/svn-view/asterisk?view=rev&rev=204755
Log:
moving device state functions from pbx.h to devicestate.h to sync with other branches

Modified:
    branches/1.4/include/asterisk/devicestate.h
    branches/1.4/include/asterisk/pbx.h
    branches/1.4/main/devicestate.c
    branches/1.4/main/pbx.c

Modified: branches/1.4/include/asterisk/devicestate.h
URL: http://svn.asterisk.org/svn-view/asterisk/branches/1.4/include/asterisk/devicestate.h?view=diff&rev=204755&r1=204754&r2=204755
==============================================================================
--- branches/1.4/include/asterisk/devicestate.h (original)
+++ branches/1.4/include/asterisk/devicestate.h Thu Jul  2 13:15:39 2009
@@ -118,6 +118,64 @@
  */ 
 void 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
+ *
+ * \param[in] 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
+ *
+ * \param[in] agg the state object
+ * \param[in] 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
+ *
+ * \param[in] 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 Map devstate to an extension state.
+ *
+ * \param[in] device state
+ *
+ * \return the extension state mapping.
+ */
+enum ast_extension_states ast_devstate_to_extenstate(enum ast_device_state devstate);
+
+/*!
+ * \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_unknown:1;
+	unsigned int on_hold:1;
+	unsigned int busy:1;
+	unsigned int in_use:1;
+	unsigned int ring:1;
+};
+
 int ast_device_state_engine_init(void);
 
 #if defined(__cplusplus) || defined(c_plusplus)

Modified: branches/1.4/include/asterisk/pbx.h
URL: http://svn.asterisk.org/svn-view/asterisk/branches/1.4/include/asterisk/pbx.h?view=diff&rev=204755&r1=204754&r2=204755
==============================================================================
--- branches/1.4/include/asterisk/pbx.h (original)
+++ branches/1.4/include/asterisk/pbx.h Thu Jul  2 13:15:39 2009
@@ -306,64 +306,6 @@
  */
 int ast_unregister_application(const char *app);
 
-/*!
- * \brief An object to hold state when calculating aggregate device state
- */
-struct ast_devstate_aggregate;
-
-/*!
- * \brief Initialize aggregate device state
- *
- * \param[in] 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
- *
- * \param[in] agg the state object
- * \param[in] 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
- *
- * \param[in] 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 Map devstate to an extension state.
- *
- * \param[in] device state
- *
- * \return the extension state mapping.
- */
-enum ast_extension_states ast_devstate_to_extenstate(enum ast_device_state devstate);
-
-/*!
- * \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_unknown:1;
-	unsigned int on_hold:1;
-	unsigned int busy:1;
-	unsigned int in_use:1;
-	unsigned int ring:1;
-};
-
 /*! 
  * \brief Uses hint and devicestate callback to get the state of an extension
  *

Modified: branches/1.4/main/devicestate.c
URL: http://svn.asterisk.org/svn-view/asterisk/branches/1.4/main/devicestate.c?view=diff&rev=204755&r1=204754&r2=204755
==============================================================================
--- branches/1.4/main/devicestate.c (original)
+++ branches/1.4/main/devicestate.c Thu Jul  2 13:15:39 2009
@@ -367,3 +367,116 @@
 
 	return 0;
 }
+
+void ast_devstate_aggregate_init(struct ast_devstate_aggregate *agg)
+{
+	memset(agg, 0, sizeof(*agg));
+	agg->all_unknown = 1;
+	agg->all_unavail = 1;
+	agg->all_busy = 1;
+	agg->all_free = 1;
+}
+
+void ast_devstate_aggregate_add(struct ast_devstate_aggregate *agg, enum ast_device_state state)
+{
+	switch (state) {
+	case AST_DEVICE_NOT_INUSE:
+		agg->all_unknown = 0;
+		agg->all_unavail = 0;
+		agg->all_busy = 0;
+		break;
+	case AST_DEVICE_INUSE:
+		agg->in_use = 1;
+		agg->all_unavail = 0;
+		agg->all_free = 0;
+		agg->all_unknown = 0;
+		break;
+	case AST_DEVICE_RINGING:
+		agg->ring = 1;
+		agg->all_unavail = 0;
+		agg->all_free = 0;
+		agg->all_unknown = 0;
+		break;
+	case AST_DEVICE_RINGINUSE:
+		agg->in_use = 1;
+		agg->ring = 1;
+		agg->all_unavail = 0;
+		agg->all_free = 0;
+		agg->all_unknown = 0;
+		break;
+	case AST_DEVICE_ONHOLD:
+		agg->all_unknown = 0;
+		agg->all_unavail = 0;
+		agg->all_free = 0;
+		agg->on_hold = 1;
+		break;
+	case AST_DEVICE_BUSY:
+		agg->all_unknown = 0;
+		agg->all_unavail = 0;
+		agg->all_free = 0;
+		agg->busy = 1;
+		agg->in_use = 1;
+		break;
+	case AST_DEVICE_UNAVAILABLE:
+		agg->all_unknown = 0;
+	case AST_DEVICE_INVALID:
+		agg->all_busy = 0;
+		agg->all_free = 0;
+		break;
+	case AST_DEVICE_UNKNOWN:
+		agg->all_busy = 0;
+		agg->all_free = 0;
+		break;
+	case AST_DEVICE_TOTAL: /* not a device state, included for completeness. */
+		break;
+	}
+}
+
+enum ast_extension_states ast_devstate_to_extenstate(enum ast_device_state devstate)
+{
+	switch (devstate) {
+	case AST_DEVICE_ONHOLD:
+		return AST_EXTENSION_ONHOLD;
+	case AST_DEVICE_BUSY:
+		return AST_EXTENSION_BUSY;
+	case AST_DEVICE_UNAVAILABLE:
+	case AST_DEVICE_UNKNOWN:
+	case AST_DEVICE_INVALID:
+		return AST_EXTENSION_UNAVAILABLE;
+	case AST_DEVICE_RINGINUSE:
+		return (AST_EXTENSION_INUSE | AST_EXTENSION_RINGING);
+	case AST_DEVICE_RINGING:
+		return AST_EXTENSION_RINGING;
+	case AST_DEVICE_INUSE:
+		return AST_EXTENSION_INUSE;
+	case AST_DEVICE_NOT_INUSE:
+		return AST_EXTENSION_NOT_INUSE;
+	case AST_DEVICE_TOTAL: /* not a device state, included for completeness */
+		break;
+	}
+
+	return AST_EXTENSION_NOT_INUSE;
+}
+enum ast_device_state ast_devstate_aggregate_result(struct ast_devstate_aggregate *agg)
+{
+	if (agg->all_free)
+		return AST_DEVICE_NOT_INUSE;
+	if ((agg->in_use || agg->on_hold) && agg->ring)
+		return AST_DEVICE_RINGINUSE;
+	if (agg->ring)
+		return AST_DEVICE_RINGING;
+	if (agg->busy)
+		return AST_DEVICE_BUSY;
+	if (agg->in_use)
+		return AST_DEVICE_INUSE;
+	if (agg->on_hold)
+		return AST_DEVICE_ONHOLD;
+	if (agg->all_busy)
+		return AST_DEVICE_BUSY;
+	if (agg->all_unknown)
+		return AST_DEVICE_UNKNOWN;
+	if (agg->all_unavail)
+		return AST_DEVICE_UNAVAILABLE;
+
+	return AST_DEVICE_NOT_INUSE;
+}

Modified: branches/1.4/main/pbx.c
URL: http://svn.asterisk.org/svn-view/asterisk/branches/1.4/main/pbx.c?view=diff&rev=204755&r1=204754&r2=204755
==============================================================================
--- branches/1.4/main/pbx.c (original)
+++ branches/1.4/main/pbx.c Thu Jul  2 13:15:39 2009
@@ -1912,119 +1912,6 @@
 	ast_unlock_contexts();
 
 	return e;
-}
-
-void ast_devstate_aggregate_init(struct ast_devstate_aggregate *agg)
-{
-	memset(agg, 0, sizeof(*agg));
-	agg->all_unknown = 1;
-	agg->all_unavail = 1;
-	agg->all_busy = 1;
-	agg->all_free = 1;
-}
-
-void ast_devstate_aggregate_add(struct ast_devstate_aggregate *agg, enum ast_device_state state)
-{
-	switch (state) {
-	case AST_DEVICE_NOT_INUSE:
-		agg->all_unknown = 0;
-		agg->all_unavail = 0;
-		agg->all_busy = 0;
-		break;
-	case AST_DEVICE_INUSE:
-		agg->in_use = 1;
-		agg->all_unavail = 0;
-		agg->all_free = 0;
-		agg->all_unknown = 0;
-		break;
-	case AST_DEVICE_RINGING:
-		agg->ring = 1;
-		agg->all_unavail = 0;
-		agg->all_free = 0;
-		agg->all_unknown = 0;
-		break;
-	case AST_DEVICE_RINGINUSE:
-		agg->in_use = 1;
-		agg->ring = 1;
-		agg->all_unavail = 0;
-		agg->all_free = 0;
-		agg->all_unknown = 0;
-		break;
-	case AST_DEVICE_ONHOLD:
-		agg->all_unknown = 0;
-		agg->all_unavail = 0;
-		agg->all_free = 0;
-		agg->on_hold = 1;
-		break;
-	case AST_DEVICE_BUSY:
-		agg->all_unknown = 0;
-		agg->all_unavail = 0;
-		agg->all_free = 0;
-		agg->busy = 1;
-		agg->in_use = 1;
-		break;
-	case AST_DEVICE_UNAVAILABLE:
-		agg->all_unknown = 0;
-	case AST_DEVICE_INVALID:
-		agg->all_busy = 0;
-		agg->all_free = 0;
-		break;
-	case AST_DEVICE_UNKNOWN:
-		agg->all_busy = 0;
-		agg->all_free = 0;
-		break;
-	case AST_DEVICE_TOTAL: /* not a device state, included for completeness. */
-		break;
-	}
-}
-
-enum ast_extension_states ast_devstate_to_extenstate(enum ast_device_state devstate)
-{
-	switch (devstate) {
-	case AST_DEVICE_ONHOLD:
-		return AST_EXTENSION_ONHOLD;
-	case AST_DEVICE_BUSY:
-		return AST_EXTENSION_BUSY;
-	case AST_DEVICE_UNAVAILABLE:
-	case AST_DEVICE_UNKNOWN:
-	case AST_DEVICE_INVALID:
-		return AST_EXTENSION_UNAVAILABLE;
-	case AST_DEVICE_RINGINUSE:
-		return (AST_EXTENSION_INUSE | AST_EXTENSION_RINGING);
-	case AST_DEVICE_RINGING:
-		return AST_EXTENSION_RINGING;
-	case AST_DEVICE_INUSE:
-		return AST_EXTENSION_INUSE;
-	case AST_DEVICE_NOT_INUSE:
-		return AST_EXTENSION_NOT_INUSE;
-	case AST_DEVICE_TOTAL: /* not a device state, included for completeness */
-		break;
-	}
-
-	return AST_EXTENSION_NOT_INUSE;
-}
-enum ast_device_state ast_devstate_aggregate_result(struct ast_devstate_aggregate *agg)
-{
-	if (agg->all_free)
-		return AST_DEVICE_NOT_INUSE;
-	if ((agg->in_use || agg->on_hold) && agg->ring)
-		return AST_DEVICE_RINGINUSE;
-	if (agg->ring)
-		return AST_DEVICE_RINGING;
-	if (agg->busy)
-		return AST_DEVICE_BUSY;
-	if (agg->in_use)
-		return AST_DEVICE_INUSE;
-	if (agg->on_hold)
-		return AST_DEVICE_ONHOLD;
-	if (agg->all_busy)
-		return AST_DEVICE_BUSY;
-	if (agg->all_unknown)
-		return AST_DEVICE_UNKNOWN;
-	if (agg->all_unavail)
-		return AST_DEVICE_UNAVAILABLE;
-
-	return AST_DEVICE_NOT_INUSE;
 }
 
 /*! \brief  ast_extensions_state2: Check state of extension by using hints */




More information about the svn-commits mailing list