Class PivoEventBus


  • public final class PivoEventBus
    extends Object
    PivoEventBus allows to listen and send Pivo events PivoEvent in different components of the application.
    • Field Detail

      • CONNECTION_COMPLETED

        public static final int CONNECTION_COMPLETED
        Connection completed subject.
        See Also:
        Constant Field Values
      • CONNECTION_FAILURE

        public static final int CONNECTION_FAILURE
        Connection failed or an app is disconnected from Pivo.
        See Also:
        Constant Field Values
      • REMOTE_CONTROLLER

        public static final int REMOTE_CONTROLLER
        Remote controller subject.
        See Also:
        Constant Field Values
      • NAME_CHANGED

        public static final int NAME_CHANGED
        Name is changed subject.
        See Also:
        Constant Field Values
      • PIVO_NOTIFICATION

        public static final int PIVO_NOTIFICATION
        Pivo notification subject
        See Also:
        Constant Field Values
    • Method Detail

      • subscribe

        public static void subscribe​(int subject,
                                     @NonNull
                                     Object lifecycle,
                                     @NonNull
                                     io.reactivex.functions.Consumer<Object> action)
        Subscribe to the specified subject and listen for updates on that subject. Pass in an object to associate your registration with, so that you can unsubscribe later.

        Note: Make sure to call unregister(Object) to avoid memory leaks.
      • unregister

        public static void unregister​(@NonNull
                                      Object lifecycle)
        Unregisters this object from the bus, removing all subscriptions. This should be called when the object is going to go out of memory.
      • publish

        public static void publish​(int subject,
                                   @NonNull
                                   Object message)
        Publish an object to the specified subject for all subscribers of that subject.