HexUtils Object

From Hubitat Documentation
Revision as of 20:54, 3 December 2018 by Hubitat admin (talk | contribs) (Created page with "==Description== The package name of this class is hubitat.helper. So to use in an App or Driver you would reference it with hubitat.helper.HexUtils. == <code>integerToHexStr...")
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to: navigation, search

Description

The package name of this class is hubitat.helper. So to use in an App or Driver you would reference it with hubitat.helper.HexUtils.

integerToHexString

Convert integer value to hex string.

Signature

String integerToHexString(int value, int minBytes)

Parameters

value - the integer value to encode
minBytes - the minmum number of hex encoded bytes, must be greater than 0

Returns

The value of the integer encoded as a hex string.

Example

int i = 5
def hexStr = hubitat.helper.HexUtils.integerToHexString(i, 1)

hexStringToInt

Convert hex string to integer.

Signature

int hexStringToInt(String value)

Parameters

value - the hex string to convert

Returns

The integer value represented by the hex string.

Example

def myInt = hubitat.helper.HexUtils.hexStringToInt("01A6")


byteArrayToHexString

Convert a byte array to hex string.

Signature

String byteArrayToHexString(byte[] value)

hexStringToByteArray

Convert a hex string to a byte array.

Signature

byte[] hexStringToByteArray(String value)

intArrayToHexString

Convert an integer array to a hex string.

Signature

String intArrayToHexString(int[] value)

hexStringToIntArray

Convert a hex string into an integer array.

Signature

int[] hexStringToIntArray(String value)