apidocs / com.nimmsta.core.android.framework / NIMMSTAConnectionManager

NIMMSTAConnectionManager

open class NIMMSTAConnectionManager : INIMMSTAConnectionManager

The NIMMSTAConnectionManager is the central background service which runs the background activity of the NIMMSTA Framework. It manages all active device connections and the mode in which the framework is currently running. It connects all involved activities. It also builds the central point for the Android specific implementations of all classes. In order to obtain an instance of this class, you need to obtain the NIMMSTAConnectionManagerService service using the NIMMSTAServiceConnection.

Author
NIMMSTA Team

Copyright
NIMMSTA GmbH & IBPG 2020

License
NIMMSTA GmbH

Properties

application

val application: Application

bluetoothCompatibilityMode

Defines whether HighPriorityHandler enabled compatibility mode or it was enabled by user.

open var bluetoothCompatibilityMode: BluetoothCompatibilityMode

displayConnectActivityAction

invoked when displayConnectionActivity is called. If set to null, default behaviour is used.

var displayConnectActivityAction: (suspend () -> Unit)?

isConnected

Indicates whether at least one device is connected.

val isConnected: Boolean

nimmstaDeviceScanner

the Device Scanner of the NIMMSTA Android Framework. Used by devices to scan for new NIMMSTA Devices.

open lateinit var nimmstaDeviceScanner: NIMMSTADeviceScanner

notificationServiceInitalized

defines if notification service was enabled. Enable using enableBackgroundAndNotifications.

val notificationServiceInitalized: Boolean

service

val service: Service

shouldConnectWithHID

Defines whether connection should be established with HID mode.

var shouldConnectWithHID: Boolean

Functions

connectAsyncInternal

Connects a device by providing a ConnectionCode or DeviceAddress. Will search for the specific NIMMSTA Device until cancellation. Searches with the existing DeviceScanner

open fun connectAsyncInternal(connectionInfo: Any, cancellationToken: CancellationToken?, deviceFound: ((scanResult: SearchScanResult) -> Unit)?, scanTimeout: TimeSpan?, scanningDoesNotFindAnyDeviceCallback: ((foundDevice: Boolean) -> Unit)?): Task<NIMMSTADevice>

displayConnectionActivity

Displays ConnectionActivity First parameters defines if Activity should finish if another process created a connection to a device which means either reconnect or other activity.

open fun displayConnectionActivity(shouldFinishActivityOnNewOtherConnection: Boolean): Task<Unit>

enableBackgroundAndNotifications

Enables notifications for connected / disconnected scanner. This also enables background ability, so that if the phone goes into standby, it still talks to the HS 50 in the background.

fun enableBackgroundAndNotifications(): Unit

hasRequiredPermissions

Returns true if all necessary permissions for the library's operation have been granted.

fun hasRequiredPermissions(context: Context): Boolean

onCreate

called when this service starts and checks for some state.

fun onCreate(): Unit

onDestroy

called when service is destroyed.

fun onDestroy(): Unit

requestRequiredPermissions

Requests all required permissions for the library's operation by starting a new permission activity. To react to the response you need to overwrite the onActivityResult method in your provided activity.

fun requestRequiredPermissions(activity: Activity): Unit

Companion Object Properties

numberOfInstances

static variable to check if NIMMSTAConnectionManager exists more than once.

var numberOfInstances: Int

PERMISSION_REQUEST_CODE

Code for the result of the permission request intent

const val PERMISSION_REQUEST_CODE: Int