@@ -0,0 +1,2590 @@
+// vim: et sw=4 sts=4 tabstop=4%0Apackage com.issc.data;%0A%0Aimport com.issc.util.Log;%0A%0Aimport java.util.ArrayList;%0Aimport java.util.Iterator;%0Aimport java.util.List;%0Aimport java.util.UUID;%0A%0Aimport android.bluetooth.BluetoothDevice;%0Aimport android.os.Bundle;%0Aimport android.os.Parcel;%0Aimport android.os.Parcelable;%0A%0A/**%0A * This class encapsulate BluetoothDevice and BLE related information.%0A */%0A%0Apublic class BLEDevice implements Parcelable %7B%0A%0A    private BluetoothDevice mDevice;%0A    private Bundle mData;%0A%0A    private final String sKeyUUID = %22uuids_of_services%22;%0A%0A    public BLEDevice(BluetoothDevice device) %7B%0A        mDevice = device;%0A        mData = new Bundle();%0A    %7D%0A%0A    public BLEDevice(Parcel src) %7B%0A        mDevice = BluetoothDevice.CREATOR.createFromParcel(src);%0A        mData = Bundle.CREATOR.createFromParcel(src);%0A    %7D%0A%0A    public BluetoothDevice getDevice() %7B%0A        return mDevice;%0A    %7D%0A%0A    public Bundle getData() %7B%0A        return mData;%0A    %7D%0A%0A    public boolean hasSameAddr(BLEDevice target) %7B%0A        return hasSameAddr(target.getDevice());%0A    %7D%0A%0A    public boolean hasSameAddr(BluetoothDevice target) %7B%0A        return hasSameAddr(target.getAddress());%0A    %7D%0A%0A    public boolean hasSameAddr(String addr) %7B%0A        return mDevice.getAddress().equals(addr);%0A    %7D%0A%0A    @Override%0A    public void writeToParcel(Parcel dst, int flags) %7B%0A        mDevice.writeToParcel(dst, flags);%0A        mData.writeToParcel(dst, flags);%0A    %7D%0A%0A    @Override%0A    public int describeContents() %7B%0A        return 0;%0A    %7D%0A%0A    public static final Parcelable.Creator%3CBLEDevice%3E CREATOR =%0A        new Parcelable.Creator%3CBLEDevice%3E() %7B%0A            public BLEDevice createFromParcel(Parcel src) %7B%0A                return new BLEDevice(src);%0A            %7D%0A%0A            public BLEDevice%5B%5D newArray(int size) %7B%0A                return new BLEDevice%5Bsize%5D;%0A            %7D%0A        %7D;%0A%0A    public void setServicesUuid(List%3CUUID%3E list) %7B%0A        ArrayList%3CString%3E uuids = new ArrayList%3CString%3E();%0A        Iterator%3CUUID%3E it = list.iterator();%0A        while (it.hasNext()) %7B%0A            UUID uuid = it.next();%0A            uuids.add(uuid.toString());%0A        %7D%0A%0A        mData.putStringArrayList(sKeyUUID, uuids);%0A    %7D%0A%0A    public List%3CUUID%3E getServicesUuid() %7B%0A        List%3CString%3E uuids = mData.getStringArrayList(sKeyUUID);%0A        if (uuids == null) %7B%0A            return null;%0A        %7D%0A%0A        List%3CUUID%3E list = new ArrayList%3CUUID%3E();%0A%0A        Iterator%3CString%3E it = uuids.iterator();%0A        while (it.hasNext()) %7B%0A            list.add(UUID.fromString(it.next()));%0A        %7D%0A%0A        return list;%0A    %7D%0A%7D%0A

add data structure BLEDevice