FreeRDP
Loading...
Searching...
No Matches
com.freerdp.freerdpcore.services.LibFreeRDP Class Reference

Data Structures

interface  EventListener
interface  UIEventListener

Static Public Member Functions

static boolean hasH264Support ()
static boolean hasCameraRedirectionSupport ()
static void setEventListener (EventListener l)
static long newInstance (Context context)
static void freeInstance (long inst)
static boolean connect (long inst)
static boolean disconnect (long inst)
static boolean cancelConnection (long inst)
static void setForeground (long inst, boolean foreground)
static boolean setConnectionInfo (Context context, long inst, BookmarkBase bookmark)
static boolean setConnectionInfo (Context context, long inst, Uri openUri)
static boolean updateGraphics (long inst, Bitmap bitmap, int x, int y, int width, int height)
static boolean sendCursorEvent (long inst, int x, int y, int flags)
static boolean sendKeyEvent (long inst, int keycode, boolean down)
static boolean sendUnicodeKeyEvent (long inst, int keycode, boolean down)
static boolean sendKeyAsUnicodeEvent (long inst, int keycode, int unicode, int modmask, boolean down)
static boolean isUnicodeInputSupported (long inst)
static boolean sendClipboardData (long inst, String data)
static boolean sendClipboardImageData (long inst, byte[] data, String mimeType)
static boolean sendMonitorLayout (long inst, int width, int height)
static String getVersion ()

Static Public Attributes

static final int KBD_MOD_LSHIFT = 0x01
static final int KBD_MOD_RSHIFT = 0x02
static final int KBD_MOD_LMENU = 0x04
static final int KBD_MOD_RMENU = 0x08
static final int KBD_MOD_LCONTROL = 0x10
static final int KBD_MOD_RCONTROL = 0x20
static final int KBD_MOD_LWIN = 0x40
static final int KBD_MOD_RWIN = 0x80
static final long VERIFY_CERT_FLAG_NONE = 0x00
static final long VERIFY_CERT_FLAG_LEGACY = 0x02
static final long VERIFY_CERT_FLAG_REDIRECT = 0x10
static final long VERIFY_CERT_FLAG_GATEWAY = 0x20
static final long VERIFY_CERT_FLAG_CHANGED = 0x40
static final long VERIFY_CERT_FLAG_MISMATCH = 0x80
static final long VERIFY_CERT_FLAG_MATCH_LEGACY_SHA1 = 0x100
static final long VERIFY_CERT_FLAG_FP_IS_PEM = 0x200
static final int EXPERIMENTAL_REMOTEAPP = 0
static final int EXPERIMENTAL_CAMERA = 1

Detailed Description

Definition at line 31 of file LibFreeRDP.java.

Member Function Documentation

◆ cancelConnection()

boolean com.freerdp.freerdpcore.services.LibFreeRDP.cancelConnection ( long inst)
inlinestatic

Definition at line 252 of file LibFreeRDP.java.

253 {
254 return freerdp_disconnect(inst);
255 }

◆ connect()

boolean com.freerdp.freerdpcore.services.LibFreeRDP.connect ( long inst)
inlinestatic

Definition at line 228 of file LibFreeRDP.java.

229 {
230 synchronized (mInstanceState)
231 {
232 if (mInstanceState.get(inst, false))
233 {
234 throw new RuntimeException("instance already connected");
235 }
236 }
237 return freerdp_connect(inst);
238 }

◆ disconnect()

boolean com.freerdp.freerdpcore.services.LibFreeRDP.disconnect ( long inst)
inlinestatic

Definition at line 240 of file LibFreeRDP.java.

241 {
242 synchronized (mInstanceState)
243 {
244 if (mInstanceState.get(inst, false))
245 {
246 return freerdp_disconnect(inst);
247 }
248 return true;
249 }
250 }

◆ freeInstance()

void com.freerdp.freerdpcore.services.LibFreeRDP.freeInstance ( long inst)
inlinestatic

