FileDocCategorySizeDatePackage
Service.javaAPI DocAndroid 5.1 API1956Thu Mar 12 22:22:42 GMT 2015com.android.accessorydisplay.common

Service

public abstract class Service extends Object implements Transport.Callback
Base implementation of a service that communicates over a transport.

This object's interface is single-threaded. It is only intended to be accessed from the {@link Looper} thread on which the transport was created.

Fields Summary
private final android.content.Context
mContext
private final com.android.accessorydisplay.common.Transport
mTransport
private final int
mServiceId
Constructors Summary
public Service(android.content.Context context, com.android.accessorydisplay.common.Transport transport, int serviceId)

        mContext = context;
        mTransport = transport;
        mServiceId = serviceId;
    
Methods Summary
public android.content.ContextgetContext()

        return mContext;
    
public LoggergetLogger()

        return mTransport.getLogger();
    
public intgetServiceId()

        return mServiceId;
    
public com.android.accessorydisplay.common.TransportgetTransport()

        return mTransport;
    
public voidonMessageReceived(int service, int what, java.nio.ByteBuffer content)

    
public voidstart()

        mTransport.registerService(mServiceId, this);
    
public voidstop()

        mTransport.unregisterService(mServiceId);