本文整理汇总了Java中android.location.GpsStatus.NmeaListener类的典型用法代码示例。如果您正苦于以下问题:Java NmeaListener类的具体用法?Java NmeaListener怎么用?Java NmeaListener使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
NmeaListener类属于android.location.GpsStatus包,在下文中一共展示了NmeaListener类的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。
示例1: notifyNmeaSentence
import android.location.GpsStatus.NmeaListener; //导入依赖的package包/类
/**
* Notifies the reception of a NMEA sentence from the bluetooth GPS to registered NMEA listeners.
*
* @param nmeaSentence the complete NMEA sentence received from the bluetooth GPS (i.e. $....*XY where XY is the checksum)
*/
private void notifyNmeaSentence(final String nmeaSentence){
if (enabled){
// Log.v(LOG_TAG, "parsing and notifying NMEA sentence: "+nmeaSentence);
String sentence = null;
try {
sentence = parser.parseNmeaSentence(nmeaSentence);
} catch (SecurityException e){
Log.e(LOG_TAG, "error while parsing NMEA sentence: "+nmeaSentence, e);
// a priori Mock Location is disabled
sentence = null;
disable(R.string.msg_mock_location_disabled);
}
final String recognizedSentence = sentence;
final long timestamp = System.currentTimeMillis();
if (recognizedSentence != null){
Log.v(LOG_TAG, "notifying NMEA sentence: "+recognizedSentence);
synchronized(nmeaListeners) {
for(final NmeaListener listener : nmeaListeners){
notificationPool.execute(new Runnable(){
@Override
public void run() {
listener.onNmeaReceived(timestamp, recognizedSentence);
}
});
}
}
}
}
}
开发者ID:miurahr,项目名称:bluegnss4osm,代码行数:35,代码来源:BluetoothGnssManager.java
示例2: addNmeaListener
import android.location.GpsStatus.NmeaListener; //导入依赖的package包/类
/**
* Adds a NMEA listener.
* In fact, it delegates to the NMEA parser.
*
* @see NmeaParser#addNmeaListener(NmeaListener)
* @param listener a {@link NmeaListener} object to register
* @return true if the listener was successfully added
*/
public boolean addNmeaListener(NmeaListener listener){
if (!nmeaListeners.contains(listener)){
Log.d(LOG_TAG, "adding new NMEA listener");
nmeaListeners.add(listener);
}
return true;
}
开发者ID:miurahr,项目名称:bluegnss4osm,代码行数:16,代码来源:BluetoothGnssManager.java
示例3: removeNmeaListener
import android.location.GpsStatus.NmeaListener; //导入依赖的package包/类
/**
* Removes a NMEA listener.
* In fact, it delegates to the NMEA parser.
*
* @see NmeaParser#removeNmeaListener(NmeaListener)
* @param listener a {@link NmeaListener} object to remove
*/
public void removeNmeaListener(NmeaListener listener){
Log.d(LOG_TAG, "removing NMEA listener");
nmeaListeners.remove(listener);
}
开发者ID:miurahr,项目名称:bluegnss4osm,代码行数:12,代码来源:BluetoothGnssManager.java
注:本文中的android.location.GpsStatus.NmeaListener类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论