Definition at line 205 of file LibFreeRDP.java.

206 {
207 synchronized (mInstanceState)
208 {
209 if (mInstanceState.get(inst, false))
210 {
211 freerdp_disconnect(inst);
212 }
213 while (mInstanceState.get(inst, false))
214 {
215 try
216 {
217 mInstanceState.wait();
218 }
219 catch (InterruptedException e)
220 {
221 throw new RuntimeException();
222 }
223 }
224 }
225 freerdp_free(inst);
226 }

◆ getVersion()

String com.freerdp.freerdpcore.services.LibFreeRDP.getVersion ( )
inlinestatic

Definition at line 894 of file LibFreeRDP.java.

895 {
896 return freerdp_get_version();
897 }

◆ hasCameraRedirectionSupport()

boolean com.freerdp.freerdpcore.services.LibFreeRDP.hasCameraRedirectionSupport ( )
inlinestatic

Definition at line 141 of file LibFreeRDP.java.

142 {
143 return mHasCameraRedirection;
144 }

◆ hasH264Support()

boolean com.freerdp.freerdpcore.services.LibFreeRDP.hasH264Support ( )
inlinestatic

Definition at line 136 of file LibFreeRDP.java.

137 {
138 return mHasH264;
139 }

◆ isUnicodeInputSupported()

boolean com.freerdp.freerdpcore.services.LibFreeRDP.isUnicodeInputSupported ( long inst)
inlinestatic

Definition at line 611 of file LibFreeRDP.java.

612 {
613 return freerdp_is_unicode_input_supported(inst);
614 }

◆ newInstance()

long com.freerdp.freerdpcore.services.LibFreeRDP.newInstance ( Context context)
inlinestatic

Definition at line 200 of file LibFreeRDP.java.

201 {
202 return freerdp_new(context);
203 }

◆ sendClipboardData()

boolean com.freerdp.freerdpcore.services.LibFreeRDP.sendClipboardData ( long inst,
String data )
inlinestatic

Definition at line 616 of file LibFreeRDP.java.

617 {
618 return freerdp_send_clipboard_data(inst, data);
619 }

◆ sendClipboardImageData()

boolean com.freerdp.freerdpcore.services.LibFreeRDP.sendClipboardImageData ( long inst,
byte[] data,
String mimeType )
inlinestatic

Definition at line 621 of file LibFreeRDP.java.

622 {
623 return freerdp_send_clipboard_image_data(inst, data, mimeType);
624 }

◆ sendCursorEvent()

boolean com.freerdp.freerdpcore.services.LibFreeRDP.sendCursorEvent ( long inst,
int x,
int y,
int flags )
inlinestatic

Definition at line 584 of file LibFreeRDP.java.

585 {
586 return freerdp_send_cursor_event(inst, x, y, flags);
587 }

◆ sendKeyAsUnicodeEvent()

boolean com.freerdp.freerdpcore.services.LibFreeRDP.sendKeyAsUnicodeEvent ( long inst,
int keycode,
int unicode,
int modmask,
boolean down )
inlinestatic

Definition at line 599 of file LibFreeRDP.java.

601 {
602 // The character as UTF-16. 0, a lone surrogate or anything past U+10FFFF goes as an empty
603 // string, and the library then sends the key's scancode.
604 String text = "";
605 if (unicode > 0 && Character.isValidCodePoint(unicode) &&
606 Character.getType(unicode) != Character.SURROGATE)
607 text = new String(Character.toChars(unicode));
608 return freerdp_send_key_as_unicode_event(inst, keycode, text, modmask, down);
609 }

◆ sendKeyEvent()

boolean com.freerdp.freerdpcore.services.LibFreeRDP.sendKeyEvent ( long inst,
int keycode,
boolean down )
inlinestatic

Definition at line 589 of file LibFreeRDP.java.

590 {
591 return freerdp_send_key_event(inst, keycode, down);
592 }

◆ sendMonitorLayout()

