// Path: nfclib/src/main/java/be/appfoundry/nfclibrary/exceptions/InsufficientCapacityException.java
// public class InsufficientCapacityException extends Exception {
// 
//     public InsufficientCapacityException() {
//     }
// 
//     public InsufficientCapacityException(String message) {
//         super(message);
//     }
// 
//     public InsufficientCapacityException(StackTraceElement[] stackTraceElements) {
//         setStackTrace(stackTraceElements);
//     }
// }
// 
// Path: nfclib/src/main/java/be/appfoundry/nfclibrary/exceptions/ReadOnlyTagException.java
// public class ReadOnlyTagException extends TagNotWritableException {
// 
//     public ReadOnlyTagException() {
//     }
// 
//     public ReadOnlyTagException(String message) {
//         super(message);
//     }
// 
// 
// }


import android.nfc.FormatException;
import android.nfc.NdefMessage;
import android.nfc.tech.Ndef;
import android.nfc.tech.NdefFormatable;
import be.appfoundry.nfclibrary.exceptions.InsufficientCapacityException;
import be.appfoundry.nfclibrary.exceptions.ReadOnlyTagException;
/*
 * NdefWrite.java
 * NfcLibrary project.
 *
 * Created by : Daneo van Overloop - 17/6/2014.
 *
 * The MIT License (MIT)
 *
 * Copyright (c) 2014 AppFoundry. All rights reserved.
 *
 * Permission is hereby granted, free of charge, to any person obtaining a copy
 * of this software and associated documentation files (the "Software"), to deal
 * in the Software without restriction, including without limitation the rights
 * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
 * copies of the Software, and to permit persons to whom the Software is
 * furnished to do so, subject to the following conditions:
 *
 * The above copyright notice and this permission notice shall be included in all
 * copies or substantial portions of the Software.
 */

package be.appfoundry.nfclibrary.utilities.interfaces;



/**
 * Interface for the lowest level write methods, layer 1 in abstraction.
 */
public interface NdefWrite {
    /**
     * Write message to ndef
     *
     * @param message
     *         to write
     * @param ndef
     *         from tag to write to
     *
     * @return true if success, false if ndef == null || message == null
     *
     * @throws ReadOnlyTagException
     *         if tag is read-only
     * @throws InsufficientCapacityException
     *         if the tag's capacity is not sufficient
     * @throws FormatException
     *         if the message is malformed
     */
    boolean writeToNdef(NdefMessage message, Ndef ndef) throws ReadOnlyTagException, InsufficientCapacityException, FormatException;

    /**
     * Write message to ndef and make readonly
     *
     * @see NdefWrite#writeToNdef(android.nfc.NdefMessage, android.nfc.tech.Ndef)
     */
// Path: nfclib/src/main/java/be/appfoundry/nfclibrary/exceptions/InsufficientCapacityException.java
// public class InsufficientCapacityException extends Exception {
// 
//     public InsufficientCapacityException() {
//     }
// 
//     public InsufficientCapacityException(String message) {
//         super(message);
//     }
// 
//     public InsufficientCapacityException(StackTraceElement[] stackTraceElements) {
//         setStackTrace(stackTraceElements);
//     }
// }
// 
// Path: nfclib/src/main/java/be/appfoundry/nfclibrary/exceptions/ReadOnlyTagException.java
// public class ReadOnlyTagException extends TagNotWritableException {
// 
//     public ReadOnlyTagException() {
//     }
// 
//     public ReadOnlyTagException(String message) {
//         super(message);
//     }
// 
// 
// }


// Path: nfclib/src/main/java/be/appfoundry/nfclibrary/utilities/interfaces/NdefWrite.java
import android.nfc.FormatException;
import android.nfc.NdefMessage;
import android.nfc.tech.Ndef;
import android.nfc.tech.NdefFormatable;
import be.appfoundry.nfclibrary.exceptions.InsufficientCapacityException;
import be.appfoundry.nfclibrary.exceptions.ReadOnlyTagException;

/*
 * NdefWrite.java
 * NfcLibrary project.
 *
 * Created by : Daneo van Overloop - 17/6/2014.
 *
 * The MIT License (MIT)
 *
 * Copyright (c) 2014 AppFoundry. All rights reserved.
 *
 * Permission is hereby granted, free of charge, to any person obtaining a copy
 * of this software and associated documentation files (the "Software"), to deal
 * in the Software without restriction, including without limitation the rights
 * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
 * copies of the Software, and to permit persons to whom the Software is
 * furnished to do so, subject to the following conditions:
 *
 * The above copyright notice and this permission notice shall be included in all
 * copies or substantial portions of the Software.
 */

package be.appfoundry.nfclibrary.utilities.interfaces;



/**
 * Interface for the lowest level write methods, layer 1 in abstraction.
 */
public interface NdefWrite {
    /**
     * Write message to ndef
     *
     * @param message
     *         to write
     * @param ndef
     *         from tag to write to
     *
     * @return true if success, false if ndef == null || message == null
     *
     * @throws ReadOnlyTagException
     *         if tag is read-only
     * @throws InsufficientCapacityException
     *         if the tag's capacity is not sufficient
     * @throws FormatException
     *         if the message is malformed
     */
    boolean writeToNdef(NdefMessage message, Ndef ndef) throws ReadOnlyTagException, InsufficientCapacityException, FormatException;

    /**
     * Write message to ndef and make readonly
     *
     * @see NdefWrite#writeToNdef(android.nfc.NdefMessage, android.nfc.tech.Ndef)
     */
    boolean writeToNdefAndMakeReadonly(NdefMessage message, Ndef ndef) throws ReadOnlyTagException, InsufficientCapacityException, FormatException;