示例#1
0
void OSInfoCommand::getOSInfo(ostream& outPrintWriter,
                              ostream& errPrintWriter)
{

    CIMClient client;
    client.setTimeout( _timeout );

    try
    {
        _connectToServer( client, outPrintWriter);

        Boolean deepInheritance = true;
        Boolean localOnly = false;
        Boolean includeQualifiers = false;
        Boolean includeClassOrigin = false;
        Uint32 numberInstances;
        Array<CIMInstance> cimNInstances =
               client.enumerateInstances(NAMESPACE, CLASSNAME,
                                         deepInheritance,
                                         localOnly,  includeQualifiers,
                                         includeClassOrigin );

        numberInstances = cimNInstances.size();

        // while we only have one instance (the running OS), we can take the
        // first instance.  When the OSProvider supports installed OSs as well,
        // will need to select the runningOS instance

        for (Uint32 i = 0; i < cimNInstances.size(); i++)
        {
           CIMObjectPath instanceRef = cimNInstances[i].getPath ();
           if ( !(instanceRef.getClassName().equal (CIMName (CLASSNAME))))
           {
              errorExit(errPrintWriter, "EnumerateInstances failed");
           }

           // first gather the interesting properties
           gatherProperties(cimNInstances[i], _useRawDateTimeFormat);
           // then display them
           displayProperties(outPrintWriter);

      }   // end for looping through instances

    }  // end try

    catch(const Exception& e)
    {
      errorExit(errPrintWriter, e.getMessage());
    }

}
示例#2
0
文件: sttyl.c 项目: siddhugit/Systems
/*
*   Main function of the program. get terminal settings using tcgetattr()
*   in a local termios object. If no command line arguments given calls
*   displayProperties() to display properties of termios, otherwise
*   calls setProperties() to set command line arguments to termios object.
*   If all the arguments are processed successfully calls tcsetattr() to
*   overwrite terminal settings with local termios object.
*   parameters:
*       o int argc - number of command line arguments
*       o char* argv[] - array of command line arguments
*   Return : exit status of program
*/
int main(int argc,char* argv[])
{
    struct	termios ttyinfo;/* this struct holds tty info */

    if ( tcgetattr( STDIN_FILENO , &ttyinfo ) == -1 ){   /* get info */
        perror("tcgetattr");
        exit(EXIT_FAILURE);
    }
    if(argc == 1){//no arguments : display terminal properties 
        showSpeed(&ttyinfo);//show baud rate
        printf("\n");
        displayProperties(&ttyinfo);//displays ctrl characters and flags
    }
    else{//set properties for given command line arguments
        //set properties in a local termios variable
        setProperties(argc,argv,&ttyinfo);
        //everything good so far, so set local termios into terminal
        if( tcsetattr(STDIN_FILENO , TCSANOW, &ttyinfo) ==  -1){
            perror( "tcsetattr");
            exit(EXIT_FAILURE);
        }
    }
    return EXIT_SUCCESS;//Success exit status
}
示例#3
0
void RGBMatrixEditor::updateExtraOptions()
{

    resetProperties(m_propertiesLayout->layout());
    m_propertiesGroup->hide();

    if (m_matrix->algorithm() == NULL ||
        m_matrix->algorithm()->type() == RGBAlgorithm::Script ||
        m_matrix->algorithm()->type() == RGBAlgorithm::Audio)
    {
        m_textGroup->hide();
        m_imageGroup->hide();
        m_offsetGroup->hide();

        if (m_matrix->algorithm() != NULL && m_matrix->algorithm()->type() == RGBAlgorithm::Script)
        {
            RGBScript *script = static_cast<RGBScript*> (m_matrix->algorithm());
            displayProperties(script);
        }
    }
    else if (m_matrix->algorithm()->type() == RGBAlgorithm::Plain)
    {
        m_textGroup->hide();
        m_imageGroup->hide();
        m_offsetGroup->hide();
    }
    else if (m_matrix->algorithm()->type() == RGBAlgorithm::Image)
    {
        m_textGroup->hide();
        m_imageGroup->show();
        m_offsetGroup->show();

        RGBImage* image = static_cast<RGBImage*> (m_matrix->algorithm());
        Q_ASSERT(image != NULL);
        m_imageEdit->setText(image->filename());

        int index = m_imageAnimationCombo->findText(RGBImage::animationStyleToString(image->animationStyle()));
        if (index != -1)
            m_imageAnimationCombo->setCurrentIndex(index);

        m_xOffsetSpin->setValue(image->xOffset());
        m_yOffsetSpin->setValue(image->yOffset());

    }
    else if (m_matrix->algorithm()->type() == RGBAlgorithm::Text)
    {
        m_textGroup->show();
        m_offsetGroup->show();
        m_imageGroup->hide();

        RGBText* text = static_cast<RGBText*> (m_matrix->algorithm());
        Q_ASSERT(text != NULL);
        m_textEdit->setText(text->text());

        int index = m_animationCombo->findText(RGBText::animationStyleToString(text->animationStyle()));
        if (index != -1)
            m_animationCombo->setCurrentIndex(index);

        m_xOffsetSpin->setValue(text->xOffset());
        m_yOffsetSpin->setValue(text->yOffset());
    }

    if (m_matrix->algorithm() != NULL)
    {
        int accColors = m_matrix->algorithm()->acceptColors();
        if (accColors == 0)
        {
            m_startColorButton->hide();
            m_endColorButton->hide();
            m_resetEndColorButton->hide();
            m_blendModeLabel->hide();
            m_blendModeCombo->hide();
        }
        else
        {
            m_startColorButton->show();
            if (accColors == 1 || m_blendModeCombo->currentIndex() != 0)
            {
                m_endColorButton->hide();
                m_resetEndColorButton->hide();
            }
            else
            {
                m_endColorButton->show();
                m_resetEndColorButton->show();
            }
            m_blendModeLabel->show();
            m_blendModeCombo->show();
        }
    }
}
void DirectShowFrameGrabber::init() {
	InitializeDirectX();
	HRESULT hr = S_OK;
	mediaEvent = NULL;
	mediaControl = NULL;
	sampleGrabber = NULL;
	buffer = NULL;
	bufferLength = 0;
	width = 640; // just default, will be overriden
	height = 480;  // just default, will be overriden

	CComPtr<IBaseFilter> captureFilter = NULL;

	// choose video capture device
	hr = ChooseDirectXFilter(captureFilter, CLSID_VideoInputDeviceCategory);

	ASSERT(SUCCEEDED(hr));
	//ASSERT(captureFilter != NULL, "no capturing device available!");
	CComPtr<IBaseFilter> sampleGrabberFilter = NULL;
	hr = sampleGrabberFilter.CoCreateInstance(CLSID_SampleGrabber);
	ASSERT(SUCCEEDED(hr));
	CComPtr<IBaseFilter> nullRendererFilter = NULL;
	hr = nullRendererFilter.CoCreateInstance(CLSID_NullRenderer);
	ASSERT(SUCCEEDED(hr));
	graphBuilder = NULL;
	hr = graphBuilder.CoCreateInstance(CLSID_FilterGraph);


	ASSERT(SUCCEEDED(hr));
	IMediaFilter *mediaFilter = 0;
	graphBuilder->QueryInterface(IID_IMediaFilter, (void**)&mediaFilter);
	mediaFilter->SetSyncSource(NULL);	  
	mediaFilter->Release();
	

	hr = graphBuilder->AddFilter(captureFilter, NULL);	  
	ASSERT(SUCCEEDED(hr));

	// open ui with video capture device properties
	displayProperties( captureFilter );

	hr = graphBuilder->AddFilter(nullRendererFilter, L"NullRenderer");
	ASSERT(SUCCEEDED(hr));
	hr = graphBuilder->AddFilter(sampleGrabberFilter, L"Grabber");
	ASSERT(SUCCEEDED(hr));


	hr = sampleGrabberFilter->QueryInterface(IID_ISampleGrabber, (void**)&sampleGrabber);
	ASSERT(SUCCEEDED(hr));

	AM_MEDIA_TYPE mediaType;
	ZeroMemory(&mediaType, sizeof(AM_MEDIA_TYPE));
	mediaType.majortype = MEDIATYPE_Video;
	mediaType.subtype = MEDIASUBTYPE_RGB24;
	mediaType.formattype = FORMAT_VideoInfo; 
	hr = sampleGrabber->SetMediaType(&mediaType);
	ASSERT(SUCCEEDED(hr));

	CComPtr<IEnumPins> pins = NULL;
	CComPtr<IPin> cameraOutputPin = NULL;

	{
		hr = captureFilter->EnumPins(&pins);
		ASSERT(SUCCEEDED(hr));
		hr = pins->Reset();
		ASSERT(SUCCEEDED(hr));
		
		hr = pins->Next(1, &cameraOutputPin, NULL); 
		ASSERT(SUCCEEDED(hr));
		pins = NULL; 
	}


	hr = sampleGrabberFilter->EnumPins(&pins);
	ASSERT(SUCCEEDED(hr));
	hr = pins->Reset();
	ASSERT(SUCCEEDED(hr));
	CComPtr<IPin> grabberInputPin = NULL;
	hr = pins->Next(1, &grabberInputPin, NULL);
	ASSERT(SUCCEEDED(hr));
	CComPtr<IPin> grabberOutputPin = NULL;
	hr = pins->Next(1, &grabberOutputPin, NULL);
	ASSERT(SUCCEEDED(hr));
	pins = NULL;
	hr = nullRendererFilter->EnumPins(&pins);
	ASSERT(SUCCEEDED(hr));
	hr = pins->Reset();
	ASSERT(SUCCEEDED(hr));
	CComPtr<IPin> nullRendererInputPin = NULL;
	hr = pins->Next(1, &nullRendererInputPin, NULL);
	ASSERT(SUCCEEDED(hr));

	// show camera properties
		CComPtr<ISpecifyPropertyPages> propertyPages;
		hr = cameraOutputPin->QueryInterface(IID_ISpecifyPropertyPages, (void**)&propertyPages);
		if (SUCCEEDED(hr)) {
			PIN_INFO pinInfo;
			cameraOutputPin->QueryPinInfo(&pinInfo);
			CAUUID caGUID;
			propertyPages->GetPages(&caGUID);
			OleCreatePropertyFrame(NULL, 0, 0, L"Property Sheet", 1,
				(IUnknown **)&(cameraOutputPin.p), caGUID.cElems,
				caGUID.pElems, 0, 0, NULL);
			CoTaskMemFree(caGUID.pElems);
			pinInfo.pFilter->Release();
		}


	hr = graphBuilder->Connect(cameraOutputPin, grabberInputPin);
	ASSERT(SUCCEEDED(hr));
	hr = graphBuilder->Connect(grabberOutputPin, nullRendererInputPin);
	ASSERT(SUCCEEDED(hr));

	hr = graphBuilder->Render(grabberOutputPin);
	//      ASSERT(SUCCEEDED(hr)); // produces an error: "An invalid field name was used in a query string"

	hr = sampleGrabber->SetBufferSamples(TRUE);
	ASSERT(SUCCEEDED(hr));
	hr = sampleGrabber->SetOneShot(FALSE);
	ASSERT(SUCCEEDED(hr));
	hr = graphBuilder->QueryInterface(IID_IMediaControl, (void**)&mediaControl);
	ASSERT(SUCCEEDED(hr));
	hr = graphBuilder->QueryInterface(IID_IMediaEvent, (void**)&mediaEvent);
	ASSERT(SUCCEEDED(hr));
	AM_MEDIA_TYPE mt;
	hr = sampleGrabber->GetConnectedMediaType(&mt);
	ASSERT(SUCCEEDED(hr));
	ASSERT(mt.formattype == FORMAT_VideoInfo);
	VIDEOINFOHEADER *videoHeader;
	videoHeader = reinterpret_cast<VIDEOINFOHEADER*>(mt.pbFormat);
	width = videoHeader->bmiHeader.biWidth;
	height = videoHeader->bmiHeader.biHeight;
	bitmapFormat = 0;
	CComPtr<IAMVideoControl> videoControl;
	hr = captureFilter->QueryInterface(IID_IAMVideoControl, (void**)&videoControl);
	
	// run the graph!
	mediaControl->Run();
}
示例#5
0
 void EditorWidget::displayProperties_(const IPropertyDescription& pd)
 {
   emit displayProperties(pd);
 }
