JMRSDK Development
v4.38
v4.38
  • Jio Mixed Reality SDK Documentation
    • Changelog 4.38
      • Upgrade Guide 4.38
    • Application Requirements
  • Device Information
    • JioGlass
    • JioDive
  • Supported Smartphones
  • Controller Specifications
    • Physical Controllers
    • External Gamepad
    • Virtual Controller / Virtual Keyboard for JioGlass
  • Getting Started
    • Development Platform
    • Setting Up Jio Mixed Reality Project in Unity
    • URP Support
      • Setting Up Your Project With URP
      • Reverting Back to Built-In Render Pipeline
  • JMRSDK
    • JMRSDK Content
    • JMRMixedReality Prefab
    • System Dock
    • JMRRig
      • Local Rig
      • Setting Homepage (Quit functionality)
      • Recenter Application on Resume
  • Develop
    • Editor Emulator
    • JioGlass Controller Interactions
    • Cameras
    • Tesseract Mixed Reality UI Toolkits
    • Examples
    • Video Tutorials
  • Interaction
    • Gaze Interaction
      • Gaze and Click
      • Gaze and Dwell
    • Interaction
      • Pointer Manager
        • Examples
      • Active Input Source
    • Interfaces
      • IFocusable
      • ISelectHandler
      • ISelectClickHandler
      • IBackHandler
      • IHomeHandler
      • IMenuHandler
      • IFn1Handler
      • IFn2Handler
      • ITouchHandler
      • ISwipeHandler
      • IVoiceHandler
      • IManipulationHandler
    • Controller Input Actions
      • Touchpad - Touch
      • Touchpad - Swipe
      • Source Buttons
      • Manipulation
    • Actions
    • Device State
      • JioDive Device State
      • JioGlass Device State
      • Controller Device State
  • Voice
    • Voice
      • Speech Events
      • Speech Result
      • Speech Error
      • Speech Session End
      • Speech Cancel
    • Listening
  • Tracking
    • Tracking
      • Coordinate System
    • Tracking Framework
      • TrackerManager Actions
        • Get Head Position
        • Get Head Rotation
        • Get Head Transform
      • TrackerManager Methods
        • Get Head Position
        • Get Head Rotation
        • Get Head Transform
    • Recenter
  • Building and Testing
    • Building to Target Device
      • Merging AndroidManifest
      • Performance Optimization
      • App optimization
    • Running your application
      • JioImmerse App For Jio Mixed Reality (JMR) Devices
      • Running the application on Prism (Holoboard)
    • IPD Calibration
  • Publish
    • Branding Guidelines
    • Licensing Journey In Android JioImmerse
    • Signing your App
    • Publishing to Google Play Store
      • Play Store Upload Journey
    • Publishing to JioImmerse Developer Console
    • Publishing to Apple Store
    • Licensing Journey in iOS JioImmerse
    • iOS Deep linking
  • Capturing and Recording
    • Capture Videos and Screenshots
      • Capturing Screenshot/Videos using scrcpy
      • Capturing Screenshot/Videos using Vysor
  • Troubleshooting
    • FAQs - Develop
    • FAQs - Building to device
      • Gradle
      • FAQs - iOS
    • FAQs - Running and Publishing
    • Laser Point Not Visible
Powered by GitBook
On this page
  • Controller Connected / Disconnected
  • Battery Percentage
  • Battery percentage update
  1. Interaction
  2. Device State

Controller Device State

Controller Connected / Disconnected

public void OnConnected (JMRInteractionManager.InteractionDeviceType devType, int index, string val)

Public void OnDisconnect(JMRInteractionManager.InteractionDeviceType devType, int index, string val)

Parameters
Description

InteractionDeviceType

Type of device connected

index

Index of connected device

name

Name of connected device

To get notified when the device is connected or disconnected, implement the callback method exposed through InteractionManager:

OnConnected(JMRInteractionManager.InteractionDeviceType devType, int index, string val)

OnDisconnected(JMRInteractionManager.InteractionDeviceType devType, int index, string val)

Interaction Manager will call this action when the device is connected.

Action will be called only when it’s subscribed to a method. Action must be subscribed to a method with a matching signature.

using JMRSDK.InputModule;
using UnityEngine;

public class JMRDemoInteractionExample : MonoBehaviour
{  
    private void OnEnable()
    {
        JMRInteractionManager.OnConnected += OnConnect;
        JMRInteractionManager.OnDisconnected += OnDisconnect;
    } 
    private void OnDisable()
    {
        JMRInteractionManager.OnConnected -= OnConnect;
        JMRInteractionManager.OnDisconnected -= OnDisconnect;
    }
    private void OnConnect(JMRInteractionManager.InteractionDeviceType devType, int index, string val)
    {
        //do something when connected
        JMRInteractionManager.InteractionDeviceType deviceType = devType;
        int deviceIndex = index;
        string deviceName = val;
    }
    private void OnDisconnect(JMRInteractionManager.InteractionDeviceType devType, int index, string val)
    {
        //do something when disconnected
        JMRInteractionManager.InteractionDeviceType deviceType = devType;
        int deviceIndex = index;
        string DeviceName = val;
    }
}


Battery Percentage

public int GetBatteryPercentage(int controllerIndex)

Parameter
Description

controllerIndex

Connected controller index

Return Type
Description

int

Batter percentage of connected controller

using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using JMRSDK.InputModule;

public class JMRInteractionExample : MonoBehaviour
{
    private List<IInputSource> Controllers = new List<IInputSource>();
    private bool isInitialized;
    private void OnEnable()
    {
        isInitialized = false;
        Controllers = new List<IInputSource>();
    }
    private IEnumerator WaitTilFindController()
    {
        do
        {
            Controllers = JMRInteractionManager.Instance.GetSources();
            yield return null;
        } while (Controllers.Count == 0);
        isInitialized = true;
    }
    private void OnDisable()
    {
        isInitialized = false;
        Controllers = new List<IInputSource>();
    }
    public void Update()
    {
        if (!isInitialized)
        {
            return;
        }
        float batteryPercentage = JMRInteractionManager.Instance.GetBatteryPercentage(Controllers[0].inputIndex);
    }
}


Battery percentage update

public void OnBatteryUpdate(JMRInteractionManager.InteractionDeviceType deviceType, int index, int percentage)

Parameters
Description

InteractionDeviceType

Type of device connected

index

Index of connected device

percentage

Percentage of Battery

To get notified when the battery percentage is updated need to implement the callback method exposed through InteractionManager:

OnBatteryUpdate(JMRInteractionManager.InteractionDeviceType deviceType, int index, int percentage)

Action will be called only when it’s subscribed to a method. Action must be subscribed to a method with a matching signature.

using JMRSDK.InputModule;
using UnityEngine;

public class JMRInteractionExample : MonoBehaviour
{  
    private void OnEnable()
    {
        JMRInteractionManager.OnBatteryUpdate += OnBatteryUpdate;
    } 
    private void OnDisable()
    {
        JMRInteractionManager.OnBatteryUpdate -= OnBatteryUpdate;
    }
    private void OnBatteryUpdate(JMRInteractionManager.InteractionDeviceType devType, int index, int percentage)
    {
        //do something when battery updated
        JMRInteractionManager.InteractionDeviceType deviceType= devType;
        int deviceIndex=index;
        int batteryPercentage=percentage;
    }
}


PreviousJioGlass Device StateNextVoice

Last updated 1 year ago