Esempio n. 1
0
        /// <summary>
        /// Parse messages from the MQTT connection.
        /// </summary>
        /// <param name="data">The data from the mqtt connected appliance.</param>
        public override void parseMqttMessages(ExtendedMqttMsgPublish data)
        {
            RevealPacket reveal_pkt = new RevealPacket();

            if (reveal_pkt.ParseMqttPacket(data))
            {
                switch (reveal_pkt.API)
                {
                case API_NUMBER:       //parse opcodes to this API (already without the feedback bit, i.e. 0x25: reveal_pkt.OpCode = 5 , reveal_pkt.IsFeedback = true )
                    switch ((OPCODES)reveal_pkt.OpCode)
                    {
                    /*
                     * Create a opcode enumeration to parse specific opcode
                     * case OPCODES.SET_VALUE:
                     *     if(reveal_pkt.IsFeedback)
                     *     {
                     *          textBox1.Text = reveal_pkt.PayLoad[0].ToString();
                     *     }
                     *     break;
                     *   */
                    default:

                        break;
                    }
                    break;

                default:
                    break;
                }
            }
        }
Esempio n. 2
0
        /// <summary>
        /// Send a Reveal Message over the Mqtt connection.
        /// Use WifiLocal.ConnectedAppliances to get the list of current scanned and/or connected appliances.
        /// </summary>
        /// <param name="connectedAppliance">The connected Applicance</param>
        /// <param name="destination">Address to send the message</param>
        /// <param name="api">Reveal Api</param>
        /// <param name="opcode">Reveal Opcode</param>
        /// <param name="isFeedback">Set true if the message is a feedback</param>
        /// <param name="payload">payload bytes</param>
        public void SendRevealMessageOverMQTT(ConnectedApplianceInfo connectedAppliance, byte destination, byte api, byte opcode, bool isFeedback, byte[] payload)
        {
            RevealPacket pkt = new RevealPacket(api, opcode, 0, destination, isFeedback, payload);

            WifiLocal.SendMqttMessage(connectedAppliance, pkt.ToMqtt());
        }
Esempio n. 3
0
 /// <summary>
 /// Send a Reveal Message over the Mqtt connection.
 /// Use WifiLocal.ConnectedAppliances to get the list of current scanned and/or connected appliances.
 /// </summary>
 /// <param name="connectedAppliance">The connected Applicance</param>
 /// <param name="pkt">Reveal packet containing the command or feedback to be sent</param>
 public void SendRevealMessageOverMQTT(ConnectedApplianceInfo connectedAppliance, RevealPacket pkt)
 {
     WifiLocal.SendMqttMessage(connectedAppliance, pkt.ToMqtt());
 }
Esempio n. 4
0
 /// <summary>
 /// Send a Reveal Message over the Revelation connection.
 /// Use WifiLocal.ConnectedAppliances to get the list of current scanned and/or connected appliances.
 /// </summary>
 /// <param name="connectedAppliance">The connected Applicance</param>
 /// <param name="pkt">Reveal packet containing the command or feedback to be sent</param>
 public void SendRevealMessageOverRevelation(ConnectedApplianceInfo connectedAppliance, RevealPacket pkt)
 {
     WifiLocal.SendRevelationMessage(connectedAppliance, pkt.ToRevelation());
 }
Esempio n. 5
0
        /// <summary>
        /// Send a Reveal Message over the bus.
        /// </summary>
        /// <param name="destination">Address to send the message</param>
        /// <param name="api">Reveal Api</param>
        /// <param name="opcode">Reveal Opcode</param>
        /// <param name="isFeedback">Set true if the message is a feedback</param>
        /// <param name="payload">payload bytes</param>
        public void SendRevealMessage(byte destination, byte api, byte opcode, bool isFeedback, byte[] payload)
        {
            RevealPacket pkt = new RevealPacket(api, opcode, 0, destination, isFeedback, payload);

            WideLocal.SendMessage(pkt.Destination, WideBoxConstants.REVEAL_SAP, pkt.ToMessagePayload());
        }
Esempio n. 6
0
 /// <summary>
 /// Send a Reveal Message over the bus.
 /// Packet Source address will be ignored as the WideBox address that will be used
 /// To set WideBox address send the WideBoxConstants.CMD_GET_WIDE_BOX_ADDR using the WideLocal.SendCommand
 /// </summary>
 /// <param name="pkt">Reveal packet containing the command or feedback to be sent</param>
 public void SendRevealMessage(RevealPacket pkt)
 {
     WideLocal.SendMessage(pkt.Destination, WideBoxConstants.REVEAL_SAP, pkt.ToMessagePayload());
 }