using System; using Microsoft.VisualStudio.TestTools.UnitTesting; using CPF; using CPF.FileTransfer; using CPF.PosixClient; 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"); BTConsole.consolePort.Write(baMsg, 0, baMsg.Length); ZmodemSender zs = new ZmodemSender(BTConsole.consolePort, "\\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(BTConsole.consolePort, true); zr.filePrefix = "\\SD\\"; while (zr.doTasks()) { } } private static BTConsole bt; private bool runonce = false; public void InitBT() { if (!runonce) { runonce = true; bt = new BTConsole(); bt.OpenConsolePort(); bt.detachEventHandler(); } } } }