示例#1
0
        /**
         * <summary>
         *   Returns the next scheduled wake up date/time (UNIX format).
         * <para>
         * </para>
         * <para>
         * </para>
         * </summary>
         * <returns>
         *   an integer corresponding to the next scheduled wake up date/time (UNIX format)
         * </returns>
         * <para>
         *   On failure, throws an exception or returns <c>YWakeUpMonitor.NEXTWAKEUP_INVALID</c>.
         * </para>
         */
        public async Task <long> get_nextWakeUp()
        {
            long res;

            if (_cacheExpiration <= YAPIContext.GetTickCount())
            {
                if (await this.load(await _yapi.GetCacheValidity()) != YAPI.SUCCESS)
                {
                    return(NEXTWAKEUP_INVALID);
                }
            }
            res = _nextWakeUp;
            return(res);
        }
        /**
         * <summary>
         *   Returns the measured voltage on the external power source, in millivolts.
         * <para>
         * </para>
         * <para>
         * </para>
         * </summary>
         * <returns>
         *   an integer corresponding to the measured voltage on the external power source, in millivolts
         * </returns>
         * <para>
         *   On failure, throws an exception or returns <c>YDualPower.EXTVOLTAGE_INVALID</c>.
         * </para>
         */
        public async Task <int> get_extVoltage()
        {
            int res;

            if (_cacheExpiration <= YAPIContext.GetTickCount())
            {
                if (await this.load(YAPI.DefaultCacheValidity) != YAPI.SUCCESS)
                {
                    return(EXTVOLTAGE_INVALID);
                }
            }
            res = _extVoltage;
            return(res);
        }
        /**
         * <summary>
         *   Returns a short string representing the current state of the function.
         * <para>
         * </para>
         * <para>
         * </para>
         * </summary>
         * <returns>
         *   a string corresponding to a short string representing the current state of the function
         * </returns>
         * <para>
         *   On failure, throws an exception or returns <c>YFunction.ADVERTISEDVALUE_INVALID</c>.
         * </para>
         */
        public async Task <string> get_advertisedValue()
        {
            string res;

            if (_cacheExpiration <= YAPIContext.GetTickCount())
            {
                if (await this.load(YAPI.DefaultCacheValidity) != YAPI.SUCCESS)
                {
                    return(ADVERTISEDVALUE_INVALID);
                }
            }
            res = _advertisedValue;
            return(res);
        }
        /**
         * <summary>
         *   Returns the output voltage set point, in V.
         * <para>
         * </para>
         * <para>
         * </para>
         * </summary>
         * <returns>
         *   a floating point number corresponding to the output voltage set point, in V
         * </returns>
         * <para>
         *   On failure, throws an exception or returns <c>YVoltageOutput.CURRENTVOLTAGE_INVALID</c>.
         * </para>
         */
        public async Task <double> get_currentVoltage()
        {
            double res;

            if (_cacheExpiration <= YAPIContext.GetTickCount())
            {
                if (await this.load(YAPI.DefaultCacheValidity) != YAPI.SUCCESS)
                {
                    return(CURRENTVOLTAGE_INVALID);
                }
            }
            res = _currentVoltage;
            return(res);
        }
        /**
         * <summary>
         *   Returns the selected voltage output at device startup, in V.
         * <para>
         * </para>
         * <para>
         * </para>
         * </summary>
         * <returns>
         *   a floating point number corresponding to the selected voltage output at device startup, in V
         * </returns>
         * <para>
         *   On failure, throws an exception or returns <c>YVoltageOutput.VOLTAGEATSTARTUP_INVALID</c>.
         * </para>
         */
        public async Task <double> get_voltageAtStartUp()
        {
            double res;

            if (_cacheExpiration <= YAPIContext.GetTickCount())
            {
                if (await this.load(YAPI.DefaultCacheValidity) != YAPI.SUCCESS)
                {
                    return(VOLTAGEATSTARTUP_INVALID);
                }
            }
            res = _voltageAtStartUp;
            return(res);
        }
