Package app.pivo.android.prosdk.events
Class PivoEventBus
- java.lang.Object
-
- app.pivo.android.prosdk.events.PivoEventBus
-
-
Field Summary
Fields Modifier and Type Field Description static intBYPASSBypass subjectstatic intCONNECTION_COMPLETEDConnection completed subject.static intCONNECTION_FAILUREConnection failed or an app is disconnected from Pivo.static intMAC_ADDRESSMacAddress subjectstatic intNAME_CHANGEDName is changed subject.static intPIVO_NOTIFICATIONPivo notification subjectstatic intREMOTE_CONTROLLERRemote controller subject.static intSCAN_DEVICEScan device subject.
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static voidpublish(int subject, Object message)Publish an object to the specified subject for all subscribers of that subject.static voidsubscribe(int subject, Object lifecycle, io.reactivex.functions.Consumer<Object> action)Subscribe to the specified subject and listen for updates on that subject.static voidunregister(Object lifecycle)Unregisters this object from the bus, removing all subscriptions.
-
-
-
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
-
SCAN_DEVICE
public static final int SCAN_DEVICE
Scan device subject.- 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
-
MAC_ADDRESS
public static final int MAC_ADDRESS
MacAddress subject- See Also:
- Constant Field Values
-
BYPASS
public static final int BYPASS
Bypass 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 callunregister(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.
-
-