コード例 #1
0
        /**
         * <summary>
         *   Registers the callback function that is invoked on every change of advertised value.
         * <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 the character string describing
         *   the new advertised value.
         * @noreturn
         * </param>
         */
        public int registerValueCallback(ValueCallback callback)
        {
            string val;

            if (callback != null)
            {
                YFunction._UpdateValueCallbackList(this, true);
            }
            else
            {
                YFunction._UpdateValueCallbackList(this, false);
            }
            this._valueCallbackInputChain = callback;
            // Immediately invoke value callback with current value
            if (callback != null && this.isOnline())
            {
                val = this._advertisedValue;
                if (!(val == ""))
                {
                    this._invokeValueCallback(val);
                }
            }
            return(0);
        }
コード例 #2
0
 // perform the initial setup that may be done without a YoctoAPI object (hwd can be null)
 internal override void base_init(YFunction hwd, string instantiationName)
 {
     _func = (YSegmentedDisplay)hwd;
     base.base_init(hwd, instantiationName);
 }
コード例 #3
0
 protected override void valueChangeCallback(YFunction source, string value)
 {
     base.valueChangeCallback(source, value);
     value        = (YAPI._atoi(value)).ToString();
     _linkQuality = YAPI._atoi(value);
 }
コード例 #4
0
 protected virtual void valueChangeCallback(YFunction source, string value)
 {
     //InternalStuff.log("new value (" + value + ")");
     _advertisedValue = value;
 }
コード例 #5
0
 protected static void _UpdateValueCallbackList(YFunction func, Boolean add)
 {
     if (add)
     {
         func.isOnline();
         if (!_ValueCallbackList.Contains(func))
         {
             _ValueCallbackList.Add(func);
         }
     }
     else
     {
         _ValueCallbackList.Remove(func);
     }
 }
コード例 #6
0
 /**
  * <summary>
  *   Retrieves a function for a given identifier.
  * <para>
  *   The identifier can be specified using several formats:
  * </para>
  * <para>
  * </para>
  * <para>
  *   - FunctionLogicalName
  * </para>
  * <para>
  *   - ModuleSerialNumber.FunctionIdentifier
  * </para>
  * <para>
  *   - ModuleSerialNumber.FunctionLogicalName
  * </para>
  * <para>
  *   - ModuleLogicalName.FunctionIdentifier
  * </para>
  * <para>
  *   - ModuleLogicalName.FunctionLogicalName
  * </para>
  * <para>
  * </para>
  * <para>
  *   This function does not require that the function is online at the time
  *   it is invoked. The returned object is nevertheless valid.
  *   Use the method <c>YFunction.isOnline()</c> to test if the function is
  *   indeed online at a given time. In case of ambiguity when looking for
  *   a function by logical name, no error is notified: the first instance
  *   found is returned. The search is performed first by hardware name,
  *   then by logical name.
  * </para>
  * </summary>
  * <param name="func">
  *   a string that uniquely characterizes the function
  * </param>
  * <returns>
  *   a <c>YFunction</c> object allowing you to drive the function.
  * </returns>
  */
 public static YFunction FindFunction(string func)
 {
     YFunction obj;
     obj = (YFunction) YFunction._FindFromCache("Function", func);
     if (obj == null) {
         obj = new YFunction(func);
         YFunction._AddToCache("Function", func, obj);
     }
     return obj;
 }
コード例 #7
0
 // perform the initial setup that may be done without a YoctoAPI object (hwd can be null)
 internal override void base_init(YFunction hwd, string instantiationName)
 {
     _func = (YPowerSupply)hwd;
     base.base_init(hwd, instantiationName);
 }
 // perform the initial setup that may be done without a YoctoAPI object (hwd can be null)
 internal override void base_init(YFunction hwd, string instantiationName)
 {
     _func = (YMultiAxisController)hwd;
     base.base_init(hwd, instantiationName);
 }
コード例 #9
0
 // perform the initial setup that may be done without a YoctoAPI object (hwd can be null)
 internal override void base_init(YFunction hwd, string instantiationName)
 {
     _func = (YQuadratureDecoder)hwd;
     base.base_init(hwd, instantiationName);
 }
