Refactor: idevice and idevice_connection abstraction.
Fix compile errors with debug code enabled.