A canine search of the exterior of a vehicle is not a 4th Amendment violation as long as the amount of time that it took for the K9 unit to arrive was reasonable. Once the dog smelled the drugs, the officer had probable cause to conduct a full search of the vehicle. You probably have the right to a public defender if you can't afford a private attorney. Good luck!
You should get an attorney to assist you with this. His having reached in your car and touched you may or may not have been legal. If it was illegal and his observations of your heart beating assisted in providing justification for the extended stop then the extended stop may be unreasonable. The officer was only entitled to stop you long enough to issue you a ticket - not search for drugs (unless further observations justified an extended detention). These sorts of things are heavily fact dependent and you will need a lawyer to assist.
Get one - public defender or private counsel.
No attorney-client relationship is formed by this communication. Any recommendation/information given through Avvo should be considered only as opinion until an attorney-client relationship is created.