コード例 #10
0
 // Token: 0x060000BF RID: 191 RVA: 0x00005B18 File Offset: 0x00003D18
 protected void _unregisterFuncCallback(YFunction func)
 {
     YFunction._FunctionCallbacks.Remove(this);
 }
コード例 #11
0
 // perform the initial setup that may be done without a YoctoAPI object (hwd can be null)
 internal override void base_init(YFunction hwd, string instantiationName)
 {
     _func = (YStepperMotor)hwd;
     base.base_init(hwd, instantiationName);
 }
コード例 #12
0
 protected override void valueChangeCallback(YFunction source, string value)
 {
     base.valueChangeCallback(source, value);
     _frequency = YAPI._atof(value);
 }
コード例 #13
0
#pragma warning restore 1998


        async Task anButtonValueChangeCallBack(YFunction fct, string value)
        {
            Output.Text += await fct.get_hardwareId() + ": " + value + " (new value)\n";
        }
コード例 #14
0
ファイル: yocto_api.cs プロジェクト: psymon75/PsymonWeather
 protected void _unregisterFuncCallback(YFunction func)
 {
     _FunctionCallbacks.Remove(this);
 }
コード例 #15
0
 // perform the initial setup that may be done without a YoctoAPI object (hwd can be null)
 internal override void base_init(YFunction hwd, string instantiationName)
 {
     _func = (YRangeFinder)hwd;
     base.base_init(hwd, instantiationName);
 }
コード例 #16
0
 protected override void valueChangeCallback(YFunction source, string value)
 {
     base.valueChangeCallback(source, value);
     _nextWakeUp = YAPI._hexStrToLong(value);
 }
コード例 #17
0
 // perform the initial setup that may be done without a YoctoAPI object (hwd can be null)
 internal override void base_init(YFunction hwd, string instantiationName)
 {
     _func = (YVoltageOutput)hwd;
     base.base_init(hwd, instantiationName);
 }
コード例 #18
0
 // perform the initial setup that may be done without a YoctoAPI object (hwd can be null)
 internal override void base_init(YFunction hwd, string instantiationName)
 {
     _func = (YTemperature)hwd;
     base.base_init(hwd, instantiationName);
 }
コード例 #19
0
 protected override void valueChangeCallback(YFunction source, string value)
 {
     base.valueChangeCallback(source, value);
     _currentVoltage = YAPI._atof(value);
 }
コード例 #20
0
 // perform the initial setup that may be done without a YoctoAPI object (hwd can be null)
 internal override void base_init(YFunction hwd, string instantiationName)
 {
     _func = (YMultiCellWeighScale)hwd;
     base.base_init(hwd, instantiationName);
 }
コード例 #21
0
 private void btnRefresh_Click(object sender, EventArgs e)
 {
     YFunction._ClearCache();
     FillList();
 }
コード例 #22
0
 protected static void _AddToCache(string classname, string func, YFunction obj)
 {
     _cache[classname + "_" + func] = obj;
 }
コード例 #23
0
 protected override void valueChangeCallback(YFunction source, string value)
 {
     base.valueChangeCallback(source, value);
     _rgbColor = YAPI._hexStrToInt(value);
     _hslColor = InternalStuff.rgb2hsl(_rgbColor, _hslColor);
 }
コード例 #24
0
 protected override void valueChangeCallback(YFunction source, string value)
 {
     base.valueChangeCallback(source, value);
     _filesCount = YAPI._atoi(value);
 }
コード例 #25
0
 // perform the initial setup that may be done without a YoctoAPI object (hwd can be null)
 internal override void base_init(YFunction hwd, string instantiationName)
 {
     _func = (YRealTimeClock)hwd;
     base.base_init(hwd, instantiationName);
 }
コード例 #26
0
 // perform the initial setup that may be done without a YoctoAPI object (hwd can be null)
 internal override void base_init(YFunction hwd, string instantiationName)
 {
     _func = (YBluetoothLink)hwd;
     base.base_init(hwd, instantiationName);
 }
