package com.phlx.anchorcollect.rfid;


import com.phlx.anchorcollect.App;
import com.phlx.anchorcollect.Configs;
import com.uhf.structures.Rfid_Value;

public class ModuleManager {

    private static String serialPort = "/dev/ttyMT1";

    public static int openCom() {

        switch (Configs.cpuName) {

            //手持机 RM_7088_MT2
            case "MT6735":
                serialPort = "/dev/ttyMT2";
                break;

            //pad RM_WIOT61c_S1
            case "MT6762V/CB":
                serialPort = "/dev/ttyS1";
                break;

            //pad RM_SD100T_MT1
            case "MT6763V/B":
                serialPort = "/dev/ttyMT1";
                break;
        }


        return App.getInstance().getLinkage().open_serial(serialPort);
    }

    public static void destroyLibSO() {
        App.getInstance().getLinkage().deinitRFID();
        App.getInstance().getLinkage().close_serial();
        powerOff();
    }

    public static int powerOn() {

        DeviceControl DevCtrl = new DeviceControl();
        DevCtrl.PowerOnDevice();
        Rfid_Value rf = new Rfid_Value();
        App.getInstance().getLinkage().getVersion(rf);
        return rf.value;
    }

    public static void powerOff() {
        DeviceControl DevCtrl = new DeviceControl();
        DevCtrl.PowerOffDevice();
    }


}