示例#6
0
/* 
   getDNSInfo of the DNS provider. 
*/
void DNSInfo::getDNSInfo(const int argc, const char** argv)
{

// ATTN-SLC-16-May-02-P1  enhance to take host & user info
//  Decided to keep local only for first release 

    Boolean cimFormat = false;

    // before we even connect to CIMOM, make sure we're
    // syntactically valid

    if (argc > 2)
    {
       _usage();
       exit(1);
    }

    if (argc == 2)
    {
       // only support one option, -c for CIM formatting
       const char *opt = argv[1];

       if (strcmp(opt,"-c") == 0)
       {
          cimFormat = true;
       }
       else
       {
          _usage();
          exit(1);
       }
    }

    // need to first connect to the CIMOM

    try
    {
        // specify the timeout value for the connection (if inactive)
        // in milliseconds, thus setting to one minute
        CIMClient client;
        client.setTimeout(60 * 1000);
	client.connectLocal();
        
        Boolean deepInheritance = true;
        Boolean localOnly = true;
        Boolean includeQualifiers = false;
        Boolean includeClassOrigin = false;
        Uint32 numberInstances;

#ifdef DEBUG
        cout << "DNSInfo::getDNSInfo() - doing enumerateInstances . . ."
             << endl;
#endif

        Array<CIMInstance> cimNInstances = 
	       client.enumerateInstances(NAMESPACE, CLASSNAME, 
                                         deepInheritance,
				         localOnly,  includeQualifiers,
				         includeClassOrigin );

#ifdef DEBUG
        cout << "DNSInfo::getDNSInfo() - enumerateInstances done" << endl;
#endif
	  
        numberInstances = cimNInstances.size();

        // while we only have one instance (the running OS), we can take the
        // first instance.  When the OSProvider supports installed OSs as well,
        // will need to select the runningOS instance

        for (Uint32 i = 0; i < cimNInstances.size(); i++)
        {
           CIMObjectPath instanceRef = cimNInstances[i].getPath ();
           if ( !(instanceRef.getClassName().equal (CIMName (CLASSNAME))))
           {
              errorExit("EnumerateInstances failed");
           }

           // first gather the interesting properties
           gatherProperties(cimNInstances[i], cimFormat);
         
           // then display them
           displayProperties();

      }   // end for looping through instances
    
    }  // end try 
   
    catch(Exception& e)
    {
      errorExit(e.getMessage());
    }

}
示例#7
0
/* 
   getNISInfo of the NIS provider. 
*/
void NISInfo::getNISInfo(const int argc, const char** argv)
{
    String hostname;
    String user;
    String passwd;

    // before we even connect to CIMOM, make sure we're
    // syntactically valid

    if (argc > 1)
    {
       _usage();
       exit(1);
    }

    // need to first connect to the CIMOM

    try
    {
        // specify the timeout value for the connection (if inactive)
        // in milliseconds, thus setting to one minute
        CIMClient client;
        client.setTimeout(120 * 1000);
        
	client.connectLocal();
        
        Boolean deepInheritance = true;
        Boolean localOnly = true;
        Boolean includeQualifiers = false;
        Boolean includeClassOrigin = false;
        Uint32 numberInstances;

#ifdef DEBUG
        cout << "NISInfo::getNISInfo() - doing enumerateInstances . . ."
             << endl;
#endif

        Array<CIMInstance> cimNInstances = 
	       client.enumerateInstances(NAMESPACE, CLASSNAME, 
                                         deepInheritance,
				         localOnly,  
            				 includeQualifiers,
				         includeClassOrigin );

#ifdef DEBUG
        cout << "NISInfo::getNISInfo() - enumerateInstances done" << endl;
#endif
	  
        numberInstances = cimNInstances.size();

        for (Uint32 i = 0; i < cimNInstances.size(); i++)
        {
           CIMObjectPath instanceRef = cimNInstances[i].getPath ();
           if ( !(instanceRef.getClassName().equal (CIMName (CLASSNAME))))
           {
              errorExit("EnumerateInstances failed");
           }

           // first gather the interesting properties
           gatherProperties(cimNInstances[i]);
         
           // then display them
           displayProperties();

      }   // end for looping through instances
    }
    catch(Exception& e)
    {
      errorExit(e.getMessage());
    }
}
void VCMatrixPresetSelection::slotUpdatePresetProperties()
{
    resetProperties(m_propertiesLayout->layout());
    RGBScript selScript = m_doc->rgbScriptsCache()->script(m_presetCombo->currentText());
    displayProperties(&selScript);
}