added communication state machine for ip devices

added communication state machine for ip devices
done some cosmetic changes to the code
added passthru command