/*******************************
	
	//1/dexter/master/master.cpp

	Dextrous Manipulation Laboratory
	Stanford University

	Author:  Weston Griffin
	
	Description: This process starts up dex_driver and then starts the
	nodecomm process
	
	
	
	history:
	07/25/01	wbg		Set up program
**********************************/

//---------------- include files -----------------------------
#include <stdio.h>
#include <unistd.h>
#include <time.h>
#include <sys/types.h>
#include <conio.h>

#include <DML_child.h>

//---------------- definitions -------------------------------


//--------------- usage --------------------------------------

//---------------- prototypes --------------------------------
static void	sigHandler( int sig_count);

// --------------- program code ------------------------------
void main( int argc, const char *argv[] )
{
	//catch termination.... kill all the children and shared memory
	signal(SIGTERM,sigHandler);			

	//set the ticksize
	qnx_ticksize(500000,_TICKSIZE_STANDARD);	//0.5ms
	
		
	//--------------------------------------------------------------------------------------
	//create all the children... pass them appropriate arguments

	printf("%% master - starting cgrasp process\n");
	DML_child cgrasp_server("cgrasp");
	cgrasp_server.sendInfoMsg();	

	printf("%% master - starting dex_driver preocess\n");
	DML_child dexDriver("dex_driver", WAIT_RESPONSE);

	printf("%% master - starting nodecomm process\n");
	DML_child nodeComm("nodecomm");
	nodeComm.sendInfoMsg();

	pause();

}  //end main


static void sigHandler( int sig_count)
{
	printf("closing master\n");
	DML_child::killChildren();
	exit(1);
}



