none
C# Dll For Rfid reader need to refrence in vb application problem RRS feed

  • Question

  • Dear i have a C# Dll that came with my rfid reader which in need to refrence in my vb6 application in order to make the reader  operate and get data in my vb application , the problem i'm facing after make the com visible and rebuilding the C# dll file and trying the refrence and call the dll in vb is that i face many error msg's such as "error 430 class dose not support automation".

    this is the code of the dll file for the reader method

     public int SetReaderAddress(byte btReadId, byte btNewReadId)
            {
                byte btCmd = 0x73;
                byte[] btAryData = new byte[1];
                btAryData[0] = btNewReadId;

                int nResult = SendMessage(btReadId, btCmd, btAryData);

                return nResult;
            }

            public int SetWorkAntenna(byte btReadId, byte btWorkAntenna)
            {
                byte btCmd = 0x74;
                byte[] btAryData = new byte[1];
                btAryData[0] = btWorkAntenna;
                int nResult = SendMessage(btReadId, btCmd, btAryData);
                return nResult;
            }

            public int GetWorkAntenna(byte btReadId)
            {
                byte btCmd = 0x75;

                int nResult = SendMessage(btReadId, btCmd);

                return nResult;
            }

            public int SetOutputPower(byte btReadId, byte btOutputPower)
            {
                byte btCmd = 0x76;
                byte[] btAryData = new byte[1];
                btAryData[0] = btOutputPower;

                int nResult = SendMessage(btReadId, btCmd, btAryData);

                return nResult;
            }

            public int SetOutputPower(byte btReadId,byte ant1Power,byte ant2Power,byte ant3Power,byte ant4Power)
            {
                byte btCmd = 0x76;
                byte[] btArayData = new byte[4];
                btArayData[0] = ant1Power;
                btArayData[1] = ant2Power;
                btArayData[2] = ant3Power;
                btArayData[3] = ant4Power;

                int nResult = SendMessage(btReadId, btCmd, btArayData);

                return nResult;
            }

            //add multi Ants set outputPower
            public int SetOutputPower(byte btReadId, byte[] btOutputPower)
            {
                byte btCmd = 0x76;

                int nResult = SendMessage(btReadId, btCmd, btOutputPower);

                return nResult;
            }

            public int GetOutputPower(byte btReadId)
            {
                byte btCmd = 0x97;

                int nResult = SendMessage(btReadId, btCmd);

                return nResult;
            }

            public int GetOutputPowerFour(byte btReadId)
            {
                byte btCmd = 0x77;

                int nResult = SendMessage(btReadId,btCmd);

                return nResult;
            }

            public int MeasureReturnLoss(byte btReadId, byte btFrequency)
            {
                byte btCmd = 0x7E;
                byte[] btAryData = new byte[1];
                btAryData[0] = btFrequency;
                int nResult = SendMessage(btReadId, btCmd, btAryData);
                return nResult;
            }

            public int SetFrequencyRegion(byte btReadId, byte btRegion, byte btStartRegion, byte btEndRegion)
            {
                byte btCmd = 0x78;
                byte[] btAryData = new byte[3];
                btAryData[0] = btRegion;
                btAryData[1] = btStartRegion;
                btAryData[2] = btEndRegion;

                int nResult = SendMessage(btReadId, btCmd, btAryData);

                return nResult;
            }
            public int SetUserDefineFrequency(byte btReadId, int nStartFreq, byte btFreqInterval, byte btChannelQuantity)
            {
                byte btCmd = 0x78;
                byte[] btAryFreq = new byte[3];
                byte[] btAryData = new byte[6];
                btAryFreq = BitConverter.GetBytes(nStartFreq);

                btAryData[0] = 4;
                btAryData[1] = btFreqInterval;
                btAryData[2] = btChannelQuantity;
                btAryData[3] = btAryFreq[2];
                btAryData[4] = btAryFreq[1];
                btAryData[5] = btAryFreq[0];
                
                int nResult = SendMessage(btReadId, btCmd, btAryData);

                return nResult;
            }

            public int GetFrequencyRegion(byte btReadId)
            {
                byte btCmd = 0x79;

                int nResult = SendMessage(btReadId, btCmd);

                return nResult;
            }

            public int SetBeeperMode(byte btReadId, byte btMode)
            {
                byte btCmd = 0x7A;
                byte[] btAryData = new byte[1];
                btAryData[0] = btMode;

                int nResult = SendMessage(btReadId, btCmd, btAryData);

                return nResult;
            }

            public int GetReaderTemperature(byte btReadId)
            {
                byte btCmd = 0x7B;

                int nResult = SendMessage(btReadId, btCmd);

                return nResult;
            }

            public int GetAntImpedanceMatch(byte btReadId, byte btFrequency)
            {
                byte btCmd = 0x7E;
                byte[] btAryData = new byte[1];
                btAryData[0] = btFrequency;
                int nResult = SendMessage(btReadId, btCmd, btAryData);

                return nResult;
            }

            public int SetDrmMode(byte btReadId, byte btDrmMode)
            {
                byte btCmd = 0x7C;
                byte[] btAryData = new byte[1];
                btAryData[0] = btDrmMode;

                int nResult = SendMessage(btReadId, btCmd, btAryData);

                return nResult;
            }

            public int GetDrmMode(byte btReadId)
            {
                byte btCmd = 0x7D;

                int nResult = SendMessage(btReadId, btCmd);

                return nResult;
            }

            public int ReadGpioValue(byte btReadId)
            {
                byte btCmd = 0x60;

                int nResult = SendMessage(btReadId, btCmd);

                return nResult;
            }

            public int WriteGpioValue(byte btReadId, byte btChooseGpio, byte btGpioValue)
            {
                byte btCmd = 0x61;
                byte[] btAryData = new byte[2];
                btAryData[0] = btChooseGpio;
                btAryData[1] = btGpioValue;

                int nResult = SendMessage(btReadId, btCmd, btAryData);

                return nResult;
            }

            public int SetAntDetector(byte btReadId, byte btDetectorStatus)
            {
                byte btCmd = 0x62;
                byte[] btAryData = new byte[1];
                btAryData[0] = btDetectorStatus;

                int nResult = SendMessage(btReadId, btCmd, btAryData);

                return nResult;
            }

            public int GetAntDetector(byte btReadId)
            {
                byte btCmd = 0x63;

                int nResult = SendMessage(btReadId, btCmd);

                return nResult;
            }

            public int GetMonzaStatus(byte btReadId)
            {
                byte btCmd = 0x8e;

                int nResult = SendMessage(btReadId, btCmd);

                return nResult;
            }

            public int SetMonzaStatus(byte btReadId, byte btMonzaStatus)
            {
                byte btCmd = 0x8D;
                byte[] btAryData = new byte[1];
                btAryData[0] = btMonzaStatus;

                int nResult = SendMessage(btReadId, btCmd, btAryData);

                return nResult;
            }

            public int SetRadioProfile(byte btReadId, byte btProfile)
            {
                byte btCmd = 0x69;
                byte[] btAryData = new byte[1];
                btAryData[0] = btProfile;
                int nResult = SendMessage(btReadId, btCmd, btAryData);
                return nResult;
            }
            public int GetRadioProfile(byte btReadId)
            {
                byte btCmd = 0x6A;

                int nResult = SendMessage(btReadId, btCmd);

                return nResult;
            }

            public int GetReaderIdentifier(byte btReadId)
            {
                byte btCmd = 0x68;

                int nResult = SendMessage(btReadId, btCmd);

                return nResult;
            }

            public int SetReaderIdentifier(byte btReadId, byte[] identifier)
            {
                byte btCmd = 0x67;

                int nResult = SendMessage(btReadId, btCmd, identifier);

                return nResult;
            }


            public int Inventory(byte btReadId, byte byRound)
            {
                byte btCmd = 0x80;
                byte[] btAryData = new byte[1];
                btAryData[0] = byRound;

                int nResult = SendMessage(btReadId, btCmd, btAryData);

                return nResult;
            }

            public int CustomizedInventory(byte btReadId, byte session, byte target,byte SL,byte byRound)
            {
                byte btCmd = 0x8B;
                byte[] btAryData = new byte[4];
                btAryData[0] = session;
                btAryData[1] = target;
                btAryData[2] = SL;
                btAryData[3] = byRound;

                int nResult = SendMessage(btReadId, btCmd, btAryData);

                return nResult;
            }

            public int ReadTag(byte btReadId, byte btMemBank, byte btWordAdd, byte btWordCnt, byte[] btPassword)
            {
                byte btCmd = 0x81;
                byte[] btAryData;
                if (btPassword == null)
                {
                    btAryData = new byte[3];
                }
                else
                {
                    btAryData = new byte[3 + btPassword.Length];
                }
                btAryData[0] = btMemBank;
                btAryData[1] = btWordAdd;
                btAryData[2] = btWordCnt;
                if (btPassword != null)
                {
                    btPassword.CopyTo(btAryData,3);
                }
                int nResult = SendMessage(btReadId, btCmd, btAryData);

                return nResult;
            }

            public int WriteTag(byte btReadId, byte[] btAryPassWord, byte btMemBank, byte btWordAdd, byte btWordCnt, byte[] btAryData,byte btCmd)
            {
                //byte btCmd = 0x82;
                byte[] btAryBuffer = new byte[btAryData.Length + 7];
                btAryPassWord.CopyTo(btAryBuffer, 0);
                btAryBuffer[4] = btMemBank;
                btAryBuffer[5] = btWordAdd;
                btAryBuffer[6] = btWordCnt;
                btAryData.CopyTo(btAryBuffer, 7);

                int nResult = SendMessage(btReadId, btCmd, btAryBuffer);

                return nResult;
            }

            public int LockTag(byte btReadId, byte[] btAryPassWord, byte btMembank, byte btLockType)
            {
                byte btCmd = 0x83;
                byte[] btAryData = new byte[6];
                btAryPassWord.CopyTo(btAryData, 0);
                btAryData[4] = btMembank;
                btAryData[5] = btLockType;

                int nResult = SendMessage(btReadId, btCmd, btAryData);

                return nResult;
            }

            public int KillTag(byte btReadId, byte[] btAryPassWord)
            {
                byte btCmd = 0x84;
                byte[] btAryData = new byte[4];
                btAryPassWord.CopyTo(btAryData, 0);

                int nResult = SendMessage(btReadId, btCmd, btAryData);

                return nResult;
            }

            public int SetAccessEpcMatch(byte btReadId, byte btMode, byte btEpcLen, byte[] btAryEpc)
            {
                byte btCmd = 0x85;
                int nLen = Convert.ToInt32(btEpcLen) + 2;
                byte[] btAryData = new byte[nLen];
                btAryData[0] = btMode;
                btAryData[1] = btEpcLen;
                btAryEpc.CopyTo(btAryData, 2);

                int nResult = SendMessage(btReadId, btCmd, btAryData);

                return nResult;
            }

            public int CancelAccessEpcMatch(byte btReadId, byte btMode)
            {
                byte btCmd = 0x85;
                byte[] btAryData = new byte[1];
                btAryData[0] = btMode;

                int nResult = SendMessage(btReadId, btCmd, btAryData);

                return nResult;
            }

            public int GetAccessEpcMatch(byte btReadId)
            {
                byte btCmd = 0x86;

                int nResult = SendMessage(btReadId, btCmd);

                return nResult;
            }

            public int InventoryReal(byte btReadId, byte byRound)
            {
                byte btCmd = 0x89;
                byte[] btAryData = new byte[1];
                btAryData[0] = byRound;

                int nResult = SendMessage(btReadId, btCmd, btAryData);

                return nResult;
            }

            public int FastSwitchInventory(byte btReadId, byte[] btAryData)
            {
                byte btCmd = 0x8A;

                int nResult = SendMessage(btReadId, btCmd, btAryData);

                return nResult;
            }

            public int GetInventoryBuffer(byte btReadId)
            {
                byte btCmd = 0x90;

                int nResult = SendMessage(btReadId, btCmd);

                return nResult;
            }

            public int GetAndResetInventoryBuffer(byte btReadId)
            {
                byte btCmd = 0x91;

                int nResult = SendMessage(btReadId, btCmd);

                return nResult;
            }

            public int GetInventoryBufferTagCount(byte btReadId)
            {
                byte btCmd = 0x92;

                int nResult = SendMessage(btReadId, btCmd);

                return nResult;
            }

            public int ResetInventoryBuffer(byte btReadId)
            {
                byte btCmd = 0x93;

                int nResult = SendMessage(btReadId, btCmd);

                return nResult;
            }

            public int SetBufferDataFrameInterval(byte btReadId, byte btInterval)
            {
                byte btCmd = 0x94;
                byte[] btAryData = new byte[1];
                btAryData[0] = btInterval;

                int nResult = SendMessage(btReadId, btCmd, btAryData);

                return nResult;
            }

            public int GetBufferDataFrameInterval(byte btReadId)
            {
                byte btCmd = 0x95;

                int nResult = SendMessage(btReadId, btCmd);

                return nResult;
            }

            public int InventoryISO18000(byte btReadId)
            {
                byte btCmd = 0xb0;

                int nResult = SendMessage(btReadId, btCmd);

                return nResult;
            }

            public int ReadTagISO18000(byte btReadId, byte[] btAryUID, byte btWordAdd, byte btWordCnt)
            {
                byte btCmd = 0xb1;
                int nLen = btAryUID.Length + 2;
                byte[] btAryData = new byte[nLen];
                btAryUID.CopyTo(btAryData, 0);
                btAryData[nLen - 2] = btWordAdd;
                btAryData[nLen - 1] = btWordCnt;

                int nResult = SendMessage(btReadId, btCmd, btAryData);

                return nResult;
            }

            public int WriteTagISO18000(byte btReadId, byte[] btAryUID, byte btWordAdd, byte btWordCnt, byte[] btAryBuffer)
            {
                byte btCmd = 0xb2;
                int nLen = btAryUID.Length + 2 + btAryBuffer.Length;
                byte[] btAryData = new byte[nLen];
                btAryUID.CopyTo(btAryData, 0);
                btAryData[btAryUID.Length] = btWordAdd;
                btAryData[btAryUID.Length + 1] = btWordCnt;
                btAryBuffer.CopyTo(btAryData, btAryUID.Length + 2);

                int nResult = SendMessage(btReadId, btCmd, btAryData);

                return nResult;
            }

            public int LockTagISO18000(byte btReadId, byte[] btAryUID, byte btWordAdd)
            {
                byte btCmd=0xb3;
                int nLen = btAryUID.Length + 1;
                byte[] btAryData = new byte[nLen];
                btAryUID.CopyTo(btAryData, 0);
                btAryData[nLen - 1] = btWordAdd;

                int nResult = SendMessage(btReadId, btCmd, btAryData);

                return nResult;
            }

            public int QueryTagISO18000(byte btReadId, byte[] btAryUID, byte btWordAdd)
            {
                byte btCmd = 0xb4;
                int nLen = btAryUID.Length + 1;
                byte[] btAryData = new byte[nLen];
                btAryUID.CopyTo(btAryData, 0);
                btAryData[nLen - 1] = btWordAdd;

                int nResult = SendMessage(btReadId, btCmd, btAryData);

                return nResult;
            }

            public int setTagMask(byte btReadId, byte btMaskNo, byte btTarget, byte btAction, byte btMembank, byte btStartAdd, byte btMaskLen, byte[] maskValue)
            {
                byte[] btAryData = new byte[7 + maskValue.Length];
                btAryData[0] = btMaskNo;
                btAryData[1] = btTarget;
                btAryData[2] = btAction;
                btAryData[3] = btMembank;
                btAryData[4] = btStartAdd;
                btAryData[5] = btMaskLen;
                maskValue.CopyTo(btAryData, 6);
                btAryData[btAryData.Length - 1] = (byte)0x00;

                int nResult = SendMessage(btReadId, (byte)0x98, btAryData);

                return nResult;
            }

            public int getTagMask(byte btReadId)
            {
                byte[] btAryData = { (byte)0x20 };

                int nResult = SendMessage(btReadId, (byte)0x98, btAryData);

                return nResult;
            }

            public int clearTagMask(byte btReadId, byte btMaskNO)
            {
                byte[] btAryData = { btMaskNO };

                int nResult = SendMessage(btReadId, (byte)0x98, btAryData);

                return nResult;
            }
        }
    }

    Sunday, April 7, 2019 7:43 PM

All replies

  • Hello,

    This forum is for VB.NET, not VB6 which was indicated when posting. Your best option is to use the following forum.

    http://www.vbforums.com/forumdisplay.php?1-Visual-Basic-6-and-Earlier


    Please remember to mark the replies as answers if they help and unmarked them if they provide no help, this will help others who are looking for solutions to the same or similar problem. Contact via my Twitter (Karen Payne) or Facebook (Karen Payne) via my MSDN profile but will not answer coding question on either.

    NuGet BaseConnectionLibrary for database connections.

    StackOverFlow
    profile for Karen Payne on Stack Exchange

    Sunday, April 7, 2019 10:57 PM