コード例 #1
0
        /**
         * <summary>
         *   Registers the callback function that is invoked on every periodic timed notification.
         * <para>
         *   The callback is invoked only during the execution of <c>ySleep</c> or <c>yHandleEvents</c>.
         *   This provides control over the time when the callback is triggered. For good responsiveness, remember to call
         *   one of these two functions periodically. To unregister a callback, pass a null pointer as argument.
         * </para>
         * <para>
         * </para>
         * </summary>
         * <param name="callback">
         *   the callback function to call, or a null pointer. The callback function should take two
         *   arguments: the function object of which the value has changed, and an <c>YMeasure</c> object describing
         *   the new advertised value.
         * @noreturn
         * </param>
         */
        public async Task <int> registerTimedReportCallback(TimedReportCallback callback)
        {
            YSensor sensor;

            sensor = this;
            if (callback != null)
            {
                await YFunction._UpdateTimedReportCallbackList(sensor, true);
            }
            else
            {
                await YFunction._UpdateTimedReportCallbackList(sensor, false);
            }
            _timedReportCallbackPressure = callback;
            return(0);
        }