def test_002_t(self): # set up fg SHR = np.array([0x00, 0x00, 0x00, 0x00, 0xA7]) PHR1 = np.array([2]) PHR2 = np.array([3]) data1 = np.array([34, 87]) data2 = np.array([23, 76, 45]) bytes_in = np.concatenate((SHR, PHR1, data1, SHR, PHR2, data2)) self.src = blocks.vector_source_b(bytes_in) self.deframer = ieee802_15_4.access_code_removal_b(-1) self.snk = blocks.message_debug() self.tb.connect(self.src, self.deframer) self.tb.msg_connect(self.deframer, "out", self.snk, "store") self.tb.start() time.sleep(.5) self.tb.stop() # check data num_msgs = self.snk.num_messages() print num_msgs self.assertTrue(num_msgs == 2) msg1 = self.snk.get_message(0) self.assertFloatTuplesAlmostEqual(data1, pmt.to_python(msg1)[1]) msg2 = self.snk.get_message(1) self.assertFloatTuplesAlmostEqual(data2, pmt.to_python(msg2)[1])
def test_001_t (self): # set up fg SHR = np.array([0x00, 0x00, 0x00, 0x00, 0xA7]) PHR1 = np.array([2]) PHR2 = np.array([3]) data1 = np.array([34, 87]) data2 = np.array([23, 76]) bytes_in = np.concatenate((SHR, PHR1, data1, SHR, PHR2, data2)) self.src = blocks.vector_source_b(bytes_in) self.deframer = ieee802_15_4.access_code_removal_b(2) self.snk = blocks.message_debug() self.tb.connect(self.src, self.deframer) self.tb.msg_connect(self.deframer, "out", self.snk, "store") self.tb.start () time.sleep(0.2) self.tb.stop() # check data num_msgs = self.snk.num_messages() print num_msgs self.assertTrue(num_msgs == 2) msg1 = self.snk.get_message(0) self.assertFloatTuplesAlmostEqual(data1, pmt.to_python(msg1)[1]) msg2 = self.snk.get_message(1) self.assertFloatTuplesAlmostEqual(data2, pmt.to_python(msg2)[1])