using System; using Microsoft.VisualStudio.TestTools.UnitTesting; using CPF; using CPF.FileTransfer; using System.Text; using Microsoft.SPOT; using System.Threading; namespace CPFUnitTests { [TestClass] public class UnitTestBTZmodem { /// /// Test the zmodem sender class works all on its own using the bluetooth serial port /// [TestMethod] public void TestBlueToothZmodemSend() { InitBT(); bt.detachEventHandler(); byte[] baMsg = Encoding.UTF8.GetBytes("ARGH"); ZmodemSender zs = new ZmodemSender(bt.IOPort, "\\SD\\graph.pdf"); while (zs.doTasks()) { } } /// /// Test that the zmodem receiver works all on its own, using the bluetooth serial port /// [TestMethod] public void TestBlueToothZmodemReceive() { InitBT(); bt.detachEventHandler(); ZmodemReceiver zr = new ZmodemReceiver(bt.IOPort, true); zr.filePrefix = "\\SD\\"; while (zr.doTasks()) { } } private static BTConsole bt; private bool runonce = false; public void InitBT() { if (!runonce) { runonce = true; bt = BTConsole.Instance; bt.OpenConsolePort(); bt.detachEventHandler(); } } } }