Esempio n. 1
0
        /// <summary>
        /// Converts a ZigBee Logical Type value to an Ember Node Type value
        /// </summary>
        /// <param name="type">The Logical Type</param>
        /// <returns>The equivalent Ember Node Type</returns>
        // Revision History
        // MM/DD/YY who Version Issue# Description
        // -------- --- ------- ------ ---------------------------------------
        // 06/24/13 RCG 2.71.00        Created

        private EmberNodeType ConvertLogicalTypeToEmberType(ZigbeeLogicalType type)
        {
            EmberNodeType EmberType = EmberNodeType.EndDevice;

            switch (type)
            {
            case ZigbeeLogicalType.COORDINATOR:
            {
                EmberType = EmberNodeType.Coordinator;
                break;
            }

            case ZigbeeLogicalType.ENDDEVICE:
            {
                EmberType = EmberNodeType.EndDevice;
                break;
            }

            case ZigbeeLogicalType.ROUTER:
            {
                EmberType = EmberNodeType.Router;
                break;
            }
            }

            return(EmberType);
        }
Esempio n. 2
0
        /// <summary>Starts the Radio. Returns a bool indicating success.
        /// </summary>
        /// <param name="MAC">MAC address for the radio</param>
        /// <param name="LogicalType">The type of device to configure.  When
        /// joined to a cell relay, this should be a router, otherwise this
        /// should be a coordinator</param>
        /// <param name="ScanChannels">Packed bits representing the channels
        /// to search.  Only channels 15-26 are valid, so only bits 15 (0x800)
        /// through bit 26 (0x4000000).  Note that bits are 0 indexed, so
        /// bit 0 = 0x01.</param>
        /// <param name="ExPanID">The 8 byte extended Pan ID you want to start
        /// with.  This value can be 0, which will cause the radio to either
        /// assign one at random or join the first suitable network it finds
        /// depending on the LogicalType.</param>
        /// <returns>True if the radio exists and was successfully started</returns>
        ///
        // Revision History
        // MM/DD/YY who Version Issue# Description
        // -------- --- ------- ------ ---------------------------------------
        // 01/31/08 mcm 1.0.x   Initial Release
        // 06/17/08 AF  1.50.37         Changed to read the link key from the registry
        // 09/15/08 AF                  Replaced C177 with EZSP because
        //                              the interface names changed in the new version
        //                              of the EZSP dlls.
        // 10/07/08 AF          121097  Modified the filter on channel.  We should allow
        //                              any valid channel
        // 01/26/11 AF  2.45.26 158436  Integration of new ezsp library to support secure rejoin.
        //
        // 10/17/12 PGH 2.70.36        Replaced EZSP with C177App
        // 09/17/15 jrf 4.21.04 616082 Sending a burst of beacons before joining and
        //                             starting intermittent beacons if method is successful.
        public override ZigbeeResult Start(ulong MAC, ulong ExPanID,
                                           ZigbeeLogicalType LogicalType, uint ScanChannels)
        {
            ZigbeeResult Result = ZigbeeResult.SUCCESS;

            if (!m_bConnected)
            {
                Result = ZigbeeResult.NOT_CONNECTED;
            }
            else
            {
                try
                {
                    if (C177App.IsJoined)
                    {
                        C177App.LeaveNetwork();
                    }

                    byte[] NetworkKey = GetSecurityKey(false);

                    //Need to wake up troublesome devices before we attempt to join.
                    SendBeaconBurst((uint)(0x1 << (int)ScanChannels));


                    C177App.Rejoin(ConvertLogicalTypeToEmberType(LogicalType), ExPanID, (byte)ScanChannels, NetworkKey);

                    if (!C177App.IsJoined)
                    {
                        Result = ZigbeeResult.ERROR;
                    }
                }
                catch (Exception e)
                {
                    m_Logger.WriteDetail(this, "BeltClipRadio.Start exception");
                    m_Logger.WriteException(this, e);
                    Result = ZigbeeResult.ERROR;
                    throw e;
                }
            }

            if (ZigbeeResult.SUCCESS == Result)
            {
                //This will keep troublesome devices communicative.
                StartIntermittentBeacons();
            }

            return(Result);
        } // Start
Esempio n. 3
0
 /// <summary>Starts the Radio. Returns a ZigbeeResult indicating success.
 /// This method can be used to detect whether the radio exists.
 /// </summary>
 /// <param name="MAC">MAC address for the radio</param>
 /// <param name="LogicalType">The type of device to configure.  When
 /// joined to a cell relay, this should be a router, otherwise this
 /// should be a coordinator</param>
 /// <param name="ScanChannels">This now represents the logical channel
 /// id.  If the channel is 0 then the dongle will try a mask of multiple
 /// channels.  This is only supported in the dongle, not the belt clip
 /// radio.
 ///
 /// Note: this is the old definintion: Packed bits representing the channels
 /// to search.  Only channels 15-26 are valid, so only bits 15 (0x800)
 /// through bit 26 (0x4000000).  Note that bits are 0 indexed, so
 /// bit 0 = 0x01.</param>
 /// <param name="ExPanID">The 8 byte extended Pan ID you want to start
 /// with.  This value can be 0, which will cause the radio to either
 /// assign one at random or join the first suitable network it finds
 /// depending on the LogicalType.</param>
 /// <returns>True if the radio exists and was successfully started</returns>
 /// <remarks>
 /// Revision History
 /// MM/DD/YY who Version Issue# Description
 /// -------- --- ------- ------ ---------------------------------------
 /// 11/08/06 mcm 8.10.26
 ///</remarks>
 public abstract ZigbeeResult Start(ulong MAC, ulong ExPanID,
                                    ZigbeeLogicalType LogicalType, uint ScanChannels);