Home > database >  How to use c# dll files in flutter to access its functions?
How to use c# dll files in flutter to access its functions?

Time:03-08

I need to use c# code or its DLL file in a flutter to access some functions that are in the DLL file.

#region Assembly HFReader9CSharp, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null
#endregion

namespace ReaderA
{
    public static class StaticClassReaderA
    {
        public static int AdjustPwr(ref byte comAddr, ref byte _DirStep, int frmportindex);
        public static int AutoOpenComPort(ref int port, ref byte comAddr, byte baud, ref int frmComPortIndex);
        public static int CalibratePwr(ref byte comAddr, ref byte _VRMS, int frmportindex);
        public static int CheckAntenna(ref byte comAddr, ref byte _AntValid, int frmportindex);
        public static int CloseComPort();
        public static int CloseNetPort(int PortHandle);
        public static int CloseRf(ref byte comAddr, int frmportindex);
        public static int CloseSpecComPort(int frmComPortIndex);
        public static int CustomizedReadMultipleBlock(ref byte comAddr, ref byte state, byte[] UID, byte blocknum, byte blockCount, byte[] DataBuffer, ref byte errorCode, int frmportindex);
        public static int CustomizedReadSingleBlock(ref byte comAddr, ref byte state, byte[] UID, byte blocknum, byte[] DataBuffer, ref byte errorCode, int frmportindex);
        public static int CustomizedWriteSingleBlock(ref byte comAddr, ref byte state, byte[] UID, byte blocknum, byte[] DataBuffer, byte byteCount, ref byte ErrorCode, int frmportindex);
        public static int GetAccessTime(ref byte comAddr, ref byte AccessTimeRet, int frmportindex);
        public static int GetANTStatus(ref byte comAddr, ref byte Get_ANT_Status, int frmportindex);
        public static int GetANTStatus_2(ref byte comAddr, ref byte Get_ANT_Status, int frmportindex);
        public static int GetGeneralInput(ref byte comAddr, ref byte _Input, int frmportindex);
        public static int GetInventoryTime(ref int m_Time, int frmportindex);
        public static int GetParseMode(ref byte comAddr, ref byte Get_ParseMode, int frmportindex);
        public static int GetPwr(ref byte comAddr, ref byte _Pwr, ref byte _PwrVal, int frmportindex);
        public static int GetReaderInformation(ref byte comAddr, byte[] versionInfo, ref byte readerType, byte[] trType, ref byte InventoryScanTime, int frmComPortIndex);
        public static int GetReceiveChannelStatus(ref byte comAddr, ref byte ReceiveChannelStatus, int frmportindex);
        public static int GetScanModeStatus(ref byte comAddr, byte[] _Scan_Mode_Status, int frmportindex);
        public static int GetSystemInformation(ref byte comAddr, ref byte state, byte[] UIDI, ref byte InformationFlag, byte[] UIDO, ref byte DSFID, ref byte AFI, byte[] MemorySize, ref byte ICReference, ref byte ErrorCode, int frmportindex);
        public static int GetUserDefinedBlocklength(ref byte comAddr, ref byte _Block_len, int frmportindex);
        public static int Inventory(ref byte comAddr, ref byte State, ref byte Afi, byte[] DsfidAndUID, ref byte CardNum, int frmComPortIndex);
        public static int ISO14443AInventory(ref byte comAddr, byte[] SN, int frmportindex);
        public static int LockAFI(ref byte comAddr, ref byte state, byte[] UID, ref byte errorCode, int frmportindex);
        public static int LockBlock(ref byte comAddr, ref byte state, byte[] UID, byte blocknum, ref byte errorCode, int frmportindex);
        public static int LockDSFID(ref byte comAddr, ref byte state, byte[] UID, ref byte ErrorCode, int frmportindex);
        public static int LockMultipleBlock(ref byte comAddr, ref byte state, byte[] UID, byte StartBlock, byte blocknum, ref byte errorCode, int frmportindex);
        public static int OpenComPort(int port, ref byte comAddr, byte baud, ref int frmComPortIndex);
        public static int OpenNetPort(int Port, string IPaddr, ref byte ComAddr, ref int PortHandle);
        public static int OpenRf(ref byte comAddr, int frmportindex);
        public static int ProgramPwrTable(ref byte comAddr, byte _Pwr, byte _PwrVal, byte _VRMS, int frmportindex);
        public static int ReadMultipleBlock(ref byte comAddr, ref byte state, byte[] UID, byte blocknum, byte blockCount, byte[] blockSecStatus, byte[] data, ref byte errorCode, int frmportindex);
        public static int ReadScanModeData(byte[] ScanModeData, ref int ValidDatalength, int frmportindex);
        public static int ReadSingleBlock(ref byte comAddr, ref byte State, byte[] UID, byte BlockNum, ref byte BlockSecStatus, byte[] Data, ref byte errorCode, int frmComPortIndex);
        public static int ResetToReady(ref byte comAddr, ref byte state, byte[] UID, ref byte errorCode, int frmportindex);
        public static int Select(ref byte comAddr, byte[] UID, ref byte errorCode, int frmportindex);
        public static int SetAccessTime(ref byte comAddr, ref byte AccessTime, int frmportindex);
        public static int SetActiveANT(ref byte comAddr, ref byte _ANT_Status, int frmportindex);
        public static int SetActiveANT_2(ref byte comAddr, ref byte _ANT_Status, int frmportindex);
        public static int SetGeneralOutput(ref byte comAddr, ref byte _Output, int frmportindex);
        public static int SetParseMode(ref byte comAddr, ref byte _ParseMode, int frmportindex);
        public static int SetPwr(ref byte comAddr, ref byte _Pwr, int frmportindex);
        public static int SetPwrByValue(ref byte comAddr, ref byte _PwrVal, int frmportindex);
        public static int SetReceiveChannel(ref byte comAddr, ref byte ReceiveChannel, int frmportindex);
        public static int SetRelay(ref byte comAddr, ref byte _Relay, int frmportindex);
        public static int SetScanMode(ref byte comAddr, byte[] _Scan_Mode_Data, int frmportindex);
        public static int SetUserDefinedBlockLength(ref byte comAddr, ref byte _Block_len, int frmportindex);
        public static int StayQuiet(ref byte comAddr, byte[] UID, ref byte errorCode, int frmComPortIndex);
        public static int SyncScan(ref byte comAddr, byte _Sync, int frmportindex);
        public static int TransparentCustomizedCmd(ref byte comAddr, byte[] RspTime, byte RspLength, byte CustomDataLength, byte[] CustomData, ref byte FeedbackDataLength, byte[] FeedbackData, ref byte errorCode, int frmportindex);
        public static int TransparentRead(ref byte comAddr, byte RspLength, byte CustomDatalength, byte[] CustomData, ref byte FeedbackDataLength, byte[] FeedbackData, ref byte errorCode, int frmportindex);
        public static int TransparentWrite(ref byte comAddr, byte[] option, byte RspLength, byte CustomDatalength, byte[] CustomData, ref byte FeedbackDataLength, byte[] FeedbackData, ref byte errorCode, int frmportindex);
        public static int WriteAFI(ref byte comAddr, ref byte state, byte[] UID, byte AFI, ref byte errorCode, int frmportindex);
        public static int WriteComAdr(ref byte currentComAddr, ref byte newComAddr, int frmportindex);
        public static int WriteDSFID(ref byte comAddr, ref byte state, byte[] UID, byte DSFID, ref byte errorCode, int frmportindex);
        public static int WriteInventoryScanTime(ref byte comAddr, ref byte InventoryScanTime, int frmportindex);
        public static int WriteMultipleBlock(ref byte comAddr, ref byte state, byte[] UID, byte StartBlock, byte blocknum, byte[] data, ref byte errorCode, int frmportindex);
        public static int WriteSingleBlock(ref byte comAddr, ref byte state, byte[] UID, byte blocknum, byte[] data, ref byte errorCode, int frmportindex);
    }
}

I am working on an NFC flutter app for a library management system. In this library, all books are tagged with a rfid tag. In-app when the tag or book is scanned it sends the tag id to the backend and fetches book details from the internet. And when the book is issued it has to change the AFI value. This AFI value is detected by HFGate and sounds if its value is 01. That's why I need the DLL file to use in a flutter to write the AFI value to the tag. From this file, I need to access the WriteAFI function in a flutter. Or if I can access all the code of that function.

CodePudding user response:

Create a .net Web API , then create your own endpoints which are using dll. Request these endpoints from mobile.

  • Related