implement queryPinState API