Expand Minimize Picture-in-picture Power Device Status Voice Recognition Skip Back Skip Forward Minus Plus Play Search
Documentation
Sidebar

Class SdlRouterService

Hierarchy

java.lang.Object
     android.content.Context
         android.content.ContextWrapper
             android.app.Service

Package
com.smartdevicelink.transport

Overview

This class should not be modified by anyone outside of the approved contributors of the SmartDeviceLink project. This service is a central point of communication between hardware and the registered clients. It will multiplex a single transport to provide a connection for a theoretical infinite amount of SDL sessions.

Quick Jump

Fields
Constructors
Methods

Fields

ROUTER_SERVICE_VERSION_NUMBER

protected static final int ROUTER_SERVICE_VERSION_NUMBER
Constant Value
8

REGISTER_NEWER_SERVER_INSTANCE_ACTION

public static final java.lang.String REGISTER_NEWER_SERVER_INSTANCE_ACTION
Constant Value
"com.sdl.android.newservice"

SDL_NOTIFICATION_FAQS_PAGE

public static final java.lang.String SDL_NOTIFICATION_FAQS_PAGE
Constant Value
"https://smartdevicelink.com/en/guides/android/frequently-asked-questions/sdl-notifications/"

START_SERVICE_ACTION

public static final java.lang.String START_SERVICE_ACTION
Constant Value
"sdl.router.startservice"

REGISTER_WITH_ROUTER_ACTION

public static final java.lang.String REGISTER_WITH_ROUTER_ACTION
Constant Value
"com.sdl.android.register"

MESSAGE_STATE_CHANGE

public static final int MESSAGE_STATE_CHANGE
Constant Value
1

MESSAGE_READ

public static final int MESSAGE_READ
Constant Value
2

MESSAGE_WRITE

public static final int MESSAGE_WRITE
Constant Value
3

MESSAGE_DEVICE_NAME

public static final int MESSAGE_DEVICE_NAME
Constant Value
4

MESSAGE_LOG

public static final int MESSAGE_LOG
Constant Value
5

SDL_DEVICE_STATUS_SHARED_PREFS

protected static final java.lang.String SDL_DEVICE_STATUS_SHARED_PREFS
Constant Value
"sdl.device.status"

registeredApps

public static java.util.HashMap registeredApps

Inherited Fields

From Class Fields
android.app.Service START_CONTINUATION_MASK, START_FLAG_REDELIVERY, START_FLAG_RETRY, START_NOT_STICKY, START_REDELIVER_INTENT, START_STICKY, START_STICKY_COMPATIBILITY
android.content.Context ACCESSIBILITY_SERVICE, ACCOUNT_SERVICE, ACTIVITY_SERVICE, ALARM_SERVICE, APPWIDGET_SERVICE, APP_OPS_SERVICE, AUDIO_SERVICE, BATTERY_SERVICE, BIND_ABOVE_CLIENT, BIND_ADJUST_WITH_ACTIVITY, BIND_ALLOW_OOM_MANAGEMENT, BIND_AUTO_CREATE, BIND_DEBUG_UNBIND, BIND_IMPORTANT, BIND_NOT_FOREGROUND, BIND_WAIVE_PRIORITY, BLUETOOTH_SERVICE, CAMERA_SERVICE, CAPTIONING_SERVICE, CARRIER_CONFIG_SERVICE, CLIPBOARD_SERVICE, CONNECTIVITY_SERVICE, CONSUMER_IR_SERVICE, CONTEXT_IGNORE_SECURITY, CONTEXT_INCLUDE_CODE, CONTEXT_RESTRICTED, DEVICE_POLICY_SERVICE, DISPLAY_SERVICE, DOWNLOAD_SERVICE, DROPBOX_SERVICE, FINGERPRINT_SERVICE, INPUT_METHOD_SERVICE, INPUT_SERVICE, JOB_SCHEDULER_SERVICE, KEYGUARD_SERVICE, LAUNCHER_APPS_SERVICE, LAYOUT_INFLATER_SERVICE, LOCATION_SERVICE, MEDIA_PROJECTION_SERVICE, MEDIA_ROUTER_SERVICE, MEDIA_SESSION_SERVICE, MIDI_SERVICE, MODE_APPEND, MODE_ENABLE_WRITE_AHEAD_LOGGING, MODE_MULTI_PROCESS, MODE_PRIVATE, MODE_WORLD_READABLE, MODE_WORLD_WRITEABLE, NETWORK_STATS_SERVICE, NFC_SERVICE, NOTIFICATION_SERVICE, NSD_SERVICE, POWER_SERVICE, PRINT_SERVICE, RESTRICTIONS_SERVICE, SEARCH_SERVICE, SENSOR_SERVICE, STORAGE_SERVICE, TELECOM_SERVICE, TELEPHONY_SERVICE, TELEPHONY_SUBSCRIPTION_SERVICE, TEXT_SERVICES_MANAGER_SERVICE, TV_INPUT_SERVICE, UI_MODE_SERVICE, USAGE_STATS_SERVICE, USB_SERVICE, USER_SERVICE, VIBRATOR_SERVICE, WALLPAPER_SERVICE, WIFI_P2P_SERVICE, WIFI_SERVICE, WINDOW_SERVICE

