public void disconnect() { // Call disconnect on the connection. // It'll notify us with DISCONNECTED when it's done. connectedServer = null; if (mClient != null) { mClient.disconnect(); } }
/** Connects to the passed 'Server' object. */ public void connectToServer(Server server) { this.connectedServer = server; String plumbleVersion; try { plumbleVersion = getPackageManager().getPackageInfo(getPackageName(), 0).versionName; } catch (NameNotFoundException e) { plumbleVersion = "???"; } final String certificatePath = settings.getCertificatePath(); final String certificatePassword = settings.getCertificatePassword(); mProtocolHost = new ServiceProtocolHost(); mConnectionHost = new ServiceConnectionHost(); mAudioHost = new ServiceAudioOutputHost(); mClient = new MumbleConnection( mConnectionHost, plumbleVersion, connectedServer.getHost(), connectedServer.getPort(), connectedServer.getUsername(), connectedServer.getPassword(), certificatePath, certificatePassword, settings.isTcpForced(), settings.isOpusDisabled()); mProtocol = new MumbleProtocol(mProtocolHost, mAudioHost, mClient, getApplicationContext()); mClientThread = mClient.start(mProtocol); // Acquire wake lock wakeLock.acquire(); // Enable TTS tts = new TextToSpeech(this, this); }
public void sendTcpMessage(MessageType t, Builder b) { mClient.sendTcpMessage(t, b); }
public void sendUdpMessage(final byte[] buffer, final int length) { mClient.sendUdpMessage(buffer, length, false); }