Hookup API for pin state and mock it for testing (bug 986100)