/*
* Copyright (C) 2012, Katy Hilgenberg.
* Special acknowledgments to: Knowledge & Data Engineering Group, University of Kassel (http://www.kde.cs.uni-kassel.de).
* Contact: sdcf@cs.uni-kassel.de
*
* This file is part of the SDCFramework (Sensor Data Collection Framework) project.
*
* The SDCFramework is free software: you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* The SDCFramework is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public License
* along with the SDCFramework. If not, see <http://www.gnu.org/licenses/>.
*/
package de.unikassel.android.sdcframework.data.independent;
import org.simpleframework.xml.Element;
import org.simpleframework.xml.Root;
/**
* The device information does provide a unique generated uuid generated by the
* service itself and specific device data like the manufacturer, model,
* product and others.
*
* @see android.os.Build
* @author Katy Hilgenberg
*
*/
@Root( name = "deviceInfo" )
public class DeviceInformation implements SerializableData
{
/**
* The filename for the serialized device info
*/
public final static String DEVICE_INFO_FILE = "devinfo.xml";
/**
* The name of the overall product.
*/
@Element( name = "product", required = true )
private String product;
/**
* The end-user-visible name for the end product.
*/
@Element( name = "model", required = true )
private String model;
/**
* The name of the industrial design.
*/
@Element( name = "device", required = true )
private String device;
/**
* The manufacturer of the hardware.
*/
@Element( name = "manufacturer", required = true )
private String manufacturer;
/**
* Either a change list number, or a label like "M4-rc20".
*/
@Element( name = "id", required = true )
private String id;
/**
* The user-visible version string.
*/
@Element( name = "androidVersion", required = true )
private String release;
/**
* A string that uniquely identifies the build.
*/
@Element( name = "fingerprint", required = true )
private String fingerprint;
/**
* A UUID created upon installation/first start of the application
*/
@Element( name = "uuid", required = true )
private String uuid;
/**
* Constructor
*/
public DeviceInformation()
{}
/*
* (non-Javadoc)
*
* @see java.lang.Object#equals(java.lang.Object)
*/
@Override
public boolean equals( Object o )
{
if ( o instanceof DeviceInformation )
{
DeviceInformation deviceInfo = (DeviceInformation) o;
return getProduct().equals( deviceInfo.getProduct() ) &&
getModel().equals( deviceInfo.getModel() ) &&
getDevice().equals( deviceInfo.getDevice() ) &&
getManufacturer().equals( deviceInfo.getManufacturer() ) &&
getId().equals( deviceInfo.getId() ) &&
getRelease().equals( deviceInfo.getRelease() ) &&
getFingerprint().equals( deviceInfo.getFingerprint() ) &&
getUuid().equals( deviceInfo.getUuid() );
}
return false;
}
/**
* Getter for the uuid
* @return the uuid
*/
public String getUuid()
{
return uuid;
}
/**
* Setter for the uuid
* @param uuid the uuid to set
*/
public void setUuid( String uuid )
{
this.uuid = uuid;
}
/**
* Getter for the product
*
* @return the product
*/
public final String getProduct()
{
return product;
}
/**
* Setter for the product
*
* @param product
* the product to set
*/
public final void setProduct( String product )
{
this.product = product;
}
/**
* Getter for the model
*
* @return the model
*/
public final String getModel()
{
return model;
}
/**
* Setter for the model
*
* @param model
* the model to set
*/
public final void setModel( String model )
{
this.model = model;
}
/**
* Getter for the device
*
* @return the device
*/
public final String getDevice()
{
return device;
}
/**
* Setter for the device
*
* @param device
* the device to set
*/
public final void setDevice( String device )
{
this.device = device;
}
/**
* Getter for the manufacturer
*
* @return the manufacturer
*/
public final String getManufacturer()
{
return manufacturer;
}
/**
* Setter for the manufacturer
*
* @param manufacturer
* the manufacturer to set
*/
public final void setManufacturer( String manufacturer )
{
this.manufacturer = manufacturer;
}
/**
* Getter for the id
*
* @return the id
*/
public final String getId()
{
return id;
}
/**
* Setter for the id
*
* @param id
* the id to set
*/
public final void setId( String id )
{
this.id = id;
}
/**
* Getter for the release
*
* @return the release
*/
public final String getRelease()
{
return release;
}
/**
* Setter for the release
*
* @param release
* the release to set
*/
public final void setRelease( String release )
{
this.release = release;
}
/**
* Getter for the fingerprint
*
* @return the fingerprint
*/
public final String getFingerprint()
{
return fingerprint;
}
/**
* Setter for the fingerprint
*
* @param fingerprint
* the fingerprint to set
*/
public final void setFingerprint( String fingerprint )
{
this.fingerprint = fingerprint;
}
/*
* (non-Javadoc)
*
* @see java.lang.Object#toString()
*/
@Override
public final String toString()
{
try
{
return toXML();
}
catch ( Exception e )
{}
return "";
}
/*
* (non-Javadoc)
*
* @see de.unikassel.android.sdcframework.data.SerializableData#toXML()
*/
@Override
public String toXML() throws Exception
{
return GlobalSerializer.toXml( this );
}
}