ZTBaseProduct

abstract class ZTBaseProduct

This class must be inherited by a SDK kit. All operations on Zhortech product are done trough this class, based on our internal communication protocol. The class handles messages from the device, parse them, treat them and returns the message to an enqueued command if needed.

Author

Alexandre Lemoult <a.lemoult@zhortech.com>

Constructors

ZTBaseProduct
Link copied to clipboard
fun ZTBaseProduct()

Functions

addActivityData
Link copied to clipboard
fun addActivityData(timestamp: Long, data: List<Any?>)
bindToConnection
Link copied to clipboard
fun Disposable.bindToConnection(): Disposable
checkFirmwareUpdate
Link copied to clipboard
fun checkFirmwareUpdate(): Observable<Optional<ZTDfuData>>
Request last available firmware version
createRestService
Link copied to clipboard
fun <T> createRestService(clazz: Class<*>): T
disconnect
Link copied to clipboard
fun disconnect()
doOnReady
Link copied to clipboard
fun doOnReady(): Single<ZTBaseProduct>
This methods is called automatically as soon as an active connection comes in.
forceStopActivity
Link copied to clipboard
fun forceStopActivity(): Completable
getDeviceIdentifier
Link copied to clipboard
fun getDeviceIdentifier(): String?
getSegmentDuration
Link copied to clipboard
abstract fun getSegmentDuration(): Long
observeRestoredActivity
Link copied to clipboard
fun observeRestoredActivity(): Observable<ZTActivity>
observeStateChanges
Link copied to clipboard
fun observeStateChanges(): Observable<ZTProductState>
onIndicateData
Link copied to clipboard
abstract fun onIndicateData(data: ByteArray)
onNotifyData
Link copied to clipboard
open fun onNotifyData(data: ByteArray)
readBattery
Link copied to clipboard
fun readBattery(): Single<ZTBatteryLevel>
readFirmwareVersion
Link copied to clipboard
fun readFirmwareVersion(): Single<String>
readHardwareVersion
Link copied to clipboard
fun readHardwareVersion(): Single<String>
readPairedDevice
Link copied to clipboard
fun readPairedDevice(): Single<String>
readSerialNumber
Link copied to clipboard
fun readSerialNumber(): Single<String>
readState
Link copied to clipboard
open fun readState(): Single<ByteArray>
requestConnectionPriority
Link copied to clipboard
fun requestConnectionPriority(connectionPriority: ZTBleConnection.ConnectionPriority): Completable
startActivityWithAttributes
Link copied to clipboard
fun startActivityWithAttributes(attributes: ZTSerializable? = null): Completable
stopActivity
Link copied to clipboard
open fun stopActivity(): Single<ZTActivity>

Properties

connection
Link copied to clipboard
val connection: ZTBleConnection?
The current active connection, could be null
connectionState
Link copied to clipboard
val connectionState: ZTConnectionState
The current connection state
device
Link copied to clipboard
open val device: ZTDevice?
The current active device, could be null
information
Link copied to clipboard
var information: ZTProductInformation? = null
The product information, serial, firmware, hardware etc
state
Link copied to clipboard
var state: ZTProductState
The parsed state of the device

Inheritors

ZTSegmentedProduct
Link copied to clipboard