package com.youchain.rfid;


import com.uhf.api.cls.BackReadOption;
import com.uhf.api.cls.JniModuleAPI;
import com.uhf.api.cls.Reader;
import com.uhf.api.cls.Reader.READER_ERR;
import com.youchain.annotation.AnonymousAccess;
import lombok.RequiredArgsConstructor;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.swing.*;


@RestController
@RequiredArgsConstructor
@RequestMapping("/api/bool")
public class rfidDocJava extends JFrame {
    @PostMapping("/readRfid")
    @AnonymousAccess
    public void readRfid() {
        System.out.println("读取");
        int[] ants = new int[]{1,2, 3, 4};
        BackReadOption Brop = new BackReadOption();
        Brop.ReadDuration = 200;
        Brop.ReadInterval = 10;
        Brop.IsFastRead = false;
        Brop.IsGPITrigger = false;
        Reader rdr=new Reader();
        READER_ERR err = rdr.InitReader_Notype("192.168.0.224",4);
        READER_ERR err1 = rdr.StartReading(ants, 3, Brop);
    }
//    public static Reader rdr=null;
    public static void main(String[] args) {
        /*Reader rdr=null;
        if (rdr != null)
            rdr.CloseReader();
            rdr=null;
        }*/
        Reader rdr=new Reader();
        int[] ants = new int[]{1,2, 3, 4};
        BackReadOption prop = new BackReadOption();
        prop.ReadDuration = 200;
        prop.ReadInterval = 10;
        prop.IsFastRead = false;
        prop.IsGPITrigger = false;
        Reader.READER_ERR err = rdr.InitReader_Notype("192.168.0.224",4);
        Reader.READER_ERR err1 = rdr.StartReading(ants, 3, prop);
    }
}
