int main(void)
{

  /* USER CODE BEGIN 1 */

  /* USER CODE END 1 */

  /* MCU Configuration----------------------------------------------------------*/

  /* Reset of all peripherals, Initializes the Flash interface and the Systick. */
  HAL_Init();

  /* Configure the system clock */
  SystemClock_Config();

  /* Initialize all configured peripherals */
  MX_GPIO_Init();
  MX_USART2_UART_Init();

  /* USER CODE BEGIN 2 */
  dc_main();
  /* USER CODE END 2 */

  /* Infinite loop */
  /* USER CODE BEGIN WHILE */
  while (1)
  {
  /* USER CODE END WHILE */

  /* USER CODE BEGIN 3 */

  }
  /* USER CODE END 3 */

}
int
main( int argc, char **argv )
{
	dc_main_init = main_init;
	dc_main_config = main_config;
	dc_main_shutdown_fast = main_shutdown_fast;
	dc_main_shutdown_graceful = main_shutdown_graceful;
	return dc_main( argc, argv );
}
int
main( int argc, char **argv )
{
	set_mySubSystem( "C_GAHP_WORKER_THREAD", SUBSYSTEM_TYPE_GAHP );

	dc_main_init = main_init;
	dc_main_config = main_config;
	dc_main_shutdown_fast = main_shutdown_fast;
	dc_main_shutdown_graceful = main_shutdown_graceful;
	return dc_main( argc, argv );
}
Example #4
0
int
main( int argc, char **argv )
{
	set_mySubSystem("SHARED_PORT", SUBSYSTEM_TYPE_SHARED_PORT );	// used by Daemon Core

	dc_main_init = main_init;
	dc_main_config = main_config;
	dc_main_shutdown_fast = main_shutdown_fast;
	dc_main_shutdown_graceful = main_shutdown_graceful;
	return dc_main( argc, argv );
}
Example #5
0
int
main( int argc, char **argv )
{
	set_mySubSystem( "SCHEDD", SUBSYSTEM_TYPE_SCHEDD );

	dc_main_init = main_init;
	dc_main_config = main_config;
	dc_main_shutdown_fast = main_shutdown_fast;
	dc_main_shutdown_graceful = main_shutdown_graceful;
	return dc_main( argc, argv );
}
Example #6
0
// on ! Windows, this is just called by main,
// on Windows, WinMain builds an argc,argv, 
// does some Windows specific initialization, then calls this
//
// TODO: make kbdd a simple program and not daemon core, then
// we can ditch this.
//
int
daemon_main( int argc, char **argv )
{
	set_mySubSystem( "KBDD", SUBSYSTEM_TYPE_DAEMON );

	dc_main_init = main_init;
	dc_main_config = main_config;
	dc_main_shutdown_fast = main_shutdown_fast;
	dc_main_shutdown_graceful = main_shutdown_graceful;
	return dc_main( argc, argv );
}
Example #7
0
int
main( int argc, char **argv )
{
	set_mySubSystem( "Replication", SUBSYSTEM_TYPE_DAEMON );// used by Daemon Core

	dc_main_init = main_init;
	dc_main_config = main_config;
	dc_main_shutdown_fast = main_shutdown_fast;
	dc_main_shutdown_graceful = main_shutdown_graceful;
	return dc_main( argc, argv );
}
Example #8
0
int
main( int argc, char **argv )
{
	set_mySubSystem( NULL, SUBSYSTEM_TYPE_STARTER );

	dc_main_init = main_init;
	dc_main_config = main_config;
	dc_main_shutdown_fast = main_shutdown_fast;
	dc_main_shutdown_graceful = main_shutdown_graceful;
	dc_main_pre_dc_init = main_pre_dc_init;
	return dc_main( argc, argv );
}
Example #9
0
int
main( int argc, char **argv )
{
	set_mySubSystem("FT_GAHP", SUBSYSTEM_TYPE_GAHP);

	dc_main_init = main_init;
	dc_main_config = main_config;
	dc_main_shutdown_fast = main_shutdown_fast;
	dc_main_shutdown_graceful = main_shutdown_graceful;
	dc_main_pre_command_sock_init = main_pre_command_sock_init;
	return dc_main( argc, argv );
}
Example #10
0
int
main( int argc, char **argv )
{
    if( argc == 2 && strncasecmp(argv[1],"-cl",3) == MATCH ) {
        printClassAd();
        exit(0);
    }

    set_mySubSystem( "SHADOW", SUBSYSTEM_TYPE_SHADOW );

    dc_main_init = main_init;
    dc_main_config = main_config;
    dc_main_shutdown_fast = main_shutdown_fast;
    dc_main_shutdown_graceful = main_shutdown_graceful;
    return dc_main( argc, argv );
}
Example #11
0
int
main( int argc, char **argv )
{
    // parse args to see if we have been asked to run as a service.
    // services are started without a console, so if we have one
    // we can't possibly run as a service.
    //
#ifdef WIN32
    bool has_console = main_has_console();
    bool is_daemon = dc_args_is_background(argc, argv);
#endif

	set_mySubSystem( "MASTER", SUBSYSTEM_TYPE_MASTER );
	SharedPortEndpoint::InitializeDaemonSocketDir();

	dc_main_init = main_init;
	dc_main_config = main_config;
	dc_main_shutdown_fast = main_shutdown_fast;
	dc_main_shutdown_graceful = main_shutdown_normal;
	dc_main_pre_command_sock_init = main_pre_command_sock_init;

#ifdef WIN32
    // if we have been asked to start as a daemon, on Windows
    // first try and start as a service, if that doesn't work try
    // to start as a background process. Note that we don't return
    // from the call to start_as_service() if the service successfully
    // started - just like dc_main().
    //
    NT_ServiceFlag = FALSE;
    if (is_daemon) {
       NT_ServiceFlag = TRUE;
	   DWORD err = start_as_service();
       if (err == 0x666) {
          // 0x666 is a special error code that tells us 
          // the Service Control Manager didn't create this process
          // so we should go ahead run as normal background 'daemon'
          NT_ServiceFlag = FALSE;
       } else {
          return (int)err;
       }
    }
#endif

	return dc_main( argc, argv );
}
Example #12
0
int main(int argc, char *argv[])
{
	int i;
	int sensor_on = 0;
	int ldw = 0;
	int ret = 0;
	int initial_err = 0;
	int sensor60fps = 0;
	gpCVR_VStream_Cfg cfg;
	
	if((strcmp(SYSCONFIG_PLATFORM, "gplus.cvr_turnkey_demo0") == 0 )|| (	strcmp(SYSCONFIG_PLATFORM, "gplus.cvr_turnkey_demo2") == 0 ))
	{
		g_flip_on = 0;
		g_flip_off = 1;
	}
	else
	{
		g_flip_on = 1;
		g_flip_off = 0;
	}
	global_flip = g_flip_off;
	
	memset(&cfg, 0, sizeof(gpCVR_VStream_Cfg));
	cfg.sensor_calibrate = 	&ar0330_cdsp_calibration;
	cfg.cdsp_user_preference = &cdsp_user_preference;
	
	memset(cam_working_path, 0, 256);
	
	if (strcmp(argv[1], "-dv") == 0)
		mode = DV_MODE;
	else if (strcmp(argv[1], "-dc") == 0)
		mode = DC_MODE;
	else
		return -1;
		
	dv_parse_command(argc, argv);
	dc_parse_command(argc, argv);

	
	signal(SIGUSR1,get_signal_user1);
	signal(SIGUSR2,get_signal_user2);
	signal(SIGTERM,get_signal_term);
				
	ldw = global_ldw;
	update_flag(&cfg.flag, CFG_LDW, ldw);
	sensor60fps = global_60fps;
			
	sensor_on = 0;
	RegisterSigint();
	
	while(!powerOff)
	{
		//unsigned int msgId;
		//void* msgPara = NULL;

		if (mode == DV_MODE)
		{
			cfg.mode = MODE_H264;
			update_flag(&cfg.flag, CFG_LDW, global_ldw);
			cfg.width = cfg.height = cfg.fps = 0;
			if (global_60fps)
			{
				cfg.width = 1280;
				cfg.height = 720;
				cfg.fps = 60;
			}
			if (!sensor_on)
			{
				ret = gp_IPC_VStream_Open(&cfg);
			}
			else if (global_ldw != ldw || global_60fps != sensor60fps)
			{
				gp_IPC_VStream_Close();
				ret = gp_IPC_VStream_Open(&cfg);
			}
			if (ret < 0) 
			{
				initial_err = 1;
				powerOff = 1;
			}
			
			sensor_on = 1;
			gp_IPC_VStream_Start();
			printf("Start DV Mode\n");
			ret = dv_main(argc, argv);
			if (ret < 0)
			{
				powerOff = 1;
				continue;
			}
			mode = WAIT_MODE;
			ldw = global_ldw;
			sensor60fps = global_60fps;
		}
		else if (mode == DC_MODE)
		{
			cfg.mode = MODE_JPG;
			update_flag(&cfg.flag, CFG_LDW, 0);
			cfg.width = cfg.height = cfg.fps = 0;
			if (!sensor_on)
			{
				ret = gp_IPC_VStream_Open(&cfg);
			}
			else if (ldw || sensor60fps)
			{
				gp_IPC_VStream_Close();
				ret = gp_IPC_VStream_Open(&cfg);
			}
			if (ret < 0) 
			{
				initial_err = 1;
				powerOff = 1;
				continue;
			}
			
			ldw = 0;
			sensor60fps = 0;
			sensor_on = 1;
			gp_IPC_VStream_Start();
			printf("Start DC Mode\n");	
			ret = dc_main(argc, argv);
			if (ret < 0)
			{
				powerOff = 1;
				continue;
			}
			mode = WAIT_MODE;
		}
		else if (mode == IDLE_MODE)
		{
			if (sensor_on)
			{
				printf("Sensor Stop\n");
				//gp_IPC_VStream_Stop();
				gp_IPC_VStream_Close();
				sensor_on = 0;
			}
			mode = WAIT_MODE;
		}

		g_bQuit = 0;
									
		usleep(5000);
	}

	if (initial_err)
	{
		printf("[camcorder] Initialize Error\n");
		dvr_pipe_init();
		dvr_pipemsg_send(CMD_READY_KEY, 0, NULL);
		dvr_pipe_close();
	}
	else
	{
		gp_IPC_VStream_Close();
	}
	printf("[camcorder] program exit\n");

	return ret;
}