private void OnUnpair() { if (device.IsConnected || (AndroidUtils.ConvertConnectionStatus(device.ConnectionStatus) == 2 && device.IsPaired)) { BhapticsAndroidManager.Unpair(device.Address); } }
public List <HapticDevice> GetDevices() { string[] result = androidJavaObject.Call <string[]>("getDeviceList"); deviceList = AndroidUtils.ConvertToBhapticsDevices(result); return(deviceList); }
public bool CheckPermission() { if (androidJavaObject == null) { return(false); } return(AndroidUtils.CallNativeBoolMethod(AndroidJavaObjectPtr, HasPermissionPtr, EmptyParams)); }
public void RequestPermission() { if (androidJavaObject == null) { return; } AndroidUtils.CallNativeVoidMethod(AndroidJavaObjectPtr, RequestPermissionPtr, EmptyParams); }
private bool CallNativeBoolMethod(IntPtr methodPtr, object[] param) { if (androidJavaObject == null) { return(false); } return(AndroidUtils.CallNativeBoolMethod(AndroidJavaObjectPtr, methodPtr, param)); }
private void CallNativeVoidMethod(IntPtr methodPtr, object[] param) { if (androidJavaObject == null) { return; } AndroidUtils.CallNativeVoidMethod(AndroidJavaObjectPtr, methodPtr, param); }
public List <HapticDevice> GetDevices(bool force = false) { if (force) { string result = hapticPlayer.Call <string>("getDeviceList"); deviceList = AndroidUtils.ConvertToBhapticsDevices(result); } return(deviceList); }
private static void RequestPermission(string[] permissionNames) { if (GetPermissionsService() == null) { return; } AndroidUtils.CallNativeVoidMethod( permissionObjectPtr, RequestPermissionAsyncPtr, new object[] { permissionNames }); }
private static bool IsPermissionGranted(string permissionName) { if (GetPermissionsService() == null) { return(false); } return(AndroidUtils.CallNativeBoolMethod( permissionObjectPtr, IsPermissionGrantedPtr, new object[] { permissionName })); }
public static bool CanPairDevice(PositionType position) { var deviceList = GetDevices(); foreach (var device in deviceList) { if (AndroidUtils.CanPair(device, position)) { return(true); } } return(false); }
private void OnSwap() { if (device.IsConnected) { BhapticsAndroidManager.TogglePosition(device.Address); if (AndroidUtils.IsLeft(device.Position)) { toggleButton.image.sprite = leftSide; } else { toggleButton.image.sprite = rightSide; } } }
public static bool IsNeededToScan() { var devices = GetDevices(); if (IsScanning()) { return(false); } if (devices != null) { for (int i = 0; i < devices.Count; i++) { if (devices[i].IsPaired && AndroidUtils.ConvertConnectionStatus(devices[i].ConnectionStatus) == 2) { return(true); } } } return(false); }