boolean com.freerdp.freerdpcore.services.LibFreeRDP.sendMonitorLayout ( long inst,
int width,
int height )
inlinestatic

Definition at line 626 of file LibFreeRDP.java.

627 {
628 return freerdp_send_monitor_layout(inst, width, height);
629 }

◆ sendUnicodeKeyEvent()

boolean com.freerdp.freerdpcore.services.LibFreeRDP.sendUnicodeKeyEvent ( long inst,
int keycode,
boolean down )
inlinestatic

Definition at line 594 of file LibFreeRDP.java.

595 {
596 return freerdp_send_unicodekey_event(inst, keycode, down);
597 }

◆ setConnectionInfo() [1/2]

boolean com.freerdp.freerdpcore.services.LibFreeRDP.setConnectionInfo ( Context context,
long inst,
BookmarkBase bookmark )
inlinestatic

Definition at line 271 of file LibFreeRDP.java.

272 {
273 BookmarkBase.ScreenSettings screenSettings = bookmark.getActiveScreenSettings();
274 BookmarkBase.AdvancedSettings advanced = bookmark.getAdvancedSettings();
275 BookmarkBase.DebugSettings debug = bookmark.getDebugSettings();
276
277 String arg;
278 ArrayList<String> args = new ArrayList<>();
279
280 args.add(TAG);
281 args.add("/gdi:sw");
282
283 final String clientName = ApplicationSettingsActivity.getClientName(context);
284 if (!clientName.isEmpty())
285 {
286 args.add("/client-hostname:" + clientName);
287 }
288 String certName = "";
289 if (bookmark.getType() != BookmarkBase.TYPE_MANUAL)
290 {
291 return false;
292 }
293
294 int port = bookmark.getPort();
295 String hostname = bookmark.getHostname();
296
297 args.add("/v:" + hostname);
298 args.add("/port:" + port);
299
300 final int level = advanced.getTlsSecLevel();
301 List<String> tls = new ArrayList<>();
302
303 if (level >= 0)
304 {
305 tls.add("seclevel:" + level);
306 }
307
308 final int tlsMinLevel = advanced.getTlsMinLevel();
309 if (tlsMinLevel >= 0)
310 {
311 tls.add("enforce:" + tlsMinLevel);
312 }
313
314 if (!tls.isEmpty())
315 {
316 StringBuilder sb = new StringBuilder();
317 for (String s : tls)
318 {
319 if (sb.length() > 0)
320 {
321 sb.append(',');
322 }
323 sb.append(s);
324 }
325 args.add("/tls:" + sb);
326 }
327
328 arg = bookmark.getUsername();
329 if (!arg.isEmpty())
330 {
331 args.add("/u:" + arg);
332 }
333 arg = bookmark.getDomain();
334 if (!arg.isEmpty())
335 {
336 args.add("/d:" + arg);
337 }
338 arg = bookmark.getPassword();
339 if (!arg.isEmpty())
340 {
341 args.add("/p:" + arg);
342 }
343
344 args.add(String.format(java.util.Locale.US, "/size:%dx%d", screenSettings.getWidth(),
345 screenSettings.getHeight()));
346 args.add("/bpp:" + screenSettings.getColors());
347
348 if (screenSettings.isCustomScale())
349 {
350 args.add("/scale-desktop:" + screenSettings.getScaleDesktop());
351 args.add("/scale-device:" + screenSettings.getScaleDevice());
352 }
353 else
354 {
355 args.add("/scale:" + screenSettings.getScalePreset());
356 }
357
358 if (advanced.getConsoleMode())
359 {
360 args.add("/admin");
361 }
362
363 if (advanced.getVmConnectMode())
364 {
365 String guid = advanced.getVmConnectGuid();
366 if (!guid.isEmpty())
367 args.add("/vmconnect:" + guid);
368 else
369 args.add("/vmconnect");
370 }
371
372 switch (advanced.getSecurity())
373 {
374 case 3: // NLA
375 args.add("/sec:nla");
376 break;
377 case 2: // TLS
378 args.add("/sec:tls");
379 break;
380 case 1: // RDP
381 args.add("/sec:rdp");
382 break;
383 default:
384 break;
385 }
386
387 if (!certName.isEmpty())
388 {
389 args.add("/cert-name:" + certName);
390 }
391
392 args.add("/network:auto");
393
394 BookmarkBase.PerformanceFlags flags = bookmark.getActivePerformanceFlags();
395 if (flags.getRemoteFX())
396 {
397 args.add("/rfx");
398 }
399
400 if (flags.getGfx())
401 {
402 if (flags.getH264() && mHasH264)
403 {
404 args.add("/gfx:AVC444,AVC420,RFX,progressive");
405 }
406 else
407 {
408 args.add("/gfx");
409 }
410 }
411
412 args.add(addFlag("wallpaper", flags.getWallpaper()));
413 args.add(addFlag("window-drag", flags.getFullWindowDrag()));
414 args.add(addFlag("menu-anims", flags.getMenuAnimations()));
415 args.add(addFlag("themes", flags.getTheming()));
416 args.add(addFlag("fonts", flags.getFontSmoothing()));
417 args.add(addFlag("aero", flags.getDesktopComposition()));
418
419 if (!advanced.getRemoteProgram().isEmpty())
420 {
421 args.add("/app:program:" + advanced.getRemoteProgram());
422 if (!advanced.getWorkDir().isEmpty())
423 args.add("/app:workdir:" + advanced.getWorkDir());
424 }
425 else
426 {
427 if (!advanced.getAlternateShell().isEmpty())
428 args.add("/shell:" + advanced.getAlternateShell());
429 if (!advanced.getWorkDir().isEmpty())
430 args.add("/shell-dir:" + advanced.getWorkDir());
431 }
432
433 args.add(addFlag("async-channels", debug.getAsyncChannel()));
434 args.add(addFlag("async-update", debug.getAsyncUpdate()));
435
436 if (advanced.getRedirectSDCard())
437 {
438 String path = android.os.Environment.getExternalStorageDirectory().getPath();
439 args.add("/drive:sdcard," + path);
440 }
441
442 String info = advanced.getLoadBalanceInfo();
443 if (!info.isEmpty())
444 {
445 args.add("/load-balance-info:" + info);
446 }
447 args.add("/clipboard");
448 args.add("/disp");
449
450 if (advanced.getRedirectPrinter())
451 args.add("/printer:aFreeRDP Print,Microsoft Print to PDF,default");
452
453 // Gateway enabled?
454 if (bookmark.getType() == BookmarkBase.TYPE_MANUAL && bookmark.getEnableGatewaySettings())
455 {
456 BookmarkBase.GatewaySettings gateway = bookmark.getGatewaySettings();
457
458 StringBuilder carg = new StringBuilder();
459 carg.append(String.format(java.util.Locale.US, "/gateway:g:%s:%d",
460 gateway.getHostname(), gateway.getPort()));
461
462 arg = gateway.getUsername();
463 if (!arg.isEmpty())
464 {
465 carg.append(",u:" + arg);
466 }
467 arg = gateway.getDomain();
468 if (!arg.isEmpty())
469 {
470 carg.append(",d:" + arg);
471 }
472 arg = gateway.getPassword();
473 if (!arg.isEmpty())
474 {
475 carg.append(",p:" + arg);
476 }
477 args.add(carg.toString());
478 }
479
480 /* 0 ... local
481 1 ... remote
482 2 ... disable */
483 args.add("/audio-mode:" + advanced.getRedirectSound());
484 if (advanced.getRedirectSound() == 0)
485 {
486 args.add("/sound");
487 }
488
489 if (advanced.getRedirectMicrophone())
490 {
491 args.add("/microphone");
492 }
493
494 if (advanced.getRedirectCamera() && mHasCameraRedirection)
495 {
496 args.add("/dvc:rdpecam");
497 }
498
499 if (ApplicationSettingsActivity.getAutoReconnect(context))
500 {
501 args.add("/auto-reconnect");
502 }
503
504 args.add("/kbd:unicode:on");
505 args.add("/cert:ignore");
506 args.add("/log-level:" + debug.getDebugLevel());
507 String[] arrayArgs = args.toArray(new String[0]);
508 return freerdp_parse_arguments(inst, arrayArgs);
509 }
#define TAG

