Пример #1
0
        /// <summary>
        /// Sends message to ZigBee C177 Heartbeat Request Cluster
        /// </summary>
        /// <param name="destination">The destination node ID to request from</param>
        //  Revision History
        //  MM/DD/YY Who Version Issue# Description
        //  -------- --- ------- ------ -------------------------------------------
        //  10/26/12 PGH 2.70.36       Created

        private void SendC177HeartbeatRequest(ushort destination)
        {
            // Get source endpoint
            ZigBeeEndpointInfo C177EndPoint = m_Endpoints.First(e => e.ProfileID == (ushort)ZigBeeProfileIDs.ItronPrivateProfile);

            // Set up the APS Frame for the message
            EmberApsFrame ApsFrame = new EmberApsFrame();

            ApsFrame.ProfileID           = (ushort)ZigBeeProfileIDs.ItronPrivateProfile;
            ApsFrame.DestinationEndpoint = C177EndPoint.FindMatchingClientEndpoint(destination, (ushort)ItronClusters.HEARTBEAT_REQUEST);
            ApsFrame.SourceEndpoint      = C177EndPoint.Endpoint;
            ApsFrame.ClusterID           = (ushort)ItronClusters.HEARTBEAT_REQUEST;
            ApsFrame.Options             = EmberApsOptions.EnableAddressDiscovery
                                           | EmberApsOptions.EnableRouteDiscovery
                                           | EmberApsOptions.Retry;
            //| EmberApsOptions.Encryption;

            byte[]       Message       = new byte[8 + 2 + 1 + 1];
            MemoryStream MessageStream = new MemoryStream(Message);
            BinaryWriter MessageWriter = new BinaryWriter(MessageStream);

            // Create the Message
            MessageWriter.Write(MACAddress);
            MessageWriter.Write(NodeID);
            MessageWriter.Write(DEFAULT_C177_ENDPOINT);

            // Send Unicast Message down to the meter
            SendUnicastMessage(destination, ApsFrame, Message);
        }
Пример #2
0
        /// <summary>
        /// Constructor
        /// </summary>
        /// <param name="messageType">The message type</param>
        /// <param name="apsFrame">The APS frame for the message</param>
        /// <param name="lastHopLqi">The last hop LQI</param>
        /// <param name="lastHopRssi">The last hop RSSI</param>
        /// <param name="senderNodeID">The node ID of the sender</param>
        /// <param name="bindingIndex">The index of the sender in the binding table</param>
        /// <param name="addressIndex">The index of the sender in the address table</param>
        /// <param name="messageLength">The length of the message</param>
        /// <param name="messageContents">The contents of the message</param>
        //  Revision History
        //  MM/DD/YY Who Version Issue# Description
        //  -------- --- ------- ------ -------------------------------------------
        //  08/09/11 RCG 2.52.00        Created

        public IncomingMessage(EmberIncomingMessageType messageType, EmberApsFrame apsFrame, byte lastHopLqi, byte lastHopRssi,
                               ushort senderNodeID, byte bindingIndex, byte addressIndex, byte messageLength, byte[] messageContents)
        {
            m_MessageType     = messageType;
            m_APSFrame        = apsFrame;
            m_LastHopLqi      = lastHopLqi;
            m_LastHopRssi     = lastHopRssi;
            m_SenderNodeID    = senderNodeID;
            m_BindingIndex    = bindingIndex;
            m_AddressIndex    = addressIndex;
            m_MessageLength   = messageLength;
            m_MessageContents = messageContents;
        }