public function setFrame($frame) { $this->setStatus(Buffer::unpackInt8u($frame)); if ($this->getStatus() == Status::SUCCESS) { $this->setNeighborTableEntries(Buffer::unpackInt8u($frame)); $this->setStartIndex(Buffer::unpackInt8u($frame)); $neighbor_table_list_count = Buffer::unpackInt8u($frame); for ($i = 0; $i < $neighbor_table_list_count; $i++) { $neighbor_descriptor = new NeighborDescriptor(); $neighbor_descriptor->consumeFrame($frame); $this->addNeighborDescriptor($neighbor_descriptor); } } }
public function testInclusionByStaticConstructor() { $base_frame = MgmtLqiRspCommand::constructSuccess(80, 10, [NeighborDescriptor::construct("3781220488658316", "3781220489559882", Status::SUCCESS, NeighborDescriptor::ZIGBEE_END_DEVICE, NeighborDescriptor::RECEIVER_ON_WHEN_IDLE, NeighborDescriptor::RELATION_NEIGHBOR_IS_SIBLING, NeighborDescriptor::NEIGHBOR_ACCEPTS_JOIN_REQUESTS_UNKNOWN, 0xf, 0xf0), NeighborDescriptor::construct("1231534523", "131412415445", Status::SUCCESS, NeighborDescriptor::ZIGBEE_COORDINATOR, NeighborDescriptor::RECEIVER_OFF_WHEN_IDLE, NeighborDescriptor::RELATION_NEIGHBOR_IS_CHILD, NeighborDescriptor::NEIGHBOR_IS_ACCEPTING_JOIN_REQUESTS, 0x1f, 0xf2)]); $transaction_id = 20; $parent = ZDPFrame::construct($base_frame, $transaction_id); $this->assertInstanceOf("Munisense\\Zigbee\\ZDP\\Network\\MgmtLqiRspCommand", $parent->getPayloadObject()); $this->assertEquals($base_frame->displayFrame(), $parent->displayPayload()); }