interface SmartWorkspaceSdk
Sensorberg Smart Spaces SDK interface. All methods are expected to be called from UI-thread. The SDK handles all needed threading internally. The Smart Workspaces SDK must be a singleton in the application. Consult the implementation guide for singleton pattern.
There are three implementations of the SDK:
SmartWorkspaceSdk
.Builder(context) // Android context
.baseUrl(baseUrl) // base URL to the server
.oauthId(oauthId) // oauth ID of the Android application on the server
.certificate(certificate) // server public key certificate hash on the format: "sha256/AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA="
.build()
testImplementation 'com.sensorberg.smartworkspace:test-sdk:VERSION'
val sdk = EmptySdk()
sdk.getUserResponse.value = Response.success(user)
sdk.getUnitsResponse.value = Response.success(units) ... etc
assertEquals(user, sdk.getUnitController().getUnits(Availability.All, Sorting.None))
androidTestImplementation 'com.sensorberg.smartworkspace:test-sdk:VERSION'
val sdk = TestSdk()
sdk.getUnitController().getUnits(...)
.observeForEver {
// response will be executing and later success with some mocked data
}
class Builder
Builder for the real Smart Workspace implementation. All parameters are required and can be found on the Smart Workspaces admin panel. |
abstract fun getBookingManager(): BookingManager
Manages bookings and schedules on the units. |
|
abstract fun getTapController(): TapController
Controller for magneto and NFC "tap" actions. |
|
abstract fun getUnitController(): UnitController
Controller for IotUnit. Find nearby, open, etc |
|
abstract fun getUserManager(): UserManager
Manages user authentication. Provides methods for login, logout, change password and the logged-in/out |
|
abstract fun refresh(vararg refresh: Refresh = arrayOf(Refresh.All)): Unit
Force refreshes relevant data from backend. On success, this new data will be reflected on their appropriate LiveData. Optional refresh parameter to refresh only certain data types. |