setHexId method

Future<CommandResponse> setHexId({
  1. required dynamic deviceId,
  2. required String poolId,
})

Sets the connection pool ID to the specified 4-character hexadecimal value.

The ID must pass validation checks for both format and reserved ID status. If the validation succeeds, the ID is converted into direct input key codes and sent to the device.

deviceId - The identifier of the target device. poolId 0 A valid 4-character hexadecimal connection pool ID.

Returns a CommandResponse indicating the success or failure of the operation.

Implementation

Future<CommandResponse> setHexId(
    {required deviceId, required String poolId}) async {
  final validationResponse = _validateHexId(poolId);
  if (!validationResponse.succeeded) {
    return validationResponse;
  }
  final directInputKeys = _getDirectInputKeysFromHexId(poolId);
  final result = await sendCommand(deviceId, setConnectionPoolId,
      parameters: directInputKeys);
  if (!result.succeeded) {
    return result;
  } else {
    return sendCommand(deviceId, saveSettings);
  }
}