⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 getdigs.c

📁 ipt网关源码
💻 C
字号:
#include <srllib.h>
#include <dxxxlib.h>
#include <stdio.h>
#include "pstndefs.h"

//功能:取得用户按键函数
//输入:通道号、超时时间
//输出:成功返回1。错误返回-1
int getdigs(int chdev,int timeout)
{
	
	DV_TPT tpt[4];        //中断条件数组 

	  
	  dx_clrtpt(&tpt,3);
      tpt[0].tp_type   = IO_CONT;            // two entry in the table 
      tpt[0].tp_termno = DX_DIGMASK;          //遇到指定按键结束
      tpt[0].tp_length = DM_P;                 // “#”结束
      tpt[0].tp_flags  = TF_DIGMASK	;        // Use the default flags 

      tpt[1].tp_type   = IO_CONT;            // only entry in the table 
      tpt[1].tp_termno = DX_LCOFF;        // 环流下降 
      tpt[1].tp_length = 3;                 
      tpt[1].tp_flags  = TF_LCOFF|TF_10MS;
      
	  tpt[2].tp_type   = IO_CONT;            // only entry in the table 
      tpt[2].tp_termno = DX_MAXSIL;          // 静音时间 为什么不管用??
      tpt[2].tp_length = 300;                 // unit is 100ms
      tpt[2].tp_flags  = TF_MAXSIL;

      tpt[3].tp_type   = IO_EOT;
      tpt[3].tp_termno = DX_MAXTIME;        // Function Time 
      tpt[3].tp_length = timeout*10;        // 10 seconds (100 ms resolution* timer) 
      tpt[3].tp_flags  = TF_MAXTIME;        // Edge triggered 

   //取用户按键

       if (dx_getdig(chdev, tpt, &digp[chdev], EV_ASYNC) == -1) {
          /* process error */
           //printf("Error in getting digits!\n");
		   return(-1);
       }
	   // 等待按键结束!
	   //if( sr_waitevt(-1) == -1 ){
       //      printf( "sr_waitevt, %s\n",ATDV_ERRMSGP( SRL_DEVICE ));
       //      return(-1);
	   //	}

        return(1);
}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -