Example #1
0
 /// <summary>
 /// Unset the Kai's capabilities and subscribes to that data
 /// </summary>
 /// <param name="capabilities">The capabilities to set the Kai to</param>
 public void UnsetCapabilities(KaiCapabilities capabilities)
 {
     KaiSDK.UnsetCapabilities(this, capabilities);
 }
Example #2
0
        /// <summary>
        /// Unset the Kai's capabilities and subscribes to that data
        /// </summary>
        /// <param name="capabilities">The capabilities to set the Kai to</param>
        /// <param name="kai">The kai to set the capabilities to</param>
        public static void UnsetCapabilities(Kai kai, KaiCapabilities capabilities)
        {
            kai.Capabilities &= ~capabilities;             // value = value AND NOT parameter. This will unset the parameter from the value
            if (!Authenticated)
            {
                return;
            }

            var json = new JObject
            {
                [Constants.Type] = Constants.SetCapabilities
            };

            if (ReferenceEquals(kai, DefaultKai))
            {
                json.Add(Constants.KaiID, Constants.Default);
            }
            else if (ReferenceEquals(kai, DefaultLeftKai))
            {
                json.Add(Constants.KaiID, Constants.DefaultLeft);
            }
            else if (ReferenceEquals(kai, DefaultRightKai))
            {
                json.Add(Constants.KaiID, Constants.DefaultRight);
            }
            else
            {
                json.Add(Constants.KaiID, kai.KaiID);
            }

            if (capabilities.HasFlag(KaiCapabilities.GestureData))
            {
                json.Add(Constants.GestureData, false);
            }

            if (capabilities.HasFlag(KaiCapabilities.LinearFlickData))
            {
                json.Add(Constants.LinearFlickData, false);
            }

            if (capabilities.HasFlag(KaiCapabilities.FingerShortcutData))
            {
                json.Add(Constants.FingerShortcutData, false);
            }

            if (capabilities.HasFlag(KaiCapabilities.FingerPositionalData))
            {
                json.Add(Constants.FingerPositionalData, false);
            }

            if (capabilities.HasFlag(KaiCapabilities.PYRData))
            {
                json.Add(Constants.PYRData, false);
            }

            if (capabilities.HasFlag(KaiCapabilities.QuaternionData))
            {
                json.Add(Constants.QuaternionData, false);
            }

            if (capabilities.HasFlag(KaiCapabilities.AccelerometerData))
            {
                json.Add(Constants.AccelerometerData, false);
            }

            if (capabilities.HasFlag(KaiCapabilities.GyroscopeData))
            {
                json.Add(Constants.GyroscopeData, false);
            }

            if (capabilities.HasFlag(KaiCapabilities.MagnetometerData))
            {
                json.Add(Constants.MagnetometerData, false);
            }

            Send(json.ToString(Formatting.None));
        }
Example #3
0
 /// <summary>
 /// Set the Kai's capabilities and subscribes to that data
 /// </summary>
 /// <param name="capabilities">The capabilities to set the Kai to</param>
 public void SetCapabilities(KaiCapabilities capabilities)
 {
     KaiSDK.SetCapabilities(this, capabilities);
 }
Example #4
0
        /// <summary>
        /// Set the Kai's capabilities and subscribes to that data
        /// </summary>
        /// <param name="capabilities">The capabilities to set the Kai to</param>
        /// <param name="kai">The kai to set the capabilities to</param>
        public static void SetCapabilities(Kai kai, KaiCapabilities capabilities)
        {
            kai.Capabilities |= capabilities;
            if (!Authenticated)
            {
                return;
            }

            var json = new JObject
            {
                [Constants.Type] = Constants.SetCapabilities
            };

            if (ReferenceEquals(kai, DefaultKai))
            {
                json.Add(Constants.KaiID, Constants.Default);
            }
            else if (ReferenceEquals(kai, DefaultLeftKai))
            {
                json.Add(Constants.KaiID, Constants.DefaultLeft);
            }
            else if (ReferenceEquals(kai, DefaultRightKai))
            {
                json.Add(Constants.KaiID, Constants.DefaultRight);
            }
            else
            {
                json.Add(Constants.KaiID, kai.KaiID);
            }

            if (capabilities.HasFlag(KaiCapabilities.GestureData))
            {
                json.Add(Constants.GestureData, true);
            }

            if (capabilities.HasFlag(KaiCapabilities.LinearFlickData))
            {
                json.Add(Constants.LinearFlickData, true);
            }

            if (capabilities.HasFlag(KaiCapabilities.FingerShortcutData))
            {
                json.Add(Constants.FingerShortcutData, true);
            }

            if (capabilities.HasFlag(KaiCapabilities.FingerPositionalData))
            {
                json.Add(Constants.FingerPositionalData, true);
            }

            if (capabilities.HasFlag(KaiCapabilities.PYRData))
            {
                json.Add(Constants.PYRData, true);
            }

            if (capabilities.HasFlag(KaiCapabilities.QuaternionData))
            {
                json.Add(Constants.QuaternionData, true);
            }

            if (capabilities.HasFlag(KaiCapabilities.AccelerometerData))
            {
                json.Add(Constants.AccelerometerData, true);
            }

            if (capabilities.HasFlag(KaiCapabilities.GyroscopeData))
            {
                json.Add(Constants.GyroscopeData, true);
            }

            if (capabilities.HasFlag(KaiCapabilities.MagnetometerData))
            {
                json.Add(Constants.MagnetometerData, true);
            }

            Send(json.ToString(Constants.JsonFormatting));
        }