/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

package ufrcoderadvance;
import com.sun.jna.Library;
import com.sun.jna.Native;
import com.sun.jna.ptr.ByteByReference;
import com.sun.jna.ptr.IntByReference;
import com.sun.jna.ptr.ShortByReference;
public class UFRCoderWrapper extends frmMain
{
   static String sDirPath=System.getProperty("user.dir");    
   public interface UFRCoderDeclaration extends Library
   {
        
        UFRCoderDeclaration UFRInstance=(UFRCoderDeclaration)Native.loadLibrary(sDirPath+"\\"+PlatformOsType(), UFRCoderDeclaration.class);
        int ReaderOpen();
        int ReaderClose();
        int GetReaderType(int[] reader_type);
        int GetReaderSerialNumber(int[] reader_serial);
        int GetCardId(byte[] card_id,int[] card_serial);
        int ReaderUISignal(int light_mode,int sound_mode);
        int ReaderSoftRestart();
        int ReaderReset();
        int ReadUserData(byte[] read_user_data);
        int WriteUserData(byte[] write_user_data);
        int ReaderKeyWrite(byte[]reader_key,byte key_index);
        
        int LinearRead(byte[] aucdata,int linear_address,int data_length,ShortByReference bytes_ret,byte auth_mode,int key_index);
        int LinearRead_AKM1(byte[]aucdata,int linear_address,int data_length,ShortByReference bytes_ret,byte auth_mode);
        int LinearRead_AKM2(byte[]aucdata,int linear_address,int data_length,ShortByReference bytes_ret,byte auth_mode);
        int LinearRead_PK(byte[]aucdata,int linear_address,int data_length,ShortByReference bytes_ret,byte auth_mode,byte[]pk_key);

        int LinearWrite(byte[] aucdata,int linear_address,int data_length,ShortByReference bytes_written,byte auth_mode,int key_index);
        int LinearWrite_AKM1(byte[] aucdata,int linear_address,int data_length,ShortByReference bytes_written,byte auth_mode);
        int LinearWrite_AKM2(byte[] aucdata,int linear_address,int data_length,ShortByReference bytes_written,byte auth_mode);
        int LinearWrite_PK(byte[]aucdata,int linear_address,int data_length,ShortByReference bytes_written,byte auth_mode,byte[]pk_key);
        
        int BlockRead(byte[] block_data, byte block_address, byte auth_mode, byte key_index);
        int BlockRead_AKM1(byte[] block_data, byte block_address, byte auth_mode);
        int BlockRead_AKM2(byte[] block_data, byte block_address, byte auth_mode);
        int BlockRead_PK(byte[] block_data, byte block_address, byte auth_mode,byte[]pk_key);

        int BlockWrite(byte[] block_data, byte block_address, byte auth_mode, byte key_index);
        int BlockWrite_AKM1(byte[] block_data, byte block_address, byte auth_mode);
        int BlockWrite_AKM2(byte[] block_data, byte block_address, byte auth_mode);
        int BlockWrite_PK(byte[] block_data, byte block_address, byte auth_mode,byte[]pk_key);

        int BlockInSectorRead(byte[] block_data,byte sector_address, byte block_address, byte auth_mode, byte key_index);
        int BlockInSectorRead_AKM1(byte[] block_data,byte sector_address, byte block_address, byte auth_mode);
        int BlockInSectorRead_AKM2(byte[] block_data,byte sector_address, byte block_address, byte auth_mode);
        int BlockInSectorRead_PK(byte[] block_data,byte sector_address, byte block_address, byte auth_mode,byte[]pk_key);

        int BlockInSectorWrite(byte[] block_data,byte sector_address, byte block_address, byte auth_mode, byte key_index);
        int BlockInSectorWrite_AKM1(byte[] block_data,byte sector_address, byte block_address, byte auth_mode);
        int BlockInSectorWrite_AKM2(byte[] block_data,byte sector_address, byte block_address, byte auth_mode);
        int BlockInSectorWrite_PK(byte[] block_data,byte sector_address, byte block_address, byte auth_mode,byte[]pk_key);

        int ValueBlockRead(IntByReference value_read,ShortByReference value_address,byte block_address,byte auth_mode,byte key_index);
        int ValueBlockRead_AKM1(IntByReference value_read,ShortByReference value_address,byte block_address,byte auth_mode);
        int ValueBlockRead_AKM2(IntByReference value_read,ShortByReference value_address,byte block_address,byte auth_mode);
        int ValueBlockRead_PK(IntByReference value_read,ShortByReference value_address,byte block_address,byte auth_mode,byte[]pk_key);

        int ValueBlockWrite(int value_read,short value_address,byte block_address,byte auth_mode,byte key_index);
        int ValueBlockWrite_AKM1(int value_read,short value_address,byte block_address,byte auth_mode);
        int ValueBlockWrite_AKM2(int value_read,short value_address,byte block_address,byte auth_mode);
        int ValueBlockWrite_PK(int value_read,short value_address,byte block_address,byte auth_mode,byte[]pk_key);

