Search in sources :

Example 1 with KapuaMessageFactory

use of org.eclipse.kapua.message.KapuaMessageFactory in project kapua by eclipse.

the class TranslatorKuraKapuaUtils method translate.

/**
 * Translate {@link DevicePosition} to {@link KapuaPosition}
 *
 * @param kuraPosition
 * @return
 */
public static KapuaPosition translate(DevicePosition kuraPosition) {
    KapuaPosition kapuaPosition = null;
    if (kuraPosition != null) {
        KapuaLocator locator = KapuaLocator.getInstance();
        KapuaMessageFactory kapuaMessageFactory = locator.getFactory(KapuaMessageFactory.class);
        kapuaPosition = kapuaMessageFactory.newPosition();
        kapuaPosition.setAltitude(kuraPosition.getAltitude());
        kapuaPosition.setHeading(kuraPosition.getHeading());
        kapuaPosition.setLatitude(kuraPosition.getLatitude());
        kapuaPosition.setLongitude(kuraPosition.getLongitude());
        kapuaPosition.setPrecision(kuraPosition.getPrecision());
        kapuaPosition.setSatellites(kuraPosition.getSatellites());
        kapuaPosition.setSpeed(kuraPosition.getSpeed());
        kapuaPosition.setStatus(kuraPosition.getStatus());
        kapuaPosition.setTimestamp(kuraPosition.getTimestamp());
    }
    return kapuaPosition;
}
Also used : KapuaLocator(org.eclipse.kapua.locator.KapuaLocator) KapuaPosition(org.eclipse.kapua.message.KapuaPosition) KapuaMessageFactory(org.eclipse.kapua.message.KapuaMessageFactory)

Aggregations

KapuaLocator (org.eclipse.kapua.locator.KapuaLocator)1 KapuaMessageFactory (org.eclipse.kapua.message.KapuaMessageFactory)1 KapuaPosition (org.eclipse.kapua.message.KapuaPosition)1