Class Heartbeat
java.lang.Object
org.openremote.agent.protocol.bluetooth.mesh.utils.Heartbeat
- Direct Known Subclasses:
HeartbeatPublication
,HeartbeatSubscription
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final int
static final int
protected byte
static final int
static final int
protected int
static final int
static final int
static final int
static final int
protected byte
static final int
-
Method Summary
Modifier and TypeMethodDescriptionstatic int
calculateHeartbeatCount
(int countLog) Calculates the heart beat publication count which is the number of publications to be sentstatic int
calculateHeartbeatPeriod
(short periodLog) Calculates the heart beat period interval in secondsstatic byte
decodeHeartbeatPeriod
(int period) Decodes the period and returns the period log valuebyte
int
getDst()
Returns the destination address.byte
Returns the period for processing.abstract boolean
Returns true if the heartbeats are enabled.static boolean
isValidHeartbeatPeriod
(int period) Validates heart beat period.static boolean
isValidHeartbeatPeriodLog
(byte period) Validates heart beat period log.static String
periodToTime
(int seconds) Converts the period to time
-
Field Details
-
DO_NOT_SEND_PERIODICALLY
public static final int DO_NOT_SEND_PERIODICALLY- See Also:
-
PERIOD_MIN
public static final int PERIOD_MIN- See Also:
-
PERIOD_MAX
public static final int PERIOD_MAX- See Also:
-
PERIOD_LOG_MIN
public static final int PERIOD_LOG_MIN- See Also:
-
PERIOD_LOG_MAX
public static final int PERIOD_LOG_MAX- See Also:
-
COUNT_MIN
public static final int COUNT_MIN- See Also:
-
COUNT_MAX
public static final int COUNT_MAX- See Also:
-
SEND_INDEFINITELY
public static final int SEND_INDEFINITELY- See Also:
-
DEFAULT_PUBLICATION_TTL
public static final int DEFAULT_PUBLICATION_TTL- See Also:
-
dst
protected int dst -
periodLog
protected byte periodLog -
countLog
protected byte countLog
-
-
Method Details
-
isEnabled
public abstract boolean isEnabled()Returns true if the heartbeats are enabled. -
getDst
public int getDst()Returns the destination address. -
getPeriodLog
public byte getPeriodLog()Returns the period for processing. -
calculateHeartbeatPeriod
public static int calculateHeartbeatPeriod(short periodLog) Calculates the heart beat period interval in seconds- Parameters:
periodLog
- period value
-
decodeHeartbeatPeriod
public static byte decodeHeartbeatPeriod(int period) Decodes the period and returns the period log value- Parameters:
period
- period value
-
isValidHeartbeatPeriod
public static boolean isValidHeartbeatPeriod(int period) Validates heart beat period.- Parameters:
period
- Heartbeat publication period.- Returns:
- true if valid or false otherwise.
- Throws:
IllegalArgumentException
- if the value does not range from 0 to 17.
-
isValidHeartbeatPeriodLog
public static boolean isValidHeartbeatPeriodLog(byte period) Validates heart beat period log.- Parameters:
period
- Heartbeat publication period.- Returns:
- true if valid or false otherwise.
- Throws:
IllegalArgumentException
- if the value does not range from 0 to 17.
-
getCountLog
public byte getCountLog() -
calculateHeartbeatCount
public static int calculateHeartbeatCount(int countLog) Calculates the heart beat publication count which is the number of publications to be sent- Parameters:
countLog
- count value
-
periodToTime
Converts the period to time- Parameters:
seconds
- PeriodLog
-