コード例 #1
0
ファイル: ZigBee.java プロジェクト: rossbiro/Arduino
      void process(ZigBee zb, byte[] packet, int offset) {
        if (packet.length < offset + 11) {
          return;
        }
        short address16 = (short) bytesToNum(packet, offset, 2);
        long address64 = bytesToNum(packet, offset + 2, 8);
        zb = findOrCreateRemote(address64, address16);
        try {
          zb.updatePan(getLocal().getPan());
        } catch (Exception e) {
          // Ignore it, can't happen.
          e.printStackTrace();
        }

        // Byte 10 is the signal strength, at least in XBee's.
        if (packet.length < offset + 13) {
          return;
        }
        zb.updateNI(bytesToString(packet, offset + 11, 21));

        offset = offset + 11 + zb.getNI().length() + 1;
        // next is parent network address 2 bytes
        // zb.setDeviceType(bytesToNum(packet, offset+2, 1)); // router vs end node vs coordinator
        // next is status 1 byte (reserved)
        if (packet.length < offset + 6) {
          return;
        }
        zb.setProfileID((short) bytesToNum(packet, offset + 4, 2));

        if (packet.length < offset + 8) {
          return;
        }
        zb.setManufacturerID((short) bytesToNum(packet, offset + 6, 2));
      }
コード例 #2
0
ファイル: ZigBee.java プロジェクト: rossbiro/Arduino
 void process(ZigBee zb, byte[] packet, int offset) {
   zb.updatePan(new Long(bytesToNum(packet, offset, 4, packet.length - 1)));
 }