示例#6
0
        /**
         * <summary>
         *   Returns the PWM frequency used to control the motor.
         * <para>
         * </para>
         * <para>
         * </para>
         * </summary>
         * <returns>
         *   a floating point number corresponding to the PWM frequency used to control the motor
         * </returns>
         * <para>
         *   On failure, throws an exception or returns <c>YMotor.FREQUENCY_INVALID</c>.
         * </para>
         */
        public async Task <double> get_frequency()
        {
            double res;

            if (_cacheExpiration <= YAPIContext.GetTickCount())
            {
                if (await this.load(await _yapi.GetCacheValidity()) != YAPI.SUCCESS)
                {
                    return(FREQUENCY_INVALID);
                }
            }
            res = _frequency;
            return(res);
        }
示例#7
0
        /**
         * <summary>
         *   Returns the delay in milliseconds allowed for the controller to run autonomously without
         *   receiving any instruction from the control process.
         * <para>
         *   When this delay has elapsed,
         *   the controller automatically stops the motor and switches to FAILSAFE error.
         *   Failsafe security is disabled when the value is zero.
         * </para>
         * <para>
         * </para>
         * </summary>
         * <returns>
         *   an integer corresponding to the delay in milliseconds allowed for the controller to run autonomously without
         *   receiving any instruction from the control process
         * </returns>
         * <para>
         *   On failure, throws an exception or returns <c>YMotor.FAILSAFETIMEOUT_INVALID</c>.
         * </para>
         */
        public async Task <int> get_failSafeTimeout()
        {
            int res;

            if (_cacheExpiration <= YAPIContext.GetTickCount())
            {
                if (await this.load(await _yapi.GetCacheValidity()) != YAPI.SUCCESS)
                {
                    return(FAILSAFETIMEOUT_INVALID);
                }
            }
            res = _failSafeTimeout;
            return(res);
        }
示例#8
0
        /**
         * <summary>
         *   Returns the security algorithm used by the selected wireless network.
         * <para>
         * </para>
         * <para>
         * </para>
         * </summary>
         * <returns>
         *   a value among <c>YWireless.SECURITY_UNKNOWN</c>, <c>YWireless.SECURITY_OPEN</c>,
         *   <c>YWireless.SECURITY_WEP</c>, <c>YWireless.SECURITY_WPA</c> and <c>YWireless.SECURITY_WPA2</c>
         *   corresponding to the security algorithm used by the selected wireless network
         * </returns>
         * <para>
         *   On failure, throws an exception or returns <c>YWireless.SECURITY_INVALID</c>.
         * </para>
         */
        public async Task <int> get_security()
        {
            int res;

            if (_cacheExpiration <= YAPIContext.GetTickCount())
            {
                if (await this.load(await _yapi.GetCacheValidity()) != YAPI.SUCCESS)
                {
                    return(SECURITY_INVALID);
                }
            }
            res = _security;
            return(res);
        }
示例#9
0
        /**
         * <summary>
         *   Returns the latest status message from the wireless interface.
         * <para>
         * </para>
         * <para>
         * </para>
         * </summary>
         * <returns>
         *   a string corresponding to the latest status message from the wireless interface
         * </returns>
         * <para>
         *   On failure, throws an exception or returns <c>YWireless.MESSAGE_INVALID</c>.
         * </para>
         */
        public async Task <string> get_message()
        {
            string res;

            if (_cacheExpiration <= YAPIContext.GetTickCount())
            {
                if (await this.load(await _yapi.GetCacheValidity()) != YAPI.SUCCESS)
                {
                    return(MESSAGE_INVALID);
                }
            }
            res = _message;
            return(res);
        }
示例#10
0
        /**
         * <summary>
         *   Returns the free space for uploading new files to the filesystem, in bytes.
         * <para>
         * </para>
         * <para>
         * </para>
         * </summary>
         * <returns>
         *   an integer corresponding to the free space for uploading new files to the filesystem, in bytes
         * </returns>
         * <para>
         *   On failure, throws an exception or returns <c>YFiles.FREESPACE_INVALID</c>.
         * </para>
         */
        public async Task <int> get_freeSpace()
        {
            int res;

            if (_cacheExpiration <= YAPIContext.GetTickCount())
            {
                if (await this.load(await _yapi.GetCacheValidity()) != YAPI.SUCCESS)
                {
                    return(FREESPACE_INVALID);
                }
            }
            res = _freeSpace;
            return(res);
        }
