Example #1
0
def main():
    """ Parser Options """
    parser = OptionParser (option_class=eng_option)
    manager.add_parser_options (parser)
    (options, args) = parser.parse_args ()
    if len(args)!=0:
        parser.print_help()
        sys.exit(1)

    phy   = PyHydra.transceiver(options)
    mpif  = PyHydra.mpif_impl(options)
    mpif.set_transceiver(phy)

    g = PyHydra.FuncThread(phy.run)
    g.start()
    mpif.start()

    mgr = manager(options)
    mgr.SetMPIF(mpif)
    
    h = PyHydra.FuncThread(bar, "bar", mgr, mgr.control)
    h.setDaemon(1)
    h.start()
    mgr.run()
Example #2
0
    def make_control(self):
        bspace = 10
        PyHydra.control.make_control(self)

        self.AddLocalMacAddress()
        
        """ Create MCS choicebox_field """
        box = wx.BoxSizer(wx.HORIZONTAL)
        self.make_label("MCS", box, 35)
        self.mcsfield = PyHydra.choicebox_field(self, box, \
                        value="Auto", callback = self.SetMCS, \
                        choices = MimoControl.MCS_CHOICES)
        self.mcsfield.f.SetToolTipString("Select Modulation and Coding Scheme")
        self.AddParam('rate', self.SetMCS)
        self.AddParam('mcs', self.SetMCS)
        if self.options.rate<0: self.SetParam('mcs', "Auto")
        else: self.SetParam('mcs', self.options.rate)
        self.cbox.Add (box, 0, wx.ALIGN_LEFT|wx.ALL, border = bspace)

        ## Create divider
        divider = PyHydra.Divider(self)
        divider.SetBackgroundColour(wx.Colour(200,200,200) )
        self.cbox.AddSpacer((10,10))
        self.cbox.Add(divider, 0, wx.EXPAND|wx.GROW)
        self.cbox.AddSpacer((10,10))
        
        """ Packet Detector Threshold """
        box = wx.BoxSizer(wx.VERTICAL)
        self.pd_threshold = form.slider_field(self, box,  \
                "Packet Detector Threshold (%)", value=self.options.pd_threshold,
                callback=self.SetPacketDetectorThreshold, min=20, max=100)
        self.AddParam('pd_threshold', self.SetPacketDetectorThreshold)
        self.SetParam('pd_threshold', self.options.pd_threshold)
        self.cbox.Add(box, 0, wx.ALIGN_LEFT|wx.ALL, border=bspace)

        """ Enable Beamforming """
        box = wx.BoxSizer(wx.HORIZONTAL)
        self.make_label("Enable Beamforming: ", box, 20)
        self.enable_beamforming = form.radiobox_field(self, box, label="", \
                value = MimoControl.ENABLE_CHOICES[self.options.enable_beamforming], \
                callback=self.SetEnableBeamforming,     \
                choices = MimoControl.ENABLE_CHOICES, major_dimension=0)
        #box.Hide(1, recursive=True), box.Remove(1) # Remove default form label
        self.enable_beamforming.f.SetLabel("")
        self.AddParam('enable_beamforming', self.SetEnableBeamforming)
        self.SetParam('enable_beamforming', self.options.enable_beamforming)
        self.cbox.Add(box, 0, wx.ALIGN_LEFT|wx.ALL, border=bspace)

        """ MAC Monitor Address """
        vbox = wx.BoxSizer(wx.VERTICAL)
        self.monitor = MimoControl.BROADCAST_ADDR
        f = form.static_text_field(self, vbox, value="Monitoring MAC Address: ")
        vbox.AddSpacer((10,10) )
        box = wx.BoxSizer(wx.HORIZONTAL)
        self.fmonitor = form.text_field(self, box, \
                value="FF:"*(mimo.mac_monitor.MAC_ADDR_SIZE-1)+"FF", \
                callback=self.SetMonitor, weight=1)
        self.AddParam('mac_monitor', self.SetMonitor)
        box.AddSpacer((10,10) )
        self.enable_monitor = form.checkbox_field(self, box, "monitor?", \
                value=False, callback=self.SetEnableMonitor, \
                weight=0)
        box.AddSpacer((100,10) )
        vbox.Add(box, 0, wx.EXPAND)
        self.cbox.Add(vbox, 1, wx.EXPAND|wx.ALIGN_LEFT|wx.ALL, border=bspace)
        self.Fit()