User manual

GHI Electronics,LLC Embedded Master User Manual
Hardware and Software Library
using GHIElectronics.System;
using GHIElectronics.System.SystemDevices;
using System.Threading;
using Microsoft.SPOT;
namespace MyNamespace
{
class Program
{
public static void Main()
{
// must start system first with an event registered
SystemManager.Start(DevicesUpdate);
// the system does nothing if there is no devices
Thread.Sleep(Timeout.Infinite);
}
// This event is fired when a device is connected/disconnected
public static void DevicesUpdate(SystemEventType type, SystemEventArgs args)
{
if (type == SystemEventType.DevicesConnectionChanged)
{
if (args.isDeviceConnected)
{
Debug.Print("Device Connected. ID: " + args.device.deviceID);
switch (args.device.deviceType)
{
case DeviceType.Mouse:
Debug.Print("Mouse conected");
break;
}
}
else
{
Debug.Print("Device Disconnected. ID: " + args.device.deviceID);
}
}
}
}
}
Reference
GHIElectronics.System
GHIElectronics.System.SystemDevices
GHIElectronics.System.SystemManager
GHIElectronics.System.SystemDevices.Device
GHIElectronics.System.SystemDevices.DeviceType
11.14.1 Low Level USB Host Device Access
Using RawUSBDevice class, the user can access any device. This is useful if GHI does not
already provide a driver for that device. The USB device can be manipulated easily, see
Rev. 2.06 TFT Page 79 of 102 www.ghielectronics.com