@Override public void writeToParcel(Parcel dest, int flags) { UUIDUtils.writeToParcel(mService.getUuid(), dest); dest.writeInt(mService.getType()); dest.writeInt(mService.getCharacteristics().size()); for (BluetoothGattCharacteristic characteristic : mService.getCharacteristics()) { BTCharacteristicProfile profile = new BTCharacteristicProfile(characteristic); profile.writeToParcel(dest, flags); } }
public BTServiceProfile(Parcel in) { UUID serviceUUID = UUIDUtils.readFromParcel(in); int type = in.readInt(); int numCharacteristics = in.readInt(); mService = new BluetoothGattService(serviceUUID, type); for (int i = 0; i < numCharacteristics; i++) { BTCharacteristicProfile profile = new BTCharacteristicProfile(in); mService.addCharacteristic(profile.mCharacteristic); } }