Exemple #1
0
 static void Main(string[] args) {
   if (args.Length != 2 || !args[0].Equals("-comm")) {
     string exename= System.AppDomain.CurrentDomain.FriendlyName;
     Console.WriteLine("Usage: {0} -comm <source>", exename);
     Console.WriteLine("e.g. {0} -comm serial@com27:115200", exename);
     Console.ReadKey();
     return;
   }
   mote = new MoteIF(args[1]);
   mote.onMessageArrived += mote_onMessageArrived;
   var evt = new AutoResetEvent(false);
   evt.WaitOne();
 }
Exemple #2
0
 static void Main(string[] args) {
   if (args.Length != 2 || !args[0].Equals("-comm")) {
     Console.WriteLine("Usage: TestSerial -comm <source>");
     Console.WriteLine("e.g. TestSerial -comm serial@com27:115200");
     Console.ReadKey();
     return;
   }
   mote = new MoteIF(args[1]);
   mote.onMessageArrived += newMsgHandler;
   Thread sendWorker = new Thread(Send);
   sendWorker.Start();
   var evt = new AutoResetEvent(false);
   evt.WaitOne();
 }
Exemple #3
0
 public Sender(ArrayList args, Prompt prompt) {
   this.prompt = prompt;
   if (!ParseArgs(args)) {
     prompt.WriteLine("send: wrong arguments", prompt.errorTextColor);
     return;
   }
   try{
     mote = new MoteIF(motecom);
   }
   catch(Exception e){
     prompt.WriteLine(e.Message, prompt.errorTextColor);
     return;
   }
 }
Exemple #4
0
    public Listener(MoteIF mote, Prompt prompt) {

      if (mote == null) {
        return;
      }

      motecom = mote.motecom;
      active = true;
      this.mote = mote;
      this.prompt = prompt;
      prompt.WriteLine("Listening on " +motecom+ " (^C or 'exit' returns to prompt)", prompt.successTextColor);
      //Console.CancelKeyPress += stop;
      mote.onMessageArrived += newMsgHandler;
      //evt = new AutoResetEvent(false);
      //evt.WaitOne();
      //Console.CancelKeyPress -= stop;
    }
Exemple #5
0
 public Listener(ArrayList args, Prompt prompt) {
   if (args.Count != 3) {
     prompt.WriteLine("listen: Wrong arguments", prompt.errorTextColor);
     return;
   }
   this.prompt = prompt;
   motecom = args[2].ToString();
   try {
     mote = new MoteIF(motecom);
   } catch (Exception e) {
     prompt.WriteLine(e.Message, prompt.errorTextColor);
     return;
   }
   active = true;
   prompt.WriteLine("Listening on " + motecom + " (^C or 'exit' returns to prompt)", prompt.successTextColor);
   //Console.TreatControlCAsInput = false;
   //Console.CancelKeyPress += stop;
   mote.onMessageArrived += newMsgHandler;
   //evt = new AutoResetEvent(false);
   //evt.WaitOne();
   //Console.TreatControlCAsInput = true;
   //Console.CancelKeyPress -= stop;
 }