IDeviceStatusManager
IDeviceStatusManager
Description Class that is used to manage device status. Users can get and monitor device status. For example, Aircraft disconnected, Sensor Error, Low Voltage Warning, etc.
method addAutelDeviceStatusChangeListener
fun addAutelDeviceStatusChangeListener(listener: AutelDeviceStatusChangeListener)
Description: Add the listener of the device status.
Input Parameters: AutelDeviceStatusChangeListener Listener of the device status.
Output Parameter: NONE
Related Parameters: AutelDeviceStatusChangeListener
method removeAutelDeviceStatusChangeListener
fun removeAutelDeviceStatusChangeListener(listener: AutelDeviceStatusChangeListener)
Description: Remove the listener of the device status.
Input Parameters: AutelDeviceStatusChangeListener Listener of the device status.
Output Parameter: NONE
Related Parameters: NONE
method clearAllListeners
fun clearAllListeners()
Description: Remove all listeners of the device status.
Input Parameters: NONE
Output Parameter: NONE
Related Parameters: NONE
method getCurrentDeviceStatus
fun getCurrentDeviceStatus(): AutelDeviceStatus?
Description: Get the current device status.
Input Parameters: NONE
Output Parameter: AutelDeviceStatus Return the current device status.
Related Parameters: NONE
method getCurrentDeviceStatusList
fun getCurrentDeviceStatusList(): List<AutelDeviceStatus>
Description: Get the devices alarm list.
Input Parameters: NONE
Output Parameter: List<AutelDeviceStatus>
Return the devices alarm list.
Related Parameters: AutelDeviceStatus
For alarm IDs, please refer to WaringIdEnum
/**
* Device status class. It is used to get the device status.
*/
data class AutelDeviceStatus(
val statusCode: String, //Alarm Id
val description: String, //Alarm description
val warningLevel: WarningLevel, //Alarm level
) {
override fun toString(): String {
return "AutelDeviceStatus(statusCode=$statusCode,description=$description,warningLevel=$warningLevel)"
}
}
/**
* Waring level class.
*/
enum WarningLevel {
NORMAL, //Normal
NOTICE, //Notice
CAUTION, //Caution
WARNING, //Warning
SERIOUS_WARNING, //Serious warning.
}
/**
* Listener of the device status.
*/
interface AutelDeviceStatusChangeListener {
/**
* Real-time alarm reporting (notification of alarm information with short timeliness at the current moment to the APP
* and waiting for the APP to respond)
*
* @param from Previous alarm information, if null, it means there was no alarm before
* @param to Current alarm information, if null, it means there is no alarm currently
*/
fun onDeviceStatusUpdate(from: AutelDeviceStatus?, to: AutelDeviceStatus)
/**
* Aircraft alarm list notification (periodically reporting the current alarm information of the aircraft).
* If `to` is null, it means that the aircraft currently has no alarms.
*
* @param from The previous alarm list. If null, it means there were no previous alarms.
* @param to The current alarm list. If null, it means there are no current alarms.
*/
fun onDeviceStatusListUpdate(from: List<AutelDeviceStatus>, to: List<AutelDeviceStatus>)
}