Set<RoutingTable> routes; RoutingTable route1 = new RoutingTable(); route1.setDestinationAddress(12345); route1.setNextHopAddress(98765); route1.setStatus(DiscoveryState.ACTIVE); route1.setRouteRecordRequired(false); RoutingTable route2 = new RoutingTable(); route2.setDestinationAddress(12345); route2.setNextHopAddress(98765); route2.setStatus(DiscoveryState.ACTIVE); route2.setRouteRecordRequired(false); RoutingTable route3 = new RoutingTable(); route3.setDestinationAddress(12345); route3.setNextHopAddress(98765); route3.setStatus(DiscoveryState.INACTIVE); route3.setRouteRecordRequired(false); RoutingTable route4 = new RoutingTable(); route4.setDestinationAddress(54321); route4.setNextHopAddress(98765); route4.setStatus(DiscoveryState.INACTIVE); route4.setRouteRecordRequired(false);
object.put("destination", route.getDestinationAddress()); object.put("next_hop", route.getNextHopAddress()); object.put("state", route.getStatus()); jsonBuilder.append(ZigBeeBindingConstants.propertiesToJson(object));
out.println(route.toString());
break; case ROUTING_TABLE: RoutingTable routingTable = new RoutingTable(); routingTable.deserialize(this); value[0] = routingTable; break;
object.put("destination", route.getDestinationAddress()); object.put("next_hop", route.getNextHopAddress()); object.put("state", route.getStatus()); jsonBuilder.append(ZigBeeBindingConstants.propertiesToJson(object));
@Test public void testReceive() { // Short response - ie not extended int[] packet = getPacketData("00 00 01 00 01 2A 2F 00 35 38"); ManagementRoutingResponse routingResponse = new ManagementRoutingResponse(); DefaultDeserializer deserializer = new DefaultDeserializer(packet); ZclFieldDeserializer fieldDeserializer = new ZclFieldDeserializer(deserializer); routingResponse.deserialize(fieldDeserializer); System.out.println(routingResponse); assertEquals(1, (int) routingResponse.getRoutingTableEntries()); assertEquals(0, (int) routingResponse.getStartIndex()); List<RoutingTable> routes = routingResponse.getRoutingTableList(); assertEquals(1, routes.size()); assertEquals(12074, (int) routes.get(0).getDestinationAddress()); assertEquals(14389, (int) routes.get(0).getNextHopAddress()); assertEquals(DiscoveryState.ACTIVE, routes.get(0).getStatus()); } }