def onSave(self,event):
		# Save, then hide
		# not very safe but at least no human readable
		passwd=base64.b64encode(self.password.GetValue())
		bb_prefs.set(bb_prefs.SECTION_MAIN,"password",passwd)
		bb_prefs.set(bb_prefs.SECTION_MAIN,"verbose",self.verbose.GetValue())
		bb_prefs.set(bb_prefs.SECTION_MAIN,"veryverbose",self.sverbose.GetValue())
		# Make those take effect right away
		bb_messenging.verbose=self.verbose.GetValue()
		bb_messenging.veryVerbose=self.sverbose.GetValue()
		selection=self.pppdchoices[self.pppdconf.GetSelection()]
		if selection == "--Do not start PPPD--":
			selection=""
		bb_prefs.set(bb_prefs.SECTION_MAIN,"pppd_config",selection)
		bb_prefs.set(bb_prefs.SECTION_MAIN,"pppd_path",self.pppd.GetValue())
		bb_prefs.set(bb_prefs.SECTION_MAIN,"data_mode",self.datamode.GetValue())
		bb_prefs.set(bb_prefs.SECTION_USER_EP,"device",self.device.GetValue())
		bb_prefs.set(bb_prefs.SECTION_USER_EP,"bus",self.bus.GetValue())
		bb_prefs.set(bb_prefs.SECTION_USER_EP,"interface",self.interface.GetValue())
		bb_prefs.set(bb_prefs.SECTION_USER_EP,"readpt",self.rp.GetValue())
		bb_prefs.set(bb_prefs.SECTION_USER_EP,"writept",self.wp.GetValue())
		bb_prefs.set(bb_prefs.SECTION_USER_EP,"modem_readpt",self.mrp.GetValue())
		bb_prefs.set(bb_prefs.SECTION_USER_EP,"modem_writept",self.mwp.GetValue())
		bb_prefs.save_prefs()
		self.Hide()
	def onStart(self, event):
		if self.bbtether!=None and self.bbtether.is_running():
			dlg = wx.MessageDialog(self, "The modem is already Connected.", "Warning!", wx.OK | wx.ICON_INFORMATION)
			dlg.ShowModal()
			dlg.Destroy()
			return
		# ask config to use
		pppdconf=bb_prefs.get_def_string(bb_prefs.SECTION_MAIN, "pppd_config", "")
		# if none picked yet, ask and save in prefs for next time
		if pppdconf == "":
			choices=get_ppp_confs()
			choices.append("--Do not start PPPD--")
			evt=pickEvent(caption="PPP config to use (EX: tmobile) see conf/ folder.",choices=choices,default=pppdconf)
			pppconf=self.onPick(evt)
			print "pppconf:"+str(pppconf)
			if pppconf==None:
				# cancelled
				return
			if pppconf == "--Do not start PPPD--":
				pppconf=""
			bb_prefs.set(bb_prefs.SECTION_MAIN,"pppd_config",pppconf)
			bb_prefs.save_prefs()

		fake_args=self.build_args_from_prefs()
		bb_messenging.log("Will run bbtether with args: "+str(fake_args))
		
		(options,args)=bb_tether.parse_cmd(fake_args)
		self.bbtether = BBTetherThread(options, args)
		self.bbtether.start()
Ejemplo n.º 3
0
 def onSave(self, event):
     # Save, then hide
     # not very safe but at least no human readable
     passwd = base64.b64encode(self.password.GetValue())
     bb_prefs.set(bb_prefs.SECTION_MAIN, "password", passwd)
     bb_prefs.set(bb_prefs.SECTION_MAIN, "verbose", self.verbose.GetValue())
     bb_prefs.set(bb_prefs.SECTION_MAIN, "veryverbose",
                  self.sverbose.GetValue())
     # Make those take effect right away
     bb_messenging.verbose = self.verbose.GetValue()
     bb_messenging.veryVerbose = self.sverbose.GetValue()
     selection = self.pppdchoices[self.pppdconf.GetSelection()]
     if selection == "--Do not start PPPD--":
         selection = ""
     bb_prefs.set(bb_prefs.SECTION_MAIN, "pppd_config", selection)
     bb_prefs.set(bb_prefs.SECTION_MAIN, "pppd_path", self.pppd.GetValue())
     bb_prefs.set(bb_prefs.SECTION_MAIN, "data_mode",
                  self.datamode.GetValue())
     bb_prefs.set(bb_prefs.SECTION_USER_EP, "device",
                  self.device.GetValue())
     bb_prefs.set(bb_prefs.SECTION_USER_EP, "bus", self.bus.GetValue())
     bb_prefs.set(bb_prefs.SECTION_USER_EP, "interface",
                  self.interface.GetValue())
     bb_prefs.set(bb_prefs.SECTION_USER_EP, "readpt", self.rp.GetValue())
     bb_prefs.set(bb_prefs.SECTION_USER_EP, "writept", self.wp.GetValue())
     bb_prefs.set(bb_prefs.SECTION_USER_EP, "modem_readpt",
                  self.mrp.GetValue())
     bb_prefs.set(bb_prefs.SECTION_USER_EP, "modem_writept",
                  self.mwp.GetValue())
     bb_prefs.save_prefs()
     self.Hide()
