Simultaneous protonation/deprotonation mechanism in polyaniline-based devices as complementary resistive switches