def send_bytes(self, cmd_bytes): # add checksum to commands combo_bytes = cmd_bytes[:] combo_bytes.append(rfm.acs(cmd_bytes)) self.tx_zmq.send_framed_bytes( preamble=self.downlink_bb_params.preamble_bytes, byte_list=combo_bytes, verbose=self.verbose)
def recv_bytes(self, verbose=False): # wait for valid transmission raw_data = self.rx_zmq.poll_bytes(self.verbose) # checksum cs_computed = rfm.acs(raw_data[:-1]) if verbose: print "Raw data bytes:", print raw_data print "Checksum: {}".format(cs_computed) # if we have a valid command, reconfigure the flowgraph if cs_computed == raw_data[-1]: return raw_data[:-1] else: return []
def recv_bytes(self, verbose=False): # wait for valid transmission raw_data = self.rx_zmq.poll_bytes(self.verbose) # checksum cs_computed = rfm.acs(raw_data[:-1]) if verbose: print "Raw data bytes:", print raw_data print "Checksum: {}".format(cs_computed) # if we have a valid payload, else return empty list if cs_computed == raw_data[-1]: #if the payload is the dummy payload, ignore it if raw_data[:-1] != rfm.DUMMY_PAYLOAD: return raw_data[:-1] else: return [] else: return []