예제 #1
0
파일: jausSubsystem.c 프로젝트: pfg/qgc
JausBoolean jausSubsystemFreeMemory(JausSubsystem subsystem)
{
	if(subsystem->nodes == NULL)
	{
		return JAUS_FALSE;
	}
	else
	{
		jausArrayDestroy(subsystem->nodes, free);
	}

	return JAUS_TRUE;
}
예제 #2
0
// Services Vector Destructor
void jausServicesDestroy(JausArray jausServices)
{
	jausArrayDestroy(jausServices, (void *)jausServiceDestroy);
}
예제 #3
0
파일: wd.c 프로젝트: OpenJAUS/openjaus
void wdShutdownState(void)
{
	RejectComponentControlMessage rejectComponentControl;
	ReleaseComponentControlMessage releaseControl = NULL;
	JausMessage txMessage;
		
	scManagerRemoveSupportedMessage(wdNmi, JAUS_REPORT_COMPONENT_STATUS);	

	if(wd->controller.active)
	{
		// Terminate control of current component
		rejectComponentControl = rejectComponentControlMessageCreate();
		jausAddressCopy(rejectComponentControl->source, wd->address);
		jausAddressCopy(rejectComponentControl->destination, wd->controller.address);

		txMessage = rejectComponentControlMessageToJausMessage(rejectComponentControl);
		nodeManagerSend(wdNmi, txMessage);
		jausMessageDestroy(txMessage);

		rejectComponentControlMessageDestroy(rejectComponentControl);
	}
	
	// USER: Insert Shutdown Code Here, NOTE: Terminate any active service connections
	
	// Release Control
	if(wdInControl)
	{
		//cDebug(4, "wd: Releasing control of PD\n");
	
		releaseControl = releaseComponentControlMessageCreate();
		jausAddressCopy(releaseControl->source, wd->address);
		jausAddressCopy(releaseControl->destination, pd->address);
		
		txMessage = releaseComponentControlMessageToJausMessage(releaseControl);
		nodeManagerSend(wdNmi, txMessage);
		jausMessageDestroy(txMessage);
		
		releaseComponentControlMessageDestroy(releaseControl);
		
		wdInControl = JAUS_FALSE;
		wd->state = JAUS_INITIALIZE_STATE;
	}
	
	if(pdStatusSc->isActive)
	{	
		scManagerTerminateServiceConnection(wdNmi, pdStatusSc);
		serviceConnectionDestroy(pdStatusSc);
	}
	
	if(pdWrenchSc->isActive)
	{	
		scManagerTerminateServiceConnection(wdNmi, pdWrenchSc);		
		serviceConnectionDestroy(pdWrenchSc);
	}	

	if(gposSc->isActive)
	{	
		scManagerTerminateServiceConnection(wdNmi, gposSc);		
		serviceConnectionDestroy(gposSc);
	}	

	if(vssSc->isActive)
	{	
		scManagerTerminateServiceConnection(wdNmi, vssSc);		
		serviceConnectionDestroy(vssSc);
	}
	
	// Destory Global Messages
	if(wdSpeed)
	{
		setTravelSpeedMessageDestroy(wdSpeed);
	}

	if(wdReportGpos)
	{
		reportGlobalPoseMessageDestroy(wdReportGpos);
	}

	if(wdReportVss)
	{
		reportVelocityStateMessageDestroy(wdReportVss);
	}

	if(wdReportWrench)
	{
		reportWrenchEffortMessageDestroy(wdReportWrench);
	}

	// Destroy Global Variables
	vehicleStateDestroy(vehicleState);	
	jausArrayDestroy(wdWaypoints, (void *)setGlobalWaypointMessageDestroy);
	setWrenchEffortMessageDestroy(wdWrench);
	jausComponentDestroy(pd);
}
예제 #4
0
void jausNodeDestroy(JausNode node)
{
    jausArrayDestroy(node->components, (void *)jausComponentDestroy);
    if(node->identification) free(node->identification);
    free(node);
}
예제 #5
0
void lmListDestroy(LargeMessageList msgList)
{
	jausArrayDestroy(msgList->messages, (void *)jausMessageDestroy);
	jausAddressDestroy(msgList->source);
	free(msgList);
}
예제 #6
0
void lmHandlerDestroy(LargeMessageHandler lmh)
{
	jausArrayDestroy(lmh->messageLists, (void *)lmListDestroy);
	free(lmh);
}
예제 #7
0
파일: jausSubsystem.c 프로젝트: pfg/qgc
void jausSubsystemDestroy(JausSubsystem subsystem)
{
	jausArrayDestroy(subsystem->nodes, (void *)jausNodeDestroy);
	if(subsystem->identification) free(subsystem->identification);
	free(subsystem);
}