// Path: app/src/main/java/com/ubiqlog/vis/utils/JsonEncodeDecode.java
// public class JsonEncodeDecode 
// {
// 	public static String EncodeBluetooth(String deviceName, String deviceAddress, String bindState, Date timeStamp) 
// 	{
// 		StringBuilder encodedString = new StringBuilder("");
// 		encodedString = encodedString.append("{\"Bluetooth\":{\"name\":\""
// 				+ deviceName
// 				+ "\",\"address\":\""
// 				+ deviceAddress
// 				+ "\",\"bond status\":\""
// 				+ bindState
// 				+ "\",\"time\":\""
// 				+ DateFormat.getDateTimeInstance(DateFormat.FULL, DateFormat.FULL).format(timeStamp) 
// 				+ "\"}}");
// 
// 		return encodedString.toString();
// 	}
// 
// 	public static String[] DecodeBluetooth(String jsonString) 
// 	{
// 		String[] split = jsonString.split("\"");
// 
// 		String[] decodedString = new String[4];
// 
// 		decodedString[0] = split[5];
// 		decodedString[1] = split[9];
// 		decodedString[2] = split[13];
// 		decodedString[3] = split[17];
// 
// 		return decodedString;
// 	}
// 
// 	public static String EncodeMovement(Date timestampStart, Date timestampEnd, Movement movementState) 
// 	{
// 		StringBuilder encodedString = new StringBuilder("");
// 		encodedString = encodedString.append("{\"Movement\":{\"start\":\""
// 				+ DateFormat.getDateTimeInstance(DateFormat.FULL, DateFormat.FULL).format(timestampStart)
// 				+ "\",\"end\":\""
// 				+  DateFormat.getDateTimeInstance(DateFormat.FULL, DateFormat.FULL).format(timestampEnd)
// 				+ "\",\"state\":\""
// 				+ movementState
// 				+ "\"}}");
// 
// 		return encodedString.toString();
// 	}
// 	
// 	public static String[] DecodeMovement(String jsonString) 
// 	{
// 		String[] split = jsonString.split("\"");
// 
// 		String[] decodedString = new String[3];
// 
// 		decodedString[0] = split[5];
// 		decodedString[1] = split[9];
// 		decodedString[2] = split[13];
// 
// 		return decodedString;
// 	}
// }
// 
// Path: app/src/main/java/com/ubiqlog/vis/utils/SensorState.java
// public static enum Bluetooth 
// {
// 	NONE("none"),
// 	BONDING("bonding"),
// 	BONDED("bonded");
// 		
// 	private String state;
// 		
// 	Bluetooth(String state)
// 	{
// 		this.state = state;
// 	}
// 		
// 	public String getState()
// 	{
// 		return state;
// 	}
// }


