package com.hh.arome.common.scan.broadcast.base;

import android.content.Context;
import android.os.Build;

import com.hh.arome.common.Constants;
//import com.hh.arome.common.scan.broadcast.D2Scan;
import com.hh.arome.common.scan.broadcast.abstractscan.IBroadcastScan;
import com.hh.arome.common.scan.broadcast.callback.IScanResultCallback;
import com.hh.arome.utlis.log.AppLogUtils;


/**
 * Created by L470 on 2020/5/23.
 * 给最上层调用，拿到扫码结果
 */
public class BaseBroadcastScan
{

    private volatile static BaseBroadcastScan instance;

    IScanResultCallback iScanResultCallback;

    public BaseBroadcastScan() {
    }

    public static BaseBroadcastScan getInstance(){
        if(instance == null){
            synchronized(BaseBroadcastScan.class){
                if(instance == null){
                    instance = new BaseBroadcastScan();
                }
            }
        }
        return instance;
    }

    /**
     * 根据机型，初始化不同的广播扫码实现
     * @param context
     * @return
     */
    public IBroadcastScan getBaseBroadcastScan(Context context, IScanResultCallback iScanResultCallback) {
        this.iScanResultCallback = iScanResultCallback;

        String model = Build.MODEL;
        AppLogUtils.e("getBaseBroadcastScan--model:"+model);
//        if (Constants.DeviceModel.D2.equals(model)) {
//            D2Scan d2Scan = new D2Scan(context);
//            d2Scan.setListener(iScanResultCallback);
//            return d2Scan;
//        }
        return null;
    }


}
