using SC.XR.Unity.Module_InputSystem;
using System;
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
namespace SC.XR.Unity.Module_Device {
[Serializable]
public class AndroidDevice : DeviceBase {
public AndroidDeviceType type;
///
/// 设备型号
///
///
public override string MODEL {
get {
AndroidJavaClass os = new AndroidJavaClass("android.os.Build");
return os.GetStatic("MODEL");
}
}
///
/// SN号
///
public override string SN {
get {
AndroidJavaClass os = new AndroidJavaClass("android.os.Build");
return os.GetStatic("SERIAL");
}
}
///
/// Release_Vesion
///
public override string RELEASE_VERSION {
get {
AndroidJavaClass os = new AndroidJavaClass("android.os.Build$VERSION");
return os.GetStatic("RELEASE");
}
}
///
/// BatteryLevel
///
public override int BatteryLevel {
get {
try {
string CapacityString = System.IO.File.ReadAllText("/sys/class/power_supply/battery/capacity");
return int.Parse(CapacityString);
} catch (Exception e) {
Debug.Log("Failed to read battery power; " + e.Message);
}
return 60;
}
}
public override void ShowInfo() {
base.ShowInfo();
DebugMy.Log(" *** Device Info *** "
+ " DeviceType:" + type
, this, true);
}
}
}