示例#11
0
        /**
         * <summary>
         *   Returns the 802.11 channel currently used, or 0 when the selected network has not been found.
         * <para>
         * </para>
         * <para>
         * </para>
         * </summary>
         * <returns>
         *   an integer corresponding to the 802.11 channel currently used, or 0 when the selected network has not been found
         * </returns>
         * <para>
         *   On failure, throws an exception or returns <c>YWireless.CHANNEL_INVALID</c>.
         * </para>
         */
        public async Task <int> get_channel()
        {
            int res;

            if (_cacheExpiration <= YAPIContext.GetTickCount())
            {
                if (await this.load(await _yapi.GetCacheValidity()) != YAPI.SUCCESS)
                {
                    return(CHANNEL_INVALID);
                }
            }
            res = _channel;
            return(res);
        }
示例#12
0
        /**
         * <summary>
         *   Returns the number of files currently loaded in the filesystem.
         * <para>
         * </para>
         * <para>
         * </para>
         * </summary>
         * <returns>
         *   an integer corresponding to the number of files currently loaded in the filesystem
         * </returns>
         * <para>
         *   On failure, throws an exception or returns <c>YFiles.FILESCOUNT_INVALID</c>.
         * </para>
         */
        public async Task <int> get_filesCount()
        {
            int res;

            if (_cacheExpiration <= YAPIContext.GetTickCount())
            {
                if (await this.load(await _yapi.GetCacheValidity()) != YAPI.SUCCESS)
                {
                    return(FILESCOUNT_INVALID);
                }
            }
            res = _filesCount;
            return(res);
        }
示例#13
0
        /**
         * <summary>
         *   throws an exception on error
         * </summary>
         */
        public async Task <long> get_rtcTime()
        {
            long res;

            if (_cacheExpiration <= YAPIContext.GetTickCount())
            {
                if (await this.load(await _yapi.GetCacheValidity()) != YAPI.SUCCESS)
                {
                    return(RTCTIME_INVALID);
                }
            }
            res = _rtcTime;
            return(res);
        }
示例#14
0
        /**
         * <summary>
         *   Returns the latest wake up reason.
         * <para>
         * </para>
         * <para>
         * </para>
         * </summary>
         * <returns>
         *   a value among <c>YWakeUpMonitor.WAKEUPREASON_USBPOWER</c>, <c>YWakeUpMonitor.WAKEUPREASON_EXTPOWER</c>,
         *   <c>YWakeUpMonitor.WAKEUPREASON_ENDOFSLEEP</c>, <c>YWakeUpMonitor.WAKEUPREASON_EXTSIG1</c>,
         *   <c>YWakeUpMonitor.WAKEUPREASON_SCHEDULE1</c> and <c>YWakeUpMonitor.WAKEUPREASON_SCHEDULE2</c>
         *   corresponding to the latest wake up reason
         * </returns>
         * <para>
         *   On failure, throws an exception or returns <c>YWakeUpMonitor.WAKEUPREASON_INVALID</c>.
         * </para>
         */
        public async Task <int> get_wakeUpReason()
        {
            int res;

            if (_cacheExpiration <= YAPIContext.GetTickCount())
            {
                if (await this.load(await _yapi.GetCacheValidity()) != YAPI.SUCCESS)
                {
                    return(WAKEUPREASON_INVALID);
                }
            }
            res = _wakeUpReason;
            return(res);
        }
示例#15
0
        /**
         * <summary>
         *   Returns the threshold voltage under which the controller automatically switches to error state
         *   and prevents further current draw.
         * <para>
         *   This setting prevents damage to a battery that can
         *   occur when drawing current from an "empty" battery.
         * </para>
         * <para>
         * </para>
         * </summary>
         * <returns>
         *   a floating point number corresponding to the threshold voltage under which the controller
         *   automatically switches to error state
         *   and prevents further current draw
         * </returns>
         * <para>
         *   On failure, throws an exception or returns <c>YMotor.CUTOFFVOLTAGE_INVALID</c>.
         * </para>
         */
        public async Task <double> get_cutOffVoltage()
        {
            double res;

            if (_cacheExpiration <= YAPIContext.GetTickCount())
            {
                if (await this.load(await _yapi.GetCacheValidity()) != YAPI.SUCCESS)
                {
                    return(CUTOFFVOLTAGE_INVALID);
                }
            }
            res = _cutOffVoltage;
            return(res);
        }
