VOID ReturnCompletedBuffers(SessionInfo* session_info) { PWAVEHDR header = NULL; /* Set the current header and test to ensure it's not NULL */ while ( ( header = session_info->wave_queue ) ) { if ( header->dwFlags & WHDR_DONE ) { DWORD message; /* Mark as done, and unqueued */ header->dwFlags &= ~WHDR_INQUEUE; header->dwFlags |= WHDR_DONE; /* Trim it from the start of the queue */ session_info->wave_queue = header->lpNext; /* Choose appropriate notification */ message = (session_info->device_type == WaveOutDevice) ? WOM_DONE : WIM_DATA; DPRINT("Notifying client that buffer 0x%p is done\n", header); /* Notify the client */ NotifyClient(session_info, message, (DWORD_PTR) header, 0); } } /* TODO: Perform I/O as a new buffer may have arrived */ }
void JackEngine::NotifyXRun(int refnum) { if (refnum == ALL_CLIENTS) { NotifyClients(kXRunCallback, false, "", 0, 0); } else { NotifyClient(refnum, kXRunCallback, false, "", 0, 0); } }
// --------------------------------------------------------- // CWtaiHandler::BrowserTelServiceEvent() // --------------------------------------------------------- // void CWtaiHandler::BrowserTelServiceEvent( TBrowserTelServiceState aEvent ) { CLOG_ENTERFN( "CWtaiHandler::BrowserTelServiceEvent()" ); if( EIdle == aEvent ) { NotifyClient(); } }
// --------------------------------------------------------- // CWtaiHandler::HandleUrlEmbeddedL() // --------------------------------------------------------- // void CWtaiHandler::HandleUrlEmbeddedL() { CLOG_ENTERFN( "CWtaiHandler::HandleUrlEmbeddedL()" ); TInt err; TPtrC library_function; iTelService = CBrowserTelService::NewL(); iTelService->AddObserver(this); TRAP( err, library_function.Set( GetWtaiLibraryFunctionL() ) ); TInt count = GetParameterCountL(); TBool confirmDtmfValue = ReadSdConfirmDtmfValueL(); if( ( err == KErrNone ) || ( count <= 0 ) ) { if( 0 == library_function.CompareF( KWPMC ) ) { TPtrC number = GetParameterL( ESchemeWtaiNumber ); CLOG_WRITE_FORMAT( "CWtaiHandler::GetParameter: number: %S", &number ); err = iTelService->MakeCall( number, confirmDtmfValue ); } else if( 0 == library_function.CompareF( KWPSD ) ) { TPtrC dtmf = GetParameterL( ESchemeWtaiNumber ); CLOG_WRITE_FORMAT( "CWtaiHandler::GetParameter: dtmf: %S", &dtmf ); err = iTelService->SendDTMF(dtmf, confirmDtmfValue); } else if( 0 == library_function.CompareF( KWPAP ) ) { TPtrC number = GetParameterL( ESchemeWtaiNumber ); CLOG_WRITE_FORMAT( "CWtaiHandler::GetParameter: number: %S", &number ); TPtrC name = GetParameterL( ESchemeWtaiName ); CLOG_WRITE_FORMAT( "CWtaiHandler::GetParameter: name: %S", &name ); TPtrC email = GetParameterL( ESchemeWtaiEmail ); CLOG_WRITE_FORMAT( "CWtaiHandler::GetParameter: email: %S", &email ); err = iTelService->AddPBEntryL( number, name, email ); } } NotifyClient(); ErrorHandlerL( err ); CLOG_LEAVEFN( "CWtaiHandler::HandleUrlEmbeddedL()" ); }
int JackEngine::ComputeTotalLatencies() { std::vector<jack_int_t> sorted; std::vector<jack_int_t>::iterator it; std::vector<jack_int_t>::reverse_iterator rit; fGraphManager->TopologicalSort(sorted); /* iterate over all clients in graph order, and emit * capture latency callback. */ for (it = sorted.begin(); it != sorted.end(); it++) { NotifyClient(*it, kLatencyCallback, true, "", 0, 0); } /* now issue playback latency callbacks in reverse graph order. */ for (rit = sorted.rbegin(); rit != sorted.rend(); rit++) { NotifyClient(*rit, kLatencyCallback, true, "", 1, 0); } return 0; }
DWORD OpenDevice( DeviceType device_type, UINT device_id, PVOID open_descriptor, DWORD flags, DWORD_PTR private_handle) { SessionInfo* session_info; MMRESULT result; DWORD message; /* This will automatically check for duplicate sessions */ result = CreateSession(device_type, device_id, &session_info); if ( result != MMSYSERR_NOERROR ) { DPRINT("Couldn't allocate session info\n"); return result; } result = OpenKernelDevice(device_type, device_id, GENERIC_READ, &session_info->kernel_device_handle); if ( result != MMSYSERR_NOERROR ) { DPRINT("Failed to open kernel device\n"); DestroySession(session_info); return result; } /* Set common session data */ session_info->flags = flags; /* Set wave/MIDI specific data */ if ( IsWaveDevice(device_type) ) { LPWAVEOPENDESC wave_open_desc = (LPWAVEOPENDESC) open_descriptor; session_info->callback = wave_open_desc->dwCallback; session_info->mme_wave_handle = wave_open_desc->hWave; session_info->app_user_data = wave_open_desc->dwInstance; } else { DPRINT("Only wave devices are supported at present!\n"); DestroySession(session_info); return MMSYSERR_NOTSUPPORTED; } /* Start the processing thread */ result = StartSessionThread(session_info); if ( result != MMSYSERR_NOERROR ) { DestroySession(session_info); return result; } /* Store the session info */ *((SessionInfo**)private_handle) = session_info; /* Send the right message */ message = (device_type == WaveOutDevice) ? WOM_OPEN : (device_type == WaveInDevice) ? WIM_OPEN : (device_type == MidiOutDevice) ? MOM_OPEN : (device_type == MidiInDevice) ? MIM_OPEN : 0xFFFFFFFF; NotifyClient(session_info, message, 0, 0); return MMSYSERR_NOERROR; }
void JackEngine::NotifyActivate(int refnum) { NotifyClient(refnum, kActivateClient, true, "", 0, 0); }
void JackEngine::NotifyClients(int event, int sync, const char* message, int value1, int value2) { for (int i = 0; i < CLIENT_NUM; i++) { NotifyClient(i, event, sync, message, value1, value2); } }
/////////////////////////////////////////////////////////////////////////////// // SDSetCardFeature - Set card feature // Input: hDevice - SD Device Handle // CardFeature - Card Feature to set // StructureSize - size of card feature structure // Output: pCardInfo - Information for the feature // Return: SD_API_STATUS code // Notes: This function is provided to set various card features // in a thread safe manner. SDIO cards utilize shared register sets // between functions. This requires that the // register state be preserved between functions that can be // controlled in separate thread contexts. // This function can potentially block by issuing synchronous bus // request. This function must not be called from a bus request callback /////////////////////////////////////////////////////////////////////////////// SD_API_STATUS CSDDevice::SDSetCardFeature_I(SD_SET_FEATURE_TYPE CardFeature,PVOID pCardInfo,ULONG StructureSize) { SD_API_STATUS status = SD_API_STATUS_SUCCESS; // intermediate status PSD_DATA_TRANSFER_CLOCKS pClocks; // data transfer clocks variable switch (CardFeature) { case SD_IO_FUNCTION_ENABLE: if ((sizeof(SD_IO_FUNCTION_ENABLE_INFO) != StructureSize) || (NULL == pCardInfo)) { DEBUGMSG(SDCARD_ZONE_ERROR, (TEXT("SDSetCardFeature: SD_IO_FUNCTION_ENABLE - Invalid params \n"))); return SD_API_STATUS_INVALID_PARAMETER; } if (Device_SD_IO != m_DeviceType) { DEBUGMSG(SDCARD_ZONE_ERROR, (TEXT("SDSetCardFeature: device is not SDIO ! \n"))); return SD_API_STATUS_INVALID_PARAMETER; } status = SDEnableDisableFunction((PSD_IO_FUNCTION_ENABLE_INFO)pCardInfo, TRUE); break; case SD_IO_FUNCTION_DISABLE: if (Device_SD_IO != m_DeviceType) { DEBUGMSG(SDCARD_ZONE_ERROR, (TEXT("SDSetCardFeature: device is not SDIO ! \n"))); return SD_API_STATUS_INVALID_PARAMETER; } status = SDEnableDisableFunction(NULL, FALSE); break; case SD_IO_FUNCTION_HIGH_POWER: if (Device_SD_IO != m_DeviceType) { DEBUGMSG(SDCARD_ZONE_ERROR, (TEXT("SDSetCardFeature: device is not SDIO ! \n"))); return SD_API_STATUS_INVALID_PARAMETER; } status = SDFunctionSelectPower(FALSE); break; case SD_IO_FUNCTION_LOW_POWER: if (Device_SD_IO != m_DeviceType) { DEBUGMSG(SDCARD_ZONE_ERROR, (TEXT("SDSetCardFeature: device is not SDIO ! \n"))); return SD_API_STATUS_INVALID_PARAMETER; } status = SDFunctionSelectPower(TRUE); break; case SD_INFO_POWER_CONTROL_STATE: if ((sizeof(FUNCTION_POWER_STATE) != StructureSize) || (NULL == pCardInfo)) { DEBUGMSG(SDCARD_ZONE_ERROR, (TEXT("SDSetCardFeature: SD_INFO_POWER_CONTROL_STATE - Invalid params \n"))); return SD_API_STATUS_INVALID_PARAMETER; } if (Device_SD_IO != m_DeviceType) { DEBUGMSG(SDCARD_ZONE_ERROR, (TEXT("SDSetCardFeature: device is not SDIO ! \n"))); return SD_API_STATUS_INVALID_PARAMETER; } status = GetFunctionPowerState((PFUNCTION_POWER_STATE)pCardInfo); break; case SD_IO_FUNCTION_SET_BLOCK_SIZE: if ((sizeof(DWORD) != StructureSize) || (NULL == pCardInfo)) { DEBUGMSG(SDCARD_ZONE_ERROR, (TEXT("SDSetCardFeature: SD_IO_FUNCTION_SET_BLOCK_SIZE - Invalid params \n"))); return SD_API_STATUS_INVALID_PARAMETER; } if (Device_SD_IO != m_DeviceType) { DEBUGMSG(SDCARD_ZONE_ERROR, (TEXT("SDSetCardFeature: device is not SDIO ! \n"))); return SD_API_STATUS_INVALID_PARAMETER; } status = SDSetFunctionBlockSize(*((DWORD *)pCardInfo)); break; case SD_SET_DATA_TRANSFER_CLOCKS: if ((sizeof(SD_DATA_TRANSFER_CLOCKS) != StructureSize) || (NULL == pCardInfo)) { DEBUGMSG(SDCARD_ZONE_ERROR, (TEXT("SDSetCardFeature: SD_SET_DATA_TRANSFER_CLOCKS - Invalid params \n"))); return SD_API_STATUS_INVALID_PARAMETER; } pClocks = (PSD_DATA_TRANSFER_CLOCKS)pCardInfo; m_SDCardInfo.SDMMCInformation.DataAccessReadClocks = pClocks->ReadClocks; m_SDCardInfo.SDMMCInformation.DataAccessWriteClocks = pClocks->WriteClocks; status = SD_API_STATUS_SUCCESS; break; case SD_IS_FAST_PATH_AVAILABLE: status = SD_API_STATUS_SUCCESS; break; case SD_FAST_PATH_DISABLE: // Disable the use of Fast-Path for testing. m_SDCardInfo.SDIOInformation.Flags |= FSTPTH_DISABLE; status = SD_API_STATUS_SUCCESS; break; case SD_FAST_PATH_ENABLE: #ifdef _FASTPATH_ENABLE_ // Always use Fast-Path operations. m_SDCardInfo.SDIOInformation.Flags &= ~ FSTPTH_DISABLE; #else m_SDCardInfo.SDIOInformation.Flags |= FSTPTH_DISABLE; #endif status = SD_API_STATUS_SUCCESS; break; case SD_IS_SOFT_BLOCK_AVAILABLE: status = SD_API_STATUS_SUCCESS; break; case SD_SOFT_BLOCK_FORCE_UTILIZATION: // Always use Soft-Block operations. m_SDCardInfo.SDIOInformation.Flags |= SFTBLK_USE_ALWAYS; status = SD_API_STATUS_SUCCESS; break; case SD_SOFT_BLOCK_DEFAULT_UTILIZATON: // Use hardware multi-block operations if supported by the card, // otherwise use Soft-Block. m_SDCardInfo.SDIOInformation.Flags &= ~ SFTBLK_USE_ALWAYS; status = SD_API_STATUS_SUCCESS; break; case SD_SET_CARD_INTERFACE: { if ((sizeof(SD_CARD_INTERFACE) != StructureSize) || (NULL == pCardInfo)) { DEBUGMSG(SDCARD_ZONE_ERROR, (TEXT("SDSetCardFeature: SD_SET_CARD_INTERFACE - Invalid params \n"))); return SD_API_STATUS_INVALID_PARAMETER; } PSD_CARD_INTERFACE pCardInterface = (PSD_CARD_INTERFACE) pCardInfo ; SD_CARD_INTERFACE_EX sdCardInterfaceEx; memset (&sdCardInterfaceEx, 0, sizeof(sdCardInterfaceEx)); sdCardInterfaceEx.ClockRate = pCardInterface->ClockRate; sdCardInterfaceEx.InterfaceModeEx.bit.sdWriteProtected = (pCardInterface->WriteProtected?1:0); sdCardInterfaceEx.InterfaceModeEx.bit.sd4Bit = (pCardInterface->InterfaceMode == SD_INTERFACE_SD_4BIT?1:0) ; status =SetCardFeature_Interface(sdCardInterfaceEx); break; } case SD_SET_CARD_INTERFACE_EX: { if ((sizeof(SD_CARD_INTERFACE_EX) != StructureSize) || (NULL == pCardInfo)) { DEBUGMSG(SDCARD_ZONE_ERROR, (TEXT("SDSetCardFeature: SD_SET_CARD_INTERFACE_EX - Invalid params \n"))); return SD_API_STATUS_INVALID_PARAMETER; } status = SetCardFeature_Interface(*(PSD_CARD_INTERFACE_EX)pCardInfo); break; } case SD_SET_CLOCK_STATE_DURING_IDLE: if ( (sizeof(BOOL) != StructureSize) || (NULL == pCardInfo) ) { DEBUGMSG(SDCARD_ZONE_ERROR,(TEXT("SDSetCardFeature: SD_SET_CLOCK_ON_DURING_IDLE - Invalid params \n"))); return SD_API_STATUS_INVALID_PARAMETER; } // prompt the host to turn on or off the clock during the idle state based on the client's // request. status = m_sdSlot.GetHost().SlotOptionHandler(m_sdSlot.GetSlotIndex(), SDHCDSetClockStateDuringIdle, pCardInfo,StructureSize); DEBUGMSG(SDCARD_ZONE_INFO, (TEXT("SDSetCardFeature: SDHCDSetClockStateDuringIdle finished with status: %x\n"), status)); break; case SD_CARD_FORCE_RESET: DbgPrintZo(SDCARD_ZONE_INIT, (TEXT("SDSetCardFeature: call SD_CARD_FORCE_RESET \n"))); m_sdSlot.PostEvent(SlotResetRequest); break; case SD_CARD_SELECT_REQUEST: // request made by client driver to select the card. The request will not be honored // until all client drivers in this slot make such request. { BOOL bAllFunctionsRequestedCardSelect = TRUE;; DbgPrintZo(SDCARD_ZONE_INIT,(TEXT("SDSetCardFeature: call SD_CARD_SELECT_REQUEST \n"))); m_bCardSelectRequest = TRUE; NotifyClient(SDCardSelectRequest); for (DWORD dwIndex = 0; dwIndex < SD_MAXIMUM_DEVICE_PER_SLOT; dwIndex++) { CSDDevice * pDevice = m_sdSlot.GetFunctionDevice(dwIndex); if (pDevice != NULL) { if (pDevice->m_bCardSelectRequest == FALSE && pDevice->GetDeviceType()!= Device_Unknown ) { bAllFunctionsRequestedCardSelect = FALSE; } pDevice->DeRef(); } } if (bAllFunctionsRequestedCardSelect == FALSE) { DbgPrintZo(SDCARD_ZONE_INFO, (TEXT("SDSetCardFeature: SD_CARD_SELECT_REQUEST - request is pending\n"))); return SD_API_STATUS_PENDING; } DbgPrintZo(SDCARD_ZONE_INIT, (TEXT("SDSetCardFeature: SD_CARD_SELECT_REQUEST - request is processing\n"))); m_sdSlot.PostEvent(SlotSelectRequest); } break; case SD_CARD_DESELECT_REQUEST: { BOOL bAllFunctionsRequestedCardDeselect= TRUE;; DbgPrintZo(SDCARD_ZONE_INIT, (TEXT("SDSetCardFeature: call SD_CARD_DESELECT_REQUEST \n"))); if (!m_bCardDeselectRequest) { m_bCardDeselectRequest = TRUE; NotifyClient(SDCardDeselectRequest); } for (DWORD dwIndex = 0; dwIndex < SD_MAXIMUM_DEVICE_PER_SLOT; dwIndex++) { CSDDevice * pDevice = m_sdSlot.GetFunctionDevice(dwIndex); if (pDevice != NULL) { if (pDevice->m_bCardDeselectRequest == FALSE && pDevice->GetDeviceType()!= Device_Unknown) { bAllFunctionsRequestedCardDeselect = FALSE ; } pDevice->DeRef(); } } if (bAllFunctionsRequestedCardDeselect == FALSE) { DbgPrintZo(SDCARD_ZONE_INFO, (TEXT("SDSetCardFeature: SD_CARD_DESELECT_REQUEST - request is pending\n"))); return SD_API_STATUS_PENDING; } DbgPrintZo(SDCARD_ZONE_INIT, (TEXT("SDSetCardFeature: SD_CARD_DESELECT_REQUEST - request is processing\n"))); m_sdSlot.PostEvent(SlotDeselectRequest); } break; case SD_SET_SWITCH_FUNCTION: { if (pCardInfo!=NULL && StructureSize >= sizeof(SD_CARD_SWITCH_FUNCTION)) { PSD_CARD_SWITCH_FUNCTION psdSwitchFunction = (PSD_CARD_SWITCH_FUNCTION)pCardInfo; status = SwitchFunction((PSD_CARD_SWITCH_FUNCTION)pCardInfo,FALSE); } } break; case SD_DMA_ALLOC_PHYS_MEM: if (pCardInfo!=NULL && StructureSize >= sizeof(SD_HOST_ALLOC_FREE_DMA_BUFFER)) { status = m_sdSlot.GetHost().SlotOptionHandler(m_sdSlot.GetSlotIndex(),SDHCAllocateDMABuffer, pCardInfo,sizeof(SD_HOST_ALLOC_FREE_DMA_BUFFER)); } break; case SD_DMA_FREE_PHYS_MEM: if (pCardInfo!=NULL && StructureSize >= sizeof(SD_HOST_ALLOC_FREE_DMA_BUFFER)) { status = m_sdSlot.GetHost().SlotOptionHandler(m_sdSlot.GetSlotIndex(),SDHCFreeDMABuffer, pCardInfo,sizeof(SD_HOST_ALLOC_FREE_DMA_BUFFER)); } break; default: status = SD_API_STATUS_INVALID_PARAMETER; break; } return status; }
// --------------------------------------------------------- // CMailToHandler::HandleUrlEmbeddedL() // --------------------------------------------------------- // void CMailToHandler::HandleUrlEmbeddedL() { CLOG_ENTERFN( "CMailToHandler::HandleUrlEmbeddedL()" ); //TPtrC path = iParsedUrl->Des(); iTelService = CBrowserTelService::NewL(); iTelService->AddObserver( this ); TPtrC recipient = GetField( KMailto ); TPtrC subject = GetField( KSubject ); TPtrC msgBody = GetField( KBody ); TPtrC cC = GetField( KCc ); TPtrC tO = GetField( KTo ); TPtrC bCC = GetField( KBcc ); HBufC* rec = ChangeSeparationLC( recipient ); HBufC* ccrec = ChangeSeparationLC( cC ); HBufC* torec = ChangeSeparationLC( tO ); HBufC* bccrec = ChangeSeparationLC( bCC ); HBufC* allrec = HBufC::NewLC( ccrec->Length() + torec->Length() + bccrec->Length() + 3*KComma().Length() ); if( ccrec->Length() != 0 ) { if( allrec->Length() != 0 ) { allrec->Des().Append( KComma() ); } allrec->Des().Append( ccrec->Des() ); } if( torec->Length() != 0 ) { if( allrec->Length() != 0 ) { allrec->Des().Append( KComma() ); } allrec->Des().Append( torec->Des() ); } if( bccrec->Length() != 0 ) { if( allrec->Length() != 0 ) { allrec->Des().Append( KComma() ); } allrec->Des().Append( bccrec->Des() ); } if( rec->Length() > 0 ) { TChar ch1('?'); TChar ch2('&'); TChar recchar((*rec)[ rec->Length() - 1]); if( recchar == ch1 ) { rec->Des().SetLength(rec->Length() - 1); } TChar recchar2((*rec)[ rec->Length() - 1]); if( recchar2 == ch2 ) { rec->Des().SetLength(rec->Length() - 1); } } if( allrec->Length() > 0 ) { TChar ch1('?'); TChar ch2('&'); TChar allrecchar1( (*allrec)[ allrec->Length() - 1] ); if( allrecchar1 == ch1 ) { allrec->Des().SetLength(allrec->Length() - 1); } TChar allrecchar2( (*allrec)[ allrec->Length() - 1] ); if( allrecchar2 == ch2 ) { allrec->Des().SetLength(allrec->Length() - 1); } } TRAPD( err, iTelService->SendEmailMessageL( rec->Des(), allrec->Des(), subject, msgBody, ETrue) ); CleanupStack::PopAndDestroy( 5 ); // rec, ccrec, torec, bccrec, allrec NotifyClient(); ErrorHandlerL( err ); CLOG_LEAVEFN( "CMailToHandler::HandleUrlEmbeddedL()" ); }