public synchronized Boolean sendMessage(TransmittableMessage message) {
        if (!start()) {
            log.error("Firmata library is not connected / started! Cannot send message {}",
                    message.getClass().getSimpleName());
            return false;
        }

        try {
            log.debug("Transmitting message {}. Bytes: {}", message.getClass().getSimpleName(),
                    FirmataHelper.bytesToHexString(message.toByteArray()));
            serialPort.getOutputStream().write(message.toByteArray());
            return true;
        } catch (IOException e) {
            log.error("Unable to transmit message {} through serial port", message.getClass().getName());
            stop();
        }

        return false;
    }
public synchronized Boolean sendMessage ( TransmittableMessage message ) { if ( ! start ( ) ) { log . error ( "Firmata library is not connected / started! Cannot send message {}" , message . getClass ( ) . getSimpleName ( ) ) ; return false ; } try { log . debug ( "Transmitting message {}. Bytes: {}" , message . getClass ( ) . getSimpleName ( ) , FirmataHelper . bytesToHexString ( message . toByteArray ( ) ) ) ; serialPort . getOutputStream ( ) . write ( message . toByteArray ( ) ) ; return true ; } catch ( IOException e ) { log . error ( "Unable to transmit message {} through serial port" , message . getClass ( ) . getName ( ) ) ; stop ( ) ; } return false ; }
Send a Message over the serial port to a Firmata supported device.

@param message TransmittableMessage object used to translate a series of bytes to the SerialPort.
@return True if the Message sent. False if the Message was not sent.