package com;

import com.priusis.utils.ICQrDecode;
import com.priusis.utils.IHwPortController;
import com.zy.QrDecode.CQrDecode;
import lombok.extern.slf4j.Slf4j;

@Slf4j
public class TestDemo {

    //static String qrString = "0000000D920A7111688CEDA9D7E27F2AE7C98D2E";
    static String qrString = "0000000D9BBC6C567944AF514A1AD0A252491B99";

    public static void main2(String[] args) {
        String path = CQrDecode.parseAbsolutePath("/qr/dat/", "smart-property/0000000d.dat");

        int[] result = new int[4];
        CQrDecode qrInstance = new CQrDecode();
        int ret = qrInstance.ZOOYAPI_GetCodeII(path + "0000000d.dat", qrString, result);
        log.info("ret:{}", ret);
        log.info("卡号 " + Integer.toHexString(result[0]));
        log.info("校验码 " + Integer.toString(result[1]));
        log.info("*********************************");
    }

    public static void main(String[] args) {
        /*String path = CQrDecode.parseAbsolutePath("/qr/dat/", "smart-property/0000000d.dat");

        int[] result = new int[4];

        int ret2 = ICQrDecode.instanceDll.hello(path + "0000000d.dat");
        log.info("ret:{}", ret2);

        int ret = ICQrDecode.instanceDll.ZOOYAPI_GetCodeII(path + "0000000d.dat", qrString, result);
        log.info("ret:{}", ret);
        log.info("卡号 " + Integer.toHexString(result[0]));
        log.info("校验码 " + Integer.toString(result[1]));
        log.info("*********************************");*/

        // 初始化硬件接口管理模块
        int result = IHwPortController.instanceDll.APQ_HWPORT_Initialize();
        log.info("APQ_HWPORT_Initialize ret:{}", result);
        // 获取普通设备权限
        int result31 = IHwPortController.instanceDll.APQ_HWPORT_get_normal_device_permit(4);
        log.info("APQ_HWPORT_get_normal_device_permit ret:{}", result31);
        // 设置普通设备权限
        int result32 = IHwPortController.instanceDll.APQ_HWPORT_set_normal_device_permit(4, 1, null);
        log.info("APQ_HWPORT_set_normal_device_permit ret:{}", result32);
        // 应用硬件接口管理模块的配置内容
        int result5 = IHwPortController.instanceDll.APQ_HWPORT_Apply();
        log.info("APQ_HWPORT_Apply ret:{}", result5);
        // 再次获取普通设备权限，验证
        int result33 = IHwPortController.instanceDll.APQ_HWPORT_get_normal_device_permit(4);
        log.info("Check APQ_HWPORT_get_normal_device_permit ret:{}", result33);
        // 获取网络设备权限
        //int speed = 0;
        //int result4 = IHwPortController.instanceDll.APQ_HWPORT_get_net_device_permit(0, speed);
        //log.info("APQ_HWPORT_get_net_device_permit ret:{}, speed:{}", result4, speed);
        // 清理硬件接口管理模块
        int result2 = IHwPortController.instanceDll.APQ_HWPORT_Uninitialize();
        log.info("APQ_HWPORT_Uninitialize ret:{}", result2);
    }

}
