package com.tofly.ghrq_route.module.deviceInfo.controller;

import android.content.Context;

import com.tofly.ghrq_route.module.deviceInfo.domain.DeviceInfoBean;
import com.tofly.ghrq_route.module.deviceInfo.service.DeviceInfoServiceImpl;
import com.tofly.ghrq_route.module.deviceInfo.service.IDeviceInfoService;

import java.util.List;

/**
 * Created by Amu on 2017/4/24.
 */

public class DeviceInfoController {
    /**
     * 是否在綫
     */
    boolean mbOnline;
    /**
     * 上下文
     */
    Context mContext;
    /**
     * GPS接口实现对象
     */
    IDeviceInfoService deviceInfoService;

    public DeviceInfoController(Context context){
        mbOnline = true;
        mContext = context;
        deviceInfoService = new DeviceInfoServiceImpl(context);
    }

    public DeviceInfoController(boolean online, Context context){
        mbOnline = online;
        mContext = context;
        deviceInfoService = new DeviceInfoServiceImpl(context);
    }

    /**
     * 上传终端设备信息
     * @param token
     * @param gpsData  上传的GPS数据
     * @param gpsCallBack
     */
    public void uploadDeviceInfo(String token, String userid, DeviceInfoBean deviceInfo, int workState, DeviceInfoCallback deviceInfoCallback){
        deviceInfoService.uploadDevcieInfo(token, userid, deviceInfo, workState, deviceInfoCallback);
    }

    /**
     * 批量上传终端设备信息
     * @param token
     * @param gpsDataList  批量上传的GPS数据
     * @param gpsCallBack
     */
    public void uploadBatchDeviceInfo(String token, String userid, List<DeviceInfoBean> deviceInfoList, DeviceInfoCallback deviceInfoCallback){
        deviceInfoService.uploadBatchDeviceInfo(token, userid, deviceInfoList, deviceInfoCallback);
    }
}
