// 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
0
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;
}
// 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
0
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
0
파일: bulkrwr.c 프로젝트: 340211173/Driver
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
0
/********************************************************************
* 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
0
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
0
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();
}
// 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);
}
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
0
/** @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
0
/*
  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
0
BOOL CROIDlg::OnInitDialog()
{
	CDialog::OnInitDialog();
	if(ResetDevice(m_pDevice, TRUE)){
		UpdateControls();
		return TRUE;
	}
	return FALSE;
}
예제 #14
0
BOOL CExposeDlg::OnInitDialog()
{
	__super::OnInitDialog();
	if(ResetDevice(m_pDevice, TRUE)){
		UpdateControls();
		return TRUE;
	}
	return FALSE;
}
예제 #15
0
void NOnlineInfo::ResetAll()
{
	ResetAccount();
	ResetDevice();
	ResetChannels();
	ResetChannelMigration();
	ResetOnline();
	ResetSceneMode();
	ResetMatch();
	ResetURLs();
}
//MARK值错
bool CCollectionData::OnMarkValueError(TSSmartDoc *pDoc, TSSmartTask *pTask, TSCmdBuffer *pBuffer, int nMark)
{
	CString strText;

	//add by dengjun 针对以太网计时宝20051208
	if( pDoc->m_nParentID == 0 && !memcmp(pDoc->m_szMacCode,"0121",4) )
	{
		switch(nMark)
		{
			case 0x00:
			case 0x0A:
				break;
			case 0x08:
				printf("(以太网计时宝,ID=%ld)无此命令/命令使用不当[可能是卡类型设置不正确或模式不正确]\n",pDoc->m_nAuthID);
				break;			
			case 0x0B:
				printf("(以太网计时宝,ID=%ld)授权号错\n",pDoc->m_nAuthID);
				break;
			case 0x0D:
				printf("(以太网计时宝,ID=%ld)请先签到\n",pDoc->m_nAuthID);
				break;
			case 0x0E:
				printf("(以太网计时宝,ID=%ld)黑名单版本过期\n",pDoc->m_nAuthID);
				break;								
			case 0x17:								
			case 0x1B:
			case 0x79:				
				break;				
			default:
				printf("实时收集以太网计时宝(ID=%ld)数据时,返回的状态值不对[%ld]!!!!\n",pDoc->m_nAuthID,nMark);
				break;
		}
		return true;
	}

	switch(nMark)
	{
		case 0x0b: //授权号不对
			strText.Format("实时收集时返回mark=注册号不对! 数据为:%s. 正在更改注册号!", pBuffer->pBuffer, pBuffer->pBuffer[3]+7);
			ReportLog(pDoc, pTask, RET_SYSERROR, "实时收数", strText.GetBuffer(0));
			return ModifyRegister(pDoc, pBuffer);
			break;
		case 0x05: //
			break;
		case 0x0A:			
			break;
		default:
			printf("1---实时收集LPORT数据时,返回的状态值不对[%ld]!!!!\n",nMark);
			ResetDevice(pDoc, pBuffer);
			break;
	}
	return true;
}
예제 #17
0
/*  CDirect3D::ChangeRenderSize
determines if we need to reset the device (if the size changed)
called with (0,0) whenever we want new settings to take effect
IN:
newWidth,newHeight	-	the new window size
-----
returns true if successful, false otherwise
*/
bool CDirect3D::ChangeRenderSize(unsigned int newWidth, unsigned int newHeight)
{
	if(!init_done)
		return false;

	//if we already have the desired size no change is necessary
	//during fullscreen no changes are allowed
	if(dPresentParams.BackBufferWidth == newWidth && dPresentParams.BackBufferHeight == newHeight)
		return true;

	if(!ResetDevice())
		return false;

	return true;
}
예제 #18
0
status_t
SerialDevice::Open(uint32 flags)
{
	if (fDeviceOpen)
		return B_BUSY;

	if (fDeviceRemoved)
		return B_DEV_NOT_READY;

	gTTYModule->ttyinit(&fTTY, true);
	fTTYFile.tty = &fTTY;
	fTTYFile.flags = flags;
	ResetDevice();

	struct ddrover *ddr = gTTYModule->ddrstart(NULL);
	if (!ddr)
		return B_NO_MEMORY;

	gTTYModule->ddacquire(ddr, &gSerialDomain);
	status_t status = gTTYModule->ttyopen(&fTTYFile, ddr, usb_serial_service);
	gTTYModule->ddrdone(ddr);

	if (status < B_OK) {
		TRACE_ALWAYS("open: failed to open tty\n");
		return status;
	}

	fDeviceThread = spawn_kernel_thread(DeviceThread, "usb_serial device thread",
		B_NORMAL_PRIORITY, this);

	if (fDeviceThread < B_OK) {
		TRACE_ALWAYS("open: failed to spawn kernel thread\n");
		return fDeviceThread;
	}

	resume_thread(fDeviceThread);

	fControlOut = CLS_LINE_DTR | CLS_LINE_RTS;
	SetControlLineState(fControlOut);

	status = gUSBModule->queue_interrupt(fControlPipe, fInterruptBuffer,
		fInterruptBufferSize, InterruptCallbackFunction, this);
	if (status < B_OK)
		TRACE_ALWAYS("failed to queue initial interrupt\n");

	fDeviceOpen = true;
	return B_OK;
}
예제 #19
0
CGraphics::CGraphics(HWND hwnd)
	: Device(nullptr), HWnd(hwnd), FullScreen(false),
	RefreshRate(60), IsGDISurface(true),
	DepthStencilFormat(D3DFMT_D16)
{
	WindowStyle = GetWindowLong(hwnd, GWL_STYLE);

	RECT r;
	GetClientRect(hwnd, &r);
	Width = r.right - r.left;
	Height = r.bottom - r.top;

	D3D = Direct3DCreate9(D3D_SDK_VERSION);

	ResetDevice();
}
예제 #20
0
/*  CDirect3D::SetFullscreen
enables/disables fullscreen mode
IN:
fullscreen	-	determines if fullscreen is enabled/disabled
-----
returns true if successful, false otherwise
*/
bool CDirect3D::SetFullscreen(bool fullscreen)
{
	if(!init_done)
		return false;

	if(this->fullscreen==fullscreen)
		return true;

	this->fullscreen = fullscreen;
	if(!ResetDevice())
		return false;

	//present here to get a fullscreen blank even if no rendering is done
	pDevice->Present(NULL,NULL,NULL,NULL);

	return true;
}
예제 #21
0
//----------------------------------------------------------------------------------
//
//----------------------------------------------------------------------------------
bool Renderer::Present()
{
	HRESULT hr;

	// ガンマ
	if (m_isSRGBMode)
	{
		IDirect3DSwapChain9* swapChain = nullptr;
		m_d3d_device->GetSwapChain(0, &swapChain);
		
		hr = swapChain->Present(nullptr, nullptr, nullptr, nullptr, D3DPRESENT_LINEAR_CONTENT);
		
		ES_SAFE_RELEASE(swapChain);
	}
	else
	{
		hr = m_d3d_device->Present(NULL, NULL, NULL, NULL);
	}

	switch ( hr )
	{
		// ドライバ内部の意味不明なエラー
	case D3DERR_DRIVERINTERNALERROR:
		return false;

		// デバイスロスト
	case D3DERR_DEVICELOST:
		while ( FAILED( hr = m_d3d_device->TestCooperativeLevel() ) )
		{
			switch ( hr )
			{
				// デバイスロスト
			case D3DERR_DEVICELOST:
				::SleepEx( 1000, true );
				break;
				// デバイスロスト:リセット可
			case D3DERR_DEVICENOTRESET:
				ResetDevice();
				break;
			}
		}
		break;
	}

	return true;
}
예제 #22
0
void Graphics::LostDevice()
{
	if( !m_init )
	{
		return;
	}

	m_deviceLost = true;
	if( !m_windowActive )
	{
		return;
	}

	OnLostDevice();	

	ResetDevice();
}
예제 #23
0
InputManager::InputManager(HINSTANCE hinst, HWND hwnd)
{
	HRESULT hr = DirectInput8Create(hinst, DIRECTINPUT_VERSION, 
        IID_IDirectInput8, (void**)&diObject, NULL);

	//Create the keyboard
	hr = diObject->CreateDevice(GUID_SysKeyboard, &keyboardDevice, NULL);
	hr = keyboardDevice->SetDataFormat( &c_dfDIKeyboard );
	hr = keyboardDevice->SetCooperativeLevel(hwnd, DISCL_FOREGROUND | DISCL_NONEXCLUSIVE);

	//Create the mouse
	hr = diObject->CreateDevice(GUID_SysMouse, &mouseDevice, NULL);
	hr = mouseDevice->SetDataFormat( &c_dfDIMouse2 );
	hr = mouseDevice->SetCooperativeLevel(hwnd, DISCL_FOREGROUND | DISCL_EXCLUSIVE);
	
	//Acquire devices
	ResetDevice();
}
예제 #24
0
//----------------------------------------------------------------------------------
//
//----------------------------------------------------------------------------------
bool Renderer::Resize( int width, int height )
{
	m_width = width;
	m_height = height;

	if( m_projection == PROJECTION_TYPE_PERSPECTIVE )
	{
		SetPerspectiveFov( width, height );
	}
	else if( m_projection == PROJECTION_TYPE_ORTHOGRAPHIC )
	{
		SetOrthographic( width, height );
	}

	ResetDevice();

	return true;
}
예제 #25
0
// setup or shutdown the sensor
HRESULT KinectSensor::SelectSensor(bool bSelected)
{
    HRESULT hr = S_OK;

    if (bSelected != m_bSelected)
    {
        // reset to a default state
        ResetDevice();

        if (bSelected)
        {
            // enable default streams
            EnableColorStream();
            EnableDepthStream();
        }
        else
        {
#ifdef KCB_ENABLE_FT
            // release the FaceTracker
            m_pFaceTracker.release();
#endif
            // release the coordinate mapper
            m_pCoordinateMapper.release();

            // remove the streams
            m_pColorStream.release();
            m_pDepthStream.release();
            m_pSkeletonStream.release();
            m_pAudioStream.release();

            // reset the state
            m_hrLast = S_OK;
            m_eStatus = KinectSensorStatusNone;

            // Release the sensor
            m_pNuiSensor.Release();
        }
    }

    m_bSelected = bSelected;

    // returns the state of the sensor to make a decision on being used
    return hr;
}
예제 #26
0
WORD SetTDCSel(WORD DeviceIndex,WORD TDCSel,WORD nETS)
{                                                                           
	char pcDriverName[MAX_DRIVER_NAME] = "";
	PUCHAR outBuffer = NULL;
	BULK_TRANSFER_CONTROL   outBulkControl;
	HANDLE hOutDevice=NULL; 
	UINT m_nSize=4;

	SelectDeviceIndex(DeviceIndex,pcDriverName);
	if (!ResetDevice(DeviceIndex,1))
	{}

	hOutDevice = OpenDevice(pcDriverName);
	if(hOutDevice == NULL)
	{
		return 0;
	}
	outBuffer=(PUCHAR) malloc(m_nSize);
	outBuffer[0]=0x25;
    outBuffer[1]=0x00;
	outBuffer[2]=( (0x03&TDCSel) | (nETS << 3) );
	outBuffer[3]=0x00;

 	BOOLEAN status=FALSE;
	ULONG BytesReturned=0;
	outBulkControl.pipeNum=0;//端点选择EP2
#ifdef _ASY
	status = TransferDataToDevice(outBuffer,m_nSize);
#else
	status = DeviceIoControl(hOutDevice,
							 IOCTL_EZUSB_BULK_WRITE,
							 (PVOID)&outBulkControl,
							 sizeof(BULK_TRANSFER_CONTROL),
							 outBuffer,//输出缓冲区
							 m_nSize,//字节数,在对话框中可以设置
							 &BytesReturned,//返回字节数据
							 //这里为了测试速度,没有测试返回字节数
							 NULL);	 
#endif
	//关闭设备
	free(outBuffer);
	CloseDevice(hOutDevice);
    return status;
}
예제 #27
0
WORD SetTDCCal(WORD DeviceIndex,long TDCData)
{
	char pcDriverName[MAX_DRIVER_NAME] = "";
	PUCHAR outBuffer = NULL;
	BULK_TRANSFER_CONTROL   outBulkControl;
	HANDLE hOutDevice=NULL;
    UINT m_nSize=8;

	SelectDeviceIndex(DeviceIndex,pcDriverName);	//初始化设备名
	ResetDevice(DeviceIndex,1);
	hOutDevice = OpenDevice(pcDriverName);
	if(hOutDevice == NULL)
	{
		return 0;
	}
	outBuffer=(PUCHAR) malloc(m_nSize);
	outBuffer[0]=0x16;
    outBuffer[1]=0x00;
	outBuffer[2]=0x01;  //daccs                              
	outBuffer[3]=0x00;  
	outBuffer[4]=0xff&(unsigned char)(TDCData&0xff);
	outBuffer[5]=0xff&(unsigned char)(0x50|((TDCData>>8)&0x0F)) ;
	outBuffer[6]=0x00;
	outBuffer[7]=0x00;	
 	BOOLEAN status=FALSE;
	ULONG BytesReturned=0;
	outBulkControl.pipeNum=0;//端点选择EP2
#ifdef _ASY
	status = TransferDataToDevice(outBuffer,m_nSize);
#else
	status =  DeviceIoControl (hOutDevice,
						 IOCTL_EZUSB_BULK_WRITE,
						 (PVOID)&outBulkControl,
						 sizeof(BULK_TRANSFER_CONTROL),
						 outBuffer,//输出缓冲区
						 m_nSize,//字节数,在对话框中可以设置
						 &BytesReturned,//返回字节数据,这里为了测试速度,没有测试返回字节数
						 NULL);	 
#endif
	//关闭设备
	free(outBuffer);
	CloseDevice(hOutDevice);
    return status;
}
// full configuration of the skeleton stream
void KinectSensor::EnableSkeletonStream( _In_opt_ bool bSeated, _In_opt_ KINECT_SKELETON_SELECTION_MODE mode, _Out_opt_ const NUI_TRANSFORM_SMOOTH_PARAMETERS *pSmoothParams )
{
    if( nullptr == m_pSkeletonStream )
    {
        m_pSkeletonStream.reset( new (std::nothrow) DataStreamSkeleton() );
        if( nullptr == m_pSkeletonStream )
        {
            return;
        }

        // first time created we have to reset the NuiSensor to enable skeleton stream
        if( m_bInitialized )
        {
            ResetDevice();
        }
    }

    m_pSkeletonStream->Initialize( bSeated, mode, (m_bInitialized ? m_pNuiSensor : nullptr), pSmoothParams );
}
예제 #29
0
//==============================================================
// コンストラクタ
CGraphics::CGraphics(HWND hwnd)
:	m_HWnd(hwnd), m_bFullScreen(false), m_nRefreshRate(60),
	m_pDevice(NULL), m_bIsGDISurface(true),
	m_DepthStencilFormat(D3DFMT_D16)
{
	// ウィンドウスタイルの保存
	m_WindowStyle=GetWindowLong(hwnd, GWL_STYLE);

	// クライアント領域のサイズを取得
	RECT r;
	GetClientRect(hwnd, &r);
	m_nWidth=r.right-r.left;
	m_nHeight=r.bottom-r.top;

	// Direct3Dインタフェースの作成
	m_pD3D=Direct3DCreate9(D3D_SDK_VERSION);

	// Direct3Dデバイスの作成
	ResetDevice();
}
//MARK值错
bool CCollectionData::OnMarkValueError(TSSmartDoc *pDoc, TSSmartTask *pTask, TSCmdBuffer *pBuffer, int nMark)
{
	CString strText;

	switch(nMark)
	{
	case 0x0b: //授权号不对
		strText.Format("实时收集时返回mark=注册号不对! 数据为:%s. 正在更改注册号!", pBuffer->pBuffer, pBuffer->pBuffer[3]+7);
		ReportLog(pDoc, pTask, RET_SYSERROR, "实时收数", strText.GetBuffer(0));
		return ModifyRegister(pDoc, pBuffer);
		break;
	case 0x05: //
		break;
	default:
		printf("1---实时收集LPORT数据时,返回的状态值不对!!!!\n");
		ResetDevice(pDoc, pBuffer);
		break;
	}
	return true;
}