public interface Core
<application android...> <service android:name="com.tomtom.business.ubi.core.DirectCoreService"/> ... </application>The client's implementation of
ServiceConnection.onServiceConnected(android.content.ComponentName, android.os.IBinder)
must cast the
IBinder
parameter to an InterfaceServiceBinder<Core>
and call InterfaceServiceBinder#getService()
to
get a reference to the Core
interface.
After the client has successfully bound it must call registerCallback(ServiceClientCallback)
and specify a proper implementation
of a ServiceClientCallback
. As result a reference to a ServiceClient
is returned that in turn can be used to trigger
functionality in the Core. The communication with the Core is always asynchronous and bidirectional. Mostly a call to a method in
ServiceClient
results in a callback via ServiceClientCallback
. The methods called by ServiceClientCallback
are always
executed on the main thread. The first method to call after having obtained a reference to the service client is
ServiceClient.bootCore(com.tomtom.business.ubi.commons.api.CoreBootParameter)
. This method starts the Core and initiates the connections
and starts the activation process of the dongle if necessary.
com.tomtom.business.ubi.core.DirectCoreService
).Intent bindIntent = new Intent(.., com.tomtom.business.ubi.core.DirectCoreService.class); context.bindService(bindIntent, .., ..);
IBinder
specified with
ServiceConnection.onServiceConnected(android.content.ComponentName, IBinder)
to InterfaceServiceBinder<Core>
and call InterfaceServiceBinder#getService()
to get a reference to the Core
.
Core core = ((InterfaceServiceBinder<Core>) serviceBinder).getService();
registerCallback(ServiceClientCallback)
and keep the reference to ServiceClient
.ServiceClient.bootCore(com.tomtom.business.ubi.commons.api.CoreBootParameter)
with valid credentials and parameters.ServiceClient
or receive calls via ServiceClientCallback
.ServiceClient
,
ServiceClientCallback
Modifier and Type | Method and Description |
---|---|
void |
addCallback(ServiceClientCallback clientCallback)
Adds a callback handler to the Core.
|
CoreInitializationStatus |
getCoreInitializationStatus()
Returns the current intialization state of the Core.
|
EndpointConnectedStatus |
getEndpointConnectedStatus()
Returns which of the end-points is currently connected to the Core.
|
ServiceClient |
getServiceClient()
To obtain a reference to the
com.tomtom.business.ubi.commons.api.ServiceClient call this method after having bound successfully to
the service. |
ServiceClient |
registerCallback(ServiceClientCallback clientCallback)
Deprecated.
|
void |
removeCallback(ServiceClientCallback clientCallback)
Removes a callback handler from the core.
|
ServiceClient registerCallback(ServiceClientCallback clientCallback)
getServiceClient()
and addCallback(com.tomtom.business.ubi.commons.api.ServiceClientCallback)
insteadcom.tomtom.business.ubi.commons.api.ServiceClient
call this method after having bound successfully to
the service. Specify a reference to a proper callback implementation which is then called from the Core when an event occurs.ServiceClient getServiceClient()
com.tomtom.business.ubi.commons.api.ServiceClient
call this method after having bound successfully to
the service.void addCallback(ServiceClientCallback clientCallback)
void removeCallback(ServiceClientCallback clientCallback)
EndpointConnectedStatus getEndpointConnectedStatus()
EndpointConnectedStatus
CoreInitializationStatus getCoreInitializationStatus()
CoreInitializationStatus