示例#1
0
    def send_pkt(self, mac_msg, eof=False):
        """
        Send the payload.

        @param payload: data to send
        @type payload: string
        """
        if eof:
            msg = gr.message(1)             # tell self._pkt_input we're not sending any more packets
            
        else: 
            info = mac_msg["INFO"]              # this dictionary vector contains tx information that will be used during the encoding process                     
	    N_cbps            = info["N_cbps"]     # Upload the number of Coded bits per OFDM Symbol
	    N_bpsc            = info["N_bpsc"]     # Upload the number of Coded bits per sub-carrier
            N_rate            = info["rate"]   # Upload the data rate code
	    N_sym             = info["N_sym"]      # Upload the OFDM Symbols' number
        
        # MODIFIED FROM ORIGINAL
        # It is necessary to update the payload and length field on every packet transmitted 
            (pkt,Length) = mac_msg["MPDU"], mac_msg["LENGTH"] 

            
            #print"Txtime in microseconds:",info["txtime"]
            #print"Length of MPDU in bytes = ", info["packet_len"]
            #print"Number of DATA OFDM symbols = ", info["N_sym"]    
            #print"Number of padding bits = ", info["N_pad"]

         
        # Encoding operations
	    (pkt_scrambled,Length) = ofdm_packet_utils.scrambler(pkt,Length)
	    pkt_coded = ofdm_packet_utils.conv_encoder(pkt_scrambled, Length, self._regime, N_cbps, N_bpsc, N_sym, N_rate)
	    pkt_interleaved = ofdm_packet_utils.interleaver(pkt_coded , self._regime, N_cbps, N_bpsc)
	    msg = gr.message_from_string(pkt_interleaved)
        self._pkt_input.msgq().insert_tail(msg)
示例#2
0
文件: ftw_ofdm.py 项目: UpYou/ofdm
    def send_pkt(self, payload='', eof=False):
        """
        Send the payload.

        @param payload: data to send
        @type payload: string
        """
        if eof:
            msg = gr.message(1)              # tell self._pkt_input we're not sending any more packets
        else: 
            info = ofdm_packet_utils.get_info(payload, self._regime, self._symbol_time)
	    N_cbps            = info["N_cbps"]
	    N_bpsc            = info["N_bpsc"]
            N_rate            = info["rate"]
	    N_sym             = info["N_sym"]

	    (pkt,Length) = ofdm_packet_utils.ftw_make(payload,self._regime, self._symbol_time)
	    (pkt_scrambled,Length) = ofdm_packet_utils.scrambler(pkt,Length)	
#            print
#            print conv_packed_binary_string_to_1_0_string(pkt_scrambled)	
	    pkt_coded = ofdm_packet_utils.conv_encoder(pkt_scrambled, Length, self._regime, N_cbps, N_bpsc, N_sym, N_rate)
#            print
#            print conv_packed_binary_string_to_1_0_string(pkt_coded)
	    pkt_interleaved = ofdm_packet_utils.interleaver(pkt_coded , self._regime, N_cbps, N_bpsc)
#            print
#            print conv_packed_binary_string_to_1_0_string(pkt_interleaved)
	    msg = gr.message_from_string(pkt_interleaved) 

        self._pkt_input.msgq().insert_tail(msg)
示例#3
0
文件: ftw_ofdm.py 项目: ljxangus/ofdm
    def send_pkt(self, payload='', eof=False):
        """
        Send the payload.

        @param payload: data to send
        @type payload: string
        """
        if eof:
            msg = gr.message(
                1)  # tell self._pkt_input we're not sending any more packets
        else:
            info = ofdm_packet_utils.get_info(payload, self._regime,
                                              self._symbol_time)
            N_cbps = info["N_cbps"]
            N_bpsc = info["N_bpsc"]
            N_rate = info["rate"]
            N_sym = info["N_sym"]

            (pkt, Length) = ofdm_packet_utils.ftw_make(payload, self._regime,
                                                       self._symbol_time)
            (pkt_scrambled, Length) = ofdm_packet_utils.scrambler(pkt, Length)
            #            print
            #            print conv_packed_binary_string_to_1_0_string(pkt_scrambled)
            pkt_coded = ofdm_packet_utils.conv_encoder(pkt_scrambled, Length,
                                                       self._regime, N_cbps,
                                                       N_bpsc, N_sym, N_rate)
            #            print
            #            print conv_packed_binary_string_to_1_0_string(pkt_coded)
            pkt_interleaved = ofdm_packet_utils.interleaver(
                pkt_coded, self._regime, N_cbps, N_bpsc)
            #            print
            #            print conv_packed_binary_string_to_1_0_string(pkt_interleaved)
            msg = gr.message_from_string(pkt_interleaved)

        self._pkt_input.msgq().insert_tail(msg)