tResult Test::getWheelTicks(IMediaSample *mediaSample, tFloat32 &value)
{
	RETURN_IF_FAILED(getF32Value(mediaSample, this->coderDescriptionWheelTicks, value));
	RETURN_NOERROR;
}
tResult cMarkerDetectFilter::Init(tInitStage eStage, __exception)
{
    RETURN_IF_FAILED(cFilter::Init(eStage, __exception_ptr));
    if (eStage == StageFirst)
        {
        //create the video rgb input pin
        RETURN_IF_FAILED(m_oPinInputVideo.Create("Video_RGB_input",IPin::PD_Input, static_cast<IPinEventSink*>(this))); 
        RETURN_IF_FAILED(RegisterPin(&m_oPinInputVideo));

        //create the video rgb output pin
        RETURN_IF_FAILED(m_oPinOutputVideo.Create("Video_RGB_output", IPin::PD_Output, static_cast<IPinEventSink*>(this)));
        RETURN_IF_FAILED(RegisterPin(&m_oPinOutputVideo));

        // create the description manager
        cObjectPtr<IMediaDescriptionManager> pDescManager;
        RETURN_IF_FAILED(_runtime->GetObject(OID_ADTF_MEDIA_DESCRIPTION_MANAGER,IID_ADTF_MEDIA_DESCRIPTION_MANAGER, (tVoid**)&pDescManager,__exception_ptr));

		tChar const * strDescSignalLanacc_man = pDescManager->GetMediaDescription("tSignalValue");
		RETURN_IF_POINTER_NULL(strDescSignalLanacc_man);
		cObjectPtr<IMediaType> pTypeSignalmaneuver_lanacc = new cMediaType(0, 0, 0, "tSignalValue", strDescSignalLanacc_man, IMediaDescription::MDF_DDL_DEFAULT_VERSION);
		RETURN_IF_FAILED(pTypeSignalmaneuver_lanacc->GetInterface(IID_ADTF_MEDIA_TYPE_DESCRIPTION, (tVoid**)&mediatype_Lan_Acc_Man));
		RETURN_IF_FAILED(Lan_Acc_Man.Create("Lan_Acc_Man", pTypeSignalmaneuver_lanacc, static_cast<IPinEventSink*> (this)));
		RETURN_IF_FAILED(RegisterPin(&Lan_Acc_Man));

		tChar const * strDescSignalmaneuver_accspeed = pDescManager->GetMediaDescription("tSignalValue");
		RETURN_IF_POINTER_NULL(strDescSignalmaneuver_accspeed);
		cObjectPtr<IMediaType> pTypeSignalmaneuver_accspeed = new cMediaType(0, 0, 0, "tSignalValue", strDescSignalmaneuver_accspeed, IMediaDescription::MDF_DDL_DEFAULT_VERSION);
		RETURN_IF_FAILED(pTypeSignalmaneuver_accspeed->GetInterface(IID_ADTF_MEDIA_TYPE_DESCRIPTION, (tVoid**)&mediatype_Lan_Acc_Speed));
		RETURN_IF_FAILED(Lan_Acc_Speed.Create("Lane_Speed", pTypeSignalmaneuver_accspeed, static_cast<IPinEventSink*> (this)));
		RETURN_IF_FAILED(RegisterPin(&Lan_Acc_Speed));

		tChar const * strDescSignalmaneuver_idJury = pDescManager->GetMediaDescription("tSignalValue");
		RETURN_IF_POINTER_NULL(strDescSignalmaneuver_idJury);
		cObjectPtr<IMediaType> pTypeSignalmaneuver_idjury = new cMediaType(0, 0, 0, "tSignalValue", strDescSignalmaneuver_idJury, IMediaDescription::MDF_DDL_DEFAULT_VERSION);
		RETURN_IF_FAILED(pTypeSignalmaneuver_idjury->GetInterface(IID_ADTF_MEDIA_TYPE_DESCRIPTION, (tVoid**)&mediatype_maneuverid_Jury));
		RETURN_IF_FAILED(maneuverid_Jury.Create("maneuverid_Jury", pTypeSignalmaneuver_idjury, static_cast<IPinEventSink*> (this)));
		RETURN_IF_FAILED(RegisterPin(&maneuverid_Jury));

		tChar const * strDescSignalmaneuver_id = pDescManager->GetMediaDescription("tSignalValue");
		RETURN_IF_POINTER_NULL(strDescSignalmaneuver_id);
		cObjectPtr<IMediaType> pTypeSignalmaneuver_id = new cMediaType(0, 0, 0, "tSignalValue", strDescSignalmaneuver_id, IMediaDescription::MDF_DDL_DEFAULT_VERSION);
		RETURN_IF_FAILED(pTypeSignalmaneuver_id->GetInterface(IID_ADTF_MEDIA_TYPE_DESCRIPTION, (tVoid**)&mediatype_maneuver_id));
		RETURN_IF_FAILED(maneuver_id.Create("Maneuver_ID", pTypeSignalmaneuver_id, static_cast<IPinEventSink*> (this)));
		RETURN_IF_FAILED(RegisterPin(&maneuver_id));

		tChar const * strDescSignalmaneuver_finish = pDescManager->GetMediaDescription("tBoolSignalValue");
		RETURN_IF_POINTER_NULL(strDescSignalmaneuver_finish);
		cObjectPtr<IMediaType> pTypeSignalmaneuver_finish = new cMediaType(0, 0, 0, "tBoolSignalValue", strDescSignalmaneuver_finish, IMediaDescription::MDF_DDL_DEFAULT_VERSION);
		RETURN_IF_FAILED(pTypeSignalmaneuver_finish->GetInterface(IID_ADTF_MEDIA_TYPE_DESCRIPTION, (tVoid**)&mediatype_maneuver_finish));
		RETURN_IF_FAILED(maneuver_finish.Create("Maneuver_int_Finish", pTypeSignalmaneuver_finish, static_cast<IPinEventSink*> (this)));
		RETURN_IF_FAILED(RegisterPin(&maneuver_finish));

        // create the description for the road sign pin
        tChar const * strDesc = pDescManager->GetMediaDescription("tRoadSign");   
        RETURN_IF_POINTER_NULL(strDesc);    
        cObjectPtr<IMediaType> pType = new cMediaType(0, 0, 0, "tRoadSign", strDesc, IMediaDescription::MDF_DDL_DEFAULT_VERSION);
        
        // create the road sign OutputPin
        RETURN_IF_FAILED(m_oPinRoadSign.Create("RoadSign", pType, this));
        RETURN_IF_FAILED(RegisterPin(&m_oPinRoadSign));
        // set the description for the road sign pin
        RETURN_IF_FAILED(pType->GetInterface(IID_ADTF_MEDIA_TYPE_DESCRIPTION, (tVoid**)&m_pDescriptionRoadSign));
                
        // create the description for the road sign pin
        tChar const * strDescExt = pDescManager->GetMediaDescription("tRoadSignExt");   
        RETURN_IF_POINTER_NULL(strDescExt);    
        cObjectPtr<IMediaType> pTypeExt = new cMediaType(0, 0, 0, "tRoadSignExt", strDescExt, IMediaDescription::MDF_DDL_DEFAULT_VERSION);
        
        // create the extended road sign OutputPin
        RETURN_IF_FAILED(m_oPinRoadSignExt.Create("RoadSign_ext", pTypeExt, this));
        RETURN_IF_FAILED(RegisterPin(&m_oPinRoadSignExt));
        // set the description for the extended road sign pin
        RETURN_IF_FAILED(pTypeExt->GetInterface(IID_ADTF_MEDIA_TYPE_DESCRIPTION, (tVoid**)&m_pDescriptionRoadSignExt));
        }
    else if (eStage == StageNormal)
        {
            // get the propeerties
    		ReadProperties(NULL);
            m_iOutputMode = GetPropertyInt("Video Output Pin");
            m_f32MarkerSize = static_cast<tFloat32>(GetPropertyFloat("Size of Markers"));
            m_bDebugModeEnabled = GetPropertyBool("Debug Output to Console");
            imshowflag = GetPropertyBool(MD_ENABLE_IMSHOW);
            imshowflag_ver = GetPropertyBool(MD_ENABLE_IMSHOW_VER);
            m_bCamaraParamsLoaded = tFalse;
            //Get path of marker configuration file
            cFilename fileConfig = GetPropertyStr("Dictionary File For Markers");
            //create absolute path for marker configuration file
            ADTF_GET_CONFIG_FILENAME(fileConfig);
            fileConfig = fileConfig.CreateAbsolutePath(".");
            
            //check if marker configuration file exits
            if (fileConfig.IsEmpty() || !(cFileSystem::Exists(fileConfig)))
                {
                LOG_ERROR("Dictionary File for Markers not found");
                RETURN_ERROR(ERR_INVALID_FILE);
                }   
            else
                {
                //try to read the marker configuration file
                if(m_Dictionary.fromFile(string(fileConfig))==false)
                    {
                    RETURN_ERROR(ERR_INVALID_FILE);
                    LOG_ERROR("Dictionary File for Markers could not be read");
                    }
                if(m_Dictionary.size()==0)
                    {
                    RETURN_ERROR(ERR_INVALID_FILE);
                    LOG_ERROR("Dictionary File does not contain valid markers or could not be read sucessfully");
                    }
                //set marker configuration file to highlyreliable markers class
                if (!(HighlyReliableMarkers::loadDictionary(m_Dictionary)==tTrue))
                    {
                    //LOG_ERROR("Dictionary File could not be read for highly reliable markers"); 
                    }
                } 
    
            //Get path of calibration file with camera paramters
            cFilename fileCalibration = GetPropertyStr("Calibration File for used Camera"); ;
        
            //Get path of calibration file with camera paramters
            ADTF_GET_CONFIG_FILENAME(fileCalibration);
            fileCalibration = fileCalibration.CreateAbsolutePath(".");
            //check if calibration file with camera paramters exits
            if (fileCalibration.IsEmpty() || !(cFileSystem::Exists(fileCalibration)))
                {
                LOG_ERROR("Calibration File for camera not found");
                }   
            else
                {
                // read the calibration file with camera paramters exits and save to member variable
                m_TheCameraParameters.readFromXMLFile(fileCalibration.GetPtr());
                cv::FileStorage camera_data (fileCalibration.GetPtr(),cv::FileStorage::READ);
                camera_data ["camera_matrix"] >> m_Intrinsics; 
                camera_data ["distortion_coefficients"] >> m_Distorsion;    
                m_bCamaraParamsLoaded = tTrue;
                }   
        }
Beispiel #3
0
STDMETHODIMP CHeapStatParser::Parse(VARIANT *v, IVariantObject** ppVariantObject)
{
	CHECK_E_POINTER(v);
	if(v->vt != VT_BSTR)
		return E_INVALIDARG;

	CComPtr<IPluginManager> pPluginManager;
	RETURN_IF_FAILED(HrGetPluginManager(&pPluginManager));
	RETURN_IF_FAILED(pPluginManager->CoCreateInstance(CLSID_VariantObject, IID_IVariantObject, (LPVOID*)ppVariantObject));
	CComPtr<IVariantObject> pVariantObject = *ppVariantObject;

	HrAddColumn(pPluginManager, pVariantObject, ObjectModel::Metadata::Object::Id, L"MT", VT_BSTR, 100);
	HrAddColumn(pPluginManager, pVariantObject, VAR_COUNT, L"Count", VT_I4, 100);
	HrAddColumn(pPluginManager, pVariantObject, VAR_TOTALSIZE, L"TotalSize", VT_I8, 100);
	HrAddColumn(pPluginManager, pVariantObject, VAR_CLASSNAME, L"ClassName");

	CComPtr<IObjCollection> pObjectCollection;
	RETURN_IF_FAILED(HrCoCreateInstance(CLSID_ObjectCollection, &pObjectCollection));
	
	CComBSTR bstrResult = v->bstrVal;
	CString strResult = bstrResult;
	int nTokenPos = 0;
	bool readyToParse = false;
	int nObjects = 0;
	
	while (nTokenPos >= 0)
	{
		CString strLine = strResult.Tokenize(L"\n", nTokenPos);

		if(strLine.Find(L"      MT") != -1)
		{
			readyToParse = true;
			continue;
		}

		if(!readyToParse)
			continue;

		if(strLine.Find(L"Total ") != -1)
			break;

		static std::wregex regex(L"(\\S+) +(\\S+) +(\\S+) +(.+)");
		std::wsmatch matches;
		auto str = std::wstring(strLine);
		if (!std::regex_search(str, matches, regex) || matches.size() != 5)
			continue;

		int index = 1;
		auto strId = matches[index++].str();
		auto count = boost::lexical_cast<int>(matches[index++].str());
		auto totalSize = boost::lexical_cast<long long>(matches[index++].str());
		auto strClassName = matches[index++].str();

		if (strClassName.find(L"Free") != std::wstring::npos)
			continue;

		CComPtr<IVariantObject> pVariantObjectValue;
		RETURN_IF_FAILED(pPluginManager->CoCreateInstance(CLSID_VariantObject, IID_IVariantObject, (LPVOID*)&pVariantObjectValue));
		RETURN_IF_FAILED(pVariantObjectValue->SetVariantValue(ObjectModel::Metadata::Object::Id, &CComVar(strId.c_str())));
		RETURN_IF_FAILED(pVariantObjectValue->SetVariantValue(VAR_COUNT, &CComVar(count)));
		RETURN_IF_FAILED(pVariantObjectValue->SetVariantValue(VAR_TOTALSIZE, &CComVar(totalSize)));
		RETURN_IF_FAILED(pVariantObjectValue->SetVariantValue(VAR_CLASSNAME, &CComVar(strClassName.c_str())));
		RETURN_IF_FAILED(pObjectCollection->AddObject(pVariantObjectValue));
		nObjects++;
	}

	if(!nObjects)
		return E_FAIL;

	CComPtr<IVariantTable> pVariantTable;
	RETURN_IF_FAILED(HrWrapToVariantTable(pPluginManager, pVariantObject, pObjectCollection, &pVariantTable));
	CComVar vObjects(pVariantTable);
	RETURN_IF_FAILED(pVariantObject->SetVariantValue(ObjectModel::Metadata::TableObject::ObjectsObject, &vObjects));
	RETURN_IF_FAILED(pVariantObject->SetVariantValue(VAR_RESULT, v));
	return S_OK;
}
tResult cSimpleFusion::OnPinEvent( IPin *pSource, tInt nEventCode, tInt nParam1, tInt nParam2, IMediaSample *pMediaSample)
{
    RETURN_IF_POINTER_NULL(pMediaSample);
    RETURN_IF_POINTER_NULL(pSource);

    if (nEventCode == IPinEventSink::PE_MediaSampleReceived)
    {
        tFloat32 signalValue = 0;
        tUInt32 timeStamp = 0;
        m_nLastMSTime = pMediaSample->GetTime();

        if (pMediaSample != NULL && m_pCoderDescSignalInput != NULL)
        {
            // read-out the incoming Media Sample
            cObjectPtr<IMediaCoder> pCoderInput;
            RETURN_IF_FAILED(m_pCoderDescSignalInput->Lock(pMediaSample, &pCoderInput));

            //get values from media sample and sets it on signalValue / timeStamp
            pCoderInput->Get("f32Value", (tVoid*)&signalValue);
            pCoderInput->Get("ui32ArduinoTimestamp", (tVoid*)&timeStamp);
            m_pCoderDescSignalInput->Unlock(pCoderInput);
        }
        else
            RETURN_ERROR(ERR_FAILED);


        // do stuff for the IR-longrange sensor
        if (pSource == &m_ir_long_in)
        {
            //Do not iterate if the input pin is deactivated but connected
            if(stateOfLongeRangeInputPin != 1)
            {
                RETURN_NOERROR;
            }

            //Schwellwerte für ir long range
            if (signalValue < thresholdIRLongRange)
            {
                last_ir_long_input = signalValue;
                sigma_vector.push_back((tFloat32)20.0); // kürzesten Wert ausgeben zw. 20
            }
            // Ausreißer
            else if(abs(int(last_ir_long_input - tUInt32(signalValue))) > 30)
            {
                //Ausreißer  Statistisch auswerten ob es wirklich ein Ausreißer ist
                last_ir_long_input = signalValue;
                last_ir_long_oor = true;
                //sigma_vector.push_back();
                RETURN_NOERROR;
            }
            else
            {
                last_ir_long_input = signalValue;
                // add every iteration the signalValue into the vector
                sigma_vector.push_back(signalValue);
            }
        }

        //Do not iterate if the input pin is deactivated but connected
        else if(pSource == &m_ir_short_in1 && stateOfShortRangeInputPin1 != 1)
        {
            RETURN_NOERROR;
        }
        //Do not iterate if the input pin is deactivated but connected
        else if(pSource == &m_ir_short_in2 && stateOfShortRangeInputPin2 != 1)
        {
            RETURN_NOERROR;
        }
        // do stuff for the IR-shortrange sensor
        else if (pSource == &m_ir_short_in1 || pSource == &m_ir_short_in2)
        {
            // Schwellwert von short range einhalten
            if (signalValue < thresholdIRShortRange)
            {
                last_ir_short_input = signalValue;
                last_ir_short_oor = true;

                sigma_vector.push_back((tFloat32)8.0);// kürzesten Wert ausgeben 8
            }
            // Ausreißer
            else if(abs(int(last_ir_short_input - tUInt32(signalValue))) > 30)
            {
                //Ausreißer...todo: Statistisch auswerten ob es wirklich ein Ausreißer ist
                last_ir_short_input = signalValue;
                last_ir_short_oor = true;

                RETURN_NOERROR;
            }
            else
            {
                last_ir_short_input = signalValue;
                sigma_vector.push_back(signalValue);
            }

        }

        //Do not iterate if the input pin is deactivated but connected
        else if(pSource == &m_us_left_in && stateOfUSLeftInputPin != 1)
        {
            RETURN_NOERROR;
        }
        //Do not iterate if the input pin is deactivated but connected
        else if(pSource == &m_us_right_in && stateOfUSRightInputPin != 1)
        {
            RETURN_NOERROR;
        }
        // do stuff for the Ultrasonic sensors(left||right)
        else if(pSource == &m_us_left_in || pSource == &m_us_right_in)
        {
            //Setion für Schwellwerte für US
            if(signalValue < thresholdUS && pSource == &m_us_left_in )
            {
                last_us_left_input = signalValue;
                sigma_vector.push_back((tFloat32)thresholdUS); // kürzesten Wert ausgeben
                last_us_left_oor = true;
            }
            else if(signalValue < thresholdUS && pSource == &m_us_right_in)
            {
                last_us_right_input = signalValue;
                sigma_vector.push_back((tFloat32)thresholdUS); // kürzesten Wert ausgeben
                last_us_right_oor = true;
            }
            else
            {
                sigma_vector.push_back(signalValue);
            }
        }

        //decrement everytime a signalValue comes in
        sigma_iterations++;

        //send the median value from the sigma_vector to the output
        if(sigma_iterations == lengthOfMedianVector && sigma_vector.capacity() != 0)
        {
            sort(sigma_vector.begin(),sigma_vector.end());

            sigma_Value = sigma_vector.at(median-1);
            //LOG_INFO(cString::Format("%f",sigma_Value));
            sendNewValue(sigma_Value);

            sigma_vector.clear();
            sigma_iterations = 0;
        }
    }
    else
    {
        sendNewValue(0);
    }
    RETURN_NOERROR;
}
tResult ImageCutter::Shutdown(tInitStage eStage, __exception)
{
	RETURN_IF_FAILED(cFilter::Shutdown(eStage, __exception_ptr));

	RETURN_NOERROR;
}
tResult cJuryTransmitter::Start(__exception)
{
    RETURN_IF_FAILED(cBaseQtFilter::Start(__exception_ptr));

    RETURN_NOERROR;
}
tResult cJuryTransmitter::Shutdown(tInitStage eStage, __exception)
{ 
    RETURN_IF_FAILED(cBaseQtFilter::Shutdown(eStage, __exception_ptr));
    RETURN_NOERROR;
}
Beispiel #8
0
tResult cBoolValueGenerator::Start(__exception)
{
    RETURN_IF_FAILED(cBaseQtFilter::Start(__exception_ptr));    

    RETURN_NOERROR;
}
tResult Emergency::Stop(__exception)
{
    RETURN_IF_FAILED(cFilter::Stop(__exception_ptr));

    RETURN_NOERROR;
}
// -------------------------------------------------------------------------------------------------
tResult SensorPackageFilter::Init(tInitStage stage, __exception) {
// -------------------------------------------------------------------------------------------------
  RETURN_IF_FAILED(cFilter::Init(stage, __exception_ptr));
  
	if (stage == StageFirst) {
	  // Create and register the input pin
    cObjectPtr<IMediaDescriptionManager> description_manager;
    RETURN_IF_FAILED(_runtime->GetObject(OID_ADTF_MEDIA_DESCRIPTION_MANAGER,
      IID_ADTF_MEDIA_DESCRIPTION_MANAGER,(tVoid**)&description_manager,__exception_ptr));
    
    // Create the sensor value media description
    tChar const * sensor_description = description_manager->GetMediaDescription("tSignalValue");
    RETURN_IF_POINTER_NULL(sensor_description);        
    cObjectPtr<IMediaType> sensor_type = new cMediaType(0, 0, 0, "tSignalValue",
      sensor_description,IMediaDescription::MDF_DDL_DEFAULT_VERSION);	
    RETURN_IF_FAILED(sensor_type->GetInterface(IID_ADTF_MEDIA_TYPE_DESCRIPTION,
      (tVoid**)&sensor_data_description_));
    
    // Create the sensor input pins
    RETURN_IF_FAILED(ir_short_front_left_input_pin_.Create("IR_front_left_shortrange", sensor_type, static_cast<IPinEventSink*>(this)));
    RETURN_IF_FAILED(RegisterPin(&ir_short_front_left_input_pin_));
    RETURN_IF_FAILED(ir_short_left_input_pin_.Create("IR_rear_left_shortrange", sensor_type, static_cast<IPinEventSink*>(this)));
    RETURN_IF_FAILED(RegisterPin(&ir_short_left_input_pin_));
    RETURN_IF_FAILED(ir_long_front_left_input_pin_.Create("IR_front_left_longrange", sensor_type, static_cast<IPinEventSink*>(this)));
    RETURN_IF_FAILED(RegisterPin(&ir_long_front_left_input_pin_));
    RETURN_IF_FAILED(ir_short_rear_center_input_pin_.Create("IR_rear_center_shortrange", sensor_type, static_cast<IPinEventSink*>(this)));
    RETURN_IF_FAILED(RegisterPin(&ir_short_rear_center_input_pin_));
    RETURN_IF_FAILED(us_front_right_input_pin_.Create("US_range_front_right", sensor_type, static_cast<IPinEventSink*>(this)));
    RETURN_IF_FAILED(RegisterPin(&us_front_right_input_pin_));
    RETURN_IF_FAILED(ir_short_front_center_input_pin_.Create("IR_front_center_shortrange", sensor_type, static_cast<IPinEventSink*>(this)));
    RETURN_IF_FAILED(RegisterPin(&ir_short_front_center_input_pin_));
    RETURN_IF_FAILED(ir_short_front_right_input_pin_.Create("IR_front_right_shortrange", sensor_type, static_cast<IPinEventSink*>(this)));
    RETURN_IF_FAILED(RegisterPin(&ir_short_front_right_input_pin_));
    RETURN_IF_FAILED(us_front_left_input_pin_.Create("US_range_front_left", sensor_type, static_cast<IPinEventSink*>(this)));
    RETURN_IF_FAILED(RegisterPin(&us_front_left_input_pin_));
    RETURN_IF_FAILED(ir_long_front_center_input_pin_.Create("IR_front_center_longrange", sensor_type, static_cast<IPinEventSink*>(this)));
    RETURN_IF_FAILED(RegisterPin(&ir_long_front_center_input_pin_));
    RETURN_IF_FAILED(ir_long_front_right_input_pin_.Create("IR_front_right_longrange", sensor_type, static_cast<IPinEventSink*>(this)));
    RETURN_IF_FAILED(RegisterPin(&ir_long_front_right_input_pin_));
    RETURN_IF_FAILED(us_rear_right_input_pin_.Create("US_range_rear_right", sensor_type, static_cast<IPinEventSink*>(this)));
    RETURN_IF_FAILED(RegisterPin(&us_rear_right_input_pin_));
    RETURN_IF_FAILED(ir_short_right_input_pin_.Create("IR_rear_right_shortrange", sensor_type, static_cast<IPinEventSink*>(this)));
    RETURN_IF_FAILED(RegisterPin(&ir_short_right_input_pin_));
    RETURN_IF_FAILED(us_rear_left_input_pin_.Create("US_range_rear_left", sensor_type, static_cast<IPinEventSink*>(this)));
    RETURN_IF_FAILED(RegisterPin(&us_rear_left_input_pin_));
    
    // Create the output pin description
    tChar const * package_description = description_manager->GetMediaDescription("SensorPackage");
    RETURN_IF_POINTER_NULL(package_description);        
    cObjectPtr<IMediaType> package_type = new cMediaType(0, 0, 0, "SensorPackage", package_description, IMediaDescription::MDF_DDL_DEFAULT_VERSION);	
    RETURN_IF_FAILED(package_type->GetInterface(IID_ADTF_MEDIA_TYPE_DESCRIPTION, (tVoid**)&sensor_package_description_));
    
    // Create the output pin
    RETURN_IF_FAILED(sensor_package_output_.Create("sensorPackage", package_type, NULL));
    RETURN_IF_FAILED(RegisterPin(&sensor_package_output_));
	}
	
	RETURN_NOERROR;
}
Beispiel #11
0
HRESULT CPluginTable::FinalConstruct()
{
	RETURN_IF_FAILED(AddObject(CLSID_PictureWindow, L"Picture window object"));
	RETURN_IF_FAILED(AddObject(CLSID_TimelineControl, L"Timeline control object"));
	RETURN_IF_FAILED(AddObject(CLSID_UserAccountControl, L"User account control object"));
	RETURN_IF_FAILED(AddObject(CLSID_UserInfoControl, L"User info control object"));
	RETURN_IF_FAILED(AddObject(CLSID_TwitViewControl, L"Twit view control object"));
	RETURN_IF_FAILED(AddObject(CLSID_SearchTimelineControl, L"Search timeline control object"));
	RETURN_IF_FAILED(AddObject(CLSID_ListTimelineControl, L"List timeline control object"));
	RETURN_IF_FAILED(AddObject(CLSID_ScrollControl, L"Scroll control"));
	RETURN_IF_FAILED(AddObject(CLSID_AnimationService, L"Animation service"));
	RETURN_IF_FAILED(AddObject(CLSID_ImageViewControl, L"Image view control"));
	RETURN_IF_FAILED(AddObject(CLSID_VideoViewControl, L"Video view control"));
    RETURN_IF_FAILED(AddObject(CLSID_FollowingControl, L"Following control"));

	RETURN_IF_FAILED(AddPluginInfo(PNAMESP_HOSTFORM, PVIEWTYPE_CONTAINERWINDOW, CONTROL_TABCONTAINER, CLSID_CustomTabControl, _T("Skin tab control")));
	RETURN_IF_FAILED(AddPluginInfo(PNAMESP_HOSTFORM, PVIEWTYPE_INPLACE_CONTROL, CLSID_HomeTimeLineControl, CLSID_HomeTimeLineControl, L"Home timeline control"));
	RETURN_IF_FAILED(AddPluginInfo(PNAMESP_HOSTFORM, PVIEWTYPE_INPLACE_CONTROL, CLSID_ListsControl, CLSID_ListsControl, L"Lists control"));
	RETURN_IF_FAILED(AddPluginInfo(PNAMESP_HOSTFORM, PVIEWTYPE_INPLACE_CONTROL, CLSID_SearchControl, CLSID_SearchControl, L"Search control"));
	RETURN_IF_FAILED(AddPluginInfo(PNAMESP_HOSTFORM, PVIEWTYPE_INPLACE_CONTROL, CLSID_SettingsControl, CLSID_SettingsControl, L"Settings control"));

	RETURN_IF_FAILED(AddPluginInfo(PNAMESP_TIMELINE_CONTROL, PVIEWTYPE_COMMAND, CLSID_TimelineControlCopyCommand, CLSID_TimelineControlCopyCommand, L"Copy commands for timeline control"));
	RETURN_IF_FAILED(AddPluginInfo(PNAMESP_TIMELINE_CONTROL, PVIEWTYPE_COMMAND, CLSID_TimelineControlOpenInBrowserCommand, CLSID_TimelineControlOpenInBrowserCommand, L"Open in browser command for timeline control"));

	RETURN_IF_FAILED(AddPluginInfo(PNAMESP_PICTUREWINDOW_CONTROL, PVIEWTYPE_WINDOW_SERVICE, CLSID_AnimationService, CLSID_AnimationService, L"Animation service for picture window"));
	RETURN_IF_FAILED(AddPluginInfo(PNAMESP_PICTUREWINDOW_CONTROL, PVIEWTYPE_COMMAND, CLSID_PictureWindowCopyCommand, CLSID_PictureWindowCopyCommand, L"Copy commands for picture window"));
	RETURN_IF_FAILED(AddPluginInfo(PNAMESP_PICTUREWINDOW_CONTROL, PVIEWTYPE_COMMAND, CLSID_PictureWindowSaveCommand, CLSID_PictureWindowSaveCommand, L"Save command for picture window"));

	RETURN_IF_FAILED(AddPluginInfoRemote(PNAMESP_USERINFO_CONTROL, PVIEWTYPE_WINDOW_SERVICE, SERVICE_ANIMATION_BACKGROUND, CLSID_AnimationService, L"Animation service for background image"));
	RETURN_IF_FAILED(AddPluginInfoRemote(PNAMESP_USERINFO_CONTROL, PVIEWTYPE_WINDOW_SERVICE, SERVICE_ANIMATION_USER_IMAGE, CLSID_AnimationService, L"Animation service for user image"));
	RETURN_IF_FAILED(AddPluginInfoRemote(PNAMESP_USERINFO_CONTROL, PVIEWTYPE_WINDOW_SERVICE, SERVICE_ANIMATION_USER_TEXT, CLSID_AnimationService, L"Animation service for user text"));

	return S_OK;
}
Beispiel #12
0
HRESULT CFollowingControl::Initializing()
{
    RETURN_IF_FAILED(__super::Initializing());
    RETURN_IF_FAILED(m_pPluginSupport->InitializePlugins(PNAMESP_FOLLOWING_CONTROL, PVIEWTYPE_WINDOW_SERVICE));
    return S_OK;
}
Beispiel #13
0
STDMETHODIMP CFollowingControl::SetVariantObject(IVariantObject* pVariantObject)
{
    RETURN_IF_FAILED(HrInitializeWithVariantObject(m_pPluginSupport, pVariantObject));
    return S_OK;
}
tResult Test::Init(tInitStage eStage, __exception)
{
	RETURN_IF_FAILED(cFilter::Init(eStage, __exception_ptr));

	if (eStage == StageFirst)
	{	

		RETURN_IF_FAILED(_runtime->GetObject(OID_ADTF_MEDIA_DESCRIPTION_MANAGER, IID_ADTF_MEDIA_DESCRIPTION_MANAGER, (tVoid**) &this->descriptionManager, __exception_ptr));

		cObjectPtr<IMediaType> typeSignalManeuver;
		cObjectPtr<IMediaType> typeSignalSteeringAngle;
		cObjectPtr<IMediaType> typeSignalAcceleration;
		cObjectPtr<IMediaType> typeSignalWheelTicks;

		RETURN_IF_FAILED(initMediaType("tSteeringAngleData", typeSignalManeuver, this->coderDescriptionManeuver));
		RETURN_IF_FAILED(initMediaType("tSignalValue", typeSignalSteeringAngle, this->coderDescriptionSteeringAngle));
		RETURN_IF_FAILED(initMediaType("tSignalValue", typeSignalAcceleration, this->coderDescriptionAcceleration));
		RETURN_IF_FAILED(initMediaType("tSignalValue", typeSignalWheelTicks, this->coderDescriptionWheelTicks));

		// input pins
		RETURN_IF_FAILED(createVideoInputPin("rgbVideo", this->xtionPin));
		RETURN_IF_FAILED(createInputPin("maneuver", this->maneuverPin, typeSignalManeuver));
		RETURN_IF_FAILED(createInputPin("wheelTicks", this->wheelTicksPin, typeSignalWheelTicks));

		// output pins
		RETURN_IF_FAILED(createOutputPin("steeringAngle", this->steeringAnglePin, typeSignalSteeringAngle));
		RETURN_IF_FAILED(createOutputPin("acceleration", this->accelerationPin, typeSignalAcceleration));
	}
	else if (eStage == StageGraphReady)
	{
		cObjectPtr<IMediaSerializer> serializer;
		RETURN_IF_FAILED(this->coderDescriptionAcceleration->GetMediaSampleSerializer(&serializer));
		this->ddlSizeUI16 = serializer->GetDeserializedSize();

		std::thread test(&Test::accept, this);
	}

	RETURN_NOERROR;
}
tResult StateControllerNew::CreateInputPins(IException **__exception_ptr)
{
    RETURN_IF_FAILED(juryInput.Create("Jury_Struct", juryMediaType, this));
    RETURN_IF_FAILED(RegisterPin(&juryInput));

    RETURN_IF_FAILED(incrementManeuverInput.Create("Increment_Maneuver_ID", boolMediaType, static_cast<IPinEventSink *> (this)));
    RETURN_IF_FAILED(RegisterPin(&incrementManeuverInput));

    RETURN_IF_FAILED(readyInput.Create("Ready_Input", enumMediaType, static_cast<IPinEventSink *> (this)));
    RETURN_IF_FAILED(RegisterPin(&readyInput));

    RETURN_IF_FAILED(errorInput.Create("Error_Input", boolMediaType, static_cast<IPinEventSink *> (this)));
    RETURN_IF_FAILED(RegisterPin(&errorInput));

    RETURN_IF_FAILED(emergencyStopInput.Create("Emergency_Stop_Input", juryStopMediaType, static_cast<IPinEventSink *> (this)));
    RETURN_IF_FAILED(RegisterPin(&emergencyStopInput));

    RETURN_IF_FAILED(maneuverListInput.Create("Maneuver_List", maneuverListMediaType, this));
    RETURN_IF_FAILED(RegisterPin(&maneuverListInput));

    RETURN_NOERROR;
}
Beispiel #16
0
STDMETHODIMP CObjectsParser::Parse(VARIANT *v, IVariantObject** ppVariantObject)
{
    CHECK_E_POINTER(v);
    if(v->vt != VT_BSTR)
        return E_INVALIDARG;

    CComPtr<IPluginManager> pPluginManager;
    RETURN_IF_FAILED(HrGetPluginManager(&pPluginManager));
    RETURN_IF_FAILED(pPluginManager->CoCreateInstance(CLSID_VariantObject, IID_IVariantObject, (LPVOID*)ppVariantObject));
    CComPtr<IVariantObject> pVariantObject = *ppVariantObject;

    HrAddColumn(pPluginManager, pVariantObject, ObjectModel::Metadata::Object::Id, L"Address", VT_BSTR, 100);
    HrAddColumn(pPluginManager, pVariantObject, ObjectModel::Metadata::Object::Key, L"MT", VT_BSTR, 100);
    HrAddColumn(pPluginManager, pVariantObject, ObjectModel::Metadata::Object::Value, L"Size", VT_BSTR, 100);

    CComPtr<IObjCollection> pObjectCollection;
    RETURN_IF_FAILED(HrCoCreateInstance(CLSID_ObjectCollection, &pObjectCollection));

    CComBSTR bstrResult = v->bstrVal;
    CString strResult = bstrResult;
    int nTokenPos = 0;
    bool readyToParse = false;
    int nObjects = 0;

    while (nTokenPos >= 0)
    {
        CString strLine = strResult.Tokenize(L"\n", nTokenPos);

        if(strLine.Find(L" Address") != -1)
        {
            readyToParse = true;
            continue;
        }

        if(!readyToParse)
            continue;

        if(strLine.Find(L"object ") != -1)
            break;

        if(strLine.Find(L"Statistics:") != -1)
            break;

        if(strLine.Find(L"total ") != -1)
            break;

        std::wsmatch matches;
        static std::wregex regex(L"(\\S+) +(\\S+) +(\\S+)");
        auto str = std::wstring(strLine);
        if (!std::regex_search(str, matches, regex) || matches.size() != 4)
            continue;

        int index = 1;
        auto strAddress = matches[index++].str();
        auto strMt = matches[index++].str();
        auto strSize = matches[index++].str();

        if(strSize.empty())
            continue;

        CComPtr<IVariantObject> pVariantObjectValue;
        RETURN_IF_FAILED(pPluginManager->CoCreateInstance(CLSID_VariantObject, IID_IVariantObject, (LPVOID*)&pVariantObjectValue));
        RETURN_IF_FAILED(pVariantObjectValue->SetVariantValue(ObjectModel::Metadata::Object::Id, &CComVar(strAddress.c_str())));
        RETURN_IF_FAILED(pVariantObjectValue->SetVariantValue(ObjectModel::Metadata::Object::Key, &CComVar(strMt.c_str())));
        RETURN_IF_FAILED(pVariantObjectValue->SetVariantValue(ObjectModel::Metadata::Object::Value, &CComVar(strSize.c_str())));
        RETURN_IF_FAILED(pObjectCollection->AddObject(pVariantObjectValue));
        nObjects++;
    }

    if(!nObjects)
        return E_FAIL;

    CComPtr<IVariantTable> pVariantTable;
    RETURN_IF_FAILED(HrWrapToVariantTable(pPluginManager, pVariantObject, pObjectCollection, &pVariantTable));
    CComVar vObjects(pVariantTable);
    RETURN_IF_FAILED(pVariantObject->SetVariantValue(ObjectModel::Metadata::TableObject::ObjectsObject, &vObjects));
    RETURN_IF_FAILED(pVariantObject->SetVariantValue(VAR_RESULT, v));
    return S_OK;
}
tResult cJuryTransmitter::Init(tInitStage eStage, __exception)
{
    RETURN_IF_FAILED(cBaseQtFilter::Init(eStage, __exception_ptr));

    // pins need to be created at StageFirst
    if (eStage == StageFirst)
    {
        
        cObjectPtr<IMediaDescriptionManager> pDescManager;
        RETURN_IF_FAILED(_runtime->GetObject(OID_ADTF_MEDIA_DESCRIPTION_MANAGER,
                                             IID_ADTF_MEDIA_DESCRIPTION_MANAGER,
                                             (tVoid**)&pDescManager,
                                             __exception_ptr));
        /*
        * the MediaDescription for <struct name="tJuryNotAusFlag" .../> has to exist in a description file (e.g. in $ADTF_DIR\description\ or $ADTF_DIR\src\examples\src\description
        * before (!) you start adtf_devenv !! if not: the Filter-Plugin will not loaded because cPin.Create() and so ::Init() failes !
        */
        // Select Output
        tChar const * strDesc2 = pDescManager->GetMediaDescription("tJuryStruct");
        RETURN_IF_POINTER_NULL(strDesc2);
        cObjectPtr<IMediaType> pType2 = new cMediaType(0, 0, 0, "tJuryStruct", strDesc2, IMediaDescription::MDF_DDL_DEFAULT_VERSION);
        RETURN_IF_FAILED(m_JuryStructOutputPin.Create("Jury_Struct", pType2, this));
        RETURN_IF_FAILED(RegisterPin(&m_JuryStructOutputPin));
        RETURN_IF_FAILED(pType2->GetInterface(IID_ADTF_MEDIA_TYPE_DESCRIPTION, (tVoid**)&m_pCoderDescJuryStruct));

        // NotAus Output
        tChar const * strDesc1 = pDescManager->GetMediaDescription("tJuryEmergencyStop");
        RETURN_IF_POINTER_NULL(strDesc1);
        cObjectPtr<IMediaType> pType1 = new cMediaType(0, 0, 0, "tJuryEmergencyStop", strDesc1,IMediaDescription::MDF_DDL_DEFAULT_VERSION);
        RETURN_IF_FAILED(m_NotAusOutputPin.Create("Emergency_Stop", pType1, this));
        RETURN_IF_FAILED(RegisterPin(&m_NotAusOutputPin));
        RETURN_IF_FAILED(pType1->GetInterface(IID_ADTF_MEDIA_TYPE_DESCRIPTION, (tVoid**)&m_pCoderDescNotAus));
        
        // input Pin
        tChar const * strDesc4 = pDescManager->GetMediaDescription("tDriverStruct");
        RETURN_IF_POINTER_NULL(strDesc4);
        cObjectPtr<IMediaType> pType4 = new cMediaType(0, 0, 0, "tDriverStruct", strDesc4, IMediaDescription::MDF_DDL_DEFAULT_VERSION);
        RETURN_IF_FAILED(m_DriverStructInputPin.Create("Driver_Struct", pType4, this));
        RETURN_IF_FAILED(RegisterPin(&m_DriverStructInputPin));
        RETURN_IF_FAILED(pType4->GetInterface(IID_ADTF_MEDIA_TYPE_DESCRIPTION, (tVoid**)&m_pCoderDescDriverStruct));
        
        m_bDebugModeEnabled = GetPropertyBool("Debug Output to Console");
    }
    else if(eStage == StageNormal)
    {

    }
    else if(eStage == StageGraphReady)
    {
        loadManeuverList();
        m_pWidget->SetManeuverList(m_sectorList);
        m_pWidget->FillComboBox();
    }
    RETURN_NOERROR;
}
tResult pylonDetection::CreateInputPins(__exception)
{	
    cObjectPtr<IMediaDescriptionManager> pDescManager;
    RETURN_IF_FAILED(_runtime->GetObject(OID_ADTF_MEDIA_DESCRIPTION_MANAGER,IID_ADTF_MEDIA_DESCRIPTION_MANAGER,(tVoid**)&pDescManager,__exception_ptr));
    tChar const * strDescMotion = pDescManager->GetMediaDescription("tMotionDataExt");
    RETURN_IF_POINTER_NULL(strDescMotion);
    cObjectPtr<IMediaType> pTypeMotion = new cMediaType(0, 0, 0, "tMotionDataExt", strDescMotion,IMediaDescription::MDF_DDL_DEFAULT_VERSION);
    RETURN_IF_FAILED(pTypeMotion->GetInterface(IID_ADTF_MEDIA_TYPE_DESCRIPTION, (tVoid**)&m_pCoderDescMotion));

    //rgb image input pin
    RETURN_IF_FAILED(m_inputPin_colorImage.Create("rgb_image", adtf::IPin::PD_Input  , static_cast<IPinEventSink*> (this)));
    RETURN_IF_FAILED(RegisterPin(&m_inputPin_colorImage));

    //depth image input pin
    RETURN_IF_FAILED(m_inputPin_depthImage.Create("depth_image_in", adtf::IPin::PD_Input  , static_cast<IPinEventSink*> (this)));
    RETURN_IF_FAILED(RegisterPin(&m_inputPin_depthImage));

    //motion data input pin
    RETURN_IF_FAILED(m_inputPin_motion.Create("motion_data", pTypeMotion, static_cast<IPinEventSink*> (this)));
    RETURN_IF_FAILED(RegisterPin(&m_inputPin_motion));

    //sign data input pin
    tChar const * strMarkerInfoValue = pDescManager->GetMediaDescription("tRoadSign");
    RETURN_IF_POINTER_NULL(strMarkerInfoValue);
    cObjectPtr<IMediaType> pTypeSignInfoValue = new cMediaType(0, 0, 0, "tRoadSign", strMarkerInfoValue,IMediaDescription::MDF_DDL_DEFAULT_VERSION);
    RETURN_IF_FAILED(pTypeSignInfoValue->GetInterface(IID_ADTF_MEDIA_TYPE_DESCRIPTION, (tVoid**)&m_pCoderDescSign));
    RETURN_IF_FAILED(m_inputPin_signLocation.Create("RoadSign", pTypeSignInfoValue  , static_cast<IPinEventSink*> (this)));
    RETURN_IF_FAILED(RegisterPin(&m_inputPin_signLocation));

    //Color calib input pins
    tChar const * strDescSignalValue = pDescManager->GetMediaDescription("tSignalValue");
    RETURN_IF_POINTER_NULL(strDescSignalValue);
    cObjectPtr<IMediaType> pTypeSignalValue = new cMediaType(0, 0, 0, "tSignalValue", strDescSignalValue,IMediaDescription::MDF_DDL_DEFAULT_VERSION);
    RETURN_IF_FAILED(pTypeSignalValue->GetInterface(IID_ADTF_MEDIA_TYPE_DESCRIPTION, (tVoid**)&m_pCoderDescSignal));
    RETURN_IF_FAILED(m_inputPin_0.Create("hlow", new cMediaType(0, 0, 0, "tSignalValue") , static_cast<IPinEventSink*> (this)));
    RETURN_IF_FAILED(RegisterPin(&m_inputPin_0));
    RETURN_IF_FAILED(m_inputPin_1.Create("hhigh", new cMediaType(0, 0, 0, "tSignalValue") , static_cast<IPinEventSink*> (this)));
    RETURN_IF_FAILED(RegisterPin(&m_inputPin_1));
    RETURN_IF_FAILED(m_inputPin_2.Create("slow", new cMediaType(0, 0, 0, "tSignalValue") , static_cast<IPinEventSink*> (this)));
    RETURN_IF_FAILED(RegisterPin(&m_inputPin_2));
    RETURN_IF_FAILED(m_inputPin_3.Create("shigh", new cMediaType(0, 0, 0, "tSignalValue") , static_cast<IPinEventSink*> (this)));
    RETURN_IF_FAILED(RegisterPin(&m_inputPin_3));
    RETURN_IF_FAILED(m_inputPin_4.Create("vlow", new cMediaType(0, 0, 0, "tSignalValue") , static_cast<IPinEventSink*> (this)));
    RETURN_IF_FAILED(RegisterPin(&m_inputPin_4));
    RETURN_IF_FAILED(m_inputPin_5.Create("vhigh", new cMediaType(0, 0, 0, "tSignalValue") , static_cast<IPinEventSink*> (this)));
    RETURN_IF_FAILED(RegisterPin(&m_inputPin_5));

	RETURN_NOERROR;
}
tResult cJuryTransmitter::Run(tInt nActivationCode, const tVoid* pvUserData, tInt szUserDataSize, ucom::IException** __exception_ptr/* =NULL */)
{
    if (nActivationCode == IRunnable::RUN_TIMER)
    {
        
        //not aus timer
        if (pvUserData==&m_hTimerNotAusCounter)
        {
            m_hTimerNotAusCounter++;
            RETURN_IF_FAILED(sendEmergencyStop());

            // the signal was transmitted three times
            if (m_hTimerNotAusCounter >= 3 && m_hTimerNotAus)
            {
                __synchronized_obj(m_oCriticalSectionTimerNotAus);
                // Destroy the timer
                tResult nResult = _kernel->TimerDestroy(m_hTimerNotAus);
                if (IS_FAILED(nResult)) THROW_ERROR(nResult);
            }
        }
        
        //start event timer
        if (pvUserData==&m_hTimerStartCounter)
        {
            m_hTimerStartCounter++;
            RETURN_IF_FAILED(sendJuryStruct(action_START,m_Start_entry_id));

            // the signal was transmitted three times
            if (m_hTimerStartCounter >= 3 && m_hTimerStart)
            {
                __synchronized_obj(m_oCriticalSectionTimerStart);
                // Destroy the timer
                tResult nResult = _kernel->TimerDestroy(m_hTimerStart);
                if (IS_FAILED(nResult)) THROW_ERROR(nResult);
            }
        }
        //request ready event timer
        if (pvUserData==&m_hTimerRequestReadyCounter)
        {
            m_hTimerRequestReadyCounter++;
            RETURN_IF_FAILED(sendJuryStruct(action_GETREADY,m_Request_Ready_entry_id));

            // the signal was transmitted three times
            if (m_hTimerRequestReadyCounter >= 3 && m_hTimerRequestReady)
            {
                __synchronized_obj(m_oCriticalSectionTimerRequestReady);
                // Destroy the timer
                tResult nResult = _kernel->TimerDestroy(m_hTimerRequestReady);
                if (IS_FAILED(nResult)) THROW_ERROR(nResult);
            }
        }
        //stop event timer
        if (pvUserData==&m_hTimerStopCounter)
        {
            m_hTimerStopCounter++;
            RETURN_IF_FAILED(sendJuryStruct(action_STOP,m_Stop_entry_id));

            // the signal was transmitted three times
            if (m_hTimerStopCounter >= 3 && m_hTimerStop)
            {
                __synchronized_obj(m_oCriticalSectionTimerStop);
                // Destroy the timer
                tResult nResult = _kernel->TimerDestroy(m_hTimerStop);
                if (IS_FAILED(nResult)) THROW_ERROR(nResult);
            }
        }

    }
    return cBaseQtFilter::Run(nActivationCode, pvUserData, szUserDataSize, __exception_ptr);
}
tResult pylonDetection::CreateOutputPins(__exception)
{
    //debug image otput pin
    RETURN_IF_FAILED(m_outputPin_debugImage.Create("debug_image", adtf::IPin::PD_Output  , static_cast<IPinEventSink*> (this)));
    RETURN_IF_FAILED(RegisterPin(&m_outputPin_debugImage));

    //depth depth output pin
    RETURN_IF_FAILED(m_outputPin_depthImage.Create("depth_image_out", adtf::IPin::PD_Output  , static_cast<IPinEventSink*> (this)));
    RETURN_IF_FAILED(RegisterPin(&m_outputPin_depthImage));

    //Pylon Info output pin
    cObjectPtr<IMediaDescriptionManager> pDescManager;
    RETURN_IF_FAILED(_runtime->GetObject(OID_ADTF_MEDIA_DESCRIPTION_MANAGER,IID_ADTF_MEDIA_DESCRIPTION_MANAGER,(tVoid**)&pDescManager,__exception_ptr));
    tChar const * strDesc = pDescManager->GetMediaDescription("tPylonInfo");
    if(!strDesc) LOG_ERROR(cString(OIGetInstanceName()) + ": Could not load mediadescription tPylonInfo, check path");
    RETURN_IF_POINTER_NULL(strDesc);
    cObjectPtr<IMediaType> pType = new cMediaType(0, 0, 0, "tPylonInfo", strDesc, IMediaDescription::MDF_DDL_DEFAULT_VERSION);
    RETURN_IF_FAILED(m_outputPin_PylonInfo.Create("PylonInfo", pType, this));
    RETURN_IF_FAILED(RegisterPin(&m_outputPin_PylonInfo));
    RETURN_IF_FAILED(pType->GetInterface(IID_ADTF_MEDIA_TYPE_DESCRIPTION, (tVoid**)&m_pCoderDescPylonInfo));
 
    //Lane Info
    tChar const * strDescLaneInfoValue = pDescManager->GetMediaDescription("tLaneInfo");
    RETURN_IF_POINTER_NULL(strDescLaneInfoValue);
    cObjectPtr<IMediaType> pTypeLaneInfoValue = new cMediaType(0, 0, 0, "tLaneInfo", strDescLaneInfoValue,IMediaDescription::MDF_DDL_DEFAULT_VERSION);
    RETURN_IF_FAILED(pTypeLaneInfoValue->GetInterface(IID_ADTF_MEDIA_TYPE_DESCRIPTION, (tVoid**)&m_pCoderDescLaneInfo));

    RETURN_IF_FAILED(m_oLaneDataOutputPin.Create("laneInfo", pTypeLaneInfoValue  , static_cast<IPinEventSink*> (this)));
    RETURN_IF_FAILED(RegisterPin(&m_oLaneDataOutputPin));

    //acceleration pin
    tChar const * strDescSignalValue = pDescManager->GetMediaDescription("tSignalValue");
    RETURN_IF_POINTER_NULL(strDescSignalValue);
    cObjectPtr<IMediaType> pTypeSignalValue = new cMediaType(0, 0, 0, "tSignalValue", strDescSignalValue,IMediaDescription::MDF_DDL_DEFAULT_VERSION);

    RETURN_IF_FAILED(m_outputPin_speed.Create("accelerate", pTypeSignalValue  , static_cast<IPinEventSink*> (this)));
    RETURN_IF_FAILED(RegisterPin(&m_outputPin_speed));

    RETURN_NOERROR;
}
tResult cSimpleFusion::Stop(__exception)
{
    RETURN_IF_FAILED(cFilter::Stop( __exception_ptr));

    RETURN_NOERROR;
}
Beispiel #22
0
int
main(int argc, char **argv)
{
    nsresult rv;
    TestContext *c;
    int i, nc=0, npending=0;
    char buf[256];

    if (argc < 2) {
        printf("Usage: TestSyncHTTP <url-list>\n");
        return -1;
    }

    c = new TestContext[argc-1];

    for (i=0; i<(argc-1); ++i, ++nc) {
        rv = NS_NewURI(getter_AddRefs(c[i].uri), argv[i+1]);
        RETURN_IF_FAILED(rv, "NS_NewURI");

        rv = NS_OpenURI(getter_AddRefs(c[i].channel,
                        c[i].uri,
                        nsContentUtils::GetSystemPrincipal(),
                        nsILoadInfo::SEC_NORMAL,
                        nsIContentPolicy::TYPE_OTHER);

        RETURN_IF_FAILED(rv, "NS_OpenURI");

        nsCOMPtr<nsIHTTPChannel> httpChannel = do_QueryInterface(c[i].channel);
        if (httpChannel)
            httpChannel->SetOpenHasEventQueue(false);

        // initialize these fields for reading
        c[i].bytesRead = 1;
        c[i].totalRead = 0;
    }

    for (i=0; i<nc; ++i) {
        c[i].t1 = PR_Now();

        rv = c[i].channel->Open(getter_AddRefs(c[i].inputStream));
        RETURN_IF_FAILED(rv, "nsIChannel::OpenInputStream");
    }

    npending = nc;
    while (npending) {
        for (i=0; i<nc; ++i) {
            //
            // read the response content...
            //
            if (c[i].bytesRead > 0) {
                rv = c[i].inputStream->Read(buf, sizeof buf, &c[i].bytesRead);
                RETURN_IF_FAILED(rv, "nsIInputStream::Read");
                c[i].totalRead += c[i].bytesRead;

                if (c[i].bytesRead == 0) {
                    c[i].t2 = PR_Now();
                    printf("finished GET of: %s\n", argv[i+1]);
                    printf("total read: %u bytes\n", c[i].totalRead);
                    printf("total read time: %0.3f\n",
                            ((double) (c[i].t2 - c[i].t1))/1000000.0);
                    npending--;
                }
            }
        }
    }

    delete[] c;

    NS_ShutdownXPCOM(nullptr);
    return 0;
}
tResult ImageCutter::Stop(__exception)
{
	RETURN_IF_FAILED(cFilter::Stop(__exception_ptr));

	RETURN_NOERROR;
}
Beispiel #24
0
STDMETHODIMP CUpdateIssueService::OnFinish(IVariantObject* pResult)
{
	CHECK_E_POINTER(pResult);
	RETURN_IF_FAILED(m_pTimerService->ResumeTimer());
	return S_OK;
}
Beispiel #25
0
HRESULT CPluginDebugCommand::FinalConstruct()
{
	RETURN_IF_FAILED(HrGetPluginManager(&m_pPluginManager));
	RETURN_IF_FAILED(m_pPluginManager->CoCreateInstance(CLSID_DebugCommand, IID_IDebugCommand, (LPVOID*)&m_pDebugCommand));
	return S_OK;
}
// -------------------------------------------------------------------------------------------------
tResult LaneFilter::Init(tInitStage stage, __exception) {
// -------------------------------------------------------------------------------------------------
  RETURN_IF_FAILED(cFilter::Init(stage, __exception_ptr));
  
	if (stage == StageFirst) {
		// Video input.
		RETURN_IF_FAILED(video_input_pin_.Create("Video_Input", IPin::PD_Input,
		  static_cast<IPinEventSink*>(this)));
    RETURN_IF_FAILED(RegisterPin(&video_input_pin_));
    
    // Create the lane data media description
    
    // Set up the media description manager object for object output
    cObjectPtr<IMediaDescriptionManager> description_manager;
    RETURN_IF_FAILED(_runtime->GetObject(OID_ADTF_MEDIA_DESCRIPTION_MANAGER,
      IID_ADTF_MEDIA_DESCRIPTION_MANAGER, (tVoid**) &description_manager, __exception_ptr));
    
    tChar const * lane_type = description_manager->GetMediaDescription("LanePointArray");
    RETURN_IF_POINTER_NULL(lane_type);
    cObjectPtr<IMediaType> lane_signal_value = new cMediaType(0, 0, 0, "LanePointArray",
      lane_type,IMediaDescription::MDF_DDL_DEFAULT_VERSION);	
    RETURN_IF_FAILED(lane_signal_value->GetInterface(IID_ADTF_MEDIA_TYPE_DESCRIPTION,
      (tVoid**)&lane_data_description_));
      
    RETURN_IF_FAILED(lane_output_pin_.Create("lanes", lane_signal_value, NULL));
    RETURN_IF_FAILED(RegisterPin(&lane_output_pin_));
    
    // Create the object input pin.      
    tChar const * object_stream_type = description_manager->GetMediaDescription("ObjectArray");
    RETURN_IF_POINTER_NULL(object_stream_type);
    
    // Create the stream description used to receive/send data
    cObjectPtr<IMediaType> object_type_signal_value = new cMediaType(0, 0, 0, "ObjectArray",
      object_stream_type, IMediaDescription::MDF_DDL_DEFAULT_VERSION);
    RETURN_IF_FAILED(object_type_signal_value->GetInterface(IID_ADTF_MEDIA_TYPE_DESCRIPTION,
      (tVoid**) &object_data_description_));
    
    // Create and register the input pin
    RETURN_IF_FAILED(object_input_pin_.Create("objects", object_type_signal_value, static_cast<IPinEventSink*>(this)));
    RETURN_IF_FAILED(RegisterPin(&object_input_pin_));
    
    // Create the headlight output stuff
    tChar const * bool_stream_type = description_manager->GetMediaDescription("tBoolSignalValue");
    RETURN_IF_POINTER_NULL(bool_stream_type);
    
    cObjectPtr<IMediaType> bool_signal_type = new cMediaType(0, 0, 0, "tBoolSignalValue", bool_stream_type, IMediaDescription::MDF_DDL_DEFAULT_VERSION);
    RETURN_IF_FAILED(bool_signal_type->GetInterface(IID_ADTF_MEDIA_TYPE_DESCRIPTION, (tVoid**) &light_data_description_));
    
    RETURN_IF_FAILED(light_output_.Create("headlight_enabled", bool_signal_type, NULL));
    RETURN_IF_FAILED(RegisterPin(&light_output_));
	}
	
	else if (stage == StageGraphReady) {
	  cObjectPtr<IMediaType> type;
	  RETURN_IF_FAILED(video_input_pin_.GetMediaType(&type));
	  
	  cObjectPtr<IMediaTypeVideo> type_video;
	  RETURN_IF_FAILED(type->GetInterface(IID_ADTF_MEDIA_TYPE_VIDEO, (tVoid**) &type_video));
	  
	  const tBitmapFormat* format = type_video->GetFormat();
	  if (format == NULL) RETURN_ERROR(ERR_NOT_SUPPORTED);
	  
    cMemoryBlock::MemCopy(&input_format_, format, sizeof(tBitmapFormat));
	}
	
	RETURN_NOERROR;
}
Beispiel #27
0
STDMETHODIMP CDebugFormManager::OpenForm(REFGUID guidCommandId, VARIANT* vParam)
{
	RETURN_IF_FAILED(m_pViewDebugEngineService->ExecuteCommandSimpleAsync(guidCommandId, vParam));
	m_bSelfCall = TRUE;
	return S_OK;
}
Beispiel #28
0
STDMETHODIMP CObjectValuesParser::Parse(VARIANT *v, IVariantObject** ppVariantObject)
{
	CHECK_E_POINTER(v);
	if(v->vt != VT_BSTR)
		return E_INVALIDARG;

	CComPtr<IPluginManager> pPluginManager;
	RETURN_IF_FAILED(HrGetPluginManager(&pPluginManager));
	RETURN_IF_FAILED(pPluginManager->CoCreateInstance(CLSID_VariantObject, IID_IVariantObject, (LPVOID*)ppVariantObject));
	CComPtr<IVariantObject> pVariantObject = *ppVariantObject;

	HrAddColumn(pPluginManager, pVariantObject, VAR_MT, L"MT", VT_BSTR, 100);
	HrAddColumn(pPluginManager, pVariantObject, VAR_FIELD, L"Field", VT_BSTR, 100);
	HrAddColumn(pPluginManager, pVariantObject, VAR_OFFSET, L"Offset", VT_BSTR, 100);
	HrAddColumn(pPluginManager, pVariantObject, VAR_TYPE, L"Type");
	HrAddColumn(pPluginManager, pVariantObject, VAR_VT, L"VT");
	HrAddColumn(pPluginManager, pVariantObject, VAR_ATTR, L"Attr");
	HrAddColumn(pPluginManager, pVariantObject, ObjectModel::Metadata::Object::Id, L"Value");
	HrAddColumn(pPluginManager, pVariantObject, VAR_NAME, L"Name");

	CComPtr<IObjCollection> pObjectCollection;
	RETURN_IF_FAILED(HrCoCreateInstance(CLSID_ObjectCollection, &pObjectCollection));

	CComBSTR bstrResult = v->bstrVal;
	CString strResult = bstrResult;
	int nTokenPos = 0;
	bool readyToParse = false;
	int nObjects = 0;

	while (nTokenPos >= 0)
	{
		CString strLine = strResult.Tokenize(L"\n", nTokenPos);

		if(strLine.Find(L"      MT") != -1)
		{
			readyToParse = true;
			continue;
		}

		if(!readyToParse)
			continue;

		std::wsmatch matches;
		static std::wregex regex(L"(\\S+) +(\\S+) +(\\S+) +(\\S+) +(\\S+) +(\\S+) +(\\S+) +(\\S+)");
		auto str = std::wstring(strLine);
		if (!std::regex_search(str, matches, regex) || matches.size() != 9)
			continue;

		int index = 1;
		auto strMt = matches[index++].str();
		auto strField = matches[index++].str();
		auto strOffset = matches[index++].str();
		auto strType = matches[index++].str();
		auto strVt = matches[index++].str();
		auto strAttr = matches[index++].str();
		auto strValue = matches[index++].str();
		auto strName = matches[index++].str();

		if(strName.empty())
			continue;

		CComPtr<IVariantObject> pVariantObjectValue;
		RETURN_IF_FAILED(pPluginManager->CoCreateInstance(CLSID_VariantObject, IID_IVariantObject, (LPVOID*)&pVariantObjectValue));

		RETURN_IF_FAILED(pVariantObjectValue->SetVariantValue(VAR_MT, &CComVar(strMt.c_str())));
		RETURN_IF_FAILED(pVariantObjectValue->SetVariantValue(VAR_FIELD, &CComVar(strField.c_str())));
		RETURN_IF_FAILED(pVariantObjectValue->SetVariantValue(VAR_OFFSET, &CComVar(strOffset.c_str())));
		RETURN_IF_FAILED(pVariantObjectValue->SetVariantValue(VAR_TYPE, &CComVar(strType.c_str())));
		RETURN_IF_FAILED(pVariantObjectValue->SetVariantValue(VAR_VT, &CComVar(strVt.c_str())));
		RETURN_IF_FAILED(pVariantObjectValue->SetVariantValue(VAR_ATTR, &CComVar(strAttr.c_str())));
		RETURN_IF_FAILED(pVariantObjectValue->SetVariantValue(ObjectModel::Metadata::Object::Id, &CComVar(strValue.c_str())));
		RETURN_IF_FAILED(pVariantObjectValue->SetVariantValue(VAR_NAME, &CComVar(strName.c_str())));

		RETURN_IF_FAILED(pObjectCollection->AddObject(pVariantObjectValue));
		nObjects++;
	}

	CComPtr<IVariantTable> pVariantTable;
	RETURN_IF_FAILED(HrWrapToVariantTable(pPluginManager, pVariantObject, pObjectCollection, &pVariantTable));
	CComVar vObjects(pVariantTable);
	RETURN_IF_FAILED(pVariantObject->SetVariantValue(ObjectModel::Metadata::TableObject::ObjectsObject, &vObjects));
	RETURN_IF_FAILED(pVariantObject->SetVariantValue(VAR_RESULT, v));
	return S_OK;
}
    bool InitializeTransformComponent(IActorComponent* cmp, ICMStream* stream)
    {
        TransformComponent* transformation = (TransformComponent*)cmp;
        tinyxml2::XMLElement* pData = (tinyxml2::XMLElement*)stream;
        tinyxml2::XMLElement* trans = pData->FirstChildElement("Position");

        if(trans)
        {
            float x, y, z;
            RETURN_IF_FAILED(tinyxml2::XML_NO_ATTRIBUTE != trans->QueryFloatAttribute("x", &x));
            RETURN_IF_FAILED(tinyxml2::XML_NO_ATTRIBUTE != trans->QueryFloatAttribute("y", &y));
            RETURN_IF_FAILED(tinyxml2::XML_NO_ATTRIBUTE != trans->QueryFloatAttribute("z", &z));
            transformation->GetTransformation()->Translate(x, y, z);
        }

        tinyxml2::XMLElement* rot = pData->FirstChildElement("Rotation");

        if(rot)
        {
            float x, y, z, w;
            RETURN_IF_FAILED(tinyxml2::XML_NO_ATTRIBUTE != rot->QueryFloatAttribute("x", &x));
            RETURN_IF_FAILED(tinyxml2::XML_NO_ATTRIBUTE != rot->QueryFloatAttribute("y", &y));
            RETURN_IF_FAILED(tinyxml2::XML_NO_ATTRIBUTE != rot->QueryFloatAttribute("z", &z));
            RETURN_IF_FAILED(tinyxml2::XML_NO_ATTRIBUTE != rot->QueryFloatAttribute("w", &w));
            transformation->GetTransformation()->SetRotateQuat(x, y, z, w);
        }

        rot = pData->FirstChildElement("AxisAngle");

        if(rot)
        {
            float x, y, z, w;
            RETURN_IF_FAILED(tinyxml2::XML_NO_ATTRIBUTE != rot->QueryFloatAttribute("x", &x));
            RETURN_IF_FAILED(tinyxml2::XML_NO_ATTRIBUTE != rot->QueryFloatAttribute("y", &y));
            RETURN_IF_FAILED(tinyxml2::XML_NO_ATTRIBUTE != rot->QueryFloatAttribute("z", &z));
            RETURN_IF_FAILED(tinyxml2::XML_NO_ATTRIBUTE != rot->QueryFloatAttribute("w", &w));
            transformation->GetTransformation()->SetRotation(util::Vec3(x, y, z), w);
        }

        tinyxml2::XMLElement* scale = pData->FirstChildElement("Scale");

        if(scale)
        {
            float x, y, z;
            RETURN_IF_FAILED(tinyxml2::XML_NO_ATTRIBUTE != scale->QueryFloatAttribute("x", &x));
            RETURN_IF_FAILED(tinyxml2::XML_NO_ATTRIBUTE != scale->QueryFloatAttribute("y", &y));
            RETURN_IF_FAILED(tinyxml2::XML_NO_ATTRIBUTE != scale->QueryFloatAttribute("z", &z));
            transformation->GetTransformation()->SetScale(x, y, z);
        }
        
        return true;
    }
tResult Test::transmitStop(const tFloat32 value)
{
	RETURN_IF_FAILED(transmitF32Value(this->accelerationPin, this->coderDescriptionAcceleration, value));
	RETURN_NOERROR;
}