Exemple #1
0
  public static void main(String[] args) throws Exception {
    String source = null;
    if (args.length == 2) {
      if (!args[0].equals("-comm")) {
        usage();
        System.exit(1);
      }
      source = args[1];
    } else if (args.length != 0) {
      usage();
      System.exit(1);
    }

    PhoenixSource phoenix;

    if (source == null) {
      phoenix = BuildSource.makePhoenix(PrintStreamMessenger.err);
    } else {
      phoenix = BuildSource.makePhoenix(source, PrintStreamMessenger.err);
    }

    MoteIF mif = new MoteIF(phoenix);
    TestSerial serial = new TestSerial(mif);
    serial.sendPackets();
  }
Exemple #2
0
 public MsgReader(String source) throws Exception {
   if (source != null) {
     moteIF = new MoteIF(BuildSource.makePhoenix(source, PrintStreamMessenger.err));
   } else {
     moteIF = new MoteIF(BuildSource.makePhoenix(PrintStreamMessenger.err));
   }
   client = new RestClient();
 }
  public RadioSignalMeter(String motePort, String outputFile) {
    this.motePort = motePort;
    this.outputFile = outputFile;

    PhoenixSource phoenixLocal = null;

    if (motePort == null) {
      phoenixLocal = BuildSource.makePhoenix(PrintStreamMessenger.err);
    } else {
      phoenixLocal = BuildSource.makePhoenix(motePort, PrintStreamMessenger.err);
    }

    moteIF = new MoteIF(phoenixLocal);
    moteIF.registerListener(new RadioSignalResultsMsg(), this);
  }
Exemple #4
0
  public static void main(String[] args) throws Exception {
    String source = "";
    if (args.length == 2) {
      if (!args[0].equals("-comm")) {
        usage();
        System.exit(1);
      }
      source = args[1];
    } else {
      usage();
      System.exit(1);
    }

    PhoenixSource phoenix;
    if (source == null) {
      phoenix = BuildSource.makePhoenix(PrintStreamMessenger.err);
    } else {
      phoenix = BuildSource.makePhoenix(source, PrintStreamMessenger.err);
    }
    System.out.print(phoenix);
    MoteIF mif = new MoteIF(phoenix);
    PrintfClient client = new PrintfClient(mif);
  }
Exemple #5
0
  static void listen() {
    if (doLogging == true) {
      // first we connect to the database first
      connectDb();
    }
    PacketSource reader = BuildSource.makePacketSource(source);

    if (reader == null) {
      System.out.println("Cannot connect to destination.");
      System.out.println("Did you forget to do network@ip:port? Destination maybe wrong or busy");
    }
    try {
      reader.open(PrintStreamMessenger.err);

      for (; ; ) {
        byte[] packet = reader.readPacket();
        if (doLogging == true) logPacket(packet);
        if (doDisplay == true) PrettyPrint.print(packet);
        System.out.println();
      }
    } catch (IOException e) {
      System.err.println("Error on " + reader.getName() + ": " + e);
    }
  }