C# Class Netduino.Core.Services.Emulator2

Extension of standard Emulator to provide events for key state changes
The standard emulator and derived classes go through several stages of initialization. However, external classes, like a view model don't get to participate in the "notification" of state changes. Thus it is difficult for a view model to know when it is safe to attach to the emulators LCD changed event.

This class is designed to add events to the standard emulator for the Initialize and Uninitialize states and to simplify registration of GPIO pins and LCD display components

Inheritance: Emulator
Mostra file Open project: mlinnen/Netduino-Emulator

Public Methods

Method Description
Emulator2 ( ) : System

Creates a new instance of an Emulator2

InitializeComponent ( ) : void

Triggers the Initialize event

StartEmulator ( ) : void

Start the emulator engine on a new thread

Uses Environment.GetCommandLineArguments()

StartEmulator ( string Args ) : void

Start the emulator engine on a new thread

UninitializeComponent ( ) : void

Triggers the Uninitialize event

Protected Methods

Method Description
RegisterPin ( string Name, Cpu Pin ) : GpioPort

Registers a GPIO pin in the system

Useful method for registering a pin

NOTE: This should only be called from an overload of the LoadDefaultComponents() Method

RegisterPin ( string Name, Cpu Pin, GpioPortMode ExpectedMode, GpioPortMode AllowedMode ) : GpioPort

Registers a GPIO pin in the system

Useful method for registering a pin

NOTE: This should only be called from an overload of the LoadDefaultComponents() Method

RegisterPin ( string Name, Cpu Pin, VirtualKey Key ) : GpioPort

Registers a GPIO pin in the system

Useful method for registering a pin that acts as a button

NOTE: This should only be called from an overload of the LoadDefaultComponents() Method

Method Details

Emulator2() public method

Creates a new instance of an Emulator2
public Emulator2 ( ) : System
return System

InitializeComponent() public method

Triggers the Initialize event
public InitializeComponent ( ) : void
return void

RegisterPin() protected method

Registers a GPIO pin in the system

Useful method for registering a pin

NOTE: This should only be called from an overload of the LoadDefaultComponents() Method

protected RegisterPin ( string Name, Cpu Pin ) : GpioPort
Name string Name for the pin
Pin Microsoft.SPOT.Hardware.Cpu Pin number
return GpioPort

RegisterPin() protected method

Registers a GPIO pin in the system

Useful method for registering a pin

NOTE: This should only be called from an overload of the LoadDefaultComponents() Method

protected RegisterPin ( string Name, Cpu Pin, GpioPortMode ExpectedMode, GpioPortMode AllowedMode ) : GpioPort
Name string Name for the pin
Pin Microsoft.SPOT.Hardware.Cpu Pin number
ExpectedMode GpioPortMode Expected mode for the pin
AllowedMode GpioPortMode Allowed modes for the pin
return GpioPort

RegisterPin() protected method

Registers a GPIO pin in the system

Useful method for registering a pin that acts as a button

NOTE: This should only be called from an overload of the LoadDefaultComponents() Method

protected RegisterPin ( string Name, Cpu Pin, VirtualKey Key ) : GpioPort
Name string Name for the pin
Pin Microsoft.SPOT.Hardware.Cpu Pin number
Key VirtualKey Virtual Key to attach to the pin
return GpioPort

StartEmulator() public method

Start the emulator engine on a new thread
Uses Environment.GetCommandLineArguments()
public StartEmulator ( ) : void
return void

StartEmulator() public method

Start the emulator engine on a new thread
public StartEmulator ( string Args ) : void
Args string Command line arguments
return void

UninitializeComponent() public method

Triggers the Uninitialize event
public UninitializeComponent ( ) : void
return void