// Path: src/com/blochstech/bitcoincardterminal/Interfaces/IDAL.java
// public interface IDAL {
// 	//Events:
// 	public Event<Message> MessageEventReference();
// 	
// 	//Database mehtods:
// 	public void setReceiveAddress(String address);
// 	public String getReceiveAddress();
// 	
// 	public void setFee(String fee);
// 	public String getFee();
// 	
// 	public void setCourtesyOK(boolean courtesyOK);
// 	public boolean getCourtesyOK();
// 	
// 	public void setCurrency(int currency);
// 	public int getCurrency();
// }
// 
// Path: src/com/blochstech/bitcoincardterminal/Interfaces/Message.java
// public class Message {
// 	public long CreatedMillis;
// 	public String Message;
// 	public MessageType Type;
// 
// 	public Message(String message, MessageType type, long createdMillis){
// 		this.Type = type;
// 		this.Message = message;
// 		this.CreatedMillis = createdMillis;
// 	}
// 	public Message(String message, MessageType type){
// 		this.Type = type;
// 		this.Message = message;
// 		this.CreatedMillis = System.currentTimeMillis();
// 	}
// 	public Message(String message){
// 		this.Type = MessageType.Info;
// 		this.Message = message;
// 		this.CreatedMillis = System.currentTimeMillis();
// 	}
// 	
// 	public enum MessageType{
// 		Info,
// 		Warning,
// 		Error
// 	}
// }
// 
// Path: src/com/blochstech/bitcoincardterminal/Interfaces/Message.java
// public enum MessageType{
// 	Info,
// 	Warning,
// 	Error
// }


import android.util.Log;
import com.blochstech.bitcoincardterminal.Interfaces.IDAL;
import com.blochstech.bitcoincardterminal.Interfaces.Message;
import com.blochstech.bitcoincardterminal.Interfaces.Message.MessageType;
import com.blochstech.bitcoincardterminal.Utils.*;
			messageEvent = new Event<Message>(this);
			addressCache = new GenericFileCache<String>(addressCachePath, "");
			feeCache = new GenericFileCache<String>(feeCachePath, "100");
			courtesyOKCache = new GenericFileCache<Boolean>(courtesyOKCachePath, false);
			currencyCache = new GenericFileCache<Integer>(currencyCachePath, 0);
		} catch (Exception e) {
			Log.e(Tags.APP_TAG, "DAL failed to initialize. Error: " + e.toString());
		}
	}
	//Singleton pattern end.
		
	private GenericFileCache<String> addressCache;
	private GenericFileCache<String> feeCache;
	private GenericFileCache<Boolean> courtesyOKCache;
	private GenericFileCache<Integer> currencyCache;
	private final String addressCachePath = "/BitcoinTerminal/Data/receiverAddress.bin";
	private final String feeCachePath = "/BitcoinTerminal/Data/fee.bin";
	private final String courtesyOKCachePath = "/BitcoinTerminal/Data/courtesyOK.bin";
	private final String currencyCachePath = "/BitcoinTerminal/Data/currency.bin";
	//TODO: Permission.
	
	public Event<Message> messageEvent;
	
	@Override
	public void setReceiveAddress(String address) {
		try {
			addressCache.Open(this);
			addressCache.set(this, address);
			addressCache.Close(this);
		} catch (Exception e) {
// Path: src/com/blochstech/bitcoincardterminal/Interfaces/IDAL.java
// public interface IDAL {
// 	//Events:
// 	public Event<Message> MessageEventReference();
// 	
// 	//Database mehtods:
// 	public void setReceiveAddress(String address);
// 	public String getReceiveAddress();
// 	
// 	public void setFee(String fee);
// 	public String getFee();
// 	
// 	public void setCourtesyOK(boolean courtesyOK);
// 	public boolean getCourtesyOK();
// 	
// 	public void setCurrency(int currency);
// 	public int getCurrency();
// }
// 
// Path: src/com/blochstech/bitcoincardterminal/Interfaces/Message.java
// public class Message {
// 	public long CreatedMillis;
// 	public String Message;
// 	public MessageType Type;
// 
// 	public Message(String message, MessageType type, long createdMillis){
// 		this.Type = type;
// 		this.Message = message;
// 		this.CreatedMillis = createdMillis;
// 	}
// 	public Message(String message, MessageType type){
// 		this.Type = type;
// 		this.Message = message;
// 		this.CreatedMillis = System.currentTimeMillis();
// 	}
// 	public Message(String message){
// 		this.Type = MessageType.Info;
// 		this.Message = message;
// 		this.CreatedMillis = System.currentTimeMillis();
// 	}
// 	
// 	public enum MessageType{
// 		Info,
// 		Warning,
// 		Error
// 	}
// }
// 
// Path: src/com/blochstech/bitcoincardterminal/Interfaces/Message.java
// public enum MessageType{
// 	Info,
// 	Warning,
// 	Error
// }


// Path: src/com/blochstech/bitcoincardterminal/DataLayer/DAL.java
import android.util.Log;
import com.blochstech.bitcoincardterminal.Interfaces.IDAL;
import com.blochstech.bitcoincardterminal.Interfaces.Message;
import com.blochstech.bitcoincardterminal.Interfaces.Message.MessageType;
import com.blochstech.bitcoincardterminal.Utils.*;

			messageEvent = new Event<Message>(this);
			addressCache = new GenericFileCache<String>(addressCachePath, "");
			feeCache = new GenericFileCache<String>(feeCachePath, "100");
			courtesyOKCache = new GenericFileCache<Boolean>(courtesyOKCachePath, false);
			currencyCache = new GenericFileCache<Integer>(currencyCachePath, 0);
		} catch (Exception e) {
			Log.e(Tags.APP_TAG, "DAL failed to initialize. Error: " + e.toString());
		}
	}
	//Singleton pattern end.
		
	private GenericFileCache<String> addressCache;
	private GenericFileCache<String> feeCache;
	private GenericFileCache<Boolean> courtesyOKCache;
	private GenericFileCache<Integer> currencyCache;
	private final String addressCachePath = "/BitcoinTerminal/Data/receiverAddress.bin";
	private final String feeCachePath = "/BitcoinTerminal/Data/fee.bin";
	private final String courtesyOKCachePath = "/BitcoinTerminal/Data/courtesyOK.bin";
	private final String currencyCachePath = "/BitcoinTerminal/Data/currency.bin";
	//TODO: Permission.
	
	public Event<Message> messageEvent;
	
	@Override
	public void setReceiveAddress(String address) {
		try {
			addressCache.Open(this);
			addressCache.set(this, address);
			addressCache.Close(this);
		} catch (Exception e) {
			messageEvent.fire(this, new Message("Error: " + e.getMessage() + e.toString(), MessageType.Error));