Heres a handy bit of code, for capturing debug messages from a USBizi connected via USB, It demonstrates using the MFDeploy interfaces provide by .NET, nb this is a PC Console app.
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
// dll added from tools directory
using Microsoft.NetMicroFramework.Tools.MFDeployTool.Engine;
using System.Threading;
namespace MfTrace
{
class Program
{
static void Main( string[] args )
{
// access the deploy engine
using ( MFDeploy deploy = new MFDeploy() )
{
// pick up the usb devices
IList<MFPortDefinition> portDefs = deploy.EnumPorts( TransportType.USB );
// display them
Console.WriteLine( "USB Devices:" );
foreach ( MFPortDefinition portDef in portDefs )
{
Console.WriteLine( portDef.Name );
}
// check if we have our device
if ( portDefs.Count == 0 )
{
Console.WriteLine( "No device found." );
return;
}
// connect to first device
Console.WriteLine( "Connecting to " + portDefs[0].Name );
using ( MFDevice device = deploy.Connect( portDefs[0] ) )
{
Console.WriteLine( "Connection OK" );
// subscribe to debug events
device.OnDebugText += new EventHandler<DebugOutputEventArgs>( device_OnDebugText );
// and hang around forever
Thread.Sleep( Timeout.Infinite );
}
Console.WriteLine( "No devices found." );
}
}
static void device_OnDebugText( object sender, DebugOutputEventArgs e )
{
Console.Write( e.Text );
//throw new NotImplementedException();
}
}
}