using System;
using Microsoft.VisualStudio.TestTools.UnitTesting;
using CPF;
using System.Text;
using Microsoft.SPOT;
using System.Threading;
using HWModules;
using Zmodem;
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();
//TODO bt.detachEventHandler();
byte[] baMsg = Encoding.UTF8.GetBytes("ARGH");
ZmodemSender zs = new ZmodemSender(bt.IOPort, "\\SD\\graph.pdf");
int ret = 0;
do
{
ret = zs.doTasks();
} while (ret == 0);
}
///
/// Test that the zmodem receiver works all on its own, using the bluetooth serial port
///
[TestMethod]
public void TestBlueToothZmodemReceive()
{
InitBT();
//TODO bt.detachEventHandler();
ZmodemReceiver zr = new ZmodemReceiver(bt.IOPort, true);
zr.filePrefix = "\\SD\\";
int ret = 0;
do
{
ret = zr.doTasks();
} while (ret == 0);
}
private static BTConsole bt;
private bool runonce = false;
public void InitBT()
{
if (!runonce)
{
runonce = true;
bt = BTConsole.Instance;
bt.init();
//TODO bt.detachEventHandler();
}
}
}
}