added ZAP_COMMAND_GET_LINK_STATUS for sangoma boards

git-svn-id: http://svn.openzap.org/svn/openzap/branches/sangoma_boost@870 a93c3328-9c30-0410-af19-c9cd2b2d52af
This commit is contained in:
Moises Silva 2009-11-16 18:42:35 +00:00
parent d7b1202a1a
commit c557472f25
2 changed files with 14 additions and 17 deletions

View File

@ -301,6 +301,7 @@ typedef enum {
ZAP_COMMAND_FLUSH_BUFFERS,
ZAP_COMMAND_SET_PRE_BUFFER_SIZE,
ZAP_COMMAND_SET_LINK_STATUS,
ZAP_COMMAND_GET_LINK_STATUS,
ZAP_COMMAND_COUNT
} zap_command_t;
@ -421,8 +422,7 @@ struct zap_state_map {
typedef struct zap_state_map zap_state_map_t;
typedef enum zap_hw_link_status {
ZAP_HW_LINK_UNINITIALIZED = 0,
ZAP_HW_LINK_DISCONNECTED,
ZAP_HW_LINK_DISCONNECTED = 0,
ZAP_HW_LINK_CONNECTED
} zap_hw_link_status_t;

View File

@ -598,22 +598,19 @@ static ZIO_COMMAND_FUNCTION(wanpipe_command)
case ZAP_COMMAND_SET_LINK_STATUS:
{
zap_hw_link_status_t status = ZAP_COMMAND_OBJ_INT;
char sangoma_status;
switch (status) {
case ZAP_HW_LINK_UNINITIALIZED:
sangoma_status = FE_UNITIALIZED;
break;
case ZAP_HW_LINK_DISCONNECTED:
sangoma_status = FE_DISCONNECTED;
break;
case ZAP_HW_LINK_CONNECTED:
sangoma_status = FE_CONNECTED;
break;
default:
return ZAP_FAIL;
}
err = sangoma_tdm_set_fe_status(zchan->sockfd, &tdm_api, status);
char sangoma_status = status == ZAP_HW_LINK_CONNECTED ? FE_CONNECTED : FE_DISCONNECTED;
err = sangoma_tdm_set_fe_status(zchan->sockfd, &tdm_api, sangoma_status);
}
break;
case ZAP_COMMAND_GET_LINK_STATUS:
{
unsigned char sangoma_status = 0;
err = sangoma_tdm_get_fe_status(zchan->sockfd, &tdm_api, &sangoma_status);
if (!err) {
ZAP_COMMAND_OBJ_INT = sangoma_status == FE_CONNECTED ? ZAP_HW_LINK_CONNECTED : ZAP_HW_LINK_DISCONNECTED;
}
}
break;
default:
break;
};