コード例 #27
0
 // perform the initial setup that may be done without a YoctoAPI object (hwd can be null)
 internal override void base_init(YFunction hwd, string instantiationName)
 {
     _func = (YGroundSpeed)hwd;
     base.base_init(hwd, instantiationName);
 }
コード例 #28
0
 protected override void valueChangeCallback(YFunction source, string value)
 {
     base.valueChangeCallback(source, value);
     _portState = YAPI._hexStrToInt(value);
 }
コード例 #29
0
 public DataEvent(YFunction fun, String value)
 {
     _fun = fun;
     _sensor = null;
     _value = value;
     _report = null;
     _timestamp = 0;
 }
コード例 #30
0
ファイル: yocto_api.cs プロジェクト: psymon75/PsymonWeather
 protected void _registerFuncCallback(YFunction func)
 {
     if (!_FunctionCallbacks.Contains(this))
     {
       _FunctionCallbacks.Add(this);
     }
 }
コード例 #31
0
 public DataEvent(YSensor sensor, double timestamp, List<int> report)
 {
     _fun = null;
     _sensor = sensor;
     _value = null;
     _timestamp = timestamp;
     _report = report;
 }
コード例 #32
0
 // perform the initial setup that may be done without a YoctoAPI object (hwd can be null)
 internal override void base_init(YFunction hwd, string instantiationName)
 {
     _func = (YWakeUpMonitor)hwd;
     base.base_init(hwd, instantiationName);
 }
コード例 #33
0
 //--- (end of generated code: YDataSet definitions)
 // YDataSet constructor, when instantiated directly by a function
 public YDataSet(YFunction parent, string functionId, string unit, long startTime, long endTime)
 {
     //--- (generated code: YDataSet attributes initialization)
     //--- (end of generated code: YDataSet attributes initialization)
     this._parent     = parent;
     this._functionId = functionId;
     this._unit       = unit;
     this._startTime  = startTime;
     this._endTime    = endTime;
     this._progress   = -1;
     this._summary = new YMeasure();
 }
コード例 #34
0
 protected override void valueChangeCallback(YFunction source, string value)
 {
     base.valueChangeCallback(source, value);
     _slotsInUse = YAPI._atoi(value);
 }
コード例 #35
0
 // YDataSet constructor for the new datalogger
 public YDataSet(YFunction parent, string data)
 {
     //--- (generated code: YDataSet attributes initialization)
     //--- (end of generated code: YDataSet attributes initialization)
     this._parent = parent;
     this._startTime = 0;
     this._endTime   = 0;
     this._summary = new YMeasure();
     this._parse(data);
 }
コード例 #36
0
 // perform the initial setup that may be done without a YoctoAPI object (hwd can be null)
 internal override void base_init(YFunction hwd, string instantiationName)
 {
     _func = (YGenericSensor)hwd;
     base.base_init(hwd, instantiationName);
 }
コード例 #37
0
 public YDataStream(YFunction parent)
 {
     this._parent = parent;
     //--- (generated code: YDataStream attributes initialization)
     //--- (end of generated code: YDataStream attributes initialization)
 }
コード例 #38
0
 // perform the initial setup that may be done without a YoctoAPI object (hwd can be null)
 internal override void base_init(YFunction hwd, string instantiationName)
 {
     _func = (YCurrent)hwd;
     base.base_init(hwd, instantiationName);
 }
コード例 #39
0
 public YDataStream(YFunction parent, YDataSet dataset, List<int> encoded)
 {
     this._parent   = parent;
     //--- (generated code: YDataStream attributes initialization)
     //--- (end of generated code: YDataStream attributes initialization)
     this._initFromDataSet(dataset, encoded);
 }
コード例 #40
0
 // perform the initial setup that may be done without a YoctoAPI object (hwd can be null)
 internal override void base_init(YFunction hwd, string instantiationName)
 {
     _func = (YAccelerometer)hwd;
     base.base_init(hwd, instantiationName);
 }
コード例 #41
0
 static void anButtonValueChangeCallBack(YFunction fct, string value)
 {
     Console.WriteLine(fct.get_hardwareId() + ": " + value + " (new value)");
 }