package com.phlx.anchorcollect.rfid;

import com.phlx.anchorcollect.App;
import com.phlx.anchorcollect.util.ConstantUtil;
import com.uhf.structures.Rfid_Value;

public class NetModuleManager {

    public static int openCom() {
        return App.getInstance().getLinkage().connectRemoteNetwork("192.168.8.16", 1200);
    }

    public static void destroyLibSO() {
        App.getInstance().getLinkage(). closeNetwork();
    }

    /**
     * 获取rm70xx软件版本方法
     *
     * @return 软件版本号
     */
    public static int getBoardSoftVersion() {
        Rfid_Value version_value = new Rfid_Value();
        byte[] versionData = App.getInstance().getLinkage().getBoardSoftVersion(version_value);
        if (version_value.value == 0) {
            ConstantUtil.RM70XX_VERSION = new String(versionData);
        } else {
            ConstantUtil.RM70XX_VERSION = "" + version_value.value;
        }
        return 0;
    }

    /**
     * 获取模rm70xx硬件版本方法
     *
     * @return 硬件版本号
     */
    public static int getBoardSerialNumber() {
        Rfid_Value serial_value = new Rfid_Value();
        byte[] serialData = App.getInstance().getLinkage().getBoardSerialNumber(serial_value);
        if (serial_value.value == 0) {
            ConstantUtil.RM70XX_SERIAL_VERSION = new String(serialData);
        } else {
            ConstantUtil.RM70XX_SERIAL_VERSION = "" + serial_value.value;
        }
        return 0;
    }

    /**
     * 获取模块软件版本方法
     *
     * @return 软件版本号
     */
    public static int getSoftwareVersion() {
        Rfid_Value version_value = new Rfid_Value();
        byte[] versionData = App.getInstance().getLinkage().getVersion(version_value);
        if (version_value.value == 0) {
            ConstantUtil.VERSION = new String(versionData);
        } else {
            ConstantUtil.VERSION = "" + version_value.value;
        }
        return 0;

    }

    /**
     * 获取模块硬件版本方法
     *
     * @return 硬件版本号
     */
    public static int getHardwareVersion() {
        Rfid_Value serial_value = new Rfid_Value();
        byte[] serialData = App.getInstance().getLinkage().getSerialNumber(serial_value);
        if (serial_value.value == 0) {
            ConstantUtil.SERIAL_VERSION = new String(serialData);
        } else {
            ConstantUtil.SERIAL_VERSION = "" + serial_value.value;
        }
        return 0;
    }

}
