001// Copyright (c) FIRST and other WPILib contributors. 002// Open Source Software; you can modify and/or share it under the terms of 003// the WPILib BSD license file in the root directory of this project. 004 005package edu.wpi.first.cscore; 006 007import edu.wpi.first.util.RawFrame; 008import edu.wpi.first.util.RuntimeLoader; 009import java.io.IOException; 010import java.nio.ByteBuffer; 011import java.util.concurrent.atomic.AtomicBoolean; 012import java.util.function.Consumer; 013 014/** CameraServer JNI. */ 015public class CameraServerJNI { 016 static boolean libraryLoaded = false; 017 018 static RuntimeLoader<CameraServerJNI> loader = null; 019 020 /** Sets whether JNI should be loaded in the static block. */ 021 public static class Helper { 022 private static AtomicBoolean extractOnStaticLoad = new AtomicBoolean(true); 023 024 /** 025 * Returns true if the JNI should be loaded in the static block. 026 * 027 * @return True if the JNI should be loaded in the static block. 028 */ 029 public static boolean getExtractOnStaticLoad() { 030 return extractOnStaticLoad.get(); 031 } 032 033 /** 034 * Sets whether the JNI should be loaded in the static block. 035 * 036 * @param load Whether the JNI should be loaded in the static block. 037 */ 038 public static void setExtractOnStaticLoad(boolean load) { 039 extractOnStaticLoad.set(load); 040 } 041 042 /** Utility class. */ 043 private Helper() {} 044 } 045 046 static { 047 if (Helper.getExtractOnStaticLoad()) { 048 try { 049 loader = 050 new RuntimeLoader<>( 051 "cscorejni", RuntimeLoader.getDefaultExtractionRoot(), CameraServerJNI.class); 052 loader.loadLibrary(); 053 } catch (IOException ex) { 054 ex.printStackTrace(); 055 System.exit(1); 056 } 057 libraryLoaded = true; 058 } 059 } 060 061 /** 062 * Force load the library. 063 * 064 * @throws IOException if library load failed 065 */ 066 public static synchronized void forceLoad() throws IOException { 067 if (libraryLoaded) { 068 return; 069 } 070 loader = 071 new RuntimeLoader<>( 072 "cscorejni", RuntimeLoader.getDefaultExtractionRoot(), CameraServerJNI.class); 073 loader.loadLibrary(); 074 libraryLoaded = true; 075 } 076 077 // 078 // Property Functions 079 // 080 081 /** 082 * Returns property kind. 083 * 084 * @param property Property handle. 085 * @return Property kind. 086 */ 087 public static native int getPropertyKind(int property); 088 089 /** 090 * Returns property name. 091 * 092 * @param property Property handle. 093 * @return Property name. 094 */ 095 public static native String getPropertyName(int property); 096 097 /** 098 * Returns property value. 099 * 100 * @param property Property handle. 101 * @return Property value. 102 */ 103 public static native int getProperty(int property); 104 105 /** 106 * Sets property value. 107 * 108 * @param property Property handle. 109 * @param value Property value. 110 */ 111 public static native void setProperty(int property, int value); 112 113 /** 114 * Returns property minimum. 115 * 116 * @param property Property handle. 117 * @return Property minimum. 118 */ 119 public static native int getPropertyMin(int property); 120 121 /** 122 * Returns property maximum. 123 * 124 * @param property Property handle. 125 * @return Property maximum. 126 */ 127 public static native int getPropertyMax(int property); 128 129 /** 130 * Returns property step. 131 * 132 * @param property Property handle. 133 * @return Property step. 134 */ 135 public static native int getPropertyStep(int property); 136 137 /** 138 * Returns property default value. 139 * 140 * @param property Property handle. 141 * @return Property default value. 142 */ 143 public static native int getPropertyDefault(int property); 144 145 /** 146 * Returns property value as a string. 147 * 148 * @param property Property handle. 149 * @return Property value as a string. 150 */ 151 public static native String getStringProperty(int property); 152 153 /** 154 * Sets property value to a string. 155 * 156 * @param property Property handle. 157 * @param value Property value string. 158 */ 159 public static native void setStringProperty(int property, String value); 160 161 /** 162 * Returns enum of possible property value strings. 163 * 164 * @param property Property handle. 165 * @return Enum of possible property value strings. 166 */ 167 public static native String[] getEnumPropertyChoices(int property); 168 169 // 170 // Source Creation Functions 171 // 172 173 /** 174 * Creates a new USB camera by device. 175 * 176 * @param name USB camera name. 177 * @param dev USB camera device number. 178 * @return USB camera handle. 179 */ 180 public static native int createUsbCameraDev(String name, int dev); 181 182 /** 183 * Creates a new USB camera by path. 184 * 185 * @param name USB camera name. 186 * @param path USB camera path. 187 * @return USB camera handle. 188 */ 189 public static native int createUsbCameraPath(String name, String path); 190 191 /** 192 * Creates an HTTP camera. 193 * 194 * @param name HTTP camera name. 195 * @param url HTTP camera stream URL. 196 * @param kind HTTP camera kind. 197 * @return HTTP camera handle. 198 */ 199 public static native int createHttpCamera(String name, String url, int kind); 200 201 /** 202 * Creates an HTTP camera from multiple URLs. 203 * 204 * @param name HTTP camera name. 205 * @param urls HTTP camera stream URLs. 206 * @param kind HTTP camera kind. 207 * @return HTTP camera handle. 208 */ 209 public static native int createHttpCameraMulti(String name, String[] urls, int kind); 210 211 /** 212 * Creates a raw source. 213 * 214 * @param name Source name. 215 * @param pixelFormat Pixel format. 216 * @param width Image width. 217 * @param height Image height. 218 * @param fps Source frames per second. 219 * @return Raw source handle. 220 */ 221 public static native int createRawSource( 222 String name, int pixelFormat, int width, int height, int fps); 223 224 // 225 // Source Functions 226 // 227 228 /** 229 * Returns source kind. 230 * 231 * @param source Source handle. 232 * @return Source kind. 233 */ 234 public static native int getSourceKind(int source); 235 236 /** 237 * Returns source name. 238 * 239 * @param source Source handle. 240 * @return Source name. 241 */ 242 public static native String getSourceName(int source); 243 244 /** 245 * Returns source description. 246 * 247 * @param source Source handle. 248 * @return Source description. 249 */ 250 public static native String getSourceDescription(int source); 251 252 /** 253 * Returns source's last frame time. 254 * 255 * @param source Source handle. 256 * @return Source's last frame time. 257 */ 258 public static native long getSourceLastFrameTime(int source); 259 260 /** 261 * Sets source connection strategy. 262 * 263 * @param source Source handle. 264 * @param strategy Connection strategy. 265 */ 266 public static native void setSourceConnectionStrategy(int source, int strategy); 267 268 /** 269 * Returns true if source is connected. 270 * 271 * @param source Source handle. 272 * @return True if source is connected. 273 */ 274 public static native boolean isSourceConnected(int source); 275 276 /** 277 * Returns true if source is enabled. 278 * 279 * @param source Source handle. 280 * @return True if source is enabled. 281 */ 282 public static native boolean isSourceEnabled(int source); 283 284 /** 285 * Returns source property. 286 * 287 * @param source Source handle. 288 * @param name Source property name. 289 * @return Source property. 290 */ 291 public static native int getSourceProperty(int source, String name); 292 293 /** 294 * Returns list of source property handles. 295 * 296 * @param source Source handle. 297 * @return List of source property handles. 298 */ 299 public static native int[] enumerateSourceProperties(int source); 300 301 /** 302 * Returns source video mode. 303 * 304 * @param source Source handle. 305 * @return Source video mode. 306 */ 307 public static native VideoMode getSourceVideoMode(int source); 308 309 /** 310 * Sets source video mode. 311 * 312 * @param source Source handle. 313 * @param pixelFormat Pixel format. 314 * @param width Image width. 315 * @param height Image height. 316 * @param fps Source frames per second. 317 * @return True if set succeeded. 318 */ 319 public static native boolean setSourceVideoMode( 320 int source, int pixelFormat, int width, int height, int fps); 321 322 /** 323 * Sets source pixel format. 324 * 325 * @param source Source handle. 326 * @param pixelFormat Source pixel format. 327 * @return True if set succeeded. 328 */ 329 public static native boolean setSourcePixelFormat(int source, int pixelFormat); 330 331 /** 332 * Sets source resolution. 333 * 334 * @param source Source handle. 335 * @param width Image width. 336 * @param height Image height. 337 * @return True if set succeeded. 338 */ 339 public static native boolean setSourceResolution(int source, int width, int height); 340 341 /** 342 * Sets source FPS. 343 * 344 * @param source Source handle. 345 * @param fps Source frames per second. 346 * @return True if set succeeded. 347 */ 348 public static native boolean setSourceFPS(int source, int fps); 349 350 /** 351 * Sets source configuration JSON. 352 * 353 * @param source Source handle. 354 * @param config Configuration JSON. 355 * @return True if set succeeded. 356 */ 357 public static native boolean setSourceConfigJson(int source, String config); 358 359 /** 360 * Returns source configuration JSON. 361 * 362 * @param source Source handle. 363 * @return Source configuration JSON. 364 */ 365 public static native String getSourceConfigJson(int source); 366 367 /** 368 * Returns list of source's supported video modes. 369 * 370 * @param source Source handle. 371 * @return List of source's supported video modes. 372 */ 373 public static native VideoMode[] enumerateSourceVideoModes(int source); 374 375 /** 376 * Returns list of source sinks. 377 * 378 * @param source Source handle. 379 * @return List of source sinks. 380 */ 381 public static native int[] enumerateSourceSinks(int source); 382 383 /** 384 * Copies source. 385 * 386 * @param source Source handle. 387 * @return New source handle. 388 */ 389 public static native int copySource(int source); 390 391 /** 392 * Releases source. 393 * 394 * @param source Source handle. 395 */ 396 public static native void releaseSource(int source); 397 398 // 399 // Camera Source Common Property Functions 400 // 401 402 /** 403 * Sets camera brightness. 404 * 405 * @param source Source handle. 406 * @param brightness Brightness. 407 */ 408 public static native void setCameraBrightness(int source, int brightness); 409 410 /** 411 * Returns camera brightness. 412 * 413 * @param source Source handle. 414 * @return Camera brightness. 415 */ 416 public static native int getCameraBrightness(int source); 417 418 /** 419 * Sets camera white balance to auto. 420 * 421 * @param source Source handle. 422 */ 423 public static native void setCameraWhiteBalanceAuto(int source); 424 425 /** 426 * Sets camera white balance to "hold current". 427 * 428 * @param source Source handle. 429 */ 430 public static native void setCameraWhiteBalanceHoldCurrent(int source); 431 432 /** 433 * Sets camera white balance to the given value. 434 * 435 * @param source Source handle. 436 * @param value White balance. 437 */ 438 public static native void setCameraWhiteBalanceManual(int source, int value); 439 440 /** 441 * Sets camera exposure to auto. 442 * 443 * @param source Source handle. 444 */ 445 public static native void setCameraExposureAuto(int source); 446 447 /** 448 * Sets camera exposure to "hold current". 449 * 450 * @param source Source handle. 451 */ 452 public static native void setCameraExposureHoldCurrent(int source); 453 454 /** 455 * Sets camera exposure to the given value. 456 * 457 * @param source Source handle. 458 * @param value Exposure. 459 */ 460 public static native void setCameraExposureManual(int source, int value); 461 462 // 463 // UsbCamera Source Functions 464 // 465 466 /** 467 * Sets USB camera path. 468 * 469 * @param source Source handle. 470 * @param path USB camera path. 471 */ 472 public static native void setUsbCameraPath(int source, String path); 473 474 /** 475 * Returns USB camera path. 476 * 477 * @param source Source handle. 478 * @return USB camera path. 479 */ 480 public static native String getUsbCameraPath(int source); 481 482 /** 483 * Returns USB camera info. 484 * 485 * @param source Source handle. 486 * @return USB camera info. 487 */ 488 public static native UsbCameraInfo getUsbCameraInfo(int source); 489 490 // 491 // HttpCamera Source Functions 492 // 493 494 /** 495 * Returns HTTP camera kind. 496 * 497 * @param source Source handle. 498 * @return HTTP camera kind. 499 */ 500 public static native int getHttpCameraKind(int source); 501 502 /** 503 * Sets HTTP camera URLs. 504 * 505 * @param source Source handle. 506 * @param urls HTTP camera URLs. 507 */ 508 public static native void setHttpCameraUrls(int source, String[] urls); 509 510 /** 511 * Returns HTTP camera URLs. 512 * 513 * @param source Source handle. 514 * @return HTTP camera URLs. 515 */ 516 public static native String[] getHttpCameraUrls(int source); 517 518 // 519 // Image Source Functions 520 // 521 522 /** 523 * Puts raw frame into source. 524 * 525 * @param source Source handle. 526 * @param frame Frame handle. 527 */ 528 public static native void putRawSourceFrame(int source, long frame); 529 530 /** 531 * Puts raw frame into source. 532 * 533 * @param source Source handle. 534 * @param data Frame byte buffer. 535 * @param size Frame size. 536 * @param width Frame width. 537 * @param height Frame height. 538 * @param stride Frame stride. 539 * @param pixelFormat Frame pixel format. 540 */ 541 public static native void putRawSourceFrameBB( 542 int source, ByteBuffer data, int size, int width, int height, int stride, int pixelFormat); 543 544 /** 545 * Puts raw frame into source. 546 * 547 * @param source Source handle. 548 * @param data Frame handle. 549 * @param size Frame size. 550 * @param width Frame width. 551 * @param height Frame height. 552 * @param stride Frame stride. 553 * @param pixelFormat Frame pixel format. 554 */ 555 public static native void putRawSourceFrameData( 556 int source, long data, int size, int width, int height, int stride, int pixelFormat); 557 558 /** 559 * Notify source error. 560 * 561 * @param source Source handle. 562 * @param msg Error message. 563 */ 564 public static native void notifySourceError(int source, String msg); 565 566 /** 567 * Sets whether source is connected. 568 * 569 * @param source Source handle. 570 * @param connected True if source is connected. 571 */ 572 public static native void setSourceConnected(int source, boolean connected); 573 574 /** 575 * Sets source description. 576 * 577 * @param source Source handle. 578 * @param description Source description. 579 */ 580 public static native void setSourceDescription(int source, String description); 581 582 /** 583 * Creates a source property. 584 * 585 * @param source Source handle. 586 * @param name Property name. 587 * @param kind Property kind. 588 * @param minimum Property minimum. 589 * @param maximum Property maximum. 590 * @param step Property step. 591 * @param defaultValue Property default value. 592 * @param value Property value. 593 * @return Source property handle. 594 */ 595 public static native int createSourceProperty( 596 int source, 597 String name, 598 int kind, 599 int minimum, 600 int maximum, 601 int step, 602 int defaultValue, 603 int value); 604 605 /** 606 * Sets list of possible property values. 607 * 608 * @param source Source handle. 609 * @param property Property handle. 610 * @param choices List of possible property values. 611 */ 612 public static native void setSourceEnumPropertyChoices( 613 int source, int property, String[] choices); 614 615 // 616 // Sink Creation Functions 617 // 618 619 /** 620 * Creates an MJPEG server. 621 * 622 * @param name MJPEG server name. 623 * @param listenAddress IP address at which server should listen. 624 * @param port Port on which server should listen. 625 * @return MJPEG server handle. 626 */ 627 public static native int createMjpegServer(String name, String listenAddress, int port); 628 629 /** 630 * Creates a raw sink. 631 * 632 * @param name Sink name. 633 * @return Raw sink handle. 634 */ 635 public static native int createRawSink(String name); 636 637 // 638 // Sink Functions 639 // 640 641 /** 642 * Returns sink kind. 643 * 644 * @param sink Sink handle. 645 * @return Sink kind. 646 */ 647 public static native int getSinkKind(int sink); 648 649 /** 650 * Returns sink name. 651 * 652 * @param sink Sink handle. 653 * @return Sink name. 654 */ 655 public static native String getSinkName(int sink); 656 657 /** 658 * Returns sink description. 659 * 660 * @param sink Sink handle. 661 * @return Sink description. 662 */ 663 public static native String getSinkDescription(int sink); 664 665 /** 666 * Returns sink property. 667 * 668 * @param sink Sink handle. 669 * @param name Property name. 670 * @return Sink property handle. 671 */ 672 public static native int getSinkProperty(int sink, String name); 673 674 /** 675 * Returns list of sink property handles. 676 * 677 * @param sink Sink handle. 678 * @return List of sink property handles. 679 */ 680 public static native int[] enumerateSinkProperties(int sink); 681 682 /** 683 * Sets sink configuration JSON. 684 * 685 * @param sink Sink handle. 686 * @param config Configuration JSON. 687 * @return True if set succeeded. 688 */ 689 public static native boolean setSinkConfigJson(int sink, String config); 690 691 /** 692 * Returns sink configuration JSON. 693 * 694 * @param sink Sink handle. 695 * @return Sink configuration JSON. 696 */ 697 public static native String getSinkConfigJson(int sink); 698 699 /** 700 * Sets sink source. 701 * 702 * @param sink Sink handle. 703 * @param source Source handle. 704 */ 705 public static native void setSinkSource(int sink, int source); 706 707 /** 708 * Returns sink source property. 709 * 710 * @param sink Sink handle. 711 * @param name Property name. 712 * @return Sink source property handle. 713 */ 714 public static native int getSinkSourceProperty(int sink, String name); 715 716 /** 717 * Returns sink source. 718 * 719 * @param sink Sink handle. 720 * @return Sink source handle. 721 */ 722 public static native int getSinkSource(int sink); 723 724 /** 725 * Copies sink. 726 * 727 * @param sink Sink handle. 728 * @return New sink handle. 729 */ 730 public static native int copySink(int sink); 731 732 /** 733 * Releases sink. 734 * 735 * @param sink Sink handle. 736 */ 737 public static native void releaseSink(int sink); 738 739 // 740 // MjpegServer Sink Functions 741 // 742 743 /** 744 * Returns MJPEG server listen address. 745 * 746 * @param sink Sink handle. 747 * @return MJPEG server listen address. 748 */ 749 public static native String getMjpegServerListenAddress(int sink); 750 751 /** 752 * Returns MJPEG server port. 753 * 754 * @param sink Sink handle. 755 * @return MJPEG server port. 756 */ 757 public static native int getMjpegServerPort(int sink); 758 759 // 760 // Image Sink Functions 761 // 762 763 /** 764 * Sets sink description. 765 * 766 * @param sink Sink handle. 767 * @param description Sink description. 768 */ 769 public static native void setSinkDescription(int sink, String description); 770 771 /** 772 * Returns raw sink frame. 773 * 774 * @param sink Sink handle. 775 * @param frame Raw frame. 776 * @param nativeObj Native object. 777 * @return Raw sink frame handle. 778 */ 779 public static native long grabRawSinkFrame(int sink, RawFrame frame, long nativeObj); 780 781 /** 782 * Returns raw sink frame timeout. 783 * 784 * @param sink Sink handle. 785 * @param frame Raw frame. 786 * @param nativeObj Native object. 787 * @param timeout Timeout in seconds. 788 * @return Raw sink frame timeout. 789 */ 790 public static native long grabRawSinkFrameTimeout( 791 int sink, RawFrame frame, long nativeObj, double timeout); 792 793 /** 794 * Returns sink error message. 795 * 796 * @param sink Sink handle. 797 * @return Sink error message. 798 */ 799 public static native String getSinkError(int sink); 800 801 /** 802 * Sets sink enable. 803 * 804 * @param sink Sink handle. 805 * @param enabled True if sink should be enabled. 806 */ 807 public static native void setSinkEnabled(int sink, boolean enabled); 808 809 // 810 // Listener Functions 811 // 812 813 /** 814 * Adds listener. 815 * 816 * @param listener Video event callback. 817 * @param eventMask Event mask. 818 * @param immediateNotify True to immediately notify on event. 819 * @return Listener handle. 820 */ 821 public static native int addListener( 822 Consumer<VideoEvent> listener, int eventMask, boolean immediateNotify); 823 824 /** 825 * Removes listener. 826 * 827 * @param handle Listener handle. 828 */ 829 public static native void removeListener(int handle); 830 831 /** 832 * Creates listener poller. 833 * 834 * @return Listener poller handle. 835 */ 836 public static native int createListenerPoller(); 837 838 /** 839 * Destroys listener poller. 840 * 841 * @param poller Listener poller handle. 842 */ 843 public static native void destroyListenerPoller(int poller); 844 845 /** 846 * Add polled listener. 847 * 848 * @param poller Poller handle. 849 * @param eventMask Event mask. 850 * @param immediateNotify True to immediately notify on event. 851 * @return Polled listener handle. 852 */ 853 public static native int addPolledListener(int poller, int eventMask, boolean immediateNotify); 854 855 /** 856 * Polls listener. 857 * 858 * @param poller Poller handle. 859 * @return List of video events. 860 * @throws InterruptedException if polling was interrupted. 861 */ 862 public static native VideoEvent[] pollListener(int poller) throws InterruptedException; 863 864 /** 865 * Polls listener with timeout. 866 * 867 * @param poller Poller handle. 868 * @param timeout Timeout in seconds. 869 * @return List of video events. 870 * @throws InterruptedException if polling was interrupted. 871 */ 872 public static native VideoEvent[] pollListenerTimeout(int poller, double timeout) 873 throws InterruptedException; 874 875 /** 876 * Cancels poll listener. 877 * 878 * @param poller Poller handle. 879 */ 880 public static native void cancelPollListener(int poller); 881 882 // 883 // Telemetry Functions 884 // 885 886 /** Telemetry kind. */ 887 public enum TelemetryKind { 888 /** kSourceBytesReceived. */ 889 kSourceBytesReceived(1), 890 /** kSourceFramesReceived. */ 891 kSourceFramesReceived(2); 892 893 private final int value; 894 895 TelemetryKind(int value) { 896 this.value = value; 897 } 898 899 /** 900 * Returns telemetry kind value. 901 * 902 * @return Telemetry kind value. 903 */ 904 public int getValue() { 905 return value; 906 } 907 } 908 909 /** 910 * Sets telemetry period. 911 * 912 * @param seconds Telemetry period in seconds. 913 */ 914 public static native void setTelemetryPeriod(double seconds); 915 916 /** 917 * Returns telemetry elapsed time. 918 * 919 * @return Telemetry elapsed time. 920 */ 921 public static native double getTelemetryElapsedTime(); 922 923 /** 924 * Returns telemetry value. 925 * 926 * @param handle Telemetry handle. 927 * @param kind Telemetry kind. 928 * @return Telemetry value. 929 */ 930 public static native long getTelemetryValue(int handle, int kind); 931 932 /** 933 * Returns telemetry value. 934 * 935 * @param handle Telemetry handle. 936 * @param kind Telemetry kind. 937 * @return Telemetry value. 938 */ 939 public static long getTelemetryValue(int handle, TelemetryKind kind) { 940 return getTelemetryValue(handle, kind.getValue()); 941 } 942 943 /** 944 * Returns telemetry average value. 945 * 946 * @param handle Telemetry handle. 947 * @param kind Telemetry kind. 948 * @return Telemetry average value. 949 */ 950 public static native double getTelemetryAverageValue(int handle, int kind); 951 952 /** 953 * Returns telemetry average value. 954 * 955 * @param handle Telemetry handle. 956 * @param kind Telemetry kind. 957 * @return Telemetry average value. 958 */ 959 public static double getTelemetryAverageValue(int handle, TelemetryKind kind) { 960 return getTelemetryAverageValue(handle, kind.getValue()); 961 } 962 963 // 964 // Logging Functions 965 // 966 967 /** Logger functional interface. */ 968 @FunctionalInterface 969 public interface LoggerFunction { 970 /** 971 * Log a string. 972 * 973 * @param level Log level. 974 * @param file Log file. 975 * @param line Line number. 976 * @param msg Log message. 977 */ 978 void apply(int level, String file, int line, String msg); 979 } 980 981 /** 982 * Sets logger. 983 * 984 * @param func Logger function. 985 * @param minLevel Minimum logging level. 986 */ 987 public static native void setLogger(LoggerFunction func, int minLevel); 988 989 // 990 // Utility Functions 991 // 992 993 /** 994 * Returns list of USB cameras. 995 * 996 * @return List of USB cameras. 997 */ 998 public static native UsbCameraInfo[] enumerateUsbCameras(); 999 1000 /** 1001 * Returns list of sources. 1002 * 1003 * @return List of sources. 1004 */ 1005 public static native int[] enumerateSources(); 1006 1007 /** 1008 * Returns list of sinks. 1009 * 1010 * @return List of sinks. 1011 */ 1012 public static native int[] enumerateSinks(); 1013 1014 /** 1015 * Returns hostname. 1016 * 1017 * @return Hostname. 1018 */ 1019 public static native String getHostname(); 1020 1021 /** 1022 * Returns list of network interfaces. 1023 * 1024 * @return List of network interfaces. 1025 */ 1026 public static native String[] getNetworkInterfaces(); 1027 1028 /** Runs main run loop. */ 1029 public static native void runMainRunLoop(); 1030 1031 /** 1032 * Runs main run loop with timeout. 1033 * 1034 * @param timeoutSeconds Timeout in seconds. 1035 * @return 3 on timeout, 2 on signal, 1 on other. 1036 */ 1037 public static native int runMainRunLoopTimeout(double timeoutSeconds); 1038 1039 /** Stops main run loop. */ 1040 public static native void stopMainRunLoop(); 1041 1042 /** Utility class. */ 1043 private CameraServerJNI() {} 1044}