-
public interface BinderWrapperRepresents a connection to the Scatterbrain API. This class should only be injected by dagger only. By default this class is created as a singleton, as there is little value of concurrent connections to Scatterbrain
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description public classBinderWrapper.Companion
-
Method Summary
Modifier and Type Method Description abstract UnitstartService()Starts the scatterbrain router if stopped. abstract UnitstopService()Stops the scatterbrain router if started. abstract UnitunbindService()disconnects from the binder interface abstract List<Identity>getIdentities()Gets a list of all known identities. abstract IdentitygetIdentity(UUID fingerprint)Gets a single identity by fingerprint. abstract List<ScatterMessage>getScatterMessages(String application)returns a list of all stored message objects for a given application requires net.ballmerlabs.scatterroutingservice.permission. abstract List<ScatterMessage>getScatterMessages(String application, Date since)returns a list of all stored messages for a given application after a given date. abstract List<ScatterMessage>getScatterMessages(String application, Date start, Date end)returns a list of all stored messages for a given application between two dates. abstract Flow<List<Identity>>observeIdentities()returns an asynchronous flow of identities received after this function is called in real time. abstract Flow<List<ScatterMessage>>observeMessages(String application)returns an asynchronous flow of all messages received after this functions is called filtered by a given application identifier. abstract IdentitygenerateIdentity(String name)generates and returns a scatterbrain identity with ACLs matching the calling application only If additional applications need access to this identity they can be assigned via the Scatterbrain app. abstract List<NamePackage>getPermissions(Identity identity)Gets a list of ACLs associated with a given identity object. abstract UnitauthorizeIdentity(Identity identity, String packageName)Adds an ACL to an identity authorizing an app to use it. abstract UnitdeauthorizeIdentity(Identity identity, String packageName)Removes an ACL authorizing an app to use an identity. abstract BooleanremoveIdentity(Identity identity)Deletes an identity. abstract ByteArraysign(Identity identity, ByteArray data)Cryptographically signs data using a stored identity. abstract Booleanverify(Identity identity, ByteArray data, ByteArray sig)Cryptographically verifies a detached signature using a stored identity This function requires net.ballmerlabs.scatterroutingservice.permission. abstract UnitstartDiscover()Starts active discovery using default transport modules This function requires net.ballmerlabs.scatterroutingservice.permission. abstract UnitstopDiscover()Stops active discovery This function requires net.ballmerlabs.scatterroutingservice.permission. abstract UnitstartPassive()Starts passive discovery using the default radio module. abstract UnitstopPassive()Stops passive discovery This function requires net.ballmerlabs.scatterroutingservice.permission. abstract UnitsendMessage(ScatterMessage message)Enqueues a Scatterbrain message to the datastore. abstract UnitsendMessage(ScatterMessage message, Identity identity)Enqueues a message to the datastore and signs it with a given identity. abstract UnitsendMessage(ScatterMessage message, UUID identity)Enqueues a message to the datastore and signs it with a given identity. abstract UnitsendMessage(List<ScatterMessage> messages, UUID identity)Enqueues a list of messages to the datastore and signs it with a given identity. abstract UnitsendMessage(List<ScatterMessage> messages)Enqueues multiple Scatterbrain messages to the datastore. abstract UnitsendMessage(List<ScatterMessage> messages, Identity identity)Enqueues a list of messages to the datastore and signs it with a given identity. abstract PermissionStatusgetPermissionStatus()Gets the current critical permissions granted to the router. abstract List<NamePackage>getPackages()Gets a list of packages declaring a Scatterbrain compatible BroadcastReceiver. abstract BooleanisDiscovering()Returns true if the RoutingService is currently discovering abstract LiveData<BinderWrapper.Companion.BinderState>observeBinderState()Returns a LiveData providing the current connection state abstract Unitregister()Unregisters the internal BroadcastReceiver for Scatterbrain events. abstract Unitunregister()Unregisters Scatterbrain broadcast receivers abstract UnitbindService(Long timeout)Attempts a connection to the scatterbrain service abstract UnitrescanPeers()Attempts to reconnect to known local peers abstract LiveData<RouterState>observeRouterState()Observe router state abstract BooleanisConnected()Checks if this SDK is connected to a running Scatterbrain router -
-
Method Detail
-
startService
abstract Unit startService()
Starts the scatterbrain router if stopped. Requires net.ballmerlabs.scatterroutingservice.permission.ADMIN permission
-
stopService
abstract Unit stopService()
Stops the scatterbrain router if started. Requires net.ballmerlabs.scatterroutingservice.permission.ADMIN permission
-
unbindService
abstract Unit unbindService()
disconnects from the binder interface
-
getIdentities
abstract List<Identity> getIdentities()
Gets a list of all known identities. requires net.ballmerlabs.scatterroutingservice.permission.ACCESS permission
-
getIdentity
abstract Identity getIdentity(UUID fingerprint)
Gets a single identity by fingerprint. requires net.ballmerlabs.scatterroutingservice.permission.ACCESS permission
-
getScatterMessages
abstract List<ScatterMessage> getScatterMessages(String application)
returns a list of all stored message objects for a given application requires net.ballmerlabs.scatterroutingservice.permission.ACCESS permission
- Parameters:
application- application identifier
-
getScatterMessages
abstract List<ScatterMessage> getScatterMessages(String application, Date since)
returns a list of all stored messages for a given application after a given date. requires net.ballmerlabs.scatterroutingservice.permission.ACCESS permission
- Parameters:
application- application identifiersince- restrict messages after this date
-
getScatterMessages
abstract List<ScatterMessage> getScatterMessages(String application, Date start, Date end)
returns a list of all stored messages for a given application between two dates. requires net.ballmerlabs.scatterroutingservice.permission.ACCESS permission
- Parameters:
application- application identifierstart- start dateend- end data
-
observeIdentities
@ExperimentalCoroutinesApi() abstract Flow<List<Identity>> observeIdentities()
returns an asynchronous flow of identities received after this function is called in real time. requires net.ballmerlabs.scatterroutingservice.permission.ACCESS permission
-
observeMessages
@ExperimentalCoroutinesApi() abstract Flow<List<ScatterMessage>> observeMessages(String application)
returns an asynchronous flow of all messages received after this functions is called filtered by a given application identifier. requires net.ballmerlabs.scatterroutingservice.permission.ACCESS permission
- Parameters:
application- application idenifier
-
generateIdentity
abstract Identity generateIdentity(String name)
generates and returns a scatterbrain identity with ACLs matching the calling application only If additional applications need access to this identity they can be assigned via the Scatterbrain app. This requires net.ballmerlabs.scatterroutingservice.permission.ACCESS permission
- Parameters:
name- human readable name associated with identity
-
getPermissions
abstract List<NamePackage> getPermissions(Identity identity)
Gets a list of ACLs associated with a given identity object. This function requires net.ballmerlabs.scatterroutingservice.permission.SUPERUSER permission and is currently not available to 3rd party applications
- Parameters:
identity- identity object
-
authorizeIdentity
abstract Unit authorizeIdentity(Identity identity, String packageName)
Adds an ACL to an identity authorizing an app to use it. This function requires net.ballmerlabs.scatterroutingservice.permission.SUPERUSER and is currently not available to 3rd party applications
- Parameters:
identity- identity objectpackageName- android app package name
-
deauthorizeIdentity
abstract Unit deauthorizeIdentity(Identity identity, String packageName)
Removes an ACL authorizing an app to use an identity. This function requires net.ballmerlabs.scatterroutingservice.permission.SUPERUSER and is currently not available to 3rd party applications
- Parameters:
identity- identity objectpackageName- android app package name
-
removeIdentity
abstract Boolean removeIdentity(Identity identity)
Deletes an identity. This function requires net.ballmerlabs.scatterroutingservice.permission.SUPERUSER and is currently not available to 3rd party applications
- Parameters:
identity- identity object
-
sign
abstract ByteArray sign(Identity identity, ByteArray data)
Cryptographically signs data using a stored identity. This function requires net.ballmerlabs.scatterroutingservice.permission.ACCESS permission
- Parameters:
identity- identity objectdata- bytes to sign
-
verify
abstract Boolean verify(Identity identity, ByteArray data, ByteArray sig)
Cryptographically verifies a detached signature using a stored identity This function requires net.ballmerlabs.scatterroutingservice.permission.ACCESS permission
- Parameters:
identity- identity object to verify withdata- data to verifysig- detached signature generated by sign()
-
startDiscover
abstract Unit startDiscover()
Starts active discovery using default transport modules This function requires net.ballmerlabs.scatterroutingservice.permission.ADMIN permission
-
stopDiscover
abstract Unit stopDiscover()
Stops active discovery This function requires net.ballmerlabs.scatterroutingservice.permission.ADMIN permission
-
startPassive
abstract Unit startPassive()
Starts passive discovery using the default radio module. This usually uses less power than active discovery for most transport modules but may skip peers that are also in passive mode This function requires net.ballmerlabs.scatterroutingservice.permission.ADMIN permission
-
stopPassive
abstract Unit stopPassive()
Stops passive discovery This function requires net.ballmerlabs.scatterroutingservice.permission.ADMIN permission
-
sendMessage
abstract Unit sendMessage(ScatterMessage message)
Enqueues a Scatterbrain message to the datastore. The messages will be sent as soon as a peer is available This function requires net.ballmerlabs.scatterroutingservice.permission.ACCESS permission
- Parameters:
message- message to send
-
sendMessage
abstract Unit sendMessage(ScatterMessage message, Identity identity)
Enqueues a message to the datastore and signs it with a given identity. This function requires net.ballmerlabs.scatterroutingservice.permission.ACCESS permission but the calling package must have accesss to the identity
- Parameters:
message- message to sendidentity- identity to sign with
-
sendMessage
abstract Unit sendMessage(ScatterMessage message, UUID identity)
Enqueues a message to the datastore and signs it with a given identity. This function requires net.ballmerlabs.scatterroutingservice.permission.ACCESS permission but the calling package must have accesss to the identity
- Parameters:
message- message to sendidentity- identity to sign with
-
sendMessage
abstract Unit sendMessage(List<ScatterMessage> messages, UUID identity)
Enqueues a list of messages to the datastore and signs it with a given identity. This function requires net.ballmerlabs.scatterroutingservice.permission.ACCESS permission but the calling package must have accesss to the identity
- Parameters:
messages- messages to sendidentity- identity to sign with
-
sendMessage
abstract Unit sendMessage(List<ScatterMessage> messages)
Enqueues multiple Scatterbrain messages to the datastore. The messages will be sent as soon as a peer is available This function requires net.ballmerlabs.scatterroutingservice.permission.ACCESS permission
- Parameters:
messages- message to send
-
sendMessage
abstract Unit sendMessage(List<ScatterMessage> messages, Identity identity)
Enqueues a list of messages to the datastore and signs it with a given identity. This function requires net.ballmerlabs.scatterroutingservice.permission.ACCESS permission but the calling package must have accesss to the identity
- Parameters:
messages- messages to sendidentity- identity to sign with
-
getPermissionStatus
abstract PermissionStatus getPermissionStatus()
Gets the current critical permissions granted to the router. This should be used to prompt the user to open Scatterbrain and grant permissions
-
getPackages
abstract List<NamePackage> getPackages()
Gets a list of packages declaring a Scatterbrain compatible BroadcastReceiver. This function requires net.ballmerlabs.scatterroutingservice.permission.SUPERUSER permission and is currently not available to 3rd party applications
-
isDiscovering
abstract Boolean isDiscovering()
Returns true if the RoutingService is currently discovering
-
observeBinderState
abstract LiveData<BinderWrapper.Companion.BinderState> observeBinderState()
Returns a LiveData providing the current connection state
-
register
abstract Unit register()
Unregisters the internal BroadcastReceiver for Scatterbrain events. This must be called to use the Scatterbrain SDK
-
unregister
abstract Unit unregister()
Unregisters Scatterbrain broadcast receivers
-
bindService
abstract Unit bindService(Long timeout)
Attempts a connection to the scatterbrain service
-
rescanPeers
abstract Unit rescanPeers()
Attempts to reconnect to known local peers
-
observeRouterState
abstract LiveData<RouterState> observeRouterState()
Observe router state
-
isConnected
abstract Boolean isConnected()
Checks if this SDK is connected to a running Scatterbrain router
-
-
-
-