示例#16
0
        /**
         * <summary>
         *   throws an exception on error
         * </summary>
         */
        public async Task <string> get_wlanConfig()
        {
            string res;

            if (_cacheExpiration <= YAPIContext.GetTickCount())
            {
                if (await this.load(await _yapi.GetCacheValidity()) != YAPI.SUCCESS)
                {
                    return(WLANCONFIG_INVALID);
                }
            }
            res = _wlanConfig;
            return(res);
        }
示例#17
0
        /**
         * <summary>
         *   Returns the current threshold (in mA) above which the controller automatically
         *   switches to error state.
         * <para>
         *   A zero value means that there is no limit.
         * </para>
         * <para>
         * </para>
         * </summary>
         * <returns>
         *   an integer corresponding to the current threshold (in mA) above which the controller automatically
         *   switches to error state
         * </returns>
         * <para>
         *   On failure, throws an exception or returns <c>YMotor.OVERCURRENTLIMIT_INVALID</c>.
         * </para>
         */
        public async Task <int> get_overCurrentLimit()
        {
            int res;

            if (_cacheExpiration <= YAPIContext.GetTickCount())
            {
                if (await this.load(await _yapi.GetCacheValidity()) != YAPI.SUCCESS)
                {
                    return(OVERCURRENTLIMIT_INVALID);
                }
            }
            res = _overCurrentLimit;
            return(res);
        }
示例#18
0
        /**
         * <summary>
         *   Returns the current state of the wireless interface.
         * <para>
         *   The state <c>YWireless.WLANSTATE_DOWN</c> means that the network interface is
         *   not connected to a network. The state <c>YWireless.WLANSTATE_SCANNING</c> means that the network
         *   interface is scanning available
         *   frequencies. During this stage, the device is not reachable, and the network settings are not yet
         *   applied. The state
         *   <c>YWireless.WLANSTATE_CONNECTED</c> means that the network settings have been successfully applied
         *   ant that the device is reachable
         *   from the wireless network. If the device is configured to use ad-hoc or Soft AP mode, it means that
         *   the wireless network
         *   is up and that other devices can join the network. The state <c>YWireless.WLANSTATE_REJECTED</c>
         *   means that the network interface has
         *   not been able to join the requested network. The description of the error can be obtain with the
         *   <c>get_message()</c> method.
         * </para>
         * <para>
         * </para>
         * </summary>
         * <returns>
         *   a value among <c>YWireless.WLANSTATE_DOWN</c>, <c>YWireless.WLANSTATE_SCANNING</c>,
         *   <c>YWireless.WLANSTATE_CONNECTED</c> and <c>YWireless.WLANSTATE_REJECTED</c> corresponding to the
         *   current state of the wireless interface
         * </returns>
         * <para>
         *   On failure, throws an exception or returns <c>YWireless.WLANSTATE_INVALID</c>.
         * </para>
         */
        public async Task <int> get_wlanState()
        {
            int res;

            if (_cacheExpiration <= YAPIContext.GetTickCount())
            {
                if (await this.load(await _yapi.GetCacheValidity()) != YAPI.SUCCESS)
                {
                    return(WLANSTATE_INVALID);
                }
            }
            res = _wlanState;
            return(res);
        }
示例#19
0
        /**
         * <summary>
         *   Returns the duration (in ms) during which the motor is driven at low frequency to help
         *   it start up.
         * <para>
         * </para>
         * <para>
         * </para>
         * </summary>
         * <returns>
         *   an integer corresponding to the duration (in ms) during which the motor is driven at low frequency to help
         *   it start up
         * </returns>
         * <para>
         *   On failure, throws an exception or returns <c>YMotor.STARTERTIME_INVALID</c>.
         * </para>
         */
        public async Task <int> get_starterTime()
        {
            int res;

            if (_cacheExpiration <= YAPIContext.GetTickCount())
            {
                if (await this.load(await _yapi.GetCacheValidity()) != YAPI.SUCCESS)
                {
                    return(STARTERTIME_INVALID);
                }
            }
            res = _starterTime;
            return(res);
        }
