コード例 #1
0
 /// <summary>
 /// Power message has been received.
 /// </summary>
 private void onPowerMessageReceived(PowerMessage msg)
 {
     if (msg.IsRequest && msg.Sender != sender)
     {
         Power.Requested = msg.Active;
     }
 }
コード例 #2
0
        /// <summary>
        /// Request to enable/disable the power on the track.
        /// </summary>
        protected override void OnRequestedPowerChanged(bool value)
        {
            // Send power off message
            var msg = new PowerMessage()
            {
                Sender = sender,
                Mode   = MessageBase.ModeRequest,
                Active = value
            };

            publishMessage(msg.Topic, msg, (e) =>
            {
                if (e.IsPublished)
                {
                    Power.Actual = value;
                }
            });
        }