本文整理汇总了C++中ResetDevice函数的典型用法代码示例。如果您正苦于以下问题:C++ ResetDevice函数的具体用法?C++ ResetDevice怎么用?C++ ResetDevice使用的例子?那么, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了ResetDevice函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: lock
// used to notify object to release of create the sensor
void KinectSensor::NuiStatusNotification( _In_z_ const WCHAR* wcPortID, HRESULT hrStatus )
{
AutoLock lock( m_nuiLock );
if( E_NUI_NOTCONNECTED == hrStatus )
{
ResetDevice();
// release the instance of the sensor
m_pNuiSensor.Release();
}
else
{
if( 0 != m_wsPortID.compare(wcPortID) )
{
ResetDevice();
m_wsPortID = wcPortID;
}
// notifaction callback, check the state
// if there is a non-recovery error, reset
HRESULT hr = GetNUISensorStatus();
if( FAILED(hr) && KinectSensorStatusError == m_eStatus )
{
ResetDevice();
// release the instance of the sensor
m_pNuiSensor.Release();
return;
}
}
}
示例2: ResetDevice
bool Device::Init()
{
ResetDevice();
if (!Device_Inserted())
return false;
SearchConfig();
if(device.ConfigDevice == 0)
{
SearchBootDevice();
if(GetDeviceCount() >= 2)
{
if(SearchDolDevice() != 0)
device.BootDevice = device.DolDevice;
}
device.ConfigDevice = device.BootDevice;
}
device.BootDevice = device.ConfigDevice;
device.BrowsedDevice = device.ConfigDevice;
device.DeviceCount = GetDeviceCount();
return true;
}
示例3: EnableSkeletonStream
// start the skeleton stream
HRESULT KinectSensor::StartSkeletonStream()
{
// since this can be call publically
// we will ensure the stream is configured and ready
if( nullptr == m_pSkeletonStream )
{
// enable a stream
EnableSkeletonStream();
}
// previous call failed, must be memory issue
if( nullptr == m_pSkeletonStream )
{
return E_OUTOFMEMORY;
}
// be sure the sensor is initialized before starting stream
HRESULT hr = UpdateSensor();
if( FAILED(hr) )
{
ResetDevice();
return hr;
}
return m_pSkeletonStream->StartStream();
}
示例4: switch
HRESULT DrawDevice::TestCooperativeLevel()
{
if (m_pDevice == NULL)
{
return E_FAIL;
}
HRESULT hr = S_OK;
// Check the current status of D3D9 device.
hr = m_pDevice->TestCooperativeLevel();
switch (hr)
{
case D3D_OK: break;
case D3DERR_DEVICELOST:
hr = S_OK;
case D3DERR_DEVICENOTRESET:
hr = ResetDevice();
break;
default:
// Some other failure.
break;
}
return hr;
}
示例5: UsbSamp_EvtReadWriteWorkItem
VOID
UsbSamp_EvtReadWriteWorkItem(
_In_ WDFWORKITEM WorkItem
)
{
PWORKITEM_CONTEXT pItemContext;
NTSTATUS status;
UsbSamp_DbgPrint(3, ("ReadWriteWorkItem called\n"));
pItemContext = GetWorkItemContext(WorkItem);
status = ResetPipe(pItemContext->Pipe);
if (!NT_SUCCESS(status)) {
UsbSamp_DbgPrint(1, ("ResetPipe failed 0x%x\n", status));
status = ResetDevice(pItemContext->Device);
if (!NT_SUCCESS(status)){
UsbSamp_DbgPrint(1, ("ResetDevice failed 0x%x\n", status));
}
}
WdfObjectDelete(WorkItem);
return;
}
示例6: GetChar
/********************************************************************
* Function: void GetChar(BYTE * ptrChar)
*
* PreCondition: UART Setup
*
* Input: ptrChar - pointer to character received
*
* Output:
*
* Side Effects: Puts character into destination pointed to by ptrChar.
* Clear WDT
*
* Overview: Receives a character from UART2.
*
* Note: None
********************************************************************/
void GetChar(BYTE * ptrChar)
{
BYTE dummy;
while(1)
{
asm("clrwdt"); //looping code, so clear WDT
//check for receive errors
if((UxSTA & 0x000E) != 0x0000)
{
dummy = UxRXREG; //dummy read to clear FERR/PERR
UxSTAbits.OERR = 0; //clear OERR to keep receiving
}
//get the data
if(UxSTAbits.URXDA == 1)
{
* ptrChar = UxRXREG; //get data from UART RX FIFO
break;
}
#ifndef USE_AUTOBAUD
//if timer expired, jump to user code
if(IFS0bits.T3IF == 1){
ResetDevice(userReset.Val);
}
#endif
}//end while(1)
}//end GetChar(BYTE *ptrChar)
示例7: manager
void manager (struct plc * plc, signed count, signed pause)
{
while (count--)
{
if (_anyset (plc->flags, PLC_VERSION))
{
VersionInfo1 (plc);
}
if (_anyset (plc->flags, PLC_LOCAL_TRAFFIC))
{
Traffic1 (plc);
}
if (_anyset (plc->flags, PLC_NETWORK_TRAFFIC))
{
NetworkTraffic1 (plc);
}
if (_anyset (plc->flags, PLC_NETWORK))
{
PhyRates1 (plc);
}
if (_anyset (plc->flags, PLC_RESET_DEVICE))
{
ResetDevice (plc);
}
sleep (pause);
}
return;
}
示例8: TRACE
status_t
AHCIPort::ResetPort(bool forceDeviceReset)
{
if (!fTestUnitReadyActive)
TRACE("AHCIPort::ResetPort port %d\n", fIndex);
// stop DMA engine
fRegs->cmd &= ~PORT_CMD_ST;
FlushPostedWrites();
if (wait_until_clear(&fRegs->cmd, PORT_CMD_CR, 500000) < B_OK) {
TRACE("AHCIPort::ResetPort port %d error DMA engine doesn't stop\n",
fIndex);
}
bool deviceBusy = fRegs->tfd & (ATA_BSY | ATA_DRQ);
if (!fTestUnitReadyActive) {
TRACE("AHCIPort::ResetPort port %d, deviceBusy %d, "
"forceDeviceReset %d\n", fIndex, deviceBusy, forceDeviceReset);
}
if (deviceBusy || forceDeviceReset)
ResetDevice();
// start DMA engine
fRegs->cmd |= PORT_CMD_ST;
FlushPostedWrites();
return PostReset();
}
示例9: assert
// create the instance of the nui sensor
HRESULT KinectSensor::CreateNuiDevice()
{
assert( m_wsPortID.size() != 0 );
// check if we can use it
CComPtr<INuiSensor> pNuiSensor;
HRESULT hr = NuiCreateSensorById( m_wsPortID.c_str(), &pNuiSensor );
if( FAILED(hr) )
{
return hr;
}
// is this one we already have
if( m_pNuiSensor == pNuiSensor )
{
return S_OK;
}
assert( nullptr == m_pNuiSensor );
// if the device is not in use by another process
if( !IsSensorConflict(pNuiSensor) )
{
// start clean
ResetDevice();
m_pNuiSensor = pNuiSensor; // auto refcount with CComPtr
}
// update internal state and return
return GetNUISensorStatus(true);
}
示例10: OMX_INIT_STRUCT
OMX_ERRORTYPE IpulibRender::PortFormatChanged(OMX_U32 nPortIndex)
{
OMX_ERRORTYPE ret = OMX_ErrorNone;
OMX_PARAM_PORTDEFINITIONTYPE sPortDef;
OMX_BOOL bFmtChanged = OMX_FALSE;
if(nPortIndex != IN_PORT)
return OMX_ErrorBadPortIndex;
OMX_INIT_STRUCT(&sPortDef, OMX_PARAM_PORTDEFINITIONTYPE);
ports[IN_PORT]->GetPortDefinition(&sPortDef);
if(sVideoFmt.nFrameWidth != sPortDef.format.video.nFrameWidth)
{
sVideoFmt.nFrameWidth = sPortDef.format.video.nFrameWidth;
bFmtChanged = OMX_TRUE;
}
if(sVideoFmt.nFrameHeight != sPortDef.format.video.nFrameHeight)
{
sVideoFmt.nFrameHeight = sPortDef.format.video.nFrameHeight;
bFmtChanged = OMX_TRUE;
}
if(sVideoFmt.eColorFormat != sPortDef.format.video.eColorFormat)
{
sVideoFmt.eColorFormat = sPortDef.format.video.eColorFormat;
bFmtChanged = OMX_TRUE;
}
if(bFmtChanged == OMX_TRUE)
ResetDevice();
return ret;
}
示例11: Reset
/** @brief Reset service
*
* @param instance
* @param message_router_request
* @param message_router_response
* @returns Currently always kEipOkSend is returned
*/
static EipStatus Reset(CipInstance *instance, /* pointer to instance*/
CipMessageRouterRequest *message_router_request, /* pointer to message router request*/
CipMessageRouterResponse *message_router_response) /* pointer to message router response*/
{
(void) instance;
EipStatus eip_status = kEipStatusOkSend;
message_router_response->reply_service = (0x80
| message_router_request->service);
message_router_response->size_of_additional_status = 0;
message_router_response->general_status = kCipErrorSuccess;
if (message_router_request->data_length == 1) {
switch (message_router_request->data[0]) {
case 0: /* Reset type 0 -> emulate device reset / Power cycle */
if (kEipStatusError == ResetDevice()) {
message_router_response->general_status = kCipErrorInvalidParameter;
}
break;
case 1: /* Reset type 1 -> reset to device settings */
if (kEipStatusError == ResetDeviceToInitialConfiguration()) {
message_router_response->general_status = kCipErrorInvalidParameter;
}
break;
/* case 2: Not supported Reset type 2 -> Return to factory defaults except communications parameters */
default:
message_router_response->general_status = kCipErrorInvalidParameter;
break;
}
} else /*TODO: Should be if (pa_stMRRequest->DataLength == 0)*/
{
/* The same behavior as if the data value given would be 0
emulate device reset */
if (kEipStatusError == ResetDevice()) {
message_router_response->general_status = kCipErrorInvalidParameter;
} else {
/* eip_status = EIP_OK; */
}
}
message_router_response->data_length = 0;
return eip_status;
}
示例12: main
/*
Checks for commandline args, intializes globals, then begins code download.
*/
int main(int argc, char **argv) {
nf2.device_name = DEFAULT_IFACE;
processArgs(argc, argv);
if (check_iface(&nf2))
{
exit(1);
}
if (openDescriptor(&nf2))
{
exit(1);
}
if (strncmp(log_file_name, "stdout",6)) {
if ((log_file = fopen(log_file_name, "w")) == NULL) {
printf("Error: unable to open logfile %s for writing.\n",
log_file_name);
exit(1);
}
}
else
log_file = stdout;
InitGlobals();
BeginCodeDownload(bin_file_name);
if (!cpci_reprog)
ResetDevice();
/* reset the PHYs */
NF2_WR32(MDIO_0_CONTROL_REG, 0x8000);
NF2_WR32(MDIO_1_CONTROL_REG, 0x8000);
NF2_WR32(MDIO_2_CONTROL_REG, 0x8000);
NF2_WR32(MDIO_3_CONTROL_REG, 0x8000);
/* wait until the resets have been completed */
usleep(100);
if (intr_enable)
{
/* PHY interrupt mask off for link status change */
NF2_WR32(MDIO_0_INTERRUPT_MASK_REG, 0xfffd);
NF2_WR32(MDIO_1_INTERRUPT_MASK_REG, 0xfffd);
NF2_WR32(MDIO_2_INTERRUPT_MASK_REG, 0xfffd);
NF2_WR32(MDIO_3_INTERRUPT_MASK_REG, 0xfffd);
}
VerifyDevInfo();
fclose(log_file);
closeDescriptor(&nf2);
return SUCCESS;
}
示例13: OnInitDialog
BOOL CROIDlg::OnInitDialog()
{
CDialog::OnInitDialog();
if(ResetDevice(m_pDevice, TRUE)){
UpdateControls();
return TRUE;
}
return FALSE;
}
示例14: OnInitDialog
BOOL CExposeDlg::OnInitDialog()
{
__super::OnInitDialog();
if(ResetDevice(m_pDevice, TRUE)){
UpdateControls();
return TRUE;
}
return FALSE;
}
示例15: ResetAccount
void NOnlineInfo::ResetAll()
{
ResetAccount();
ResetDevice();
ResetChannels();
ResetChannelMigration();
ResetOnline();
ResetSceneMode();
ResetMatch();
ResetURLs();
}