def __web_connect(self, u, wantPipe): self.web_disconnect() # Drop any old connections try: self.web = WebClient(u) self.web.connect(lambda msg: self.handle_webmavlink(msg), wantPipe = wantPipe) self.is_controlling = wantPipe print("Connected to server") except: print("Error, can not connect to server") self.web = None
def test_login_info(): log.debug('Running web test') logging.basicConfig(level=logging.DEBUG) def __handleRxMavlink(msg): log.debug("MavRx: %s" % msg) user = LoginInfo() user.loginName = "test-bob-py" user.password = "******" user.email = "*****@*****.**" user.vehicleId = 'a8098c1a-f86e-11da-bd1a-00112444be1e' # FIXME - store in prefs web_client = WebClient(user) web_client.connect(__handleRxMavlink)
from droneapi.lib.WebClient import * import logging print "Running web test" logging.basicConfig(level=logging.DEBUG) def __handleRxMavlink(msg): print "MavRx: ", msg u = LoginInfo() u.loginName = "test-bob-py" u.password = "******" u.email = "*****@*****.**" u.vehicleId = 'a8098c1a-f86e-11da-bd1a-00112444be1e' # FIXME - store in prefs w = WebClient(u) w.connect(__handleRxMavlink)