// Path: bletia-core/src/main/java/info/izumin/android/bletia/core/action/AbstractAction.java
// public abstract class AbstractAction<T, E extends Throwable, I, R> {
//     public enum Type {
//         WRITE_CHARACTERISTIC(1),
//         READ_CHARACTERISTIC(2),
//         WRITE_DESCRIPTOR(3),
//         READ_DESCRIPTOR(4),
//         ENABLE_NOTIFICATION(5),
//         READ_REMOTE_RSSI(6),
//         CONNECT(101),
//         DISCOVER_SERVICES(102),
//         DISCONNECT(103);
// 
//         private final int mCode;
// 
//         Type(int code) {
//             mCode = code;
//         }
// 
//         public int getCode() {
//             return mCode;
//         }
// 
//         public static Type valueOf(int code) {
//             for (Type type : values()) {
//                 if (type.getCode() == code) { return type; }
//             }
//             throw new IllegalArgumentException();
//         }
//     }
// 
//     public static final String KEY_IDENTITY = "key_identity";
// 
//     private final I mIdentity;
//     private final Type mType;
//     private final ResolveStrategy<T, E, R> mResolveStrategy;
// 
//     public AbstractAction(I identity, Type type, ResolveStrategy<T, E, R> resolveStrategy) {
//         mIdentity = identity;
//         mType = type;
//         mResolveStrategy = resolveStrategy;
//     }
// 
//     public final I getIdentity() {
//         return mIdentity;
//     }
// 
//     public final Type getType() {
//         return mType;
//     }
// 
//     public final R getResolver() {
//         return mResolveStrategy.getResolver();
//     }
// 
//     public void resolve(T value) {
//         mResolveStrategy.resolve(value);
//     }
// 
//     public void reject(E throwable) {
//         mResolveStrategy.reject(throwable);
//     }
// 
//     public final Message obtainMessage() {
//         Message message = Message.obtain();
//         message.what = mType.getCode();
//         message.setData(getBundle());
//         return message;
//     }
// 
//     public Bundle getBundle() {
//         Bundle bundle = new Bundle();
//         if (mIdentity instanceof Serializable) {
//             bundle.putSerializable(KEY_IDENTITY, (Serializable) mIdentity);
//         }
//         return bundle;
//     }
// 
//     public abstract boolean execute(BluetoothGattWrapper gattWrapper);
// }


import info.izumin.android.bletia.core.action.AbstractAction;
    public BletiaException(AbstractAction action, String detailMessage, BletiaErrorType type) {
        this(action.getClass().getSimpleName(), detailMessage, type);
        mAction = action;
    }

    public BletiaException(BleErrorType type) {
        super();
        mType = type;
        mTag = getStackTrace()[0].getMethodName();
    }

    public BletiaException(String tag, BletiaErrorType type) {
        this(tag, type.getName(), type);
    }

    public BletiaException(String tag, String detailMessage, BletiaErrorType type) {
        super(detailMessage);
        mType = type;
        mTag = tag;
    }

    @Override
    public String getMessage() {
        return "[" + mTag + "] " + super.getMessage();
    }

    public String getTag() {
        return mTag;
    }

// Path: bletia-core/src/main/java/info/izumin/android/bletia/core/action/AbstractAction.java
// public abstract class AbstractAction<T, E extends Throwable, I, R> {
//     public enum Type {
//         WRITE_CHARACTERISTIC(1),
//         READ_CHARACTERISTIC(2),
//         WRITE_DESCRIPTOR(3),
//         READ_DESCRIPTOR(4),
//         ENABLE_NOTIFICATION(5),
//         READ_REMOTE_RSSI(6),
//         CONNECT(101),
//         DISCOVER_SERVICES(102),
//         DISCONNECT(103);
// 
//         private final int mCode;
// 
//         Type(int code) {
//             mCode = code;
//         }
// 
//         public int getCode() {
//             return mCode;
//         }
// 
//         public static Type valueOf(int code) {
//             for (Type type : values()) {
//                 if (type.getCode() == code) { return type; }
//             }
//             throw new IllegalArgumentException();
//         }
//     }
// 
//     public static final String KEY_IDENTITY = "key_identity";
// 
//     private final I mIdentity;
//     private final Type mType;
//     private final ResolveStrategy<T, E, R> mResolveStrategy;
// 
//     public AbstractAction(I identity, Type type, ResolveStrategy<T, E, R> resolveStrategy) {
//         mIdentity = identity;
//         mType = type;
//         mResolveStrategy = resolveStrategy;
//     }
// 
//     public final I getIdentity() {
//         return mIdentity;
//     }
// 
//     public final Type getType() {
//         return mType;
//     }
// 
//     public final R getResolver() {
//         return mResolveStrategy.getResolver();
//     }
// 
//     public void resolve(T value) {
//         mResolveStrategy.resolve(value);
//     }
// 
//     public void reject(E throwable) {
//         mResolveStrategy.reject(throwable);
//     }
// 
//     public final Message obtainMessage() {
//         Message message = Message.obtain();
//         message.what = mType.getCode();
//         message.setData(getBundle());
//         return message;
//     }
// 
//     public Bundle getBundle() {
//         Bundle bundle = new Bundle();
//         if (mIdentity instanceof Serializable) {
//             bundle.putSerializable(KEY_IDENTITY, (Serializable) mIdentity);
//         }
//         return bundle;
//     }
// 
//     public abstract boolean execute(BluetoothGattWrapper gattWrapper);
// }


// Path: bletia-core/src/main/java/info/izumin/android/bletia/core/BletiaException.java
import info.izumin.android.bletia.core.action.AbstractAction;

    public BletiaException(AbstractAction action, String detailMessage, BletiaErrorType type) {
        this(action.getClass().getSimpleName(), detailMessage, type);
        mAction = action;
    }

    public BletiaException(BleErrorType type) {
        super();
        mType = type;
        mTag = getStackTrace()[0].getMethodName();
    }

    public BletiaException(String tag, BletiaErrorType type) {
        this(tag, type.getName(), type);
    }

    public BletiaException(String tag, String detailMessage, BletiaErrorType type) {
        super(detailMessage);
        mType = type;
        mTag = tag;
    }

    @Override
    public String getMessage() {
        return "[" + mTag + "] " + super.getMessage();
    }

    public String getTag() {
        return mTag;
    }

    public BletiaErrorType getType() {