MCPcopy Create free account
hub / github.com/360Controller/360Controller / Escape

Method Escape

XBOBTFF/FFDriver.cpp:565–615  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

563}
564
565HRESULT FeedbackXBOBT::Escape(FFEffectDownloadID downloadID, FFEFFESCAPE *escape)
566{
567 if (downloadID!=0) return FFERR_UNSUPPORTED;
568 if (escape->dwSize < sizeof(FFEFFESCAPE)) return FFERR_INVALIDPARAM;
569 escape->cbOutBuffer=0;
570 switch (escape->dwCommand) {
571#if 0
572 case 0x00: // Control motors
573 if(escape->cbInBuffer!=1) return FFERR_INVALIDPARAM;
574 dispatch_sync(Queue, ^{
575 Manual=((unsigned char*)escape->lpvInBuffer)[0]!=0x00;
576 });
577 break;
578
579 case 0x01: // Set motors
580 if (escape->cbInBuffer!=2) return FFERR_INVALIDPARAM;
581 dispatch_sync(Queue, ^{
582 if(Manual) {
583 unsigned char *data=(unsigned char *)escape->lpvInBuffer;
584 unsigned char buf[]={0x00,0x04,data[0],data[1]};
585 Device_Send(&this->device,buf,sizeof(buf));
586 }
587 });
588 break;
589
590 case 0x02: // Set LED
591 if (escape->cbInBuffer!=1) return FFERR_INVALIDPARAM;
592 {
593 dispatch_sync(Queue, ^{
594 unsigned char *data=(unsigned char *)escape->lpvInBuffer;
595 unsigned char buf[]={0x01,0x03,data[0]};
596 Device_Send(&this->device,buf,sizeof(buf));
597 });
598 }
599 break;
600
601 case 0x03: // Power off
602 {
603 dispatch_sync(Queue, ^{
604 unsigned char buf[] = {0x02, 0x02};
605 Device_Send(&this->device, buf, sizeof(buf));
606 });
607 }
608 break;
609#endif
610 default:
611 fprintf(stderr, "XboxOneBTController FF plugin: Unknown escape (%i)\n", (int)escape->dwCommand);
612 return FFERR_UNSUPPORTED;
613 }
614 return FF_OK;
615}
616
617void FeedbackXBOBT::SetForce(LONG LeftLevel, LONG RightLevel, LONG ltLevel, LONG rtLevel)
618{

Callers 1

sEscapeMethod · 0.45

Calls 1

Device_SendFunction · 0.85

Tested by

no test coverage detected