示例#20
0
        /**
         * <summary>
         *   Returns the measure update frequency, measured in Hz.
         * <para>
         * </para>
         * <para>
         * </para>
         * </summary>
         * <returns>
         *   an integer corresponding to the measure update frequency, measured in Hz
         * </returns>
         * <para>
         *   On failure, throws an exception or returns <c>YAccelerometer.BANDWIDTH_INVALID</c>.
         * </para>
         */
        public async Task <int> get_bandwidth()
        {
            int res;

            if (_cacheExpiration <= YAPIContext.GetTickCount())
            {
                if (await this.load(await _yapi.GetCacheValidity()) != YAPI.SUCCESS)
                {
                    return(BANDWIDTH_INVALID);
                }
            }
            res = _bandwidth;
            return(res);
        }
示例#21
0
        /**
         * <summary>
         *   throws an exception on error
         * </summary>
         */
        public async Task <string> get_command()
        {
            string res;

            if (_cacheExpiration <= YAPIContext.GetTickCount())
            {
                if (await this.load(await _yapi.GetCacheValidity()) != YAPI.SUCCESS)
                {
                    return(COMMAND_INVALID);
                }
            }
            res = _command;
            return(res);
        }
示例#22
0
        /**
         * <summary>
         *   Returns the Z component of the acceleration, as a floating point number.
         * <para>
         * </para>
         * <para>
         * </para>
         * </summary>
         * <returns>
         *   a floating point number corresponding to the Z component of the acceleration, as a floating point number
         * </returns>
         * <para>
         *   On failure, throws an exception or returns <c>YAccelerometer.ZVALUE_INVALID</c>.
         * </para>
         */
        public async Task <double> get_zValue()
        {
            double res;

            if (_cacheExpiration <= YAPIContext.GetTickCount())
            {
                if (await this.load(await _yapi.GetCacheValidity()) != YAPI.SUCCESS)
                {
                    return(ZVALUE_INVALID);
                }
            }
            res = _zValue;
            return(res);
        }
        /**
         * <summary>
         *   throws an exception on error
         * </summary>
         */
        public async Task <string> get_voltageTransition()
        {
            string res;

            if (_cacheExpiration <= YAPIContext.GetTickCount())
            {
                if (await this.load(YAPI.DefaultCacheValidity) != YAPI.SUCCESS)
                {
                    return(VOLTAGETRANSITION_INVALID);
                }
            }
            res = _voltageTransition;
            return(res);
        }
示例#24
0
        /**
         * <summary>
         *   throws an exception on error
         * </summary>
         */
        public async Task <int> get_gravityCancellation()
        {
            int res;

            if (_cacheExpiration <= YAPIContext.GetTickCount())
            {
                if (await this.load(await _yapi.GetCacheValidity()) != YAPI.SUCCESS)
                {
                    return(GRAVITYCANCELLATION_INVALID);
                }
            }
            res = _gravityCancellation;
            return(res);
        }
        /**
         * <summary>
         *   Returns the selected power source for module functions that require lots of current.
         * <para>
         * </para>
         * <para>
         * </para>
         * </summary>
         * <returns>
         *   a value among <c>YDualPower.POWERCONTROL_AUTO</c>, <c>YDualPower.POWERCONTROL_FROM_USB</c>,
         *   <c>YDualPower.POWERCONTROL_FROM_EXT</c> and <c>YDualPower.POWERCONTROL_OFF</c> corresponding to the
         *   selected power source for module functions that require lots of current
         * </returns>
         * <para>
         *   On failure, throws an exception or returns <c>YDualPower.POWERCONTROL_INVALID</c>.
         * </para>
         */
        public async Task <int> get_powerControl()
        {
            int res;

            if (_cacheExpiration <= YAPIContext.GetTickCount())
            {
                if (await this.load(YAPI.DefaultCacheValidity) != YAPI.SUCCESS)
                {
                    return(POWERCONTROL_INVALID);
                }
            }
            res = _powerControl;
            return(res);
        }
