Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

C++ Full code to copy please. Design a multifunction toaster over: The oven will

ID: 3866877 • Letter: C

Question

C++ Full code to copy please. Design a multifunction toaster over: The oven will have four dials/selectors as listed below: A Function selector: Toast, Broil, Warm, Bake (no need to set the time and the temperature when on Toast) A temperature selector: used to set temp from 0 – 450 degree Fahrenheit A time selector: used to set time from 0 to 60 minutes A toast selector: light (sets time to 1 min.), mild (Sets time to 2 min.), dark (sets time to 3 min). Time is automatically set by the toaster selection. The user opens the oven door, pulls the oven tray out, places the food in the tray, pushes the try back in, closes the oven door then sets the dials (not all of them necessarily). Oven has a light indicator that goes on when oven is in use. When oven is done a bell rings and the light goes off. Pick a specific scenario and completely describe it with all possible variations if any. Generate a UML diagram for your use case. Identify the classes and operations, use CRC cards. Present the class diagram for your design. Include all multiplicities. Draw a sequence diagram for the use case in part (a) (optional)Code your design

Explanation / Answer

#include "stdafx.h"
#include "Driver.h"
#include "Device.h"
#include "Queue.h"

#include "internal.h"
#include "driver.tmh"

//Idle setting for the Toaster device
#define IDLEWAKE_TIMEOUT_MSEC 6000


HRESULT
CDriver::OnDeviceAdd(
_In_ IWDFDriver* pDriver,
_In_ IWDFDeviceInitialize* pDeviceInit
)
/*++

Routine Description:

The framework calls this function when a device is being added to
the driver stack.

Arguments:

IWDFDriver - Framework interface. The driver uses this
interface to create device objects.
IWDFDeviceInitialize - Framework interface. The driver uses this
interface to set device parameters before
creating the device obeject.

Return Value:

HRESULT S_OK - Device added successfully

--*/
{
IUnknown *pDeviceCallback = NULL;
IWDFDevice *pIWDFDevice = NULL;
IWDFDevice2 *pIWDFDevice2 = NULL;
IUnknown *pIUnkQueue = NULL;   

//
// UMDF Toaster is a function driver so set is as the power policy owner (PPO)
//
pDeviceInit->SetPowerPolicyOwnership(TRUE);

//
// Create our device callback object.
//
HRESULT hr = CDevice::CreateInstance(&pDeviceCallback);

//
// Ask the framework to create a device object for us.
// We pass in the callback object and device init object
// as creation parameters.
//
if (SUCCEEDED(hr))
{
hr = pDriver->CreateDevice(pDeviceInit,
pDeviceCallback,
&pIWDFDevice);
}

//
// Create the queue callback object.
//

if (SUCCEEDED(hr))
{
hr = CQueue::CreateInstance(&pIUnkQueue);
}

//
// Configure the default queue. We pass in our queue callback
// object to inform the framework about the callbacks we want.
//

if (SUCCEEDED(hr))
{
IWDFIoQueue * pDefaultQueue = NULL;
hr = pIWDFDevice->CreateIoQueue(
pIUnkQueue,
TRUE, // bDefaultQueue
WdfIoQueueDispatchParallel,
TRUE, // bPowerManaged
FALSE, // bAllowZeroLengthRequests
&pDefaultQueue);
SAFE_RELEASE(pDefaultQueue);
}

//
// Enable the device interface.
//

if (SUCCEEDED(hr))
{
hr = pIWDFDevice->CreateDeviceInterface(&GUID_DEVINTERFACE_TOASTER,
NULL);
}
  
//
// IWDFDevice2 interface is an extension of IWDFDevice interface that enables
// Idle and Wake support.
//

//
// Get a pointer to IWDFDevice2 interface
//

if (SUCCEEDED(hr))
{
hr = pIWDFDevice->QueryInterface(__uuidof(IWDFDevice2), (void**) &pIWDFDevice2);
}   

//
// Since this is a virtual device we tell the framework that we cannot wake
// ourself if we sleep in S0. Only way the device can be brought to D0 is if
// the device recieves an I/O from the system.
//

if (SUCCEEDED(hr))
{
  
hr = pIWDFDevice2->AssignS0IdleSettings(
IdleCannotWakeFromS0,
PowerDeviceD3, //the lowest-powered device sleeping state
IDLEWAKE_TIMEOUT_MSEC, //idle timeout
IdleAllowUserControl, //user can control the device's idle behavior.
WdfTrue);

}

//
// TODO: Add the Idle and Wake suupport specific for your hardware
//

SAFE_RELEASE(pDeviceCallback);
SAFE_RELEASE(pIWDFDevice);
SAFE_RELEASE(pIWDFDevice2);
SAFE_RELEASE(pIUnkQueue);   

return hr;
}

VOID
CDriver::OnDeinitialize(
_In_ IWDFDriver * /* pDriver */
)
/*++

Routine Description:

The framework calls this function just before de-initializing itself. All
WDF framework resources should be released by driver before returning from this call.

Arguments:

Return Value:

--*/
{
return ;
}

HRESULT
CDriver::OnInitialize(
_In_ IWDFDriver * /* pDriver */
)
/*++

Routine Description:

The framework calls this function just after loading the driver. The driver can
perform any global, device independent intialization in this routine.

Arguments:

Return Value:

--*/
{
return S_OK;
}

Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
Chat Now And Get Quote