Ejemplo n.º 1
0
  @Test
  public void test() {
    GenericDevice dev = new GenericDevice(ConnectionDialog.promptConnection());
    dev.connect();

    dev.send("bcs.io.*;0.3;;", BowlerMethod.POST, "schv", new Object[] {0, 2, 1000});
    dev.disconnect();
  }
Ejemplo n.º 2
0
  public boolean setConnection(BowlerAbstractConnection connection) {
    dev = new GenericDevice(connection);
    // populate list

    ArrayList<String> namespaces = dev.getNamespaces();

    for (String s : namespaces) {
      String[] split = s.split(";");
      DefaultMutableTreeNode namespaceTree = new DefaultMutableTreeNode(split[0]);
      DefaultMutableTreeNode getTree = null;
      DefaultMutableTreeNode postTree = null;
      DefaultMutableTreeNode critTree = null;
      DefaultMutableTreeNode asynTree = null;

      ArrayList<RpcEncapsulation> rpcSet = dev.getRpcList(s);

      for (RpcEncapsulation r : rpcSet) {

        DefaultMutableTreeNode rpcDhild = new DefaultMutableTreeNode(r.getRpc());
        RpcCommandPanel control = new RpcCommandPanel(r, dev, rpcDhild);

        if (r.getDownstreamMethod() == BowlerMethod.GET) {
          if (getTree == null) getTree = new DefaultMutableTreeNode("GET");
          getTree.add(rpcDhild);
        }
        if (r.getDownstreamMethod() == BowlerMethod.POST) {
          if (postTree == null) postTree = new DefaultMutableTreeNode("POST");
          postTree.add(rpcDhild);
        }
        if (r.getDownstreamMethod() == BowlerMethod.CRITICAL) {
          if (critTree == null) critTree = new DefaultMutableTreeNode("CRITICAL");
          critTree.add(rpcDhild);
        }
        if (r.getDownstreamMethod() == BowlerMethod.ASYNCHRONOUS) {
          if (asynTree == null) asynTree = new DefaultMutableTreeNode("ASYNCHRONOUS");
          asynTree.add(rpcDhild);
        }

        commandPanels.add(control);
      }
      if (getTree != null) namespaceTree.add(getTree);
      if (postTree != null) namespaceTree.add(postTree);
      if (critTree != null) namespaceTree.add(critTree);
      if (asynTree != null) namespaceTree.add(asynTree);

      root.add(namespaceTree);
    }

    display = new JTree(root);
    display.addTreeSelectionListener(this);

    add(display, "cell 0 0,alignx leading");
    add(controlPanel, "cell 1 0,alignx trailing");
    return dev.connect();
  }