Optimize the gatttool interaction code.

Change-Id: Icd22be7e320e21d643dbda6f1ff1cdd1133ab04b
Reviewed-by: Nedim Hadzic <nedimhadzija@gmail.com>
Reviewed-by: Alex Blasche <alexander.blasche@digia.com>