Constructors

SdlRouterService()

public SdlRouterService()

Methods

onBind( Intent intent )

public android.os.IBinder onBind(Intent intent)

Parameters

intent

onUnbind( Intent intent )

public boolean onUnbind(Intent intent)

Parameters

intent

formatMessage( SdlRouterService.RegisteredApp app, Message message )

Formats the message for the app that is to receive it

protected boolean formatMessage(SdlRouterService.RegisteredApp app,Message message)

Parameters

app
message

onCreate()

public void onCreate()

deployNextRouterService()

The method will attempt to start up the next router service in line based on the sorting criteria of best router service.

protected void deployNextRouterService()

startUpSequence()

public void startUpSequence()

onStartCommand( Intent intent, int flags, int startId )

public int onStartCommand(Intent intent,int flags,int startId)

Parameters

intent
flags
startId

onDestroy()

public void onDestroy()

resetForegroundTimeOut( long delay )

public void resetForegroundTimeOut(long delay)

Parameters

delay

cancelForegroundTimeOut()

public void cancelForegroundTimeOut()

getConnectedDeviceName()

Deprecated

public java.lang.String getConnectedDeviceName()

shouldServiceRemainOpen( Intent intent )

1. If the app has SDL shut off, shut down 2. if The app has an Alt Transport address or was started by one, stay open 3. If Bluetooth is off/NA shut down 4. Anything else

public boolean shouldServiceRemainOpen(Intent intent)

Parameters

intent

closeSelf()

This method is needed so that apps that choose not to implement this as a service as defined by Android, but rather just a simple class we have to know how to shut down.

public void closeSelf()

onTransportConnected( TransportType type )

Deprecated

public void onTransportConnected(TransportType type)

Parameters

type

onTransportConnected( TransportRecord record )

public void onTransportConnected(TransportRecord record)

Parameters

record

onTransportDisconnected( TransportType type )

Deprecated

public void onTransportDisconnected(TransportType type)

Parameters

type

onTransportDisconnected( TransportRecord record )

public void onTransportDisconnected(TransportRecord record)

Parameters

record

onTransportError( TransportType transportType )

Deprecated

public void onTransportError(TransportType transportType)

Parameters

transportType

onTransportError( TransportRecord transport )

public void onTransportError(TransportRecord transport)

Parameters

transport

onPacketRead( SdlPacket packet )

public void onPacketRead(SdlPacket packet)

Parameters

packet

writeBytesToTransport( Bundle bundle )

public boolean writeBytesToTransport(Bundle bundle)

Parameters

bundle

sendPacketToRegisteredApp( SdlPacket packet )

This will send the received packet to the registered service. It will default to the single registered "foreground" app. This can be overridden to provide more specific functionality.

public boolean sendPacketToRegisteredApp(SdlPacket packet)

Parameters

packet
the packet that is received

bluetoothQuerryAndConnect()

This function looks through the phones currently paired bluetooth devices If one of the devices' names contain "sync", or livio it will attempt to connect the RFCOMM And start SDL

public synchronized boolean bluetoothQuerryAndConnect()

setBluetoothPrefs( int level, String prefLocation )

Deprecated

public static void setBluetoothPrefs(int level,String prefLocation)

Parameters

level
The level of bluetooth connecting method that last worked
prefLocation
Where the preference should be stored

getBluetoothPrefs( String prefLocation )

Deprecated

public static int getBluetoothPrefs(String prefLocation)

Parameters

prefLocation

setSDLConnectedStatus( String address, boolean hasSDLConnected )

Set the connection establishment status of the particular device

protected void setSDLConnectedStatus(String address,boolean hasSDLConnected)

Parameters

address
address of the device in quesiton
hasSDLConnected
true if a connection has been established, false if not

isFirstStatusCheck( String address )

Checks to see if a device address has connected to SDL before.

protected boolean isFirstStatusCheck(String address)

Parameters

address
the mac address of the device in quesiton

hasSDLConnected( String address )

Checks to see if a device address has connected to SDL before.

protected boolean hasSDLConnected(String address)

Parameters

address
the mac address of the device in quesiton

getLocalRouterService( Intent launchIntent, ComponentName name )

Deprecated

protected static com.smartdevicelink.transport.SdlRouterService.LocalRouterService getLocalRouterService(Intent launchIntent,ComponentName name)

Parameters

launchIntent
name

getNextTask( TransportType transportType )

Method for finding the next, highest priority write task from all connected apps.

protected com.smartdevicelink.transport.SdlRouterService.PacketWriteTask getNextTask(TransportType transportType)

Parameters

transportType

Inherited Methods

