// Path: DeviceService/src/com/ratio/util/UUIDUtils.java
// public class UUIDUtils {
// 	
// 	// if the UUID is null, then we write 0L,0L
// 	public static void writeToParcel(UUID uuid, Parcel parcel) {
// 		if (uuid == null) {
// 			parcel.writeLong(0L);
// 			parcel.writeLong(0L);
// 		} else {
// 			parcel.writeLong(uuid.getLeastSignificantBits());
// 			parcel.writeLong(uuid.getMostSignificantBits());
// 		}
// 	}
// 	
// 	// if the uuid is 0L,0L, then we assume that it is null
// 	public static UUID readFromParcel(Parcel parcel) {
// 		long lsb = parcel.readLong();
// 		long msb = parcel.readLong();
// 		if ((lsb == 0L) && (msb == 0L)) {
// 			return null;
// 		} else {
// 			return new UUID(msb, lsb);
// 		}
// 	}
// 	
// 	// turn B6981800756211E2B50D00163E46F8FE into B6981800-7562-11E2-B50D-00163E46F8FE
// 	public static UUID fromByteArray(byte[] byteArray, int offset) {
// 		String format = "%s-%s-%s-%s-%s";
// 		String p1 = StringUtil.toHexCode(byteArray, offset + 0, 4);
// 		String p2 = StringUtil.toHexCode(byteArray, offset + 4, 2);
// 		String p3 = StringUtil.toHexCode(byteArray, offset + 6, 2);
// 		String p4 = StringUtil.toHexCode(byteArray, offset + 8, 2);
// 		String p5 = StringUtil.toHexCode(byteArray, offset + 10, 6);
// 		String uuidString = String.format(format, p1, p2, p3, p4, p5);
// 		return UUID.fromString(uuidString);		
// 	}
// }


import java.util.UUID;
import com.ratio.util.UUIDUtils;
import android.bluetooth.BluetoothGattDescriptor;
import android.os.Parcel;
import android.os.Parcelable;
package com.ratio.deviceService;




/**
 * external description of a device profile, so once we query the device services and descriptors
 * we can send it back from the service to the activity in a bundle, which can be received by the BroadcastReceiver
 * @author mreynolds
 *
 */

public class BTDescriptorProfile implements Parcelable {
	protected BluetoothGattDescriptor mDescriptor;
	
	public BTDescriptorProfile(BluetoothGattDescriptor descriptor) {
		mDescriptor = descriptor;
	}
	
	public BTDescriptorProfile(UUID uuid, int permissions) {
		mDescriptor = new BluetoothGattDescriptor(uuid, permissions);
	}
	
	public BluetoothGattDescriptor getDescriptor() {
		return mDescriptor;
	}
	
	@Override
	public int describeContents() {
		return 0;
	}
	
	@Override
	public void writeToParcel(Parcel dest, int flags) {
// Path: DeviceService/src/com/ratio/util/UUIDUtils.java
// public class UUIDUtils {
// 	
// 	// if the UUID is null, then we write 0L,0L
// 	public static void writeToParcel(UUID uuid, Parcel parcel) {
// 		if (uuid == null) {
// 			parcel.writeLong(0L);
// 			parcel.writeLong(0L);
// 		} else {
// 			parcel.writeLong(uuid.getLeastSignificantBits());
// 			parcel.writeLong(uuid.getMostSignificantBits());
// 		}
// 	}
// 	
// 	// if the uuid is 0L,0L, then we assume that it is null
// 	public static UUID readFromParcel(Parcel parcel) {
// 		long lsb = parcel.readLong();
// 		long msb = parcel.readLong();
// 		if ((lsb == 0L) && (msb == 0L)) {
// 			return null;
// 		} else {
// 			return new UUID(msb, lsb);
// 		}
// 	}
// 	
// 	// turn B6981800756211E2B50D00163E46F8FE into B6981800-7562-11E2-B50D-00163E46F8FE
// 	public static UUID fromByteArray(byte[] byteArray, int offset) {
// 		String format = "%s-%s-%s-%s-%s";
// 		String p1 = StringUtil.toHexCode(byteArray, offset + 0, 4);
// 		String p2 = StringUtil.toHexCode(byteArray, offset + 4, 2);
// 		String p3 = StringUtil.toHexCode(byteArray, offset + 6, 2);
// 		String p4 = StringUtil.toHexCode(byteArray, offset + 8, 2);
// 		String p5 = StringUtil.toHexCode(byteArray, offset + 10, 6);
// 		String uuidString = String.format(format, p1, p2, p3, p4, p5);
// 		return UUID.fromString(uuidString);		
// 	}
// }


// Path: DeviceService/src/com/ratio/deviceService/BTDescriptorProfile.java
import java.util.UUID;
import com.ratio.util.UUIDUtils;
import android.bluetooth.BluetoothGattDescriptor;
import android.os.Parcel;
import android.os.Parcelable;

package com.ratio.deviceService;




/**
 * external description of a device profile, so once we query the device services and descriptors
 * we can send it back from the service to the activity in a bundle, which can be received by the BroadcastReceiver
 * @author mreynolds
 *
 */

public class BTDescriptorProfile implements Parcelable {
	protected BluetoothGattDescriptor mDescriptor;
	
	public BTDescriptorProfile(BluetoothGattDescriptor descriptor) {
		mDescriptor = descriptor;
	}
	
	public BTDescriptorProfile(UUID uuid, int permissions) {
		mDescriptor = new BluetoothGattDescriptor(uuid, permissions);
	}
	
	public BluetoothGattDescriptor getDescriptor() {
		return mDescriptor;
	}
	
	@Override
	public int describeContents() {
		return 0;
	}
	
	@Override
	public void writeToParcel(Parcel dest, int flags) {
		UUIDUtils.writeToParcel(mDescriptor.getUuid(), dest);