Ejemplo n.º 4
0
    def onStart(self, event):
        if self.bbtether != None and self.bbtether.is_running():
            dlg = wx.MessageDialog(self, "The modem is already Connected.",
                                   "Warning!", wx.OK | wx.ICON_INFORMATION)
            dlg.ShowModal()
            dlg.Destroy()
            return
        # ask config to use
        pppdconf = bb_prefs.get_def_string(bb_prefs.SECTION_MAIN,
                                           "pppd_config", "")
        # if none picked yet, ask and save in prefs for next time
        if pppdconf == "":
            choices = get_ppp_confs()
            choices.append("--Do not start PPPD--")
            evt = pickEvent(
                caption="PPP config to use (EX: tmobile) see conf/ folder.",
                choices=choices,
                default=pppdconf)
            pppconf = self.onPick(evt)
            print "pppconf:" + str(pppconf)
            if pppconf == None:
                # cancelled
                return
            if pppconf == "--Do not start PPPD--":
                pppconf = ""
            bb_prefs.set(bb_prefs.SECTION_MAIN, "pppd_config", pppconf)
            bb_prefs.save_prefs()

        fake_args = self.build_args_from_prefs()
        bb_messenging.log("Will run bbtether with args: " + str(fake_args))

        (options, args) = bb_tether.parse_cmd(fake_args)
        self.bbtether = BBTetherThread(options, args)
        self.bbtether.start()
Ejemplo n.º 5
0
        bb_messenging.log("***********************************************")
        msgs=["We just ran the initial device Endpoints Scan",
        "This needs to be done only once.",
        "Saved the scan results to "+PREF_FILE,
        "some devices (Bold) do not like being scanned.","",
        "AND WILL NEED THE BATTERY REMOVED / ADDED (just this once)",
        "BEFORE YOU CAN USE THE MODEM."]
        bb_messenging.warn(msgs)
        bb_messenging.log("***********************************************")
        bb_prefs.set(bb_prefs.SECTION_SCANNED_EP,'interface', device.interface)
        bb_prefs.set(bb_prefs.SECTION_SCANNED_EP,'readpt', device.readpt)
        bb_prefs.set(bb_prefs.SECTION_SCANNED_EP,'writept', device.writept)
        bb_prefs.set(bb_prefs.SECTION_SCANNED_EP,'modem_readpt', device.modem_readpt)
        bb_prefs.set(bb_prefs.SECTION_SCANNED_EP,'modem_writept', device.modem_writept)
        bb_messenging.log("Saving EP data: "+str(device.interface)+", "+str(device.readpt)+", "+str(device.writept)+", "+str(device.modem_readpt)+", "+str(device.modem_writept))
        bb_prefs.save_prefs()

def clear_halt(device, endpt):
    device.handle.clearHalt(endpt)

def set_bb_power(device):
    '''
    Added try / expect blocks as I had reports of failure(which ?) on storm 9500
    '''
    bb_messenging.status("Increasing USB power - for charging")
    try:
        buffer= [0,0]
        device.handle.controlMsg(0xc0, 0xa5, buffer, 0 , 1)
        buffer = []
        device.handle.controlMsg(0x40, 0xA2, buffer, 0 , 1)
        # reset
Ejemplo n.º 6
0
        ]
        bb_messenging.warn(msgs)
        bb_messenging.log("***********************************************")
        bb_prefs.set(bb_prefs.SECTION_SCANNED_EP, 'interface',
                     device.interface)
        bb_prefs.set(bb_prefs.SECTION_SCANNED_EP, 'readpt', device.readpt)
        bb_prefs.set(bb_prefs.SECTION_SCANNED_EP, 'writept', device.writept)
        bb_prefs.set(bb_prefs.SECTION_SCANNED_EP, 'modem_readpt',
                     device.modem_readpt)
        bb_prefs.set(bb_prefs.SECTION_SCANNED_EP, 'modem_writept',
                     device.modem_writept)
        bb_messenging.log("Saving EP data: " + str(device.interface) + ", " +
                          str(device.readpt) + ", " + str(device.writept) +
                          ", " + str(device.modem_readpt) + ", " +
                          str(device.modem_writept))
        bb_prefs.save_prefs()


def clear_halt(device, endpt):
    device.handle.clearHalt(endpt)


def set_bb_power(device):
    '''
    Added try / expect blocks as I had reports of failure(which ?) on storm 9500
    '''
    bb_messenging.status("Increasing USB power - for charging")
    try:
        buffer = [0, 0]
        device.handle.controlMsg(0xc0, 0xa5, buffer, 0, 1)
        buffer = []