示例#26
0
        /**
         * <summary>
         *   Return the controller state.
         * <para>
         *   Possible states are:
         *   IDLE   when the motor is stopped/in free wheel, ready to start;
         *   FORWD  when the controller is driving the motor forward;
         *   BACKWD when the controller is driving the motor backward;
         *   BRAKE  when the controller is braking;
         *   LOVOLT when the controller has detected a low voltage condition;
         *   HICURR when the controller has detected an over current condition;
         *   HIHEAT when the controller has detected an overheat condition;
         *   FAILSF when the controller switched on the failsafe security.
         * </para>
         * <para>
         *   When an error condition occurred (LOVOLT, HICURR, HIHEAT, FAILSF), the controller
         *   status must be explicitly reset using the <c>resetStatus</c> function.
         * </para>
         * <para>
         * </para>
         * </summary>
         * <returns>
         *   a value among <c>YMotor.MOTORSTATUS_IDLE</c>, <c>YMotor.MOTORSTATUS_BRAKE</c>,
         *   <c>YMotor.MOTORSTATUS_FORWD</c>, <c>YMotor.MOTORSTATUS_BACKWD</c>,
         *   <c>YMotor.MOTORSTATUS_LOVOLT</c>, <c>YMotor.MOTORSTATUS_HICURR</c>,
         *   <c>YMotor.MOTORSTATUS_HIHEAT</c> and <c>YMotor.MOTORSTATUS_FAILSF</c>
         * </returns>
         * <para>
         *   On failure, throws an exception or returns <c>YMotor.MOTORSTATUS_INVALID</c>.
         * </para>
         */
        public async Task <int> get_motorStatus()
        {
            int res;

            if (_cacheExpiration <= YAPIContext.GetTickCount())
            {
                if (await this.load(await _yapi.GetCacheValidity()) != YAPI.SUCCESS)
                {
                    return(MOTORSTATUS_INVALID);
                }
            }
            res = _motorStatus;
            return(res);
        }
        /**
         * <summary>
         *   Returns the logical name of the function.
         * <para>
         * </para>
         * <para>
         * </para>
         * </summary>
         * <returns>
         *   a string corresponding to the logical name of the function
         * </returns>
         * <para>
         *   On failure, throws an exception or returns <c>YFunction.LOGICALNAME_INVALID</c>.
         * </para>
         */
        public async Task <string> get_logicalName()
        {
            string res;

            if (_cacheExpiration <= YAPIContext.GetTickCount())
            {
                if (await this.load(YAPI.DefaultCacheValidity) != YAPI.SUCCESS)
                {
                    return(LOGICALNAME_INVALID);
                }
            }
            res = _logicalName;
            return(res);
        }
示例#28
0
        /**
         * <summary>
         *   Returns the braking force applied to the motor, as a percentage.
         * <para>
         *   The value 0 corresponds to no braking (free wheel).
         * </para>
         * <para>
         * </para>
         * </summary>
         * <returns>
         *   a floating point number corresponding to the braking force applied to the motor, as a percentage
         * </returns>
         * <para>
         *   On failure, throws an exception or returns <c>YMotor.BRAKINGFORCE_INVALID</c>.
         * </para>
         */
        public async Task <double> get_brakingForce()
        {
            double res;

            if (_cacheExpiration <= YAPIContext.GetTickCount())
            {
                if (await this.load(await _yapi.GetCacheValidity()) != YAPI.SUCCESS)
                {
                    return(BRAKINGFORCE_INVALID);
                }
            }
            res = _brakingForce;
            return(res);
        }
        // Method used to cache DataStream objects (new DataLogger)
        internal virtual YDataStream imm_findDataStream(YDataSet dataset, string def)
        {
            string key = dataset.get_functionId() + ":" + def;

            if (_dataStreams.ContainsKey(key))
            {
                return(_dataStreams[key]);
            }

            YDataStream newDataStream = new YDataStream(this, dataset, YAPIContext.imm_decodeWords(def));

            _dataStreams[key] = newDataStream;
            return(newDataStream);
        }
示例#30
0
        /**
         * <summary>
         *   Returns the delay before the  next sleep period.
         * <para>
         * </para>
         * <para>
         * </para>
         * </summary>
         * <returns>
         *   an integer corresponding to the delay before the  next sleep period
         * </returns>
         * <para>
         *   On failure, throws an exception or returns <c>YWakeUpMonitor.SLEEPCOUNTDOWN_INVALID</c>.
         * </para>
         */
        public async Task <int> get_sleepCountdown()
        {
            int res;

            if (_cacheExpiration <= YAPIContext.GetTickCount())
            {
                if (await this.load(await _yapi.GetCacheValidity()) != YAPI.SUCCESS)
                {
                    return(SLEEPCOUNTDOWN_INVALID);
                }
            }
            res = _sleepCountdown;
            return(res);
        }