Fix bug of connect result callback trigger logic. Add state checking for
connect to SSID.