void MsgAudioPreview::MatoPrepareComplete( TInt aError )
    {
    if ( aError != KErrNone )
        {
        Cancel();
        
     //   emit notifyPreviewEvent( ToneFetcherEngine::EPreviewError, aError );        
        return;
        }

    TInt ringingVolume = RingingVolume();
    TInt ringingType = RingingType();
    TInt vibra = Vibra();
       
    iTonePlayerStatus = EPlayerInitialized;
    SetToneRingingType( ringingType );
    iTonePlayer->SetVolume( ConvertVolume( ringingVolume ) );
    
    TMdaPriorityPreference pref = (TMdaPriorityPreference) KAudioPrefRingFilePreview;               
    if ( vibra )
        {
        pref = (TMdaPriorityPreference) KAudioPrefRingFilePreviewVibra;
        }
    iTonePlayer->SetPriority( KAudioPriorityPreview, pref );
                                             
    iTonePlayer->Play();
    iTonePlayerStatus = EPlayerPlaying;
    }
Beispiel #2
0
NTSTATUS
IOCTL_GetStatus(
	PIRP pIrp, 
	PULONG pulSize
	)
/*++

Routine Description:

	This routine is called when received IOCTL_DRBDLOCK_GET_STATUS and returns status of drbdlock.

Arguments:

	pIrp - Pointer to the irp of device control.
	pulSize - The size to be retrieved to caller.

Return Value:

	NtStatus values.

--*/
{
	NTSTATUS status = STATUS_UNSUCCESSFUL;
	PIO_STACK_LOCATION pIrpStack = IoGetCurrentIrpStackLocation(pIrp);	
	PDEVICE_OBJECT pDevice = NULL;
	DRBDLOCK_VOLUME Vol = { 0, };
	PVOID pBuf = pIrp->AssociatedIrp.SystemBuffer;

	if (pBuf == NULL ||
		pIrpStack->Parameters.DeviceIoControl.InputBufferLength < (2 * sizeof(WCHAR)) ||
		pIrpStack->Parameters.DeviceIoControl.OutputBufferLength < sizeof(BOOLEAN))
	{
		drbdlock_print_log("invalid buffer length, input(%u), output(%u)\n",
			pIrpStack->Parameters.DeviceIoControl.InputBufferLength,
			pIrpStack->Parameters.DeviceIoControl.OutputBufferLength);
		return STATUS_INVALID_PARAMETER;
	}

	Vol.volumeType = VOLUME_TYPE_DEVICE_NAME;
	status = RtlStringCchCopyW(Vol.volumeID.volumeName, DRBDLOCK_VOLUMENAME_MAX_LEN, pBuf);

	if (!NT_SUCCESS(status))
		return status;

	status = ConvertVolume(&Vol, &pDevice);

	if (NT_SUCCESS(status))
	{
		BOOLEAN r = isProtectedVolume(pDevice);

		RtlCopyMemory(pBuf, &r, sizeof(BOOLEAN));

		*pulSize = sizeof(BOOLEAN);
	}

	return status;
}
void MsgAudioPreview::MdapcInitComplete( TInt aError, 
                        const TTimeIntervalMicroSeconds& /* aDuration */ )
    {
    if ( aError != KErrNone )
        {
        Cancel();
    //    emit notifyPreviewEvent( ToneFetcherEngine::EPreviewError, aError );
        return;
        }
        

    TInt ringingVolume = RingingVolume();
    TInt ringingType = RingingType();
    TInt vibra = Vibra();
    TInt echo3D = Echo3D();
    TInt effect3D = Effect3D();

    

    iAudioPlayerStatus = EPlayerInitialized;
    SetAudioRingingType( ringingType );
    iAudioPlayer->SetVolume( ConvertVolume( ringingVolume ) );
    
    TMdaPriorityPreference pref = (TMdaPriorityPreference) KAudioPrefRingFilePreview;               
    if ( vibra )
        {
        pref = (TMdaPriorityPreference) KAudioPrefRingFilePreviewVibra;
        }
    iAudioPlayer->SetPriority( KAudioPriorityPreview, pref );
     
    iAudioPlayerStatus = EPlayerPlaying;
    
    if ( effect3D == EProfile3DEffectOff )
        {
        iAudioPlayer->Play();  // 3D not used
        return;
        }

    if ( !i3dRingingTonePlugin )
        {
        TUid emptyUid = { 0 };
        TRAPD( err, i3dRingingTonePlugin = C3DRingingToneInterface::NewL( emptyUid ) );
        if ( err != KErrNone || !i3dRingingTonePlugin )
            {
            iAudioPlayer->Play();
            return;
            }
        }       
   
    i3dRingingTonePlugin->SetAttr( E3DRTIAttr3DEffect, effect3D );
    i3dRingingTonePlugin->SetAttr( E3DRTIAttr3DEcho, echo3D );    
    i3dRingingTonePlugin->SetAttr( E3DRTIAttrDrmPlayerUtility, iAudioPlayer );
    TRAP_IGNORE( i3dRingingTonePlugin->PlayL() );

    iAudioPlayerStatus = EPlayerPlayingWith3DEffect;
    }
