Search in sources :

Example 1 with RemoteVncPointer

use of com.iiordanov.bVNC.input.RemoteVncPointer in project remote-desktop-clients by iiordanov.

the class RemoteCanvas method startVncConnection.

/**
 * Starts a VNC connection using the TightVNC backend.
 *
 * @throws Exception
 */
private void startVncConnection() throws Exception {
    Log.i(TAG, "Connecting to: " + connection.getAddress() + ", port: " + connection.getPort());
    String address = getAddress();
    int vncPort = getPort(connection.getPort());
    boolean sslTunneled = connection.getConnectionType() == Constants.CONN_TYPE_STUNNEL;
    try {
        rfb = new RfbProto(decoder, this, address, vncPort, connection.getPrefEncoding(), connection.getViewOnly(), connection.getUseLocalCursor(), sslTunneled, connection.getIdHashAlgorithm(), connection.getIdHash(), connection.getSshHostKey());
        Log.v(TAG, "Connected to server: " + address + " at port: " + vncPort);
        rfb.initializeAndAuthenticate(connection.getUserName(), connection.getPassword(), connection.getUseRepeater(), connection.getRepeaterId(), connection.getConnectionType(), connection.getSshHostKey());
    } catch (AnonCipherUnsupportedException e) {
        showFatalMessageAndQuit(getContext().getString(R.string.error_anon_dh_unsupported));
    } catch (Exception e) {
        e.printStackTrace();
        throw new Exception(getContext().getString(R.string.error_vnc_unable_to_connect) + Utils.messageAndStackTraceAsString(e));
    }
    rfbconn = rfb;
    pointer = new RemoteVncPointer(rfbconn, RemoteCanvas.this, handler);
    boolean rAltAsIsoL3Shift = Utils.querySharedPreferenceBoolean(this.getContext(), Constants.rAltAsIsoL3ShiftTag);
    keyboard = new RemoteVncKeyboard(rfbconn, RemoteCanvas.this, handler, rAltAsIsoL3Shift);
    rfb.writeClientInit();
    rfb.readServerInit();
    // Is custom resolution enabled?
    if (connection.getRdpResType() != Constants.VNC_GEOM_SELECT_DISABLED) {
        waitUntilInflated();
        rfb.setPreferredFramebufferSize(getVncRemoteWidth(getWidth(), getHeight()), getVncRemoteHeight(getWidth(), getHeight()));
    }
    initializeBitmap(displayWidth, displayHeight);
    decoder.setPixelFormat(rfb);
    handler.post(new Runnable() {

        public void run() {
            pd.setMessage(getContext().getString(R.string.info_progress_dialog_downloading));
        }
    });
    sendUnixAuth();
    if (connection.getUseLocalCursor())
        initializeSoftCursor();
    handler.post(drawableSetter);
    handler.post(setModes);
    // Hide progress dialog
    if (pd.isShowing())
        pd.dismiss();
    rfb.processProtocol();
}
Also used : AnonCipherUnsupportedException(com.iiordanov.bVNC.exceptions.AnonCipherUnsupportedException) RemoteVncKeyboard(com.iiordanov.bVNC.input.RemoteVncKeyboard) RemoteVncPointer(com.iiordanov.bVNC.input.RemoteVncPointer) SuppressLint(android.annotation.SuppressLint) AnonCipherUnsupportedException(com.iiordanov.bVNC.exceptions.AnonCipherUnsupportedException) NoSuchAlgorithmException(java.security.NoSuchAlgorithmException) CertificateEncodingException(java.security.cert.CertificateEncodingException) IOException(java.io.IOException)

Aggregations

SuppressLint (android.annotation.SuppressLint)1 AnonCipherUnsupportedException (com.iiordanov.bVNC.exceptions.AnonCipherUnsupportedException)1 RemoteVncKeyboard (com.iiordanov.bVNC.input.RemoteVncKeyboard)1 RemoteVncPointer (com.iiordanov.bVNC.input.RemoteVncPointer)1 IOException (java.io.IOException)1 NoSuchAlgorithmException (java.security.NoSuchAlgorithmException)1 CertificateEncodingException (java.security.cert.CertificateEncodingException)1