package cn.org.bjca.trust.push.common

import cn.org.bjca.trust.push.db.DbHelper
import cn.org.bjca.trust.push.db.device.Device

object DeviceHelper {
    @JvmStatic
    fun getDeviceId(): String {
        val device = DbHelper.getDataBase().deviceDao().getAll()
        if (device.isEmpty()) {
            throw Throwable("获取设备信息失败")
        }
        return device[0].device
    }
    @JvmStatic
    fun getDevice(): Device {
        val device = DbHelper.getDataBase().deviceDao().getAll()
        if (device.isEmpty()) {
            throw Throwable("获取设备信息失败")
        }
        return device[0]
    }
    @JvmStatic
    fun getManufacturer(): String {
        val device = DbHelper.getDataBase().deviceDao().getAll()
        if (device.isEmpty()) {
            throw Throwable("获取设备信息失败")
        }
        return device[0].manufacturer
    }
}