Пример #1
0
 public void init() {
   queue.sendMsg(Msg.createZWaveGetVersion((byte) 0xFF), QueuePriority.Command);
   queue.sendMsg(Msg.createZWaveMemoryGetId((byte) 0xFF), QueuePriority.Command);
   queue.sendMsg(Msg.createZWaveGetControllerCapabilities((byte) 0xFF), QueuePriority.Command);
   queue.sendMsg(Msg.createZWaveSerialAPIGetCapabilities((byte) 0xFF), QueuePriority.Command);
   queue.sendMsg(Msg.createZWaveGetSUCNodeId((byte) 0xFF), QueuePriority.Command);
 }
Пример #2
0
  public void handleGetSerialAPICapabilitiesResponse(byte[] data) {
    primaryController.setSerialAPIVersion(new byte[] {data[2], data[3]});
    primaryController.setManufacturerShortId(
        (short) (SafeCast.toShort(data[4]) << 8 | SafeCast.toShort(data[5])));
    primaryController.setProductShortType(
        (short) (SafeCast.toShort(data[6]) << 8 | SafeCast.toShort(data[7])));
    primaryController.setProductShortId(
        (short) (SafeCast.toShort(data[8]) << 8 | SafeCast.toShort(data[9])));
    primaryController.setApiMask(Arrays.copyOfRange(data, 10, 32));

    logs.add(
        String.format(
            "FUNC_ID_SERIAL_API_GET_CAPABILITIES -- Serial API: v%d.%d,"
                + " Man. Id = 0x%04x, Prod. Type = 0x%04x, Prod. Id = 0x%04x",
            primaryController.getSerialAPIVersion()[0],
            primaryController.getSerialAPIVersion()[1],
            primaryController.getManufacturerShortId(),
            primaryController.getProductShortType(),
            primaryController.getProductShortId()));

    Msg msg;
    if (primaryController.isBridgeController()) {
      msg = new Msg((byte) 0xFF, Defs.REQUEST, Defs.FUNC_ID_ZW_GET_VIRTUAL_NODES, false);
      queue.sendMsg(msg, QueuePriority.Command);
    } else if (primaryController.isAPICallSupported(Defs.FUNC_ID_ZW_GET_RANDOM)) {
      msg = new Msg((byte) 0xFF, Defs.REQUEST, Defs.FUNC_ID_ZW_GET_RANDOM, false);
      msg.append((byte) 32);
      queue.sendMsg(msg, QueuePriority.Command);
    }

    msg = new Msg((byte) 0xFF, Defs.REQUEST, Defs.FUNC_ID_SERIAL_API_GET_INIT_DATA, false);
    queue.sendMsg(msg, QueuePriority.Command);

    msg =
        new Msg(
            (byte) 0xFF, Defs.REQUEST, Defs.FUNC_ID_SERIAL_API_APPL_NODE_INFORMATION, false, false);
    msg.appends(new byte[] {Defs.APPLICATION_NODEINFO_LISTENING, 0x02, 0x01, 0x01, 0x2B});
    // msg.appends(new byte[] { Defs.APPLICATION_NODEINFO_LISTENING, 0x02,
    //		0x01, 0x00 });
    queue.sendMsg(msg, QueuePriority.Command);
  }