Exemplo n.º 1
0
        private void ResetRelay()
        {
            if (relay1.isOnline())
            {
                relay1.set_state(YRelay.STATE_A); // idle
            }

            if (relay2.isOnline())
            {
                relay2.set_state(YRelay.STATE_A); // idle
            }
        }
Exemplo n.º 2
0
 /**
  * <summary>
  *   Changes the state of the relays (A for the idle position, B for the active position).
  * <para>
  * </para>
  * <para>
  * </para>
  * </summary>
  * <param name="newval">
  *   either <c>YRelay.STATE_A</c> or <c>YRelay.STATE_B</c>, according to the state of the relays (A for
  *   the idle position, B for the active position)
  * </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_state(int newval)
 {
     if (_func == null)
     {
         throw new YoctoApiProxyException("No Relay connected");
     }
     if (newval == _State_INVALID)
     {
         return(YAPI.SUCCESS);
     }
     // our enums start at 0 instead of the 'usual' -1 for invalid
     return(_func.set_state(newval - 1));
 }