Exemplo n.º 1
0
 /// <summary>
 /// Default ctor
 /// </summary>
 public BinaryOutputItem(IBinaryOutput entity, IBinaryOutputState state, ItemContext context, bool interactive)
     : base(entity, false, context)
 {
     this.state = state;
     if (interactive)
     {
         MouseHandler = new ClickHandler(null, state);
     }
 }
Exemplo n.º 2
0
        /// <summary>
        /// Send the on/off value of a binary output.
        /// </summary>
        protected override void OnSendBinaryOutput(IBinaryOutputState output)
        {
            Log.Trace("OnSendBinaryOutput: {0}", output);

            var msg = new BinaryMessage()
            {
                Sender  = sender,
                Mode    = MessageBase.ModeRequest,
                Address = output.Address.Value,
                Value   = output.Active.Requested
            };

            publishMessage(msg.Topic, msg, (e) =>
            {
                if (e.IsPublished)
                {
                    output.Active.Actual = output.Active.Actual;
                }
            });
        }
Exemplo n.º 3
0
 /// <summary>
 /// Default ctor
 /// </summary>
 public ClickHandler(MouseHandler next, IBinaryOutputState state)
     : base(next)
 {
     this.state = state;
 }
Exemplo n.º 4
0
 /// <summary>
 /// Send the on/off value of a binary output.
 /// </summary>
 protected override void OnSendBinaryOutput(IBinaryOutputState output)
 {
     OnSendBinaryOutput(output.Address, output.Active.Requested);
 }
Exemplo n.º 5
0
 /// <summary>
 /// Send the on/off value of a binary output.
 /// </summary>
 protected override void OnSendBinaryOutput(IBinaryOutputState output)
 {
     Log.Trace("OnSendBinaryOutput: {0}", output);
     output.Active.Actual = output.Active.Requested;
 }
Exemplo n.º 6
0
 /// <summary>
 /// Send the on/off value of a binary output.
 /// </summary>
 protected virtual void OnSendBinaryOutput(IBinaryOutputState output)
 {
     throw new NotImplementedException();
 }
Exemplo n.º 7
0
 /// <summary>
 /// Send the on/off value of a binary output.
 /// </summary>
 public void SendBinaryOutput(IBinaryOutputState output)
 {
     PostWorkerAction(() => OnSendBinaryOutput(output));
 }