private void handleStatus ( Status status ) { Log . d ( TAG , "Handling Bean status: " + status ) ; BeanState beanState = status . beanState ( ) ; if ( beanState == BeanState . READY ) { resetSketchStateTimeout ( ) ; if ( sketchUploadState == SketchUploadState . SENDING_START_COMMAND ) { sketchUploadState = SketchUploadState . SENDING_BLOCKS ; stopSketchStateTimeout ( ) ; sendNextSketchBlock ( ) ; } } else if ( beanState == BeanState . PROGRAMMING ) { resetSketchStateTimeout ( ) ; } else if ( beanState == BeanState . COMPLETE ) { if ( onSketchUploadComplete != null ) onSketchUploadComplete . run ( ) ; resetSketchUploadState ( ) ; } else if ( beanState == BeanState . ERROR ) { returnUploadError ( BeanError . UNKNOWN ) ; resetSketchUploadState ( ) ; } }
Fired when the Bean sends a Status message . Updates the client s internal state machine used for uploading sketches and firmware to the Bean .