//call back function for trap target ip change
void SNMPTarget (const NaSnmpTargetAddrEntry_t * entry, BOOLEAN deleted)
{


//call back handler for when a trap target ip has chnaged
//copy target address over to struct for storage in nonvol
	upsS.upstraptargetaddress[0] = entry->snmpTargetAddrTAddress[0];
	upsS.upstraptargetaddress[1] = entry->snmpTargetAddrTAddress[1];
	upsS.upstraptargetaddress[2] = entry->snmpTargetAddrTAddress[2];
	upsS.upstraptargetaddress[3] = entry->snmpTargetAddrTAddress[3];
	upsS.upstraptargetaddress[4] = entry->snmpTargetAddrTAddress[4];
	upsS.upstraptargetaddress[5] = entry->snmpTargetAddrTAddress[5];

	Flash_upsscontrol();

} 
//Initialize retsore target IP.

int InitPort()
{


//setup call back function for trap target ip change

naSnmpTargetAddrEntryChanged_t callback = &SNMPTarget;
naSnmpRegisterTargetAddrChangedCallback(callback);
 NaSnmpTargetAddrEntry_t entry;


	autostart = 0; //clear autostart flag 
	upscontrol_init(); //update autostart status & get trap target ip
 


			
	//update index to table for "target2"		
 		
 	entry.snmpTargetAddrName[0] = 0x74;
 	entry.snmpTargetAddrName[1] = 0x61;
 	entry.snmpTargetAddrName[2] = 0x72;
 	entry.snmpTargetAddrName[3] = 0x67;
 	entry.snmpTargetAddrName[4] = 0x65;
 	entry.snmpTargetAddrName[5] = 0x74;
 	entry.snmpTargetAddrName[6] = 0x32;
 	entry.snmpTargetAddrName[7] = 0x00;
 	entry.snmpTargetAddrNameLen = 7;
 	
	//update target address

	entry.snmpTargetAddrTAddress[0] = upsS.upstraptargetaddress[0];	
	entry.snmpTargetAddrTAddress[1] = upsS.upstraptargetaddress[1];
	entry.snmpTargetAddrTAddress[2] = upsS.upstraptargetaddress[2];
	entry.snmpTargetAddrTAddress[3] = upsS.upstraptargetaddress[3];
	entry.snmpTargetAddrTAddress[4] = upsS.upstraptargetaddress[4];
	entry.snmpTargetAddrTAddress[5] = upsS.upstraptargetaddress[5];
	entry.snmpTargetAddrTAddress[6] = 0x00;
			  
	
	//update target adress table

	ccode = naSnmpAddTargetAddrTableEntry(&entry);
  	
 }
	
  	
	