123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132 |
- using NibiruTask;
- using Nxr.Internal;
- using UnityEngine;
- using UnityEngine.UI;
- public class Test : MonoBehaviour
- {
- public Text wifiEnabledText;
- public Text bluetoothEnabledText;
-
- void Start()
- {
- // var isInit = NxrSensor.Instance.InitLibrary();
- // Debug.Log("NxrSensorInit:" + isInit);
- // mainCamera = Camera.main;
- // NxrViewer.Instance.sleepTimeoutMode = SleepTimeoutMode.SYSTEM_SETTING;
- // NxrViewer.Instance.GetNibiruService().RequsetPermission(new []
- // {
- // "android.permission.ACCESS_WIFI_STATE",
- // "android.permission.CHANGE_WIFI_STATE"
- // });
- NibiruTaskApi.SetInstallSuccessCallback(InstallSuccess);
- NibiruTaskApi.SetInstallFailedCallback(InstallFailed);
- NibiruTaskApi.SetUninstallSuccessCallback(UninstallSuccess);
- NibiruTaskApi.SetUninstallFailedCallback(UninstallFailed);
- }
- void InstallSuccess(string filePath, string packageName)
- {
- Debug.Log("InstallSuccessEvent:"+filePath+"---"+packageName);
- }
-
- void InstallFailed(string filePath, string packageName)
- {
- Debug.Log("InstallFailedEvent:"+filePath+"---"+packageName);
- }
-
- void UninstallSuccess(string packageName)
- {
- Debug.Log("UninstallSuccessEvent:"+packageName);
- }
-
- void UninstallFailed(string packageName)
- {
- Debug.Log("UninstallFailedEvent:"+packageName);
- }
- // private bool isStart;
- //
- // private float time;
- //
- // public Transform cube;
- //
- // private Camera mainCamera;
- // Update is called once per frame
- void Update()
- {
- // if (isStart)
- // {
- // time += Time.deltaTime;
- // if (time >= 0.3f)
- // {
- // NxrSensor.Instance.DetectTags("36h11", 0.16);
- // time = 0.0f;
- // }
- // }
- if(wifiEnabledText) wifiEnabledText.text = "WifiEnabled:" +NibiruTaskApi.IsWifiEnabled();
- if(bluetoothEnabledText) bluetoothEnabledText.text = "BluetoothEnabled:" + NibiruTaskApi.IsBluetoothEnabled();
-
- if (Input.GetKeyUp(KeyCode.Escape))
- {
- Application.Quit();
- }
- }
- // public void Click()
- // {
- // Debug.Log("fff-Unity-Click1");
- // isStart = !isStart;
- // time = 0.0f;
- // Debug.Log("fff-Unity-Click2");
- // }
- public void Click1()
- {
- NibiruTaskApi.SetWifiEnable(true);
- }
-
- public void Click2()
- {
-
- NibiruTaskApi.SetWifiEnable(false);
- }
-
- public void Click3()
- {
- NibiruTaskApi.SetBluetoothEnable(true);
- }
-
- public void Click4()
- {
- NibiruTaskApi.SetBluetoothEnable(false);
- }
-
- public void Click5()
- {
- NibiruTaskApi.GoToControllerDriver();
- }
-
- public void Click6()
- {
- NibiruTaskApi.InstallApk(NxrViewer.Instance.GetStoragePath()+"/Sensor_List.apk");
- // NibiruTaskApi.InstallApk("1");
- }
-
- public void Click7()
- {
- NibiruTaskApi.UninstallApk("com.miian.android.sensors");
- }
- string numberList<T>(T[] array)
- {
- var str = "";
- foreach (var element in array)
- {
- str += element+" ";
- }
- return str;
- }
- }
|