Class MeshAddress
java.lang.Object
org.openremote.agent.protocol.bluetooth.mesh.utils.MeshAddress
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final int
static final int
static final int
static final int
static final int
static final int
static final int
static final int
static final int
static final int
static final int
static final int
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic short
addressBytesToInt
(byte[] unicastAddress) Returns the unicast address as intstatic byte[]
addressIntToBytes
(int unicastAddress) Returns the unicast address as intstatic String
formatAddress
(int address, boolean add0x) static UUID
Generates a random uuidstatic Integer
generateVirtualAddress
(UUID uuid) Generates a virtual address from a given Lable UUIDstatic AddressType
getAddressType
(int address) Returns theAddressType
static int
getHash
(int address) Returns the value of the hash from a virtual addressstatic UUID
getLabelUuid
(List<UUID> uuids, int address) Returns the label UUID for a given virtual addressstatic boolean
isAddressInRange
(byte[] address) static boolean
isAddressInRange
(int address) Checks if the address is in rangestatic boolean
isValidFixedGroupAddress
(int address) Returns true if the its a valid fixed group address.static boolean
isValidGroupAddress
(byte[] address) static boolean
isValidGroupAddress
(int address) Returns true if the its a valid group addressstatic boolean
isValidHeartbeatPublicationDestination
(int address) Validates if the address is a valid Heartbeat publicaiton destination.static boolean
isValidHeartbeatSubscriptionDestination
(int address) Validates if the address is a valid Heartbeat subscription source.static boolean
isValidHeartbeatSubscriptionSource
(int address) Validates if the address is a valid Heartbeat subscription source.static boolean
isValidProxyFilterAddress
(byte[] address) Validates if the given address is a valid address that can be used as a proxy filterstatic boolean
isValidProxyFilterAddress
(int address) Validates if the given address is a valid address that can be used as a proxy filterstatic boolean
isValidSubscriptionAddress
(byte[] address) Validates a given address for subscriptionsstatic boolean
isValidSubscriptionAddress
(int address) Returns true if the address is a valid subscription addressstatic boolean
isValidUnassignedAddress
(byte[] address) Validates an unassigned addressstatic boolean
isValidUnassignedAddress
(int address) Validates a unassigned addressstatic boolean
isValidUnicastAddress
(byte[] address) Validates a unicast addressstatic boolean
isValidUnicastAddress
(int address) Validates a unicast addressstatic boolean
isValidVirtualAddress
(byte[] address) Validates a virtual addressstatic boolean
isValidVirtualAddress
(int address) Validates a unicast address
-
Field Details
-
UNASSIGNED_ADDRESS
public static final int UNASSIGNED_ADDRESS- See Also:
-
START_UNICAST_ADDRESS
public static final int START_UNICAST_ADDRESS- See Also:
-
END_UNICAST_ADDRESS
public static final int END_UNICAST_ADDRESS- See Also:
-
START_GROUP_ADDRESS
public static final int START_GROUP_ADDRESS- See Also:
-
END_GROUP_ADDRESS
public static final int END_GROUP_ADDRESS- See Also:
-
ALL_PROXIES_ADDRESS
public static final int ALL_PROXIES_ADDRESS- See Also:
-
ALL_FRIENDS_ADDRESS
public static final int ALL_FRIENDS_ADDRESS- See Also:
-
ALL_RELAYS_ADDRESS
public static final int ALL_RELAYS_ADDRESS- See Also:
-
ALL_NODES_ADDRESS
public static final int ALL_NODES_ADDRESS- See Also:
-
START_VIRTUAL_ADDRESS
public static final int START_VIRTUAL_ADDRESS- See Also:
-
END_VIRTUAL_ADDRESS
public static final int END_VIRTUAL_ADDRESS- See Also:
-
UUID_HASH_BIT_MASK
public static final int UUID_HASH_BIT_MASK- See Also:
-
-
Constructor Details
-
MeshAddress
public MeshAddress()
-
-
Method Details
-
formatAddress
-
isAddressInRange
public static boolean isAddressInRange(byte[] address) -
isAddressInRange
public static boolean isAddressInRange(int address) Checks if the address is in range- Parameters:
address
- address- Returns:
- true if is in range or false otherwise
-
isValidUnassignedAddress
public static boolean isValidUnassignedAddress(byte[] address) Validates an unassigned address- Parameters:
address
- 16-bit address- Returns:
- true if the address is a valid unassigned address or false otherwise
-
isValidUnassignedAddress
public static boolean isValidUnassignedAddress(int address) Validates a unassigned address- Parameters:
address
- 16-bit address- Returns:
- true if the address is a valid unassigned address or false otherwise
-
isValidUnicastAddress
public static boolean isValidUnicastAddress(byte[] address) Validates a unicast address- Parameters:
address
- Address in bytes- Returns:
- true if the address is a valid unicast address or false otherwise
-
isValidUnicastAddress
public static boolean isValidUnicastAddress(int address) Validates a unicast address- Parameters:
address
- 16-bit address- Returns:
- true if the address is a valid unicast address or false otherwise
-
isValidVirtualAddress
public static boolean isValidVirtualAddress(byte[] address) Validates a virtual address- Parameters:
address
- Address in bytes- Returns:
- true if the address is a valid virtual address or false otherwise
-
isValidVirtualAddress
public static boolean isValidVirtualAddress(int address) Validates a unicast address- Parameters:
address
- 16-bit address- Returns:
- true if the address is a valid virtual address or false otherwise
-
isValidGroupAddress
public static boolean isValidGroupAddress(byte[] address) -
isValidGroupAddress
public static boolean isValidGroupAddress(int address) Returns true if the its a valid group address- Parameters:
address
- 16-bit address- Returns:
- true if the address is valid and false otherwise
-
isValidFixedGroupAddress
public static boolean isValidFixedGroupAddress(int address) Returns true if the its a valid fixed group address. Fixed group addresses include all proxies, all friends, all relays and all nodes address.- Parameters:
address
- 16-bit address- Returns:
- true if the address is valid and false otherwise
-
isValidSubscriptionAddress
public static boolean isValidSubscriptionAddress(int address) Returns true if the address is a valid subscription address- Parameters:
address
- 16-bit address- Returns:
- true if the address is valid and false otherwise
-
isValidSubscriptionAddress
public static boolean isValidSubscriptionAddress(byte[] address) Validates a given address for subscriptions- Parameters:
address
- group address- Returns:
- true if is valid and false otherwise
-
isValidProxyFilterAddress
public static boolean isValidProxyFilterAddress(int address) Validates if the given address is a valid address that can be used as a proxy filter- Parameters:
address
- Unicast/Virtual or Group address- Returns:
- true if is valid and false otherwise
-
isValidProxyFilterAddress
public static boolean isValidProxyFilterAddress(byte[] address) Validates if the given address is a valid address that can be used as a proxy filter- Parameters:
address
- Unicast/Virtual or Group address- Returns:
- true if is valid and false otherwise
-
getAddressType
Returns theAddressType
- Parameters:
address
- 16-bit mesh address
-
generateRandomLabelUUID
Generates a random uuid -
generateVirtualAddress
Generates a virtual address from a given Lable UUID- Parameters:
uuid
- Type 4 UUID
-
getLabelUuid
Returns the label UUID for a given virtual address- Parameters:
address
- 16-bit virtual address
-
getHash
public static int getHash(int address) Returns the value of the hash from a virtual addressThe hash stored in a virtual address is derived from the label UUID. In a virtual address bits 13 to 0 are set to the value of a hash of the corresponding Label UUID.
- Parameters:
address
- virtual address
-
addressIntToBytes
public static byte[] addressIntToBytes(int unicastAddress) Returns the unicast address as int- Parameters:
unicastAddress
- unicast address- Returns:
- unicast address
-
addressBytesToInt
public static short addressBytesToInt(byte[] unicastAddress) Returns the unicast address as int- Parameters:
unicastAddress
- unicast address- Returns:
- unicast address
-
isValidHeartbeatPublicationDestination
public static boolean isValidHeartbeatPublicationDestination(int address) Validates if the address is a valid Heartbeat publicaiton destination. A valid address shall be an unassigned address, a unicast address, or a group address, all other values are Prohibited.- Parameters:
address
- address- Returns:
- true if valid or false otherwise.
-
isValidHeartbeatSubscriptionSource
public static boolean isValidHeartbeatSubscriptionSource(int address) Validates if the address is a valid Heartbeat subscription source. A valid address shall be an unassigned address, a unicast address. All other values are Prohibited.- Parameters:
address
- address- Returns:
- true if valid or false otherwise.
- Throws:
IllegalArgumentException
- if the address is not the unassigned address or a unicast address.
-
isValidHeartbeatSubscriptionDestination
public static boolean isValidHeartbeatSubscriptionDestination(int address) Validates if the address is a valid Heartbeat subscription source. A valid address shall be an unassigned address, a primary unicast address of the node, or a group address, All other values are Prohibited.- Parameters:
address
- address- Returns:
- true if valid or false otherwise.
-