        int ValueBlockIncrement(int incr_value,byte block_address,byte auth_mode,byte key_index);
        int ValueBlockIncrement_AKM1(int incr_value,byte block_address,byte auth_mode);
        int ValueBlockIncrement_AKM2(int incr_value,byte block_address,byte auth_mode);
        int ValueBlockIncrement_PK(int incr_value,byte block_address,byte auth_mode,byte[]pk_key);

        int ValueBlockDecrement(int incr_value,byte block_address,byte auth_mode,byte key_index);
        int ValueBlockDecrement_AKM1(int incr_value,byte block_address,byte auth_mode);
        int ValueBlockDecrement_AKM2(int incr_value,byte block_address,byte auth_mode);
        int ValueBlockDecrement_PK(int incr_value,byte block_address,byte auth_mode,byte[]pk_key);

        int ValueBlockInSectorRead(IntByReference read_data,ShortByReference value_address,byte sector_address,byte block_address,byte auth_mode,byte key_index);
        int ValueBlockInSectorRead_AKM1(IntByReference read_data,ShortByReference value_address,byte sector_address,byte block_address,byte auth_mode);
        int ValueBlockInSectorRead_AKM2(IntByReference read_data,ShortByReference value_address,byte sector_address,byte block_address,byte auth_mode);
        int ValueBlockInSectorRead_PK(IntByReference read_data,ShortByReference value_address,byte sector_address,byte block_address,byte auth_mode,byte[]pk_key);

        int ValueBlockInSectorWrite(int read_data,short value_address,byte sector_address,byte block_address,byte auth_mode,byte key_index);
        int ValueBlockInSectorWrite_AKM1(int read_data,short value_address,byte sector_address,byte block_address,byte auth_mode);
        int ValueBlockInSectorWrite_AKM2(int read_data,short value_address,byte sector_address,byte block_address,byte auth_mode);
        int ValueBlockInSectorWrite_PK(int read_data,short value_address,byte sector_address,byte block_address,byte auth_mode,byte[]pk_key);

        int ValueBlockInSectorIncrement(int read_data,byte sector_address,byte block_address,byte auth_mode,byte key_index);
        int ValueBlockInSectorIncrement_AKM1(int read_data,byte sector_address,byte block_address,byte auth_mode);
        int ValueBlockInSectorIncrement_AKM2(int read_data,byte sector_address,byte block_address,byte auth_mode);
        int ValueBlockInSectorIncrement_PK(int read_data,byte sector_address,byte block_address,byte auth_mode,byte[]pk_key);

        int ValueBlockInSectorDecrement(int read_data,byte sector_address,byte block_address,byte auth_mode,byte key_index);
        int ValueBlockInSectorDecrement_AKM1(int read_data,byte sector_address,byte block_address,byte auth_mode);
        int ValueBlockInSectorDecrement_AKM2(int read_data,byte sector_address,byte block_address,byte auth_mode);
        int ValueBlockInSectorDecrement_PK(int read_data,byte sector_address,byte block_address,byte auth_mode,byte[]pk_key);

        int LinearFormatCard(byte[]key_a,byte block_access_bits,byte sector_access_bits,byte sector_trailers_byte9,
                             byte[]key_b,ByteByReference sector_formatted,byte auth_mode,byte key_index);
        int LinearFormatCard_AKM1(byte[]key_a,byte block_access_bits,byte sector_access_bits,byte sector_trailers_byte9,
                             byte[]key_b,ByteByReference sector_formatted,byte auth_mode);
        int LinearFormatCard_AKM2(byte[]key_a,byte block_access_bits,byte sector_access_bits,byte sector_trailers_byte9,
                             byte[]key_b,ByteByReference sector_formatted,byte auth_mode);
        int LinearFormatCard_PK(byte[]key_a,byte block_access_bits,byte sector_access_bits,byte sector_trailers_byte9,
                             byte[]key_b,ByteByReference sector_formatted,byte auth_mode,byte[]pk_key);

        int SectorTrailerWrite(byte addressing_mode,byte address,byte[]key_a,byte block_access_bits0,
                               byte block_access_bits1,byte block_access_bits2,byte sector_trailer_access_bits,
                               byte sector_trailer_byte9,byte[]key_b,byte auth_mode,byte key_index);
        int SectorTrailerWrite_AKM1(byte addressing_mode,byte address,byte[]key_a,byte block_access_bits0,
                               byte block_access_bits1,byte block_access_bits2,byte sector_trailer_access_bits,
                               byte sector_trailer_byte9,byte[]key_b,byte auth_mode);
        int SectorTrailerWrite_AKM2(byte addressing_mode,byte address,byte[]key_a,byte block_access_bits0,
                               byte block_access_bits1,byte block_access_bits2,byte sector_trailer_access_bits,
                               byte sector_trailer_byte9,byte[]key_b,byte auth_mode);
        int SectorTrailerWrite_PK(byte addressing_mode,byte address,byte[]key_a,byte block_access_bits0,
                               byte block_access_bits1,byte block_access_bits2,byte sector_trailer_access_bits,
                               byte sector_trailer_byte9,byte[]key_b,byte auth_mode,byte[]pk_key);

   }
}
