A former Greenock police officer has been handed a community payback order after he subjected a woman to a two-year campaign of domestic abuse.