Пример #1
0
// -----------------------------------------------------------------------------
//
// -----------------------------------------------------------------------------
void ConvertOrientations::readFilterParameters(AbstractFilterParametersReader* reader, int index)
{
  reader->openFilterGroup(this, index);
  setInputType(reader->readValue("InputType", getInputType() ) );
  setOutputType(reader->readValue("OutputType", getOutputType() ) );
  setInputOrientationArrayPath(reader->readDataArrayPath("InputOrientationArrayPath", getInputOrientationArrayPath()));
  setOutputOrientationArrayName(reader->readString("OutputOrientationArrayName", getOutputOrientationArrayName()));
  reader->closeFilterGroup();
}
ossimQtIgenController::ossimQtIgenController(ossimQtIgenDialog* dialog)
   :
      ossimConnectableObjectListener(),
      ossimROIEventListener(),
      theDialog(dialog),
      theWidget(NULL),
      theWindowView(NULL),
      theOutputView(NULL),
      theWriter(NULL),
      theAnnotator(),
      theGsd(0.0, 0.0),
      theLines(0),
      theSamples(0),
      theOutputFile(),
      theOutputGeoPolygon(),
      theCallBackDisabled(false)
{
   // Listen for roi events from the annotator.
   theAnnotator.addListener((ossimROIEventListener*)this);
   
   theOutputGeoPolygon.clear();

   if (!theDialog || !theDialog->theOutputTypeComboBox)
   {
      return;
   }
   
   // Build the output type combo box.
   theDialog->theOutputTypeComboBox->clear();

   std::vector<ossimString> writerList;
   ossimImageWriterFactoryRegistry::instance()->getImageTypeList(writerList);

   std::vector<ossimString>::const_iterator i = writerList.begin();
   while (i != writerList.end())
   {
      QString qs = (*i).c_str();
      theDialog->theOutputTypeComboBox->insertItem(qs);
      ++i;
   }

   // Set the default output type.
   const QString DEFAULT_WRITER_TYPE = "tiff_tiled_band_separate";
   for (int index = 0; index < theDialog->theOutputTypeComboBox->count();
        ++index)
   {
      if (theDialog->theOutputTypeComboBox->text(index) == DEFAULT_WRITER_TYPE)
      {
         theDialog->theOutputTypeComboBox->setCurrentItem(index);
         break;
      }
   }

   // Make a writer so the user can edit it.
   setOutputType(getWriterString());
}
int main(void) {
    char *response = NULL;
    AttributeFilter *valueFilter = NULL;
    AggregatedReportInterface *aggregatedReportInterfaceObj = NULL;

    iotkit_init();

    aggregatedReportInterfaceObj = createAggregatedReportInterface();

    setReportStartTimestamp(aggregatedReportInterfaceObj, 1413504889L);
    setReportEndTimestamp(aggregatedReportInterfaceObj, getCurrentTimeInSeconds());

    addAggregationMethods(aggregatedReportInterfaceObj, "average");
    addAggregationMethods(aggregatedReportInterfaceObj, "min");
    addAggregationMethods(aggregatedReportInterfaceObj, "max");

  /*  addDimensions(aggregatedReportInterfaceObj, "dimen1");
    addDimensions(aggregatedReportInterfaceObj, "dimen2");
    addDimensions(aggregatedReportInterfaceObj, "dimen3");

    setOffset(aggregatedReportInterfaceObj, 0);
    setLimit(aggregatedReportInterfaceObj, 0); */

    setReportCountOnly(aggregatedReportInterfaceObj, true);
    setOutputType(aggregatedReportInterfaceObj, "json");

    addReportDeviceIds(aggregatedReportInterfaceObj, "ff-32-dd-ba-bb-cc");
    addReportDeviceIds(aggregatedReportInterfaceObj, "02-00-86-81-77-18");
    addReportDeviceIds(aggregatedReportInterfaceObj, "02-00-86-81-77-19");

    addReportGatewayIds(aggregatedReportInterfaceObj, "ff-32-dd-ba-bb-cc");
    addReportGatewayIds(aggregatedReportInterfaceObj, "02-00-86-81-77-14");
    addReportGatewayIds(aggregatedReportInterfaceObj, "02-00-86-81-77-15");

    addReportComponentIds(aggregatedReportInterfaceObj, "garage1");
    addReportComponentIds(aggregatedReportInterfaceObj, "garage2");
    addReportComponentIds(aggregatedReportInterfaceObj, "madras9");

    /*addReportSortInfo(aggregatedReportInterfaceObj, "sortField1", "ASC");
    addReportSortInfo(aggregatedReportInterfaceObj, "sortField2", "DESC");

/////////////////////////
    valueFilter = createAttributeFilterObject("filter_1");
    addAttributeFilterValues(valueFilter, "value1");
    addAttributeFilterValues(valueFilter, "value2");

    addFilters(aggregatedReportInterfaceObj, valueFilter);
*/

    response = aggregatedReportInterface(aggregatedReportInterfaceObj);

    printf("Response Received :%s\n", response);

    iotkit_cleanup();

    if(checkResponseValue(response, 200) == true) {
        exit(EXIT_SUCCESS);
    }

    exit(EXIT_FAILURE);
}
Пример #4
0
int main(int argc, char *argv[])
{
	int counter=0;
	FILE *fd = NULL;fopen("./client.out", "w+");
	if ( fd != NULL )
		setOutputType(fd);
	else
		setOutputType(stderr);

	
	setLogLevel(LOG_LEVEL_DEBUG);

	uint8_t keep_alive = 1;
	uint8_t msg_type = 0, timeout = 0;
	int sockfd = 0, n = 0,c=0,xadd=0,yadd=1,BCD=0,running=1, startx=30,starty=30;
	char recvBuff[1024];
	uint8_t gameStarted = 0,fakeResponded=0;
	struct EventPlayer event;
	sleep_time.tv_sec  = 0;
    	sleep_time.tv_nsec = 450000000;

	memset(recvBuff, '0',sizeof(recvBuff));


	if(argc != 3)
	{
		printf("\n Usage: %s <ip of server> <port of server>\n",argv[0]);
		return 1;
	}

	init_game();
	
	keep_alive = ConnectToServer(argv[1], argv[2], &sockfd);

	while (keep_alive)
	{
		
		void *buf = NULL;
		buf = RecieveMessage(sockfd, &msg_type, &timeout);
		
		if ( timeout == 5 ) {
			keep_alive = 0;
			ERROR("Connection to server timed out\n");
		} else {
			if(buf){
				switch(msg_type) {
					case 2:
						/* Player just connected to server;
							Message contains servers rules; */
						NOTICE("Connected to server, please stand by\n");
						CreateClientWorld(&game, buf);
						break;
					case 3:
						/* Update message received; calculate wait for button pressed */
						DEBUG("Update information recieved\n" /*TODO add data here for debuging */);
						updateClientWorld(&game,buf);
						gameStarted = 1;
						break;
					default:
						keep_alive = 0;
						DEBUG("Trashed unhandeled message type:%d\n", msg_type);
						break;
				}
				free(buf);
			}

			if (gameStarted)
			{
				
				//init_game();
				c = wgetch(key_detecter);
				
				if ( c != ERR ) {
					NOTICE(" WE PRESSED: %c\n",c);
					ClientMove(c, &game);//TODO pass c to world-done
				}		
				event.direction = (getSelf(&game))->direction;
				if ( c == ' ')
					event.shot = 1;
				else
					event.shot = 0;
				SendMessage(sockfd, &event, sizeof(event), PCKT_EVENT);
			 	DEBUG("Sending update event { %d, %d } to server \n", event.direction, event.shot );

	    	}
			drawWorld(&game);	
			getchar();		
			refresh();			
		}
	}
	NOTICE("Disconnected from server\n");
	if (fd != NULL)
		fclose(fd);
	//terminate_game();
	return 0;
}
Пример #5
0
  void FMODAudio::initialize()
  {
    FMOD_RESULT hr;

    mEngine->getConsole()->printf( Console::srcSound,
      L"Initializing FMOD Ex %x.%x.%x",
      HIWORD( FMOD_VERSION ), HIBYTE( LOWORD( FMOD_VERSION ) ),
      LOBYTE( LOWORD( FMOD_VERSION ) ) );

    refreshDrivers();
    refreshOutputTypes();
    refreshSpeakerModes();

    // Set output type
    setOutputType( stringToOutputType( g_CVar_fm_outputmode.getString() ) );

    // Set output device
    setDriver( g_CVar_fm_device.getInt() );

    // Get driver caps
    hr = mSystem->getDriverCaps( NULL, &mInfo.caps, &mInfo.rate, &mInfo.speakerMode );
    if ( FMOD_FAILED( hr ) )
      ENGINE_EXCEPT_FMOD( hr, "Failed to get driver caps" );

    // Print a warning and raise the DSP buffer if someone is poor enough to run on emulation
    if ( mInfo.caps & FMOD_CAPS_HARDWARE_EMULATED )
    {
      mEngine->getConsole()->printf( Console::srcSound,
        L"No hardware audio acceleration detected! Using software emulation!" );
      mSystem->setDSPBufferSize( 1024, 10 );
    }

    // Set speaker mode
    setSpeakerMode( stringToSpeakerMode( g_CVar_fm_speakermode.getString() ) );

    // Prepare flags
    FMOD_INITFLAGS fmodFlags = FMOD_INIT_NORMAL | FMOD_INIT_3D_RIGHTHANDED | FMOD_INIT_OCCLUSION_LOWPASS | FMOD_INIT_HRTF_LOWPASS | FMOD_INIT_GEOMETRY_USECLOSEST;
    FMOD_EVENT_INITFLAGS eventFlags = FMOD_EVENT_INIT_NORMAL;

    // Initialize the system
    int channels = g_CVar_fm_maxchannels.getInt();
    hr =  mEventSystem->init( channels, fmodFlags, nullptr, eventFlags );
    if ( FMOD_FAILED( hr ) )
      ENGINE_EXCEPT_FMOD( hr, "Failed to initialize FMOD EventSystem" );

    // Fetch realized values
    hr = mSystem->getSpeakerMode( &mInfo.speakerMode );
    if ( FMOD_FAILED( hr ) )
      ENGINE_EXCEPT_FMOD( hr, "getSpeakerMode failed" );
    mSystem->getOutput( &mInfo.outputType );
    if ( FMOD_FAILED( hr ) )
      ENGINE_EXCEPT_FMOD( hr, "getOutput failed" );
    mSystem->getDriver( &mInfo.driver );
    if ( FMOD_FAILED( hr ) )
      ENGINE_EXCEPT_FMOD( hr, "getDriver failed" );

    if ( mSettings.outputType != 0 )
      for ( size_t i = 0; i < mOutputTypes.size(); i++ )
        if ( ((FMODOutputType*)mOutputTypes[i])->fmodValue == mInfo.outputType )
        {
          mSettings.outputType = (int)i;
          break;
        }

    if ( mSettings.driver != 0 )
      for ( size_t i = 0; i < mDrivers.size(); i++ )
        if ( ((FMODDriver*)mDrivers[i])->fmodValue == mInfo.driver )
        {
          mSettings.driver = (int)i;
          break;
        }

    if ( mSettings.speakerMode != 0 )
      for ( size_t i = 0; i < mSpeakerModes.size(); i++ )
        if ( ((FMODSpeakerMode*)mSpeakerModes[i])->fmodValue == mInfo.speakerMode )
        {
          mSettings.speakerMode = (int)i;
          break;
        }

    // Log to console for good measure
    mEngine->getConsole()->printf( Console::srcSound,
      L"Speaker mode: %s", speakerModeToDisplayString( mInfo.speakerMode ).c_str() );
    mEngine->getConsole()->printf( Console::srcSound,
      L"Output type: %s", outputTypeToDisplayString( mInfo.outputType ).c_str() );

    // Setup channel groups
    hr = mSystem->getMasterChannelGroup( &mMasterGroup );
    if ( FMOD_FAILED( hr ) )
      ENGINE_EXCEPT_FMOD( hr, "Failed to get master channel group" );

    hr = mSystem->createChannelGroup( "music", &mMusicGroup );
    if ( FMOD_FAILED( hr ) )
      ENGINE_EXCEPT_FMOD( hr, "Failed to create music channel group" );
    hr = mMasterGroup->addGroup( mMusicGroup );
    if ( FMOD_FAILED( hr ) )
      ENGINE_EXCEPT_FMOD( hr, "Failed to assign music channel group" );

    hr = mSystem->createChannelGroup( "effect", &mEffectGroup );
    if ( FMOD_FAILED( hr ) )
      ENGINE_EXCEPT_FMOD( hr, "Failed to create effect channel group" );
    hr = mMasterGroup->addGroup( mEffectGroup );
    if ( FMOD_FAILED( hr ) )
      ENGINE_EXCEPT_FMOD( hr, "Failed to assign effect channel group" );

    // Set initial volumes
    setMasterVolume( g_CVar_fm_volume.getFloat() );
    setMusicVolume( g_CVar_fm_bgvolume.getFloat() );
    setEffectVolume( g_CVar_fm_fxvolume.getFloat() );

    mMusic = new FMODMusic( this );
    Locator::provideMusic( mMusic );

    mEngine->operationContinueAudio();
  }
Пример #6
0
Output::Output(OutputType outputtype) : lengthScale(Mpc), energyScale(EeV), oneDimensional(false), count(0) {
		setOutputType(outputtype);
}