Ejemplo n.º 1
0
 /**
  * <summary>
  *   Changes the activation state of this input.
  * <para>
  *   When an input is disabled,
  *   its value is no more updated. On some devices, disabling an input can
  *   improve the refresh rate of the other active inputs.
  *   Remember to call the <c>saveToFlash()</c>
  *   method of the module if the modification must be kept.
  * </para>
  * <para>
  * </para>
  * </summary>
  * <param name="newval">
  *   either <c>YGenericSensor.ENABLED_FALSE</c> or <c>YGenericSensor.ENABLED_TRUE</c>, according to the
  *   activation state of this input
  * </param>
  * <para>
  * </para>
  * <returns>
  *   <c>0</c> if the call succeeds.
  * </returns>
  * <para>
  *   On failure, throws an exception or returns a negative error code.
  * </para>
  */
 public int set_enabled(int newval)
 {
     if (_func == null)
     {
         throw new YoctoApiProxyException("No GenericSensor connected");
     }
     if (newval == _Enabled_INVALID)
     {
         return(YAPI.SUCCESS);
     }
     // our enums start at 0 instead of the 'usual' -1 for invalid
     return(_func.set_enabled(newval - 1));
 }