Beispiel #4
0
VOID
drbdlockCallbackFunc(
	IN PVOID Context,
	IN PVOID Argument1,
	IN PVOID Argument2
	)
/*++

Routine Description:

	This routine is called whenever other driver notifies drbdlock's callback object.

Arguments:

	Context - not used.
	Argument1 - Pointer to the DRBDLOCK_VOLUME_CONTROL data structure containing volume information to be (un)blocked.
	Argument2 - not used.

Return Value:

	None.

--*/
{
	UNREFERENCED_PARAMETER(Context);
	UNREFERENCED_PARAMETER(Argument2);

	PDRBDLOCK_VOLUME_CONTROL pVolumeControl = (PDRBDLOCK_VOLUME_CONTROL)Argument1;
	PDEVICE_OBJECT pVolObj = NULL;
	NTSTATUS status = STATUS_UNSUCCESSFUL;
	ULONG ulSize = 0;
	POBJECT_NAME_INFORMATION pNameInfo = NULL;

	if (pVolumeControl == NULL)
	{
		// invalid parameter.
		drbdlock_print_log("pVolumeControl is NULL\n");
		return;
	}
	
	status = ConvertVolume(&pVolumeControl->volume, &pVolObj);
	if (!NT_SUCCESS(status))
	{
		drbdlock_print_log("ConvertVolume failed, status : 0x%x\n", status);
		return;
	}

	if (STATUS_INFO_LENGTH_MISMATCH == ObQueryNameString(pVolObj, NULL, 0, &ulSize))
	{
		pNameInfo = (POBJECT_NAME_INFORMATION)ExAllocatePool(NonPagedPool, ulSize);		
		if (pNameInfo)
		{
			status = ObQueryNameString(pVolObj, pNameInfo, ulSize, &ulSize);
			if (!NT_SUCCESS(status))
			{
				ulSize = 0;
			}
		}
	}	

	if (pVolumeControl->bBlock)
	{
		if (AddProtectedVolume(pVolObj))
		{			
			drbdlock_print_log("volume(%ws) has been added as protected\n", ulSize? pNameInfo->Name.Buffer : L"NULL");
		}
		else
		{
			drbdlock_print_log("volume(%ws) add failed\n", ulSize ? pNameInfo->Name.Buffer : L"NULL");
		}
	}
	else
	{
		if (DeleteProtectedVolume(pVolObj))
		{
			drbdlock_print_log("volume(%ws) has been deleted from protected volume list\n", ulSize ? pNameInfo->Name.Buffer : L"NULL");
		}
		else
		{
			drbdlock_print_log("volume(%ws) delete failed\n", ulSize ? pNameInfo->Name.Buffer : L"NULL");
		}
	}


}