예제 #1
0
        /// <summary>
        /// 接收机连接监测
        /// </summary>
        public void Message()
        {
            if (acallback == null)
            {
                acallback = new AnswersCollection.CallbackDelegate(CallbackFun);
            }
            //AnswersCollection.CallbackDelegate DeleFun = new AnswersCollection.CallbackDelegate(CallbackFun);

            int ret1 = AnswersCollection.TB_Init();

            StringBuilder sComs     = new StringBuilder(256);
            int           DeviceCnt = AnswersCollection.TB_EnumDevices(sComs);

            if (DeviceCnt <= 0)
            {
                return;
            }

            string[]   Devices      = sComs.ToString().Split(';');
            List <int> list_devices = new List <int>();

            foreach (string s in Devices)
            {
                if (s.Trim() == string.Empty)
                {
                    continue;
                }
                device        = AnswersCollection.TB_OpenDevice(s.ToString());
                Global.device = device;
                if (device > 0)
                {
                    Console.Write(device);
                    break;
                }
            }

            AnswersCollection.TB_SetCallbackAddr(acallback);

            AnswersCollection.TB_UpdateTime(device, 3000);

            AnswersCollection.TB_EnableWhitelist(device, 1, 3000);                 //旧版本关闭白名单,支持数字答题

            AnswersCollection.TB_RemovefromWhitelist(device, char.MinValue, 3000); //每次启动删除白名单

            //AnswersCollection.TB_AddtoWhitelist(device, "0009145950", 3000);
            //AnswersCollection.TB_SetWorkMode(device, TBModeDef.HX_MODE_SINGLE, "", 2000);
        }
예제 #2
0
        /// <summary>
        /// 接收机连接监测
        /// </summary>
        public void Message()
        {
            AnswersCollection.CallbackDelegate DeleFun = new AnswersCollection.CallbackDelegate(CallbackFun);

            int ret1 = AnswersCollection.TB_Init();

            StringBuilder sComs     = new StringBuilder(256);
            int           DeviceCnt = AnswersCollection.TB_EnumDevices(sComs);

            if (DeviceCnt <= 0)
            {
                return;
            }

            string[]   Devices      = sComs.ToString().Split(';');
            List <int> list_devices = new List <int>();

            foreach (string s in Devices)
            {
                if (s.Trim() == string.Empty)
                {
                    continue;
                }
                device = AnswersCollection.TB_OpenDevice(s.ToString());
                if (device > 0)
                {
                    Console.Write(device);
                    break;
                }
            }

            int aaaa = AnswersCollection.TB_SetCallbackAddr(DeleFun);

            Console.Write(aaaa);
            AnswersCollection.TB_UpdateTime(device, 2000);

            AnswersCollection.TB_EnableWhitelist(device, 1, 2000);    //旧版本关闭白名单,支持数字答题

            int rrt = AnswersCollection.TB_SetWorkMode(device, TBModeDef.HX_MODE_SINGLE, "", 2000);
        }