示例#1
0
        private bool DongleSetDistributeNetworkKey()
        {
            ZB_WRITE_CONFIGURATION_RSP response = (ZB_WRITE_CONFIGURATION_RSP)SendSynchronous(new ZB_WRITE_CONFIGURATION(
                                                                                                  ZB_WRITE_CONFIGURATION.CONFIG_ID.ZCD_NV_PRECFGKEYS_ENABLE, new byte[] { _distributeNetworkKey ? (byte)0x00 : (byte)0x01 }));

            return(response != null && response.Status == 0);
        }
示例#2
0
        private bool DongleSetSecurityMode()
        {
            ZB_WRITE_CONFIGURATION_RSP response = (ZB_WRITE_CONFIGURATION_RSP)SendSynchronous(new ZB_WRITE_CONFIGURATION(
                                                                                                  ZB_WRITE_CONFIGURATION.CONFIG_ID.ZCD_NV_SECURITY_MODE, new byte[] { (byte)_securityMode }));

            return(response != null && response.Status == 0);
        }
示例#3
0
        private bool DongleSetNetworkKey()
        {
            ZB_WRITE_CONFIGURATION_RSP response = (ZB_WRITE_CONFIGURATION_RSP)SendSynchronous(new ZB_WRITE_CONFIGURATION(
                                                                                                  ZB_WRITE_CONFIGURATION.CONFIG_ID.ZCD_NV_PRECFGKEY, _networkKey));

            return(response != null && response.Status == 0);
        }
示例#4
0
        private bool DongleSetExtendedPanId()
        {
            ZB_WRITE_CONFIGURATION_RSP response = (ZB_WRITE_CONFIGURATION_RSP)SendSynchronous(
                new ZB_WRITE_CONFIGURATION(ZB_WRITE_CONFIGURATION.CONFIG_ID.ZCD_NV_EXTPANID, _extendedPanId.PanId));

            return(response != null && response.Status == 0);
        }
示例#5
0
        private bool DongleSetNetworkMode()
        {
            ZB_WRITE_CONFIGURATION_RSP response = (ZB_WRITE_CONFIGURATION_RSP)SendSynchronous(new ZB_WRITE_CONFIGURATION(
                                                                                                  ZB_WRITE_CONFIGURATION.CONFIG_ID.ZCD_NV_LOGICAL_TYPE, new byte[] { (byte)_mode }));

            return(response != null && response.Status == 0);
        }
示例#6
0
        /// <summary>
        /// Sets the ZigBee RF channel. The allowable channel range is 11 to 26.
        /// <p>
        /// This method will sanity check the channel and if the mask is invalid
        /// the default channel will be used.
        ///
        /// <paramref name="channelMask"/>
        /// <returns></returns>
        /// </summary>
        private bool DongleSetChannel(byte[] channelMask)
        {
            // Error check the channels.
            // Incorrectly setting the channel can cause the stick to hang!!

            // Mask out any invalid channels
            channelMask[0] &= ZNP_CHANNEL_MASK0;
            channelMask[1] &= ZNP_CHANNEL_MASK1;
            channelMask[2] &= ZNP_CHANNEL_MASK2;
            channelMask[3] &= ZNP_CHANNEL_MASK3;

            // If there's no channels set, then we go for the default
            if (channelMask[0] == 0 && channelMask[1] == 0 && channelMask[2] == 0 && channelMask[3] == 0)
            {
                channelMask[0] = ZNP_CHANNEL_DEFAULT0;
                channelMask[1] = ZNP_CHANNEL_DEFAULT1;
                channelMask[2] = ZNP_CHANNEL_DEFAULT2;
                channelMask[3] = ZNP_CHANNEL_DEFAULT3;
            }

            //Log.Verbose("Setting the channel to {}{}{}{}",
            //        new Object[] { Integer.toHexString(channelMask[0]), Integer.toHexString(channelMask[1]),
            //            Integer.toHexString(channelMask[2]), Integer.toHexString(channelMask[3]) });

            ZB_WRITE_CONFIGURATION_RSP response = (ZB_WRITE_CONFIGURATION_RSP)SendSynchronous(
                new ZB_WRITE_CONFIGURATION(ZB_WRITE_CONFIGURATION.CONFIG_ID.ZCD_NV_CHANLIST, channelMask));

            return(response != null && response.Status == 0);
        }
示例#7
0
        private bool DongleSetPanId()
        {
            _currentPanId = ushort.MaxValue;

            ZB_WRITE_CONFIGURATION_RSP response = (ZB_WRITE_CONFIGURATION_RSP)SendSynchronous(
                new ZB_WRITE_CONFIGURATION(ZB_WRITE_CONFIGURATION.CONFIG_ID.ZCD_NV_PANID, BitConverter.GetBytes(_pan)));

            return(response != null && response.Status == 0);
        }