Example #1
0
/*
 * Function: It initalizes all the necessary variables including its parent's 
 * variables
 * 
 * Parameters:
 * 'protocol_used' : specifies the protocol used in the XBee module 
 * 'uart_used' : specifies the UART where the data are sent to (SOCKET0 or SOCKET1)
 * Returns: void
*/
void WaspXBee900::init(	uint8_t uart_used )
{	
	protocol=XBEE_900;
	uart=uart_used;
	
	// in the case the XBee is plugged to SOCKET0 it is necessary to make sure
	// that the multiplexor is selecting teh XBee module
	if(uart_used==SOCKET0)
	{
		Utils.setMuxSocket0();
	}
	
	data_length=0;
	it=0;
	rxFrameType=0;
	
	pos=0;
	discoveryOptions=0x00;
	
	scanTime[0]=SCAN_TIME_DIGIMESH_H;
	scanTime[1]=SCAN_TIME_DIGIMESH_L;
	encryptMode=ENCRYPT_MODE_DIGIMESH;
	timeRSSI=TIME_RSSI_DIGIMESH;
	
	frameNext=0;
	replacementPolicy=XBEE_OUT;	
	error_AT=2;
	error_RX=2;
	error_TX=2;
	clearFinishArray();
	clearCommand();
}
void WaspXBeeDM::init(uint8_t protocol_used, uint8_t frequency, uint8_t model_used, uint8_t uart_used)
{
	protocol=protocol_used;
	freq=frequency;
	model=model_used;
	uart=uart_used;
	
	data_length=0;
	it=0;
	start=0;
	finish=0;
	add_type=0;
	mode=0;
	frag_length=0;
	TIME1=0;
	
	totalFragmentsReceived=0;
	pendingPackets=0;
	pos=0;
	discoveryOptions=0x00;
	
	scanTime[0]=SCAN_TIME_DIGIMESH_H;
	scanTime[1]=SCAN_TIME_DIGIMESH_L;
	encryptMode=ENCRYPT_MODE_DIGIMESH;
	timeRSSI=TIME_RSSI_DIGIMESH;
	
	if( protocol!=XBEE_900 )
	{	
		awakeTime[0]=AWAKE_TIME_DIGIMESH_H;
		awakeTime[1]=AWAKE_TIME_DIGIMESH_M;
		awakeTime[2]=AWAKE_TIME_DIGIMESH_L;
		sleepTime[0]=SLEEP_TIME_DIGIMESH_H;
		sleepTime[1]=SLEEP_TIME_DIGIMESH_M;
		sleepTime[2]=SLEEP_TIME_DIGIMESH_L;
		
		sleepOptions=SLEEP_OPTIONS_DIGIMESH;
		powerLevel=POWER_LEVEL_DIGIMESH;
			
		networkHops=7;
		netDelaySlots=3;
		netRouteRequest=3;
		meshNetRetries=1;
	}
	nextIndex1=0;
	frameNext=0;
	replacementPolicy=XBEE_OUT;
	indexNotModified=1;
	error_AT=2;
	error_RX=2;
	error_TX=2;
	clearFinishArray();
	clearCommand();
}
void	WaspXBee868::init(uint8_t protocol_used, uint8_t frequency, uint8_t model_used, uint8_t uart_used)
{
	protocol=protocol_used;
	freq=frequency;
	model=model_used;
	uart=uart_used;
	
	totalFragmentsReceived=0;
	pendingPackets=0;
	pos=0;
	discoveryOptions=0x00;
	
	scanTime[0]=0x00;
	scanTime[1]=0x82;
	encryptMode=0;
	powerLevel=4;
	timeRSSI=0x20;

	ACKerrors[0]=0x00;
	ACKerrors[1]=0x00;
	errorsRF[0]=0x00;
	errorsRF[1]=0x00;
	goodPackets[0]=0x00;
	goodPackets[1]=0x00;
	transmisionErrors[0]=0x00;
	transmisionErrors[1]=0x00;
	maxPayloadBytes[0]=0x01;
	maxPayloadBytes[1]=0x00;
	multipleBroadcast=0x03;
	macRetries=0x0A;
	resetReason=0x00;
	
	data_length=0;
	it=0;
	start=0;
	finish=0;
	add_type=0;
	mode=0;
	frag_length=0;
	TIME1=0;	
	nextIndex1=0;
	frameNext=0;
	replacementPolicy=XBEE_OUT;
	indexNotModified=1;
	error_AT=2;
	error_RX=2;
	error_TX=2;
	clearFinishArray();
	clearCommand();
}
Example #4
0
/*
 * Function: It initalizes all the necessary variables including its parent's 
 * variables
 * 
 * Parameters:
 * 'protocol_used' : specifies the protocol used in the XBee module 
 * 'uart_used' : specifies the UART where the data are sent to (SOCKET0 or SOCKET1)
 * Returns: void
*/
void WaspXBeeDM::init(	uint8_t uart_used	)
{	
	protocol=DIGIMESH;
	uart=uart_used;
	
	// in the case the XBee is plugged to SOCKET0 it is necessary to make sure
	// that the multiplexor is selecting teh XBee module
	if(uart_used==SOCKET0)
	{
		Utils.setMuxSocket0();
	}
	
	data_length=0;
	it=0;
	rxFrameType=0;
	
	pos=0;
	discoveryOptions=0x00;
	
	scanTime[0]=SCAN_TIME_DIGIMESH_H;
	scanTime[1]=SCAN_TIME_DIGIMESH_L;
	encryptMode=ENCRYPT_MODE_DIGIMESH;
	timeRSSI=TIME_RSSI_DIGIMESH;
	
	awakeTime[0]=AWAKE_TIME_DIGIMESH_H;
	awakeTime[1]=AWAKE_TIME_DIGIMESH_M;
	awakeTime[2]=AWAKE_TIME_DIGIMESH_L;
	sleepTime[0]=SLEEP_TIME_DIGIMESH_H;
	sleepTime[1]=SLEEP_TIME_DIGIMESH_M;
	sleepTime[2]=SLEEP_TIME_DIGIMESH_L;
	
	sleepOptions=SLEEP_OPTIONS_DIGIMESH;
	powerLevel=POWER_LEVEL_DIGIMESH;
			
	networkHops=7;
	netDelaySlots=3;
	netRouteRequest=3;
	meshNetRetries=1;
	
	nextIndex1=0;
	frameNext=0;
	replacementPolicy=XBEE_OUT;
	indexNotModified=1;
	error_AT=2;
	error_RX=2;
	error_TX=2;
	clearFinishArray();
	clearCommand();
}
Example #5
0
/*
 Function: It initalizes all the necessary variables
 Parameters:
	protocol_used : specifies the protocol used in the XBee module 
	uart_used : specifies the UART where the data are sent to (UART0 or UART1)	
 Returns: void
*/
void WaspXBee868::init(	uint8_t uart_used )
{
	// set protocol and socket used for XBee module	
	protocol=XBEE_868;
	uart=uart_used;
	
	// in the case the XBee is plugged to SOCKET0 it is necessary to make sure
	// that the multiplexor is selecting the XBee module
	if(uart_used==SOCKET0)
	{
		Utils.setMuxSocket0();
	}
	
	pos=0;
	discoveryOptions=0x00;
	
	scanTime[0]=0x00;
	scanTime[1]=0x82;
	encryptMode=0;
	powerLevel=4;
	timeRSSI=0x20;

	ACKerrors[0]=0x00;
	ACKerrors[1]=0x00;
	errorsRF[0]=0x00;
	errorsRF[1]=0x00;
	goodPackets[0]=0x00;
	goodPackets[1]=0x00;
	transmisionErrors[0]=0x00;
	transmisionErrors[1]=0x00;
	maxPayloadBytes[0]=0x01;
	maxPayloadBytes[1]=0x00;
	multipleBroadcast=0x03;
	macRetries=0x0A;
	resetReason=0x00;
	
	data_length=0;
	it=0;
	rxFrameType=0;
	nextIndex1=0;
	frameNext=0;
	replacementPolicy=XBEE_OUT;
	indexNotModified=1;
	error_AT=2;
	error_RX=2;
	error_TX=2;
	clearFinishArray();
	clearCommand();
}
Example #6
0
/*
 Function: It initializes the necessary variables
 Parameters:
	'uart_used' : specifies the UART where the data are sent to 
 Returns: void
*/
void WaspXBee802::init(	uint8_t uart_used	)
{
	// set protocol and socket used for XBee module
	protocol=XBEE_802_15_4;
	uart=uart_used;
	
	// in the case the XBee is plugged to SOCKET0 it is necessary to make sure
	// that the multiplexor is selecting teh XBee module
	if(uart_used==SOCKET0)
	{
		Utils.setMuxSocket0();
	}

	pos=0;
	discoveryOptions=0x00;
	awakeTime[0]=AWAKE_TIME_802_15_4_H;
	awakeTime[1]=AWAKE_TIME_802_15_4_L;
	sleepTime[0]=SLEEP_TIME_802_15_4_H;
	sleepTime[1]=SLEEP_TIME_802_15_4_L;
	scanTime[0]=SCAN_TIME_802_15_4;
	scanChannels[0]=SCAN_CHANNELS_802_15_4_H;
	scanChannels[1]=SCAN_CHANNELS_802_15_4_L;
	encryptMode=ENCRYPT_MODE_802_15_4;
	powerLevel=POWER_LEVEL_802_15_4;
	timeRSSI=TIME_RSSI_802_15_4;
	sleepOptions=SLEEP_OPTIONS_802_15_4;
	retries=0;
	delaySlots=0;
	macMode=0;
	energyThreshold=0x2C;
	counterCCA[0]=0x00;
	counterCCA[1]=0x00;
	counterACK[0]=0x00;
	counterACK[1]=0x00;

	counter=0;
	data_length=0;
	it=0;		
	rxFrameType=0;
	nextIndex1=0;
	frameNext=0;
	replacementPolicy=XBEE_OUT;
	indexNotModified=1;
	error_AT=2;
	error_RX=2;
	error_TX=2;
	clearFinishArray();
	clearCommand();
}
Example #7
0
void	WaspXBee802::init(uint8_t protocol_used, uint8_t frequency, uint8_t model_used)
{
	protocol=protocol_used;
	freq=frequency;
	model=model_used;

	totalFragmentsReceived=0;
	pendingPackets=0;
	pos=0;
	discoveryOptions=0x00;
	awakeTime[0]=AWAKE_TIME_802_15_4_H;
	awakeTime[1]=AWAKE_TIME_802_15_4_L;
	sleepTime[0]=SLEEP_TIME_802_15_4_H;
	sleepTime[1]=SLEEP_TIME_802_15_4_L;
	scanTime[0]=SCAN_TIME_802_15_4;
	scanChannels[0]=SCAN_CHANNELS_802_15_4_H;
	scanChannels[1]=SCAN_CHANNELS_802_15_4_L;
	encryptMode=ENCRYPT_MODE_802_15_4;
	powerLevel=POWER_LEVEL_802_15_4;
	timeRSSI=TIME_RSSI_802_15_4;
	sleepOptions=SLEEP_OPTIONS_802_15_4;
	retries=0;
	delaySlots=0;
	macMode=0;
	energyThreshold=0x2C;
	counterCCA[0]=0x00;
	counterCCA[1]=0x00;
	counterACK[0]=0x00;
	counterACK[1]=0x00;

        counter=0;
	data_length=0;
	it=0;
	start=0;
	finish=0;
	add_type=0;
	mode=0;
	frag_length=0;
	TIME1=0;
	nextIndex1=0;
	frameNext=0;
	replacementPolicy=XBEE_OUT;
	indexNotModified=1;
	error_AT=2;
	error_RX=2;
	error_TX=2;
	clearFinishArray();
	clearCommand();
}
void	WaspXBeeZB::init(uint8_t protocol_used, uint8_t frequency, uint8_t model_used, uint8_t uart_used)
{
	protocol=protocol_used;
	freq=frequency;
	model=model_used;
	uart=uart_used;
	
	totalFragmentsReceived=0;
	pendingPackets=0;
	pos=0;
	discoveryOptions=0x00;
	awakeTime[0]=AWAKE_TIME_ZIGBEE_H;
	awakeTime[1]=AWAKE_TIME_ZIGBEE_L;
	sleepTime[0]=SLEEP_TIME_ZIGBEE_H;
	sleepTime[1]=SLEEP_TIME_ZIGBEE_L;
	scanTime[0]=SCAN_TIME_ZIGBEE;
	scanChannels[0]=SCAN_CHANNELS_ZIGBEE_H;
	scanChannels[1]=SCAN_CHANNELS_ZIGBEE_L;
	timeEnergyChannel=TIME_ENERGY_CHANNEL_ZIGBEE;
	encryptMode=ENCRYPT_MODE_ZIGBEE;
	powerLevel=POWER_LEVEL_ZIGBEE;
	timeRSSI=TIME_RSSI_ZIGBEE;
	sleepOptions=SLEEP_OPTIONS_ZIGBEE;

	parentNA[0]=0xFF;
	parentNA[1]=0xFE;
	deviceType[0]=0x00;
	deviceType[1]=0x03;
	deviceType[2]=0x00;
	deviceType[3]=0x00;
	for(it=0;it<8;it++)
	{
		extendedPAN[it]=0x00;
	}
	maxUnicastHops=0x1E;
	maxBroadcastHops=0x00;
	stackProfile=0;
	joinTime=0xFF;
	channelVerification=0x00;
	joinNotification=0x00;
	aggregateNotification=0xFF;
	encryptOptions=0;
	for(it=0;it<16;it++)
	{
		networkKey[it]=0x00;
	}
	powerMode=4;
	
	data_length=0;
	it=0;
	start=0;
	finish=0;
	add_type=0;
	mode=0;
	frag_length=0;
	TIME1=0;
	nextIndex1=0;
	frameNext=0;
	replacementPolicy=XBEE_OUT;
	indexNotModified=1;
	error_AT=2;
	error_RX=2;
	error_TX=2;
	clearFinishArray();
	clearCommand();
	apsEncryption=0;
}