private void SetModeDisplay(HandyMode mode)
 {
     if (_modeInputField == null)
     {
         _modeInputField = transform.Find("Body/Mode").GetComponent <InputField>();
     }
     _modeInputField.text = mode.ToString();
 }
        //============================================================================================================//
        //============================================================================================================//
        //============================================================================================================//
        //                                                                                                            //
        //                                            INTERNAL + UTILITY                                              //
        //                                                                                                            //
        //============================================================================================================//
        //============================================================================================================//
        //============================================================================================================//


        private static void EnforceMode(HandyMode mode, Action command, Action <string> onError)
        {
            if (Mode != mode)
            {
                SetMode(mode, status => command(), onError);
            }
            else
            {
                command();
            }
        }
        //============================================================================================================//
        //                                                                                                            //
        //                                            MACHINE COMMANDS                                                //
        //                                                                                                            //
        //============================================================================================================//

        /// <summary>
        /// Sets the Mode for the Handy.
        /// </summary>
        /// <param name="mode">The new mode the device should be in</param>
        /// <param name="onSuccess">Callback indicating success, contains the newly set mode</param>
        /// <param name="onError">Callback indicating failure, contains the error message</param>
        public static void SetMode(HandyMode mode, Action <HandyMode> onSuccess = null, Action <string> onError = null)
        {
            DoCommand(
                "Set Mode",
                async() => {
                var response = await GetAsync(GetUrl("setMode", new Dictionary <string, string>
                {
                    { "mode", ((int)mode).ToString() }
                }));
                return(response);
            },
                responseJson =>
            {
                var newStatus = (HandyMode)responseJson["mode"].AsInt;
                if (Mode != newStatus)
                {
                    OnStatusChanged?.Invoke(newStatus);
                }
                Mode = newStatus;
                onSuccess?.Invoke(newStatus);
            },
                onError
                );
        }