Пример #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>
        /// Sets up any clusters that the device is hosting
        /// </summary>
        //  Revision History
        //  MM/DD/YY Who Version Issue# Description
        //  -------- --- ------- ------ -------------------------------------------
        //  10/19/12 PGH 2.70.36        Created
        protected override void SetUpClusterLists()
        {
            base.SetUpClusterLists();

            ZigBeeEndpointInfo NewEndpoint = new ZigBeeEndpointInfo();

            NewEndpoint.Endpoint  = DEFAULT_SE_ENDPOINT;
            NewEndpoint.ProfileID = (ushort)ZigBeeProfileIDs.SmartEnergy;
            NewEndpoint.AppFlags  = DEFAULT_SE_DEVICE_VERSION;
            NewEndpoint.DeviceID  = DEFAULT_SE_DEVICE_ID;

            // Set up the Client Side List
            NewEndpoint.ClientClusterList.Add((ushort)GeneralClusters.Basic);
            NewEndpoint.ClientClusterList.Add((ushort)SmartEnergyClusters.KeyEstablishment);

            // Set up the Server Side List
            NewEndpoint.ServerClusterList.Add((ushort)GeneralClusters.Basic);
            NewEndpoint.ServerClusterList.Add((ushort)SmartEnergyClusters.KeyEstablishment);

            m_Endpoints.Add(NewEndpoint);

            // Itron Private Profile
            NewEndpoint = new ZigBeeEndpointInfo();

            NewEndpoint.Endpoint  = DEFAULT_C177_ENDPOINT;
            NewEndpoint.ProfileID = (ushort)ZigBeeProfileIDs.ItronPrivateProfile;
            NewEndpoint.AppFlags  = DEFAULT_C177_DEVICE_VERSION;
            NewEndpoint.DeviceID  = DEFAULT_C177_DEVICE_ID;

            // Set up the Client Side List
            NewEndpoint.ClientClusterList.Add((ushort)ItronClusters.DATA_REQUEST);
            NewEndpoint.ClientClusterList.Add((ushort)ItronClusters.DATA_RESPONSE);
            NewEndpoint.ClientClusterList.Add((ushort)ItronClusters.HEARTBEAT_REQUEST);
            NewEndpoint.ClientClusterList.Add((ushort)ItronClusters.HEARTBEAT_RESPONSE);

            // Set up the Server Side List
            NewEndpoint.ServerClusterList.Add((ushort)ItronClusters.DATA_REQUEST);
            NewEndpoint.ServerClusterList.Add((ushort)ItronClusters.DATA_RESPONSE);
            NewEndpoint.ServerClusterList.Add((ushort)ItronClusters.HEARTBEAT_REQUEST);
            NewEndpoint.ServerClusterList.Add((ushort)ItronClusters.HEARTBEAT_RESPONSE);

            m_Endpoints.Add(NewEndpoint);
        }