import request from '@/utils/request'
// 充点电流设置方法
export function setCurrent(data,current) {
  return request({
    'url': '/device/setCurrent?current='+current,
    'method': 'post',
      data:data
  })
}
function cloneObj(obj){
    return JSON.parse(JSON.stringify(obj));
}
// 发送获取主板的命令
export function sendMainboardCmd(deviceInfo) {
    return request({
        'url': '/device/sendMainboardCmd',
        'method': 'post',
        data:deviceInfo
    })
}
// 获取主板配置方法
export function getMainbordConfig(deviceInfo,time) {
    let data = cloneObj(deviceInfo);
    data.time = time;
    return request({
        'url': '/device/getMainboardConfig',
        'method': 'post',
        data:data
    })
}
// 获取设备info
export function getDeviceInfo(deviceID) {
  return request({
      url: '/select/'+deviceID,
      method: 'post'
  })
}


// 恢复默认配置
export function reset(deviceInfo) {
  return request({
    'url': '/device/resetMainboard',
    'method': 'post',
      data:deviceInfo
  })
}

// 重启充电桩
export function restart(deviceInfo) {
  return request({
    'url': '/device/restartMainboard',
    'method': 'post',
      data:deviceInfo
  })
}