import java.text.DateFormat;
import java.util.ArrayList;
import java.util.Calendar;
import java.util.Date;
import java.util.Hashtable;
import com.ubiqlog.vis.utils.JsonEncodeDecode;
import com.ubiqlog.vis.utils.SensorState.Bluetooth;
	public void parseJsonList(String[] jsonStringList) 
	{
		DateFormat df = DateFormat.getDateTimeInstance(DateFormat.FULL, DateFormat.FULL);

		try 
		{
			for (String jsonString : jsonStringList) 
			{
				String[] jsonDecoded = JsonEncodeDecode.DecodeBluetooth(jsonString);

				String deviceName = jsonDecoded[0];
				String deviceAddress = jsonDecoded[1];
				String deviceState = jsonDecoded[2];
				String timestampCurrent = jsonDecoded[3];
				
				Calendar currentEventCalendar = (Calendar)Calendar.getInstance().clone();

				currentEventCalendar.setTime(df.parse(timestampCurrent));

				if ((currentEventCalendar.compareTo(dateLow) >=0) && (currentEventCalendar.compareTo(dateHigh) <= 0))
				{
					BluetoothDetection currentDetection;
					
					if ((currentDetection = hashDetections.get(deviceAddress)) == null)
					{
						currentDetection = new BluetoothDetection(deviceName, deviceAddress);
						hashDetections.put(deviceAddress, currentDetection);
						listDevicesAddresses.add(deviceAddress);
					}

// Path: app/src/main/java/com/ubiqlog/vis/utils/JsonEncodeDecode.java
// public class JsonEncodeDecode 
// {
// 	public static String EncodeBluetooth(String deviceName, String deviceAddress, String bindState, Date timeStamp) 
// 	{
// 		StringBuilder encodedString = new StringBuilder("");
// 		encodedString = encodedString.append("{\"Bluetooth\":{\"name\":\""
// 				+ deviceName
// 				+ "\",\"address\":\""
// 				+ deviceAddress
// 				+ "\",\"bond status\":\""
// 				+ bindState
// 				+ "\",\"time\":\""
// 				+ DateFormat.getDateTimeInstance(DateFormat.FULL, DateFormat.FULL).format(timeStamp) 
// 				+ "\"}}");
// 
// 		return encodedString.toString();
// 	}
// 
// 	public static String[] DecodeBluetooth(String jsonString) 
// 	{
// 		String[] split = jsonString.split("\"");
// 
// 		String[] decodedString = new String[4];
// 
// 		decodedString[0] = split[5];
// 		decodedString[1] = split[9];
// 		decodedString[2] = split[13];
// 		decodedString[3] = split[17];
// 
// 		return decodedString;
// 	}
// 
// 	public static String EncodeMovement(Date timestampStart, Date timestampEnd, Movement movementState) 
// 	{
// 		StringBuilder encodedString = new StringBuilder("");
// 		encodedString = encodedString.append("{\"Movement\":{\"start\":\""
// 				+ DateFormat.getDateTimeInstance(DateFormat.FULL, DateFormat.FULL).format(timestampStart)
// 				+ "\",\"end\":\""
// 				+  DateFormat.getDateTimeInstance(DateFormat.FULL, DateFormat.FULL).format(timestampEnd)
// 				+ "\",\"state\":\""
// 				+ movementState
// 				+ "\"}}");
// 
// 		return encodedString.toString();
// 	}
// 	
// 	public static String[] DecodeMovement(String jsonString) 
// 	{
// 		String[] split = jsonString.split("\"");
// 
// 		String[] decodedString = new String[3];
// 
// 		decodedString[0] = split[5];
// 		decodedString[1] = split[9];
// 		decodedString[2] = split[13];
// 
// 		return decodedString;
// 	}
// }
// 
// Path: app/src/main/java/com/ubiqlog/vis/utils/SensorState.java
// public static enum Bluetooth 
// {
// 	NONE("none"),
// 	BONDING("bonding"),
// 	BONDED("bonded");
// 		
// 	private String state;
// 		
// 	Bluetooth(String state)
// 	{
// 		this.state = state;
// 	}
// 		
// 	public String getState()
// 	{
// 		return state;
// 	}
// }


// Path: app/src/main/java/com/ubiqlog/vis/extras/bluetooth/BluetoothDetectionContainer.java
import java.text.DateFormat;
import java.util.ArrayList;
import java.util.Calendar;
import java.util.Date;
import java.util.Hashtable;
import com.ubiqlog.vis.utils.JsonEncodeDecode;
import com.ubiqlog.vis.utils.SensorState.Bluetooth;

	public void parseJsonList(String[] jsonStringList) 
	{
		DateFormat df = DateFormat.getDateTimeInstance(DateFormat.FULL, DateFormat.FULL);

		try 
		{
			for (String jsonString : jsonStringList) 
			{
				String[] jsonDecoded = JsonEncodeDecode.DecodeBluetooth(jsonString);

				String deviceName = jsonDecoded[0];
				String deviceAddress = jsonDecoded[1];
				String deviceState = jsonDecoded[2];
				String timestampCurrent = jsonDecoded[3];
				
				Calendar currentEventCalendar = (Calendar)Calendar.getInstance().clone();

				currentEventCalendar.setTime(df.parse(timestampCurrent));

				if ((currentEventCalendar.compareTo(dateLow) >=0) && (currentEventCalendar.compareTo(dateHigh) <= 0))
				{
					BluetoothDetection currentDetection;
					
					if ((currentDetection = hashDetections.get(deviceAddress)) == null)
					{
						currentDetection = new BluetoothDetection(deviceName, deviceAddress);
						hashDetections.put(deviceAddress, currentDetection);
						listDevicesAddresses.add(deviceAddress);
					}

					Bluetooth bluetoothState = Bluetooth.valueOf(deviceState.toUpperCase());