From Class Methods
android.app.Service getApplication, onCreate, onStart, onStartCommand, onDestroy, onConfigurationChanged, onLowMemory, onTrimMemory, onBind, onUnbind, onRebind, onTaskRemoved, stopSelf, stopSelf, stopSelfResult, startForeground, stopForeground, dump
android.content.ContextWrapper attachBaseContext, getBaseContext, getAssets, getResources, getPackageManager, getContentResolver, getMainLooper, getApplicationContext, setTheme, getTheme, getClassLoader, getPackageName, getApplicationInfo, getPackageResourcePath, getPackageCodePath, getSharedPreferences, openFileInput, openFileOutput, deleteFile, getFileStreamPath, fileList, getFilesDir, getNoBackupFilesDir, getExternalFilesDir, getExternalFilesDirs, getObbDir, getObbDirs, getCacheDir, getCodeCacheDir, getExternalCacheDir, getExternalCacheDirs, getExternalMediaDirs, getDir, openOrCreateDatabase, openOrCreateDatabase, deleteDatabase, getDatabasePath, databaseList, getWallpaper, peekWallpaper, getWallpaperDesiredMinimumWidth, getWallpaperDesiredMinimumHeight, setWallpaper, setWallpaper, clearWallpaper, startActivity, startActivity, startActivities, startActivities, startIntentSender, startIntentSender, sendBroadcast, sendBroadcast, sendOrderedBroadcast, sendOrderedBroadcast, sendBroadcastAsUser, sendBroadcastAsUser, sendOrderedBroadcastAsUser, sendStickyBroadcast, sendStickyOrderedBroadcast, removeStickyBroadcast, sendStickyBroadcastAsUser, sendStickyOrderedBroadcastAsUser, removeStickyBroadcastAsUser, registerReceiver, registerReceiver, unregisterReceiver, startService, stopService, bindService, unbindService, startInstrumentation, getSystemService, getSystemServiceName, checkPermission, checkCallingPermission, checkCallingOrSelfPermission, checkSelfPermission, enforcePermission, enforceCallingPermission, enforceCallingOrSelfPermission, grantUriPermission, revokeUriPermission, checkUriPermission, checkCallingUriPermission, checkCallingOrSelfUriPermission, checkUriPermission, enforceUriPermission, enforceCallingUriPermission, enforceCallingOrSelfUriPermission, enforceUriPermission, createPackageContext, createConfigurationContext, createDisplayContext, isRestricted
android.content.Context getAssets, getResources, getPackageManager, getContentResolver, getMainLooper, getApplicationContext, registerComponentCallbacks, unregisterComponentCallbacks, getText, getString, getString, getColor, getDrawable, getColorStateList, setTheme, getTheme, obtainStyledAttributes, obtainStyledAttributes, obtainStyledAttributes, obtainStyledAttributes, getClassLoader, getPackageName, getApplicationInfo, getPackageResourcePath, getPackageCodePath, getSharedPreferences, openFileInput, openFileOutput, deleteFile, getFileStreamPath, getFilesDir, getNoBackupFilesDir, getExternalFilesDir, getExternalFilesDirs, getObbDir, getObbDirs, getCacheDir, getCodeCacheDir, getExternalCacheDir, getExternalCacheDirs, getExternalMediaDirs, fileList, getDir, openOrCreateDatabase, openOrCreateDatabase, deleteDatabase, getDatabasePath, databaseList, getWallpaper, peekWallpaper, getWallpaperDesiredMinimumWidth, getWallpaperDesiredMinimumHeight, setWallpaper, setWallpaper, clearWallpaper, startActivity, startActivity, startActivities, startActivities, startIntentSender, startIntentSender, sendBroadcast, sendBroadcast, sendOrderedBroadcast, sendOrderedBroadcast, sendBroadcastAsUser, sendBroadcastAsUser, sendOrderedBroadcastAsUser, sendStickyBroadcast, sendStickyOrderedBroadcast, removeStickyBroadcast, sendStickyBroadcastAsUser, sendStickyOrderedBroadcastAsUser, removeStickyBroadcastAsUser, registerReceiver, registerReceiver, unregisterReceiver, startService, stopService, bindService, unbindService, startInstrumentation, getSystemService, getSystemService, getSystemServiceName, checkPermission, checkCallingPermission, checkCallingOrSelfPermission, checkSelfPermission, enforcePermission, enforceCallingPermission, enforceCallingOrSelfPermission, grantUriPermission, revokeUriPermission, checkUriPermission, checkCallingUriPermission, checkCallingOrSelfUriPermission, checkUriPermission, enforceUriPermission, enforceCallingUriPermission, enforceCallingOrSelfUriPermission, enforceUriPermission, createPackageContext, createConfigurationContext, createDisplayContext, isRestricted
java.lang.Object getClass, hashCode, equals, clone, toString, notify, notifyAll, wait, wait, wait, finalize
View on GitHub.com
Previous Section Next Section