Пример #1
0
        public bool conn()
        {
            hreader = (UIntPtr)0x00;
            int     iret;
            UIntPtr InvenParamSpecList = UIntPtr.Zero;

            InvenParamSpecList = RfidBLL.RDR_CreateInvenParamSpecList();
            RfidBLL.RDR_SetInvenStopTrigger(InvenParamSpecList, 3, 1000, 0);
            UIntPtr AIPIso18000p6c = RfidBLL.ISO18000p6C_CreateInvenParam(InvenParamSpecList, 0,
                                                                          0, 0, 0x00,
                                                                          0xff);

            if (AIPIso18000p6c.ToUInt64() != 0)
            {
                string connstr = "RDType=M60;CommType=COM;COMName=COM8;BaudRate=38400;Frame=8E1;BusAddr=255";
                UInt32 nCOMCnt = RfidBLL.COMPort_Enum();
                for (uint i = 0; i < nCOMCnt; i++)
                {
                    StringBuilder comName = new StringBuilder();
                    comName.Append('\0', 64);
                    RfidBLL.COMPort_GetEnumItem(i, comName, (UInt32)comName.Capacity);
                    connstr = "RDType=M60;CommType=COM;COMName=" + comName + ";BaudRate=38400;Frame=8E1;BusAddr=255";
                    int r = RfidBLL.RDR_Open(connstr, ref hreader);
                    if (r == 0)
                    {
                        StringBuilder devInfor = new StringBuilder();
                        devInfor.Append('\0', 128);
                        UInt32 nSize;
                        nSize = (UInt32)devInfor.Capacity;
                        r     = RfidBLL.RDR_GetReaderInfor(hreader, 0, devInfor, ref nSize);
                        if (r == 0)
                        {
                            ServerConfig.connState = true;
                            _shouldStop            = false;
                            return(true);
                        }
                        return(false);
                    }
                }
                return(false);
            }
            return(false);
        }
Пример #2
0
        public void DoInventory()
        {
            int  iret;
            Byte AIType = 1;

            if (onlyNewTag == 1)
            {
                AIType = 2;  //only new tag inventory
            }
            while (!_shouldStop)
            {
                StringBuilder devInfor = new StringBuilder();
                devInfor.Append('\0', 128);
                UInt32 nSize;
                nSize = (UInt32)devInfor.Capacity;
                iret  = RfidBLL.RDR_GetReaderInfor(hreader, 0, devInfor, ref nSize);
                if (iret != 0)
                {
                    close();
                    break;
                }
                byte[] AntennaSel = new byte[16];
                UInt32 nTagCount  = 0;
                iret = tag_inventory(AIType, 0, AntennaSel, ref nTagCount);
                if (iret == 0)
                {
                    // inventory ok
                }
                else
                {
                    // inventory error
                }
                AIType = 1;
                if (onlyNewTag == 1)
                {
                    AIType = 2;
                }
            }

            RfidBLL.RDR_ResetCommuImmeTimeout(hreader);
        }