コード例 #1
0
  /**
   * Send raw serial data.
   *
   * @param data the data
   * @throws NullPointerException if the passed data array is null
   */
  public void sendSerialData(byte[] data) {
    if (data == null)
      throw new NullPointerException("The passed data is null, have you checked its validity?");

    if (!isConnected()) {
      onError(OneSheeldError.DEVICE_NOT_CONNECTED);
      return;
    }
    sendData(data);
    Log.d(
        "Device "
            + this.name
            + ": Serial data sent, values: "
            + ArrayUtils.toHexString(data)
            + ".");
  }