Esempio n. 1
0
 /// <summary>
 /// Creates an empty OSVR_JointClientOpts.
 /// </summary>
 public JointClientOptions()
 {
     mHandle = JointClientKitNative.osvrJointClientCreateOptions();
     if (mHandle == IntPtr.Zero)
     {
         throw new InvalidOperationException(
                   "[OSVR] JointClientOptions.JointClientOptions(): native method osvrJointClientCreateOptions() failed");
     }
 }
Esempio n. 2
0
        /// <summary>
        /// Initialize the library, starting up a "joint" context that also
        /// contains a server. This version of InitContext performs the default
        /// server operation: loading of all autoload-enabled plugins, and a hardware
        /// detection.
        /// </summary>
        /// <param name="applicationIdentifier">A string identifying your
        /// application. Reverse DNS format strongly suggested.</param>
        /// <returns>null, if initialization failed, else a ClientContext.</returns>
        public static ClientContext InitContext(string applicationIdentifier)
        {
            var clientContextHandle = JointClientKitNative.osvrJointClientInit(applicationIdentifier, IntPtr.Zero);

            if (clientContextHandle.IsInvalid)
            {
                return(null);
            }

            return(new ClientContext(clientContextHandle));
        }
Esempio n. 3
0
        /// <summary>
        /// Initialize the library, starting up a "joint" context that also
        /// contains a server. This version of InitContext performs the default
        /// server operation: loading of all autoload-enabled plugins, and a hardware
        /// detection.
        /// </summary>
        /// <param name="options">The configuration options object for starting the joint server
        /// operations. Pass null for default operation: loading of all
        /// autoload-enabled plugins, and a hardware detection. If a non-null pointer is
        /// passed, the enqueued operations will be performed in-order (the default
        /// operations will not be performed). Any exceptions thrown will cause the
        /// initialization to fail, returning a null context.</param>
        /// <param name="applicationIdentifier">A string identifying your
        /// application. Reverse DNS format strongly suggested.</param>
        /// <returns>null, if initialization failed, else a ClientContext.</returns>
        public static ClientContext InitContext(ref JointClientOptions options, string applicationIdentifier)
        {
            if (options == null)
            {
                return(InitContext(applicationIdentifier));
            }

            var clientContextHandle = JointClientKitNative.osvrJointClientInit(applicationIdentifier, options.mHandle);

            options = null; // options can't be re-used after Init is called.
            if (clientContextHandle.IsInvalid)
            {
                return(null);
            }

            return(new ClientContext(clientContextHandle));
        }
Esempio n. 4
0
 /// <summary>
 /// Queues up a trigger for hardware detection.
 /// </summary>
 public void TriggerHardwareDetect()
 {
     ThrowIfError(JointClientKitNative.osvrJointClientOptionsTriggerHardwareDetect(mHandle),
                  "[OSVR] JointClientOptions.TriggerHardwareDetect(): native method osvrJointClientOptionsTriggerHardwareDetect failed");
 }
Esempio n. 5
0
 /// <summary>
 /// Queues up the manual addition of a string element to the path tree.
 /// </summary>
 public void AddString(string path, string value)
 {
     ThrowIfError(JointClientKitNative.osvrJointClientOptionsAddString(mHandle, path, value),
                  "[OSVR] JointClientOptions.AddString(): native method osvrJointClientOptionsAddString failed");
 }
Esempio n. 6
0
 /// <summary>
 /// Queues up the manual addition of aliases specified in JSON to the
 /// path tree.
 /// </summary>
 public void AddAliases(string aliases)
 {
     ThrowIfError(JointClientKitNative.osvrJointClientOptionsAddAliases(mHandle, aliases),
                  "[OSVR] JointClientOptions.AddAliases(): native method osvrJointClientOptionsAddAliases failed");
 }
Esempio n. 7
0
 /// <summary>
 /// Queues up the manual addition of an alias to the path tree.
 /// </summary>
 public void AddAlias(string path, string source)
 {
     ThrowIfError(JointClientKitNative.osvrJointClientOptionsAddAlias(mHandle, path, source),
                  "[OSVR] JointClientOptions.AddAlias(): native method osvrJointClientOptionsAddAlias failed");
 }
Esempio n. 8
0
 /// <summary>
 /// Queues up the manual instantiation of a plugin/driver by name with
 /// optional parameters (JSON).
 /// </summary>
 public void InstantiateDriver(string pluginName, string driverName, string parameters)
 {
     ThrowIfError(JointClientKitNative.osvrJointClientOptionsInstantiateDriver(mHandle, pluginName, driverName, parameters),
                  "[OSVR] JointClientOptions.InstantiateDriver(): native method osvrJointClientOptionsInstantiateDriver failed");
 }
Esempio n. 9
0
 /// <summary>
 /// Queues up the manual load of a plugin by name.
 /// </summary>
 public void LoadPlugin(string pluginName)
 {
     ThrowIfError(JointClientKitNative.osvrJointClientOptionsLoadPlugin(mHandle, pluginName),
                  "[OSVR] JointClientOptions.LoadPlugin(): native method osvrJointClientOptionsLoadPlugin failed");
 }
Esempio n. 10
0
 /// <summary>
 /// Queues up the autoloading of plugins. May only be called once per
 /// options object.
 /// </summary>
 public void AutoloadPlugins()
 {
     ThrowIfError(JointClientKitNative.osvrJointClientOptionsAutoloadPlugins(mHandle),
                  "[OSVR] JointClientOptions.AutoloadPlugins(): native method osvrJointClientOptionsAutoloadPlugins failed");
 }