Function splitDeviceParameterId

  • Splits a device parameter ID string into its components: index, subindex, and device serial number.

    The expected format of the ID must match deviceParameterIdRegExp. If the ID does not match the expected format, an error is thrown.

    Returns

    A tuple [index, subindex, deviceSerial] where:

    • index is the 16-bit parameter index (parsed from hexadecimal),
    • subindex is the 8-bit parameter subindex (parsed from hexadecimal),
    • deviceSerial is the device serial number as a string.

    Throws

    If the provided ID does not match the expected regular expression.

    Example

    const id = "0x6040:00.123-ABC";
    const [deviceSerial, index, subindex] = splitDeviceParameterId(id);
    // deviceSerial = "123-ABC"
    // index = 0x6040
    // subindex = 0x00

    Parameters

    • id: string

      The device parameter ID string to split.

    Returns [string, number, number]

Generated using TypeDoc