Beispiel #1
0
static void OpenDeviceOK(DeviceID_t *pDevice)
{ 
  list *current = NULL;
  int i;  
  
  if ((pDevice->m_s16DeviceMain == XMS_DEVMAIN_INTERFACE_CH) &&
      (pDevice->m_s16DeviceSub == XMS_DEVSUB_SS7_LINK))
  {
    if ((i = find(g_pLinkFirst, *pDevice, &current)) >= 0)
    {
      /*add lock*/
      if (current == NULL)
        if (ldebug_flag)
          printstr(NULL,"openDeviceOk find link=NULL\n");
          
      current->entry[i].m_dev.m_CallID = pDevice->m_CallID;
      
      if (ldebug_flag)
      {
        printstr(NULL,"open devType(%d,%d) dev(%d %d) callID(%d,%d)\n ", current->entry[i].m_dev.m_s16DeviceMain,
               current->entry[i].m_dev.m_s16DeviceSub, current->entry[i].m_dev.m_s8ModuleID, current->entry[i].m_dev.m_s16ChannelID, 
               current->entry[i].m_dev.m_CallID.m_s32FlowType, current->entry[i].m_dev.m_CallID.m_s32FlowChannel);        
      }
      /*leave lock*/
      XMS_ctsResetDevice(g_acsHandle, pDevice, NULL);
      XMS_ctsGetDevState(g_acsHandle, pDevice, NULL);     
    }   
  }   

  if (pDevice->m_s16DeviceMain == XMS_DEVMAIN_DIGITAL_PORT)
  {
    if ((i = find(g_pPcmFirst, *pDevice, &current)) >= 0)
    {
      /*add lock*/
      if (current == NULL)
        if (ldebug_flag)
          printstr(NULL,"openDeviceOk find pcm=NULL\n");
          
      current->entry[i].m_dev.m_CallID = pDevice->m_CallID;
      if (ldebug_flag)
      {
        printstr(NULL,"open devType(%d,%d) dev(%d %d) callID(%d,%d)\n ", current->entry[i].m_dev.m_s16DeviceMain,
               current->entry[i].m_dev.m_s16DeviceSub, current->entry[i].m_dev.m_s8ModuleID, 
               current->entry[i].m_dev.m_s16ChannelID, current->entry[i].m_dev.m_CallID.m_s32FlowType, 
               current->entry[i].m_dev.m_CallID.m_s32FlowChannel);        
      }
      /*leave lock*/
      XMS_ctsResetDevice(g_acsHandle, pDevice, NULL);
      XMS_ctsGetDevState(g_acsHandle, pDevice, NULL);   
    } 
  }
}
Beispiel #2
0
void	OpenDeviceOK ( DeviceID_t *pDevice )
{
	VOIP_STRUCT	*pOneVOIP;

	if (pDevice == NULL)
		return;

	if ( pDevice->m_s16DeviceMain == XMS_DEVMAIN_BOARD )
	{
		AllDeviceRes[pDevice->m_s8ModuleID].deviceID.m_CallID = pDevice->m_CallID;		// this line is very important, must before all operation
	}

	if ( pDevice->m_s16DeviceMain == XMS_DEVMAIN_VOIP )
	{
		pOneVOIP = &M_OneVOIP(*pDevice);

		pOneVOIP->deviceID.m_CallID = pDevice->m_CallID;		// this line is very important, must before all operation
	
		// init this Device: VOIP
		InitVOIPChannel ( pOneVOIP );

		XMS_ctsResetDevice ( g_acsHandle, pDevice, NULL );
		XMS_ctsGetDevState ( g_acsHandle, pDevice, NULL );	

		// modify the count
		g_iTotalVOIPOpened ++;
		AllDeviceRes[pDevice->m_s8ModuleID].lVOIPOpened ++;

		DrawCount_VOIP ( pDevice->m_s8ModuleID  );
	}

	if ( pDevice->m_s16DeviceMain == XMS_DEVMAIN_VOICE )
	{
		M_OneVoice(*pDevice).deviceID.m_CallID = pDevice->m_CallID;		// this is very important

		// init this Device: Voice
		M_OneVoice(*pDevice).State = VOC_FREE;

		XMS_ctsResetDevice ( g_acsHandle, pDevice, NULL );
		XMS_ctsGetDevState ( g_acsHandle, pDevice, NULL );

		// modify the count
		g_iTotalVoiceOpened ++;
		g_iTotalVoiceFree ++;
		AllDeviceRes[pDevice->m_s8ModuleID].lVocOpened ++;
		AllDeviceRes[pDevice->m_s8ModuleID].lVocFreeNum ++;

		DrawCount_Voc ( pDevice->m_s8ModuleID );
	}
}
Beispiel #3
0
void	OpenDeviceOK ( DeviceID_t *pDevice )
{
	TRUNK_STRUCT *	pOneTrunk;
	VOICE_STRUCT *	pOneVoice;	
	if ( pDevice->m_s16DeviceMain == XMS_DEVMAIN_INTERFACE_CH )
	{
		pOneTrunk = &AllDeviceRes[(*pDevice).m_s8ModuleID].pTrunk[(*pDevice).m_s16ChannelID];
		
		pOneTrunk->deviceID.m_CallID = pDevice->m_CallID;		// this line is very important, must before all operation
		
		// init this Device: Trunk
		pOneTrunk->State = TRK_FREE;
		pOneTrunk->CallerCode[0]=0;
		pOneTrunk->CalledCode[0]=0;	
		memset ( &pOneTrunk->VocDevID, 0, sizeof(DeviceID_t) );		// 0: didn't alloc Voc Device
			
		XMS_ctsResetDevice ( g_acsHandle, pDevice, NULL );
		XMS_ctsGetDevState ( g_acsHandle, pDevice, NULL );
		
		pdlg->m_ListTrunk.SetItemText ( pOneTrunk->iSeqID, 3, GetString_LineState(pOneTrunk->iLineState) ); 
		
		if (pOneTrunk->deviceID.m_s16DeviceSub == XMS_DEVSUB_ANALOG_USER)
		{
			pdlg->m_ListTrunk.SetItemText ( pOneTrunk->iSeqID, 4, GetString_TrunkState(pOneTrunk) ); 
		}

		AllDeviceRes[pDevice->m_s8ModuleID].lTrunkOpened ++;		
	}
	
	if ( pDevice->m_s16DeviceMain == XMS_DEVMAIN_VOICE )
	{
		pOneVoice = &AllDeviceRes[(*pDevice).m_s8ModuleID].pVoice[(*pDevice).m_s16ChannelID];
		pOneVoice->deviceID.m_CallID = pDevice->m_CallID;		// this line is very important, must before all operation

		// init this Device: Voice
		pOneVoice->State = VOC_FREE;
		
		XMS_ctsResetDevice ( g_acsHandle, pDevice, NULL );
		XMS_ctsGetDevState ( g_acsHandle, pDevice, NULL );	
	
		AllDeviceRes[pDevice->m_s8ModuleID].lVocOpened ++;
		AllDeviceRes[pDevice->m_s8ModuleID].lVocFreeNum ++;	
	}

}
Beispiel #4
0
void showPCMState()
{
  WINDOW* win;
  int height, width;
  int i; 
  list *current = NULL; 
//  char alarm[10] = {0};
  char chIndex[12][20] = {"dev", "Fas", "Mf", "Crc4",
                 "RmtAlrm", "RmtMFAlrm", "runTm",
                 "RSLIPSc", "TSLIPSc", "LCVRCnt", "FOSCnt"};    
  clear();  
  win = stdscr; 
  
  getyx(win, height, width); 
  mvprintw(height, width, chIndex[0]);
  for (i = 1; i < 11; i++)
  {
    getyx(win, height, width); 
    mvprintw(height, width + 2, "%s", chIndex[i]);
  } 

  getyx(win, height, width);
  mvprintw(height, width, "\n");
  refresh(); 

  current = g_pPcmFirst;
  while (current != NULL)
  { 
    for (i = 0; i < current->m_lDevNum; i++)
    {
        getyx(win, height, width);
        mvprintw(height , width, "%d-%d", current->entry[i].m_dev.m_s8ModuleID,
           current->entry[i].m_dev.m_s16ChannelID);
        getyx(win, height, width);
        width = strlen(chIndex[0]) + 2;
        mvprintw(height, width, 
                 getAlarmStr(current->entry[i].u_info.m_pcmInfo.m_digitState.m_u8Fas_align));
        getyx(win, height, width);
        width = strlen(chIndex[0]) + strlen(chIndex[1]) + 4;
        mvprintw(height, width, 
                 getAlarmStr(current->entry[i].u_info.m_pcmInfo.m_digitState.m_u8Mf_align));
        getyx(win, height, width);
        width = strlen(chIndex[0]) + strlen(chIndex[1]) + strlen(chIndex[2]) + 6;
        mvprintw(height, width, 
                getAlarmStr(current->entry[i].u_info.m_pcmInfo.m_digitState.m_u8Crc4_align));
        getyx(win, height, width);
        width = strlen(chIndex[0]) + strlen(chIndex[1]) + strlen(chIndex[2]) + strlen(chIndex[3]) + 8;
        mvprintw(height, width, 
                getAlarmStr(current->entry[i].u_info.m_pcmInfo.m_digitState.m_u8Remote_alarm));
        getyx(win, height, width);
        width = strlen(chIndex[0]) + strlen(chIndex[1]) + strlen(chIndex[2]) + 
                strlen(chIndex[3]) + strlen(chIndex[4]) + 10;
        mvprintw(height, width,
                getAlarmStr(current->entry[i].u_info.m_pcmInfo.m_digitState.m_u8Remote_MF_alarm));   
        getyx(win, height, width);
        width = strlen(chIndex[0]) + strlen(chIndex[1]) + strlen(chIndex[2]) + 
                strlen(chIndex[3]) + strlen(chIndex[4]) + strlen(chIndex[5]) + 12;
        mvprintw(height, width, "%d", current->entry[i].u_info.m_pcmInfo.m_digitState.m_u32total_seconds);
        getyx(win, height, width);
        width = strlen(chIndex[0]) + strlen(chIndex[1]) + strlen(chIndex[2]) + 
                strlen(chIndex[3]) + strlen(chIndex[4]) + strlen(chIndex[5]) + strlen(chIndex[6]) + 14;
        mvprintw(height, width, "%d", current->entry[i].u_info.m_pcmInfo.m_digitState.m_u32RSLIP_seconds);
        getyx(win, height, width);
        width = strlen(chIndex[0]) + strlen(chIndex[1]) + strlen(chIndex[2]) + 
                strlen(chIndex[3]) + strlen(chIndex[4]) + strlen(chIndex[5]) + 
                strlen(chIndex[6]) + strlen(chIndex[7]) + 16; 
        mvprintw(height, width, "%d", current->entry[i].u_info.m_pcmInfo.m_digitState.m_u32TSLIP_seconds);
        
        getyx(win, height, width);
        width = strlen(chIndex[0]) + strlen(chIndex[1]) + strlen(chIndex[2]) + 
                strlen(chIndex[3]) + strlen(chIndex[4]) + strlen(chIndex[5]) + 
                strlen(chIndex[6]) + strlen(chIndex[7]) + strlen(chIndex[8]) + 18; 
        mvprintw(height, width, "%d", current->entry[i].u_info.m_pcmInfo.m_digitState.m_u32LCVCR_count);
        
        getyx(win, height, width);
        width = strlen(chIndex[0]) + strlen(chIndex[1]) + strlen(chIndex[2]) + 
                strlen(chIndex[3]) + strlen(chIndex[4]) + strlen(chIndex[5]) + 
                strlen(chIndex[6]) + strlen(chIndex[7]) + strlen(chIndex[8]) + strlen(chIndex[9]) + 20; 
        mvprintw(height, width, "%d\n", current->entry[i].u_info.m_pcmInfo.m_digitState.m_u32FOSCR_count);
       
        refresh();  
        
        XMS_ctsGetDevState(g_acsHandle, &current->entry[i].m_dev, NULL);
    }
  
    current = current->next;
  } 
}