question: public void sendShieldFrame ( ShieldFrame frame , boolean waitIfInACallback ) { if ( frame == null ) throw new NullPointerException ( "The passed frame is null, have you checked its validity?" ) ; if ( ! isConnected ( ) ) { onError ( OneSheeldError . DEVICE_NOT_CONNECTED ) ; return ; } else if ( isUpdatingFirmware ( ) ) { onError ( OneSheeldError . FIRMWARE_UPDATE_IN_PROGRESS ) ; return ; } if ( ! waitIfInACallback ) { sendFrame ( frame ) ; return ; } boolean inACallback ; synchronized ( arduinoCallbacksLock ) { inACallback = isInACallback ; } if ( inACallback ) { queuedFrames . add ( frame ) ; } else { if ( queuedFrames . isEmpty ( ) ) { sendFrame ( frame ) ; } else { queuedFrames . add ( frame ) ; } } }
target:  Send a shield frame or queue it if Arduino is in a callback.