当前位置: 首页>>代码示例>>Java>>正文


Java Measurement.Listener方法代码示例

本文整理汇总了Java中com.openxc.measurements.Measurement.Listener方法的典型用法代码示例。如果您正苦于以下问题:Java Measurement.Listener方法的具体用法?Java Measurement.Listener怎么用?Java Measurement.Listener使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在com.openxc.measurements.Measurement的用法示例。


在下文中一共展示了Measurement.Listener方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: register

import com.openxc.measurements.Measurement; //导入方法依赖的package包/类
public void register(Class<? extends Measurement> measurementType,
        Measurement.Listener listener) {
    try {
        // A bit of a hack to cache this measurement's ID field so we
        // can deserialize incoming measurements of this type. Why don't we
        // have a getId() in the Measurement interface? Ah, because it would
        // have to be static and you can't have static methods in an
        // interface. It would work if we were passed an instance of the
        // measurement in this function, but we don't really have that when
        // adding a listener.
        BaseMeasurement.getKeyForMeasurement(measurementType);
    } catch(UnrecognizedMeasurementTypeException e) { }

    mMeasurementTypeListeners.put(measurementType, listener);
}
 
开发者ID:bibhrajit,项目名称:openxc-androidStudio,代码行数:16,代码来源:MessageListenerSink.java

示例2: unregister

import com.openxc.measurements.Measurement; //导入方法依赖的package包/类
public synchronized void unregister(
        Class<? extends Measurement> measurementType,
        Measurement.Listener listener) {
    mMeasurementTypeListeners.remove(measurementType, listener);
}
 
开发者ID:bibhrajit,项目名称:openxc-androidStudio,代码行数:6,代码来源:MessageListenerSink.java

示例3: addListener

import com.openxc.measurements.Measurement; //导入方法依赖的package包/类
/**
 * Register to receive asynchronous updates for a specific Measurement type.
 *
 * A Measurement is a specific, known VehicleMessage subtype.
 *
 * Use this method to register an object implementing the
 * Measurement.Listener interface to receive real-time updates
 * whenever a new value is received for the specified measurementType.
 *
 * Make sure you unregister your listeners with
 * VehicleManager.removeListener(...) when your activity or service closes
 * and no longer requires updates.
 *
 * @param measurementType The class of the Measurement
 *      (e.g. VehicleSpeed.class) the listener was listening for
 * @param listener An listener instance to receive the callback.
 */
public void addListener(Class<? extends Measurement> measurementType,
        Measurement.Listener listener) {
    Log.i(TAG, "Adding listener " + listener + " for " + measurementType);
    mNotifier.register(measurementType, listener);
}
 
开发者ID:bibhrajit,项目名称:openxc-androidStudio,代码行数:23,代码来源:VehicleManager.java

示例4: removeListener

import com.openxc.measurements.Measurement; //导入方法依赖的package包/类
/**
 * Unregister a previously registered Measurement.Listener instance.
 *
 * When an application is no longer interested in receiving measurement
 * updates (e.g. when it's pausing or exiting) it should unregister all
 * previously registered listeners to save on CPU.
 *
 * @param measurementType The class of the requested Measurement
 *      (e.g. VehicleSpeed.class)
 * @param listener The listener to remove.
 */
public void removeListener(Class<? extends Measurement> measurementType,
        Measurement.Listener listener) {
    Log.i(TAG, "Removing listener " + listener + " for " + measurementType);
    mNotifier.unregister(measurementType, listener);
}
 
开发者ID:bibhrajit,项目名称:openxc-androidStudio,代码行数:17,代码来源:VehicleManager.java


注:本文中的com.openxc.measurements.Measurement.Listener方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。