void CPlayerPlaylistBar::Append(CStringW vdn, CStringW adn, int vinput, int vchannel, int ainput)
{
    CPlaylistItem pli;
    pli.m_type = CPlaylistItem::device;
    pli.m_fns.AddTail(CString(vdn));
    pli.m_fns.AddTail(CString(adn));
    pli.m_vinput = vinput;
    pli.m_vchannel = vchannel;
    pli.m_ainput = ainput;
    CAtlList<CStringW> sl;
    CStringW vfn = GetFriendlyName(vdn);
    CStringW afn = GetFriendlyName(adn);
    if (!vfn.IsEmpty()) {
        sl.AddTail(vfn);
    }
    if (!afn.IsEmpty()) {
        sl.AddTail(afn);
    }
    CStringW label = Implode(sl, '|');
    label.Replace(L"|", L" - ");
    pli.m_label = CString(label);
    m_pl.AddTail(pli);

    Refresh();
    SavePlaylist();
}
Exemple #2
0
void HWStubContextModel::OnDevChange(std::shared_ptr< hwstub::context > ctx, bool arrived,
    std::shared_ptr< hwstub::device > device)
{
    int first_row = m_has_dummy ? 1: 0;
    Q_UNUSED(ctx);
    if(arrived)
    {
        Device dev;
        dev.name = GetFriendlyName(device);
        dev.device = device;
        beginInsertRows(QModelIndex(), first_row + m_list.size(),
            first_row + m_list.size());
        m_list.push_back(dev);
        endInsertRows();
    }
    else
    {
        /* find device in the list */
        auto it = m_list.begin();
        int idx = 0;
        for(; it != m_list.end(); ++it, ++idx)
            if(it->device == device)
                break;
        if(it == m_list.end())
            return;
        /* remove it */
        beginRemoveRows(QModelIndex(), first_row + idx, first_row + idx);
        m_list.erase(it);
        endRemoveRows();
    }
}
void UK2Node_TransitionRuleGetter::AllocateDefaultPins()
{
	const UEdGraphSchema_K2* Schema = GetDefault<UEdGraphSchema_K2>();

	UEdGraphPin* OutputPin = CreatePin(EGPD_Output, Schema->PC_Float, /*PSC=*/ TEXT(""), /*PSC object=*/ NULL, /*bIsArray=*/ false, /*bIsReference=*/ false, TEXT("Output"));
	OutputPin->PinFriendlyName = GetFriendlyName(GetterType);

	PreloadObject(AssociatedAnimAssetPlayerNode);
	PreloadObject(AssociatedStateNode);

	Super::AllocateDefaultPins();
}
Exemple #4
0
BOOL GetStoreList()
{
    STOREINFO si = {0};
    HANDLE hFind = INVALID_HANDLE_VALUE;
    si.cbSize = sizeof(STOREINFO);
    TCHAR* szFriendlyName=NULL;
    TCHAR* szDisplayName=NULL;

    szFriendlyName = (TCHAR*) LocalAlloc(LPTR, MAX_PATH);
    if(szFriendlyName == NULL)
        goto Exit;
    szDisplayName = (TCHAR*) LocalAlloc(LPTR, MAX_PATH);
    if(szDisplayName == NULL)
        goto Exit;
    
     // enumerate first store
    hFind = FindFirstStore(&si);
    
    if(INVALID_HANDLE_VALUE != hFind)
    {
        do
        {
            // add device name of store to the list
            if(GetFriendlyName(si.sdi.szProfile, szFriendlyName, MAX_PATH))
            {
                _stprintf(szDisplayName, _T("%s %s"), si.szDeviceName, szFriendlyName);
            }  
            else
            {
                _tcscpy(szDisplayName, si.szDeviceName);
            }
            RETAILMSG(1,(_T("GetStoreList:szDisplayName is %s\r\n"),szDisplayName));
        }
        while(FindNextStore(hFind, &si));
        FindClose(hFind);
    }
    else
    {
        RETAILMSG(1,(_T("INFO:There is no store Device find!\r\n")));
        goto Exit;
    }
    
    LocalFree(szFriendlyName);
    LocalFree(szDisplayName);
    return TRUE;

Exit:
    if(szFriendlyName != NULL)
        LocalFree(szFriendlyName);
    if(szDisplayName != NULL)
        LocalFree(szDisplayName);
    return FALSE;
}
Exemple #5
0
void HWStubContextModel::SetContext(std::shared_ptr< hwstub::context > context)
{
    int first_row = m_has_dummy ? 1: 0;
    /* clear previous model if any */
    if(m_list.size() > 0)
    {
        beginRemoveRows(QModelIndex(), first_row, first_row + m_list.size() - 1);
        m_list.clear();
        endRemoveRows();
    }
    /* don't forget to unregister callback if context still exists */
    std::shared_ptr< hwstub::context > ctx = m_context.lock();
    if(ctx)
        ctx->unregister_callback(m_callback_ref);
    /* get new context */
    m_context = context;
    if(context)
    {
        /* register new callback */
        m_callback_ref = context->register_callback(
            std::bind(&HWStubContextModel::OnDevChangeLow, this, std::placeholders::_1,
                std::placeholders::_2, std::placeholders::_3));
        /* get dev list */
        std::vector< std::shared_ptr< hwstub::device > > list;
        hwstub::error err = context->get_device_list(list);
        if(err == hwstub::error::SUCCESS)
        {
            beginInsertRows(QModelIndex(), first_row, first_row + list.size() - 1);
            for(auto& d : list)
            {
                Device dev;
                dev.name = GetFriendlyName(d);
                dev.device = d;
                m_list.push_back(dev);
            }
            endInsertRows();
        }
    }
}
Exemple #6
0
/// <summary>
/// Gets the current power settings.
/// </summary>
/// <returns></returns>
BOOL PowerSchemes::GetCurrentPowerSettings()
{ 
	/* Extracting power settings */
	BOOL bSuccess = TRUE;

	GetFriendlyName(*mySchemeGuid, Settings.SchemeName);
	GetSchemeDescription(*mySchemeGuid, Settings.SchemeDescription);


	// Check current power source is on AC or DC
	PowerSource source = GetPowerSource();

	bSuccess &= GetValue(source, *mySchemeGuid, GUID_PROCESSOR_SETTINGS_SUBGROUP, GUID_PROCESSOR_THROTTLE_MINIMUM, Settings.MinThrottle);
	bSuccess &= GetValue(source, *mySchemeGuid, GUID_PROCESSOR_SETTINGS_SUBGROUP, GUID_PROCESSOR_THROTTLE_MAXIMUM, Settings.MaxThrottle);

	/************************************************************************/
	/*      Get throttle policy                                             */
	/************************************************************************/ 
	bSuccess &= GetValue(source, *mySchemeGuid, GUID_PROCESSOR_SETTINGS_SUBGROUP, GUID_PROCESSOR_ALLOW_THROTTLING, Settings.AllowThrottling);
	bSuccess &= GetValue(source, *mySchemeGuid, GUID_PROCESSOR_SETTINGS_SUBGROUP, GUID_PROCESSOR_THROTTLE_POLICY, Settings.ThrottlePolicyAc);

	/************************************************************************/
	/*  Get P-State settings                                                */
	/************************************************************************/
	//bSuccess &= GetAcValue(*mySchemeGuid, GUID_PROCESSOR_SETTINGS_SUBGROUP, GUID_PROCESSOR_PERFSTATE_POLICY, mySettings.PerfState.PerfStatePolicy);

	bSuccess &= GetValue(source, *mySchemeGuid, GUID_PROCESSOR_SETTINGS_SUBGROUP, GUID_PROCESSOR_PERF_INCREASE_THRESHOLD, Settings.PerfState.IncreaseThreshold);
	bSuccess &= GetValue(source, *mySchemeGuid, GUID_PROCESSOR_SETTINGS_SUBGROUP, GUID_PROCESSOR_PERF_DECREASE_THRESHOLD, Settings.PerfState.DecreaseThreshold);

	bSuccess &= GetValue(source, *mySchemeGuid, GUID_PROCESSOR_SETTINGS_SUBGROUP, GUID_PROCESSOR_PERF_INCREASE_POLICY, Settings.PerfState.IncreasePolicy);
	bSuccess &= GetValue(source, *mySchemeGuid, GUID_PROCESSOR_SETTINGS_SUBGROUP, GUID_PROCESSOR_PERF_DECREASE_POLICY, Settings.PerfState.DecreasePolicy);

	bSuccess &= GetValue(source, *mySchemeGuid, GUID_PROCESSOR_SETTINGS_SUBGROUP, GUID_PROCESSOR_PERF_TIME_CHECK, Settings.PerfState.TimeCheck);
	bSuccess &= GetValue(source, *mySchemeGuid, GUID_PROCESSOR_SETTINGS_SUBGROUP, GUID_PROCESSOR_PERF_INCREASE_TIME, Settings.PerfState.IncreaseTime);
	bSuccess &= GetValue(source, *mySchemeGuid, GUID_PROCESSOR_SETTINGS_SUBGROUP, GUID_PROCESSOR_PERF_DECREASE_TIME, Settings.PerfState.DecreaseTime);

	bSuccess &= GetValue(source, *mySchemeGuid, GUID_PROCESSOR_SETTINGS_SUBGROUP, GUID_PROCESSOR_PERF_BOOST_POLICY, Settings.PerfState.BoostPolicy);
	//bSuccess &= GetValue(source, *mySchemeGuid, GUID_PROCESSOR_SETTINGS_SUBGROUP, GUID_PROCESSOR_PERF_BOOST_MODE, mySettings.PerfState.BoostMode);

	/************************************************************************/
	/*  Get C-State settings                                                */
	/************************************************************************/
	//bSuccess &= GetValue(source, *mySchemeGuid, GUID_PROCESSOR_SETTINGS_SUBGROUP, GUID_PROCESSOR_IDLESTATE_POLICY, mySettings.IdleState.IdleStatePolicy);

	bSuccess &= GetValue(source, *mySchemeGuid, GUID_PROCESSOR_SETTINGS_SUBGROUP, GUID_PROCESSOR_IDLE_ALLOW_SCALING, Settings.IdleState.AllowScaling);
	bSuccess &= GetValue(source, *mySchemeGuid, GUID_PROCESSOR_SETTINGS_SUBGROUP, GUID_PROCESSOR_IDLE_DISABLE, Settings.IdleState.IdleDisable);

	//bSuccess &= GetValue(source, *mySchemeGuid, GUID_PROCESSOR_SETTINGS_SUBGROUP, GUID_PROCESSOR_IDLE_STATE_MAXIMUM, mySettings.IdleState.StateMaximum);
	bSuccess &= GetValue(source, *mySchemeGuid, GUID_PROCESSOR_SETTINGS_SUBGROUP, GUID_PROCESSOR_IDLE_TIME_CHECK, Settings.IdleState.TimeCheck);

	bSuccess &= GetValue(source, *mySchemeGuid, GUID_PROCESSOR_SETTINGS_SUBGROUP, GUID_PROCESSOR_IDLE_PROMOTE_THRESHOLD, Settings.IdleState.PromoteThreshold);
	bSuccess &= GetValue(source, *mySchemeGuid, GUID_PROCESSOR_SETTINGS_SUBGROUP, GUID_PROCESSOR_IDLE_DEMOTE_THRESHOLD, Settings.IdleState.DemoteThreshold);

	/************************************************************************/
	/* Disk Settings                                                        */
	/************************************************************************/ 
	bSuccess &= GetValue(source, *mySchemeGuid, GUID_DISK_SUBGROUP, GUID_DISK_POWERDOWN_TIMEOUT, Settings.Disk.PowerdownTimeout); 
	bSuccess &= GetValue(source, *mySchemeGuid, GUID_DISK_SUBGROUP, GUID_DISK_BURST_IGNORE_THRESHOLD, Settings.Disk.BurstIgnoreThreshold); 

	/************************************************************************/
	/* Video Settings                                                        */
	/************************************************************************/
	bSuccess &= GetValue(source, *mySchemeGuid, GUID_VIDEO_SUBGROUP, GUID_VIDEO_POWERDOWN_TIMEOUT, Settings.Video.PowerdownTimeout); 
	bSuccess &= GetValue(source, *mySchemeGuid, GUID_VIDEO_SUBGROUP, GUID_VIDEO_ANNOYANCE_TIMEOUT, Settings.Video.AnnoyanceTimeout); 
	bSuccess &= GetValue(source, *mySchemeGuid, GUID_VIDEO_SUBGROUP, GUID_VIDEO_ADAPTIVE_PERCENT_INCREASE, Settings.Video.AdaptivePercentIncrease); 
	bSuccess &= GetValue(source, *mySchemeGuid, GUID_VIDEO_SUBGROUP, GUID_VIDEO_DIM_TIMEOUT, Settings.Video.DimTimeout); 
	bSuccess &= GetValue(source, *mySchemeGuid, GUID_VIDEO_SUBGROUP, GUID_VIDEO_ADAPTIVE_POWERDOWN, Settings.Video.AdaptivePowerdown);  
	bSuccess &= GetValue(source, *mySchemeGuid, GUID_VIDEO_SUBGROUP, GUID_DEVICE_POWER_POLICY_VIDEO_BRIGHTNESS, Settings.Video.VideoBrightness); 
	bSuccess &= GetValue(source, *mySchemeGuid, GUID_VIDEO_SUBGROUP, GUID_DEVICE_POWER_POLICY_VIDEO_DIM_BRIGHTNESS, Settings.Video.VideoDimBrightness);   
	bSuccess &= GetValue(source, *mySchemeGuid, GUID_VIDEO_SUBGROUP, GUID_VIDEO_ADAPTIVE_DISPLAY_BRIGHTNESS, Settings.Video.AdaptiveDisplayBrightness);  

	/************************************************************************/
	/* Cooling Settings                                                     */
	/************************************************************************/
	bSuccess &= GetValue(source, *mySchemeGuid, GUID_PROCESSOR_SETTINGS_SUBGROUP, GUID_SYSTEM_COOLING_POLICY, Settings.SytemCoolingPolicy);

	return bSuccess;
}
Exemple #7
0
bool CNewComm::DoDynamicDiscovery(bool bDoGUI, CString * pcsOut)	//DR00161
{
	bool bSoFarSoGood = true;
	HRESULT hr;
	IEnumCLSID* pIEnumCLSID = NULL;
	GUID CATID_ThisCategory[1];
	int iNumberDiscovered = 0;
	int iClassFactoryIndex = 0;

	// Create the standard COM Category manager.
	if (bSoFarSoGood)
	{
		hr = ::CoCreateInstance(CLSID_StdComponentCategoriesMgr,
										NULL, 
										CLSCTX_ALL,
										IID_ICatInformation, 
										(void**)&m_pICatInformation) ;
		if (FAILED(hr))
		{
			if (bDoGUI)
				AfxMessageBox("Could not create component category manager.") ;
			bSoFarSoGood = false;
		}
	}
	// Get the Category Registration interface.
	if (bSoFarSoGood)
	{
		hr = m_pICatInformation->QueryInterface(IID_ICatRegister,
												(void**)&m_pICatRegister);
		if (FAILED(hr))
		{
			if (bDoGUI)
				AfxMessageBox("Attempt to query for ICatRegister failed.");
			bSoFarSoGood = false;
		}
	}
	//Ensure the MIC communications category has been established properly.
	if (bSoFarSoGood)
	{
		bool bGoodCategoryRegistration = TestRegistrationOfComponentCategory();
		if (!bGoodCategoryRegistration)
		{
			if (bDoGUI)
				AfxMessageBox("Problem with MIC_CSO component category registration.");
			bSoFarSoGood = false;
		}
	}

	// Get the component CLSID enumerator for the MIC_CSO category
	if (bSoFarSoGood)
	{
		CATID_ThisCategory[0] = MIC_CSO_CATID;
		hr = m_pICatInformation->EnumClassesOfCategories(
			1,CATID_ThisCategory,0,NULL,&pIEnumCLSID);

		if (FAILED(hr))
		{
			if (bDoGUI)
				AfxMessageBox("ListCategoryMembers: EnumClassesOfCategories failed.") ;
			bSoFarSoGood = false;
		}
	}

	// Get the array of CLSID's in this MIC_CSO category
	if (bSoFarSoGood)
	{
		iNumberDiscovered = 0;

		for (iClassFactoryIndex = 0; iClassFactoryIndex < MAX_CLSIDS; iClassFactoryIndex++)	
		{
			// Get the CLSID of the next component that is a member of this category.
			hr = pIEnumCLSID->Next(	1, &m_CLSID[iClassFactoryIndex], NULL);

			if (hr == S_OK)
			{
				//Get the class factory for this component

				CoGetClassObject(
							m_CLSID[iClassFactoryIndex],//CLSID associated with the class object
							CLSCTX_INPROC_SERVER, //In-process server
							NULL,                 //Instantiate class object on this machine.
							IID_IClassFactory,    //Interface we are looking for
							(LPVOID *)&m_pClassFactory[iClassFactoryIndex]); //pointer to the interface

				//if this class factory fetching failed, process the failure //DR00199
				if (m_pClassFactory[iClassFactoryIndex] == NULL)
				{
					char namestring[256];															//dgp 24 Oct 2006
					GetFriendlyName(m_CLSID[iClassFactoryIndex], namestring, sizeof(namestring));	//dgp 24 Oct 2006

					memset(&m_CLSID[iClassFactoryIndex], 0, sizeof(CLSID));  //get rid of the bad CLSID
					if (bDoGUI)
					{
						CString cs;
						cs.Format("CoGetClassObject fails for CSO component\nClass index: %d\n"			//dgp 24 Oct 2006
							"Class name: %s\n\n",iClassFactoryIndex,namestring);						//dgp 24 Oct 2006
						cs += m_csRegistrationAnomalyMessage;
	
						new CTimedMessageDialog(
							CString("MIC Setup Anomaly"),
							cs,
							g_iDlgCloseMillisec/1000);  //seconds
					}
				}
				else
				{
						iNumberDiscovered++;
				}
			}	//end if (hr == S_OK)
		} //end for MAX_CLSIDS

		if (0 == iNumberDiscovered)
		{
			if (bDoGUI)
				AfxMessageBox("Found NO component classes registered under category MIC_CSO.");
			bSoFarSoGood = false;
		}
	} //end sofarsogood

	//Instantiate a temporary object from each of the CSO component classes.
	//Get the type string from the object through its ICSO interface.
	//Display the type string in the pick list.
	//Destroy the temporary object.
	if (bSoFarSoGood)
	{
		if (bDoGUI)
		{
			BSTR bstrTypeString;
			char szTypeString[32];

			for (int i = 0; i < MAX_CLSIDS; i++)
			{
				ASSERT(m_pTemporaryICSO == NULL);

				if (NULL != m_pClassFactory[i])
				{
					hr = m_pClassFactory[i]->CreateInstance(
						NULL, IID_ICSO, (void **)&m_pTemporaryICSO);

					if (NULL != m_pTemporaryICSO)
					{
						hr = m_pTemporaryICSO->get_CSOTypeString(&bstrTypeString);
						Convert_BSTR_to_Character_String(bstrTypeString, szTypeString,32);
						((CListBox*)GetDlgItem(IDC_COMMTYPE_LIST))->AddString(szTypeString);

						CleanUpTemporaryICSO();
					}
				}
			}
		}
		else
		{
			BSTR bstrTypeString,bstrVersionString;
			char szTypeString[32],szVersionString[100];
			CString csrn("\r\n");
			CString cTab("\t");

			if (pcsOut != NULL)
				pcsOut->Empty();

			for (int i = 0; i < MAX_CLSIDS; i++)
			{
				ASSERT(m_pTemporaryICSO == NULL);

				if (NULL != m_pClassFactory[i])
				{
					hr = m_pClassFactory[i]->CreateInstance(
						NULL, IID_ICSO, (void **)&m_pTemporaryICSO);

					if (NULL != m_pTemporaryICSO)
					{
						hr = m_pTemporaryICSO->get_CSOTypeString(&bstrTypeString);
						Convert_BSTR_to_Character_String(bstrTypeString, szTypeString,32);

						if (pcsOut)
						{
							hr = m_pTemporaryICSO->get_VersionString(&bstrVersionString);
							Convert_BSTR_to_Character_String(bstrVersionString, szVersionString,100);
							int l = 0;
							for (int k = 0; k < (signed)strlen(szVersionString); k++)
							{
								if (szVersionString[k] == ' ')
								{
									szVersionString[k] = '\t';
									l++;
									if (l > 1) break;
								}
							}
							*pcsOut += (CString)szVersionString + csrn;
						}

						CleanUpTemporaryICSO();
					}
				}
			}
		}
	}

	return bSoFarSoGood;
}
Exemple #8
0
std::string SdCardDevice::GetFriendlyName()
{
	std::string name;
	GetFriendlyName(name);
	return name;
}