int DragAndDropService::init(VBOXHGCMSVCFNTABLE *pTable) { /* Register functions. */ pTable->pfnHostCall = svcHostCall; pTable->pfnSaveState = NULL; /* The service is stateless, so the normal */ pTable->pfnLoadState = NULL; /* construction done before restoring suffices */ pTable->pfnRegisterExtension = svcRegisterExtension; modeSet(VBOX_DRAG_AND_DROP_MODE_OFF); m_pManager = new DnDManager(&DragAndDropService::progressCallback, this); return VINF_SUCCESS; }
int DragAndDropService::hostCall(uint32_t u32Function, uint32_t cParms, VBOXHGCMSVCPARM paParms[]) { int rc = VINF_SUCCESS; if (u32Function == DragAndDropSvc::HOST_DND_SET_MODE) { if (cParms != 1) rc = VERR_INVALID_PARAMETER; else if (paParms[0].type != VBOX_HGCM_SVC_PARM_32BIT) rc = VERR_INVALID_PARAMETER; else modeSet(paParms[0].u.uint32); } else if (modeGet() != VBOX_DRAG_AND_DROP_MODE_OFF) { rc = m_pManager->addMessage(u32Function, cParms, paParms); if ( RT_SUCCESS(rc) && !m_clientQueue.isEmpty()) { HGCM::Client *pClient = m_clientQueue.first(); /* Check if this was a request for getting the next host * message. If so, return the message id and the parameter * count. The message itself has to be queued. */ if (pClient->message() == DragAndDropSvc::GUEST_DND_GET_NEXT_HOST_MSG) { DO(("client is waiting for next host msg\n")); // rc = m_pManager->nextMessageInfo(&paParms[0].u.uint32, &paParms[1].u.uint32); uint32_t uMsg1; uint32_t cParms1; rc = m_pManager->nextMessageInfo(&uMsg1, &cParms1); if (RT_SUCCESS(rc)) { pClient->addMessageInfo(uMsg1, cParms1); m_pHelpers->pfnCallComplete(pClient->handle(), rc); m_clientQueue.removeFirst(); delete pClient; } else AssertMsgFailed(("Should not happen!")); } else AssertMsgFailed(("Should not happen!")); } // else // AssertMsgFailed(("Should not happen %Rrc!", rc)); } LogFlowFunc(("rc=%Rrc\n", rc)); return rc; }
void Light::setup() { pinMode(pin, OUTPUT); modeSet(NORMAL); off(); }
void Light::blinkStop(int state) { modeSet(NORMAL); state == OFF ? off() : on(); }
void Light::blinkStart(int _interval) { modeSet(BLINKING); interval = _interval; }