Пример #1
0
/****************************************************************************
 *
 * NAME: MibNwkSecurity_vSetProfile
 *
 * DESCRIPTION:
 * Set network operating profile according to network mode
 *
 ****************************************************************************/
PATCH_POINT_PUBLIC(void,MibNwkSecurity_vSetProfile)(bool_t bStandalone)
{
	/* Debug */
	DBG_vPrintf(CONFIG_DBG_MIB_NWK_SECURITY, "\nMibNwkSecurity_vSetProfile(%d)", bStandalone);

	/* Standalone system ? */
	if (bStandalone)
	{
		tsNwkProfile sNwkProfile;

		/* Read network profile */
		vJnc_GetNwkProfile(&sNwkProfile);
		/* Inhibit pings */
		sNwkProfile.u8MaxFailedPkts = 0;
		sNwkProfile.u16RouterPingPeriod = 0;
		/* Apply as user profile */
		(void) bJnc_SetRunProfile(PROFILE_USER, &sNwkProfile);
		/* Debug */
		DBG_vPrintf(CONFIG_DBG_MIB_NWK_SECURITY, "\n\tbJnc_SetRunProfile(USER)");
		/* Inhibit End Device activity timeout */
		psMibNwkSecurity->psNetworkConfigData->u32EndDeviceActivityTimeout	= 0;
	}
	/* Gateway system ? */
	else
	{
		/* Apply default run profile for joining gateway system - will be updated if necessary upon joining */
		(void) bJnc_SetRunProfile(0, NULL);
		/* Debug */
		DBG_vPrintf(CONFIG_DBG_MIB_NWK_SECURITY, "\n\tbJnc_SetRunProfile(0)");
		/* Apply gateway end device activity timeout settings */
		psMibNwkSecurity->psNetworkConfigData->u32EndDeviceActivityTimeout	= psMibNwkSecurity->u32EndDeviceActivityTimeout;
	}
}
Пример #2
0
/****************************************************************************
 *
 * NAME: MibNwkProfile_vApply
 *
 * DESCRIPTION:
 * Timing function
 *
 ****************************************************************************/
PUBLIC void MibNwkProfile_vApply(void)
{
	tsNwkProfile sNwkProfile;

	/* Debug */
	DBG_vPrintf(CONFIG_DBG_MIB_NWK_PROFILE, "\nMibNwkProfile_vApply()");
	/* Read network profile */
	vJnc_GetNwkProfile(&sNwkProfile);
	/* Update min beacon LQI */
	sNwkProfile.u8MinBeaconLQI 		= psMibNwkProfile->sPerm.u8MinBeaconLqi;
	/* In standalone mode ? */
	if (u16Api_GetStackMode() & MIB_COMMON_STACK_MODE_STANDALONE)
	{
		/* Zero profile values */
		sNwkProfile.u8MaxFailedPkts 	= 0;
		sNwkProfile.u16RouterPingPeriod = 0;
	}
	/* In gateway mode ? */
	else
	{
		/* Apply profile values */
		sNwkProfile.u8MaxFailedPkts 	= psMibNwkProfile->sPerm.u8MaxFailedPackets;
		sNwkProfile.u16RouterPingPeriod = psMibNwkProfile->sPerm.u16RouterPingPeriod;
	}
	/* Apply as user profiles */
	(void) bJnc_SetJoinProfile(PROFILE_USER, &sNwkProfile);
	(void) bJnc_SetRunProfile(PROFILE_USER, &sNwkProfile);
}