提交 5a988045 authored 作者: João Mesquita's avatar João Mesquita

A little more documentation on the code.

git-svn-id: http://svn.freeswitch.org/svn/freeswitch/trunk/contrib@14017 d0543943-73ff-0310-b7d9-9358b9ac24b2
上级 26c04c29
......@@ -122,9 +122,14 @@ struct K3LAPI
return (valid_device(dev) && obj >= 0 && obj < ((int32)_link_count[dev]));
}
/* identificadores alto-nivel de objectos */
/*!
\brief High level object identifier
Since Khomp works with an object concept, this is used to map the
object id with its proper type.
*/
struct target
{
/*! The types a target can have */
typedef enum { DEVICE, CHANNEL, MIXER, LINK } target_type;
target(K3LAPI & k3lapi, target_type type_init, int32 device_value, int32 object_value)
......
......@@ -5,15 +5,15 @@
/*!
\brief This struct holds a static linked list representing all the Khomp channels
\ found in the host. It's also a place holder for session objects and some
\ other opaque members used by the module.
found in the host. It's also a place holder for session objects and some
other opaque members used by the module.
*/
struct KhompPvt
{
typedef std::vector < KhompPvt * > PvtVectorType;
typedef std::vector < PvtVectorType > PvtVector2Type;
typedef PvtVector2Type KhompPvtVector;
typedef std::vector < KhompPvt * > PvtVectorType; /*!< Collection of pointers of KhompPvts */
typedef std::vector < PvtVectorType > PvtVector2Type; /*!< Collection of PvtVectorType */
typedef PvtVector2Type KhompPvtVector; /*!< A bidimensional array o KhompPvts, meaning [board][channel] */
KhompPvt(K3LAPI::target & target)
: _target(target), _session(NULL) {};
......@@ -75,7 +75,7 @@ struct KhompPvt
}
K3LAPI::target _target;
switch_core_session_t * _session;
switch_core_session_t * _session; /*!< The session to which this pvt is associated with */
unsigned int flags; //TODO: Alterar o nome depois
......@@ -93,13 +93,13 @@ struct KhompPvt
switch_mutex_t *_mutex;
switch_mutex_t *flag_mutex; //TODO: Alterar o nome depois
unsigned int _KDeviceId; // Represent de board we are making the call from
unsigned int _KChannelId; // Represent the channel we are making the call from
unsigned int _KDeviceId; /*!< Represent de board we are making the call from */
unsigned int _KChannelId; /*!< Represent the channel we are making the call from */
/* static stuff */
static switch_mutex_t *_pvts_mutex;
static KhompPvtVector _pvts;
static KhompPvtVector _pvts; /*!< Static structure that contains all the pvts. Will be initialized by KhompPvt::initialize */
};
......
......@@ -80,6 +80,9 @@ static void Kstdcall khomp_audio_listener(int32 deviceid, int32 objectid,
/*!
\brief Defined by mod_reference, defines statuses for the switch_channel
\param TFLAG_IO Enables the IO state of a channel
\param TFLAG_INBOUND Sets a channel as inbound
\param TFLAG_OUTBOUND Sets a channel as outbound
*/
typedef enum
{
......@@ -95,7 +98,19 @@ typedef enum
}
TFLAGS;
/* Module management routines */
/*!
\brief Load the module. Expadend by a FreeSWITCH macro.
Things we do here:
\li Initialize a static structure on KhompPvt
\li Load the configuration
\li Start the K3L API, responsible for connecting to KServer
\li Register mod APIs and APPs
\li Register audio callback for KServer
\li Register event callback for KServer
\see Opt Where all the configs are handled
\see khomp_event_callback To where we bind the event handler
\see khomp_audio_listener To where we bind the audio handlers
*/
SWITCH_MODULE_LOAD_FUNCTION(mod_khomp_load);
SWITCH_MODULE_SHUTDOWN_FUNCTION(mod_khomp_shutdown);
SWITCH_MODULE_DEFINITION(mod_khomp, mod_khomp_load, mod_khomp_shutdown, NULL);
......
......@@ -413,7 +413,7 @@ static switch_call_cause_t channel_outgoing_channel(switch_core_session_t *sessi
return cause;
}
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_INFO, "Dialing to %s out from Board:%u, Channel:%u.\n",
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_INFO, "Dialing to %u out from Board:%u, Channel:%u.\n",
argv[2],
tech_pvt->_KDeviceId,
tech_pvt->_KChannelId);
......
......@@ -25,7 +25,9 @@ KhompPvt * KhompPvt::find_channel(char* allocation_string, switch_core_session_t
/* Let's setup our own vars on tech_pvt */
if ((argc = switch_separate_string(allocation_string, '/', argv, (sizeof(argv) / sizeof(argv[0])))) < 3)
{
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Invalid dial string (%s). Should be on the format:[Khomp/BoardID (or A for first free board)/CHANNEL (or A for first free channel)]\n", allocation_string);
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR,
"Invalid dial string (%s). Should be on the format:[Khomp/BoardID (or A for first free board)/CHANNEL (or A for first free channel)]\n",
allocation_string);
return NULL;
}
......@@ -73,6 +75,7 @@ KhompPvt * KhompPvt::find_channel(char* allocation_string, switch_core_session_t
{
channel_low = 0;
channel_high = Globals::_k3lapi.channel_count(board);
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Just to check we are getting on the first_channel\n", board_low, board_high, channel_low, channel_high);
}
else
{
......@@ -131,4 +134,4 @@ KhompPvt * KhompPvt::find_channel(char* allocation_string, switch_core_session_t
switch_mutex_unlock(_pvts_mutex);
return pvt;
}
\ No newline at end of file
}
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论