本文整理汇总了C++中FindDevice函数的典型用法代码示例。如果您正苦于以下问题:C++ FindDevice函数的具体用法?C++ FindDevice怎么用?C++ FindDevice使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了FindDevice函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: ChangeInterface
bool ChangeInterface(char * filepath, bool silent)
{
int device = -1;
if(!FindDevice(filepath, &device))
return false;
return ChangeInterface(device, silent);
}
示例2: ctr_drives_chdrive
int ctr_drives_chdrive(const char *drive)
{
//Check that the drive requested is in the devoptab table
int index = FindDevice(drive);
if (index == -1) return -1;
setDefaultDevice(index);
return 0;
}
示例3: ChangeInterface
bool ChangeInterface(char * filepath, int retryCount )
{
int device = -1;
if(!FindDevice(filepath, &device))
return false;
return ChangeInterface(device, retryCount );
}
示例4: CDXLOG
//////////////////////////////////////////////////////////////////////////////////
// CRMEngine CreateWindowed - creates a windowed application
//////////////////////////////////////////////////////////////////////////////////
HRESULT CRMEngine::CreateWindowed(CDXScreen* pScreen, void *hWnd,
int Width, int Height)
{
GUID d3dGUID;
CDXLOG("START: CRMEngine::CreateWindowed");
CDXLOG("Release our m_RMDevice and Clipper object if we have one");
// first release everything that has been allocated
RELEASE(m_RMDevice);
RELEASE(m_lpDDClipper);
CDXLOG("Save the Screen object and do a CreateWindow");
// create the CDXScreen object
m_Screen = pScreen;
if(FAILED(m_Screen->CreateWindowed(hWnd, Width, Height))) {
CDXLOG("CreateWindow failed");
return D3DRMERR_NOTDONEYET;
}
CDXLOG("Create a Clipper object");
// create the dd clipper object
if(FAILED(DirectDrawCreateClipper(0, &m_lpDDClipper, NULL))) {
CDXLOG("Clipper creation failed");
return D3DRMERR_NOTDONEYET;
}
CDXLOG("Set the hWnd of the clipper to the main window");
// set the clipper objects hWnd
if(FAILED(m_lpDDClipper->SetHWnd(0, (HWND)hWnd))) {
RELEASE(m_lpDDClipper);
return D3DRMERR_NOTDONEYET;
}
CDXLOG("Do a CreateDeviceFromClipper to setup the 3DRM clipper");
// create the d3d device
if(FAILED(m_Direct3DRM->CreateDeviceFromClipper(m_lpDDClipper,
FindDevice(m_Screen->GetBPP(), &d3dGUID), Width, Height, &m_RMDevice))) {
return D3DRMERR_NOTDONEYET;
}
CDXLOG("Call SetDefaults");
// start our engine with default values based on color depth
SetDefaults();
CDXLOG("END: CRMEngine::CreateWindowed");
return D3DRM_OK;
}
示例5: OpenProfilesFolder
int OpenProfilesFolder()
{
sprintf(browser.dir, "%s/profiles/", appPath);
int device = 0;
FindDevice(browser.dir, &device);
CleanupPath(browser.dir);
ResetBrowser(); // reset browser
return ParseDirectory();
}
示例6: FindDevice
void Fl_Canvas::DeleteSelection (void) {
if (! m_HaveSelection) return;
// show some warning here
for (unsigned int i=0; i<m_Selection.m_DeviceIds.size(); i++) {
int ID = m_Selection.m_DeviceIds[i];
Fl_DeviceGUI* o = FindDevice(ID);
if (o) Fl_DeviceGUI::Kill(o);
}
m_HaveSelection = false;
m_Selection.Clear();
redraw();
}
示例7: while
bool C1WireByOWFS::FindDevice(const std::string inDir, const std::string sID, /*out*/_t1WireDevice& device) const
{
bool found = false;
DIR *d=opendir(inDir.c_str());
if (d != NULL)
{
struct dirent *de=NULL;
// Loop while not NULL or not found
while((de=readdir(d)) && !found)
{
// Check dir
if (!IsValidDir(de))
continue;
// Get the device from it's dirname
GetDevice(inDir, de->d_name, device);
// Check if it's the device we are looking for
if (device.devid.compare(0,sID.length(),sID)==0)
{
found=true;
continue;
}
// Else, try to scan hubs (recursively)
if (device.family==microlan_coupler)
{
// Search in "main" and "aux" dir
found=FindDevice(inDir + "/" + de->d_name + HUB_MAIN_SUB_PATH, sID, device);
if(!found)
found=FindDevice(inDir + "/" + de->d_name + HUB_AUX_SUB_PATH, sID, device);
}
}
}
closedir(d);
return found;
}
示例8: FindDevice
KSGDeviceNode* KSGDeviceManager::NewDevice(
int did,
KSGDeviceNode* parent,
const std::string& phyid,
KSGDevice* devtype)
{
KSGDeviceNode* ret = FindDevice(did);
if(ret)
throw DeviceIdAlreadyExists();
ret = _pool.construct(did,parent,devtype);
ret->SetPhyId(phyid);
SaveDevice(ret);
return ret;
}
示例9: MakeX
static int MakeX(int help)
{
char *token, *server;
int dpi, device, defDPI;
if (help) {
p_stderr("gist: display command syntax:\n ");
p_stderr("display host:server.screen [dpi]\n");
p_stderr(" Connects to the specified X server.\n");
p_stderr(" Subsequent draw commands will write to server,\n");
p_stderr(" unless the draw to list is modified (see draw).\n");
p_stderr(" If specified, 40<=dpi<=200 (default 100).\n");
return 0;
}
token= strtok(0, " \t\n");
if (!token) {
p_stderr("gist: (SYNTAX) cgmoutput name missing in cgm command\n");
return 0;
}
server= token;
token= strtok(0, " \t\n");
if (token) {
char *suffix;
dpi= (int)strtol(token, &suffix, 0);
if (*suffix) {
p_stderr("gist: (SYNTAX) dpi unintelligble in display command\n");
return 0;
}
if (dpi<40 && dpi>200) {
p_stderr(
"gist: (SYNTAX) dpi not between 40 and 200 in display command\n");
return 0;
}
if (CheckEOL("display")) return 0;
} else {
dpi= 100;
}
device= FindDevice();
if (device>=8) return 0;
defDPI= defaultDPI;
defaultDPI= dpi;
CreateX(device, server);
defaultDPI= defDPI;
return 0;
}
示例10: MOZ_ASSERT
// nsIDNSServiceResolveListener
NS_IMETHODIMP
MulticastDNSDeviceProvider::OnServiceResolved(nsIDNSServiceInfo* aServiceInfo)
{
MOZ_ASSERT(NS_IsMainThread());
if (NS_WARN_IF(!aServiceInfo)) {
return NS_ERROR_INVALID_ARG;
}
nsresult rv;
nsAutoCString serviceName;
if (NS_WARN_IF(NS_FAILED(rv = aServiceInfo->GetServiceName(serviceName)))) {
return rv;
}
LOG_I("OnServiceResolved: %s", serviceName.get());
nsAutoCString host;
if (NS_WARN_IF(NS_FAILED(rv = aServiceInfo->GetHost(host)))) {
return rv;
}
uint16_t port;
if (NS_WARN_IF(NS_FAILED(rv = aServiceInfo->GetPort(&port)))) {
return rv;
}
nsAutoCString serviceType;
if (NS_WARN_IF(NS_FAILED(rv = aServiceInfo->GetServiceType(serviceType)))) {
return rv;
}
uint32_t index;
if (FindDevice(host, index)) {
return UpdateDevice(index,
serviceName,
serviceType,
host,
port);
} else {
return AddDevice(serviceName,
serviceType,
host,
port);
}
return NS_OK;
}
示例11: emuShutdown
bool emuShutdown(const CComBSTR& deviceIdentifier)
{
CComPtr<IDeviceEmulatorManagerVMID> pDevice = NULL;
BOOL bFound = FindDevice(deviceIdentifier, &pDevice);
if (bFound && pDevice){
HRESULT hr = pDevice->Shutdown(FALSE);
if (!SUCCEEDED(hr)) {
wprintf(L"Error: Operation Shutdown failed. Hr=0x%x\n", hr);
return false;
}
return true;
}
return false;
}
示例12: IsWidcommDevice
bool
IsWidcommDevice(const TCHAR *name)
{
TCHAR key[64];
if (!FindDevice(name, key, 64))
return false;
RegistryKey registry(HKEY_LOCAL_MACHINE, key, true);
if (registry.error())
return false;
TCHAR dll[64];
return registry.get_value(_T("Dll"), dll, 64) &&
_tcscmp(dll, _T("btcedrivers.dll"));
}
示例13: FindDevice
KSGDeviceNode* KSGDeviceManager::NewDevice(
int did,
int parentId,
const std::string& phyid,
NormalDeviceType devtype)
{
KSGDeviceNode* ret = FindDevice(did);
if(ret)
throw DeviceIdAlreadyExists();
KSGDevice* dev = FindDeviceType(devtype);
ret = _pool.construct<int,int,KSGDevice*>(did,parentId,dev);
ret->SetPhyId(phyid);
SaveDevice(ret);
return ret;
}
示例14: ClearIncompleteWire
void Fl_Canvas::ClearConnections(Fl_DeviceGUI* Device)
{
bool removedall=false;
//make sure we don't leave a dangling incomplete wire this will cause errors/seg-faults
if (UserMakingConnection() && Device && ((Device->GetID() == m_IncompleteWire.OutputID) ||
(Device->GetID() == m_IncompleteWire.InputID)))
{
ClearIncompleteWire();
}
while (!removedall)
{
removedall=true;
for (vector<CanvasWire>::iterator i=m_WireVec.begin();
i!=m_WireVec.end(); i++)
{
if (i->OutputID==Device->GetID() ||
i->InputID==Device->GetID())
{
// Turn off both ports
FindDevice(i->OutputID)->RemoveConnection(i->OutputPort+FindDevice(i->OutputID)->GetInfo()->NumInputs);
FindDevice(i->InputID)->RemoveConnection(i->InputPort);
// send the unconnect callback
cb_Unconnect(this,(void*)&(*i));
m_Graph.RemoveConnection(i->OutputID,i->InputID);
m_WireVec.erase(i);
removedall=false;
break;
}
}
}
}
示例15: DownloadUpdate
bool DownloadUpdate()
{
bool result = false;
if(updateURL[0] == 0 || appPath[0] == 0 || !ChangeInterface(appPath, NOTSILENT))
{
ErrorPrompt("Update failed!");
updateFound = false; // updating is finished (successful or not!)
return false;
}
// stop checking if devices were removed/inserted
// since we're saving a file
HaltDeviceThread();
int device;
FindDevice(appPath, &device);
char updateFile[50];
sprintf(updateFile, "%s%s Update.zip", pathPrefix[device], APPNAME);
FILE * hfile = fopen (updateFile, "wb");
if (hfile)
{
if(http_request(updateURL, hfile, NULL, (1024*1024*10), NOTSILENT) > 0)
{
fclose (hfile);
result = unzipArchive(updateFile, (char *)pathPrefix[device]);
}
else
{
fclose (hfile);
}
remove(updateFile); // delete update file
}
// go back to checking if devices were inserted/removed
ResumeDeviceThread();
if(result)
InfoPrompt("Update successful!");
else
ErrorPrompt("Update failed!");
updateFound = false; // updating is finished (successful or not!)
return result;
}