◆ setConnectionInfo() [2/2]

boolean com.freerdp.freerdpcore.services.LibFreeRDP.setConnectionInfo ( Context context,
long inst,
Uri openUri )
inlinestatic

Definition at line 511 of file LibFreeRDP.java.

512 {
513 ArrayList<String> args = new ArrayList<>();
514
515 // Parse URI from query string. Same key overwrite previous one
516 // freerdp://user@ip:port/connect?sound=&rfx=&p=password&clipboard=%2b&themes=-
517
518 // Now we only support Software GDI
519 args.add(TAG);
520 args.add("/gdi:sw");
521
522 final String clientName = ApplicationSettingsActivity.getClientName(context);
523 if (!clientName.isEmpty())
524 {
525 args.add("/client-hostname:" + clientName);
526 }
527
528 // Parse hostname and port. Set to 'v' argument
529 String hostname = openUri.getHost();
530 int port = openUri.getPort();
531 if (hostname != null)
532 {
533 hostname = hostname + ((port == -1) ? "" : (":" + port));
534 args.add("/v:" + hostname);
535 }
536
537 String user = openUri.getUserInfo();
538 if (user != null)
539 {
540 args.add("/u:" + user);
541 }
542
543 for (String key : openUri.getQueryParameterNames())
544 {
545 String value = openUri.getQueryParameter(key);
546
547 if (value.isEmpty())
548 {
549 // Query: key=
550 // To freerdp argument: /key
551 args.add("/" + key);
552 }
553 else if (value.equals("-") || value.equals("+"))
554 {
555 // Query: key=- or key=+
556 // To freerdp argument: -key or +key
557 args.add(value + key);
558 }
559 else
560 {
561 // Query: key=value
562 // To freerdp argument: /key:value
563 if (key.equals("drive") && value.equals("sdcard"))
564 {
565 // Special for sdcard redirect
566 String path = android.os.Environment.getExternalStorageDirectory().getPath();
567 value = "sdcard," + path;
568 }
569
570 args.add("/" + key + ":" + value);
571 }
572 }
573
574 String[] arrayArgs = args.toArray(new String[0]);
575 return freerdp_parse_arguments(inst, arrayArgs);
576 }

◆ setEventListener()

void com.freerdp.freerdpcore.services.LibFreeRDP.setEventListener ( EventListener l)
inlinestatic

Definition at line 195 of file LibFreeRDP.java.

196 {
197 listener = l;
198 }

◆ setForeground()

void com.freerdp.freerdpcore.services.LibFreeRDP.setForeground ( long inst,
boolean foreground )
inlinestatic

Definition at line 257 of file LibFreeRDP.java.

258 {
259 freerdp_set_foreground(inst, foreground);
260 }

◆ updateGraphics()

boolean com.freerdp.freerdpcore.services.LibFreeRDP.updateGraphics ( long inst,
Bitmap bitmap,
int x,
int y,
int width,
int height )
inlinestatic

Definition at line 578 of file LibFreeRDP.java.

580 {
581 return freerdp_update_graphics(inst, bitmap, x, y, width, height);
582 }

Field Documentation

◆ EXPERIMENTAL_CAMERA

final int com.freerdp.freerdpcore.services.LibFreeRDP.EXPERIMENTAL_CAMERA = 1
static

Definition at line 61 of file LibFreeRDP.java.

◆ EXPERIMENTAL_REMOTEAPP

final int com.freerdp.freerdpcore.services.LibFreeRDP.EXPERIMENTAL_REMOTEAPP = 0
static

Definition at line 60 of file LibFreeRDP.java.

◆ KBD_MOD_LCONTROL

final int com.freerdp.freerdpcore.services.LibFreeRDP.KBD_MOD_LCONTROL = 0x10
static

Definition at line 45 of file LibFreeRDP.java.

◆ KBD_MOD_LMENU

final int com.freerdp.freerdpcore.services.LibFreeRDP.KBD_MOD_LMENU = 0x04
static

Definition at line 43 of file LibFreeRDP.java.

◆ KBD_MOD_LSHIFT

final int com.freerdp.freerdpcore.services.LibFreeRDP.KBD_MOD_LSHIFT = 0x01
static

Definition at line 41 of file LibFreeRDP.java.

◆ KBD_MOD_LWIN

final int com.freerdp.freerdpcore.services.LibFreeRDP.KBD_MOD_LWIN = 0x40
static

Definition at line 47 of file LibFreeRDP.java.

◆ KBD_MOD_RCONTROL

final int com.freerdp.freerdpcore.services.LibFreeRDP.KBD_MOD_RCONTROL = 0x20
static

Definition at line 46 of file LibFreeRDP.java.

◆ KBD_MOD_RMENU

final int com.freerdp.freerdpcore.services.LibFreeRDP.KBD_MOD_RMENU = 0x08
static

Definition at line 44 of file LibFreeRDP.java.

◆ KBD_MOD_RSHIFT

final int com.freerdp.freerdpcore.services.LibFreeRDP.KBD_MOD_RSHIFT = 0x02
static

Definition at line 42 of file LibFreeRDP.java.

◆ KBD_MOD_RWIN

final int com.freerdp.freerdpcore.services.LibFreeRDP.KBD_MOD_RWIN = 0x80
static

Definition at line 48 of file LibFreeRDP.java.

◆ VERIFY_CERT_FLAG_CHANGED

final long com.freerdp.freerdpcore.services.LibFreeRDP.VERIFY_CERT_FLAG_CHANGED = 0x40
static

Definition at line 54 of file LibFreeRDP.java.

◆ VERIFY_CERT_FLAG_FP_IS_PEM

final long com.freerdp.freerdpcore.services.LibFreeRDP.VERIFY_CERT_FLAG_FP_IS_PEM = 0x200
static

Definition at line 57 of file LibFreeRDP.java.

◆ VERIFY_CERT_FLAG_GATEWAY

final long com.freerdp.freerdpcore.services.LibFreeRDP.VERIFY_CERT_FLAG_GATEWAY = 0x20
static

Definition at line 53 of file LibFreeRDP.java.

◆ VERIFY_CERT_FLAG_LEGACY

final long com.freerdp.freerdpcore.services.LibFreeRDP.VERIFY_CERT_FLAG_LEGACY = 0x02
static

Definition at line 51 of file LibFreeRDP.java.

◆ VERIFY_CERT_FLAG_MATCH_LEGACY_SHA1

final long com.freerdp.freerdpcore.services.LibFreeRDP.VERIFY_CERT_FLAG_MATCH_LEGACY_SHA1 = 0x100
static

Definition at line 56 of file LibFreeRDP.java.

◆ VERIFY_CERT_FLAG_MISMATCH

final long com.freerdp.freerdpcore.services.LibFreeRDP.VERIFY_CERT_FLAG_MISMATCH = 0x80
static

Definition at line 55 of file LibFreeRDP.java.

◆ VERIFY_CERT_FLAG_NONE

final long com.freerdp.freerdpcore.services.LibFreeRDP.VERIFY_CERT_FLAG_NONE = 0x00
static

Definition at line 50 of file LibFreeRDP.java.

◆ VERIFY_CERT_FLAG_REDIRECT

final long com.freerdp.freerdpcore.services.LibFreeRDP.VERIFY_CERT_FLAG_REDIRECT = 0x10
static

Definition at line 52 of file LibFreeRDP.java.


The documentation for this class was generated from the following file: