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


Java Beacon.getRssi方法代码示例

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


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

示例1: onBeaconDataReceived

import org.altbeacon.beacon.Beacon; //导入方法依赖的package包/类
@Subscribe
public void onBeaconDataReceived(RangeScanCompleteEvent event) {
    Beacon beacon = event.getBeacons().get(0);
    double distanceM = beacon.getDistance();
    Utils.Proximity proximity = Utils.proximityFromDistance(beacon.getDistance());

    rangeView.setText(com.trifork.ibeacon.util.Utils.formatRange(distanceM) + "m");
    proximityView.setText(proximity.toString());

    // Calculate new pause based on current RSSI
    // Convert to positive numbers to not make my head hurt.
    float txPower = -beacon.getTxPower();
    float rssi = -beacon.getRssi();
    if (rssi <= txPower) {
        pause = MIN_PAUSE_MS;
    } else if (rssi >= 100) {
        pause = MAX_PAUSE_MS;
    } else {
        float factor = ((rssi - txPower)/(100 - txPower));
        pause = (int) (MIN_PAUSE_MS + (MAX_PAUSE_MS - MIN_PAUSE_MS) * factor);
    }
}
 
开发者ID:cmelchior,项目名称:trifork-ibeacon-demo,代码行数:23,代码来源:RangingFragment.java

示例2: ThunderBoardDevice

import org.altbeacon.beacon.Beacon; //导入方法依赖的package包/类
public ThunderBoardDevice(Beacon beacon) {
    this.address = beacon.getBluetoothAddress();
    this.name = beacon.getBluetoothName();
    Timber.d("beacon: %s name: %s, timestamp: %d", address, beacon.getBluetoothName(), timestamp);
    if (name == null) {
        this.name = String.format("%s #%08d", THUNDER_BOARD_DEFAULT_NAME, beacon.getId3().toInt());
        this.isOriginalNameNull = true;
    } else {
        this.isOriginalNameNull = false;
    }
    this.rssi = beacon.getRssi();
}
 
开发者ID:SiliconLabs,项目名称:thunderboard-android,代码行数:13,代码来源:ThunderBoardDevice.java

示例3: PIBeaconData

import org.altbeacon.beacon.Beacon; //导入方法依赖的package包/类
/**
 *
 * @param beacon AltBeacon beacon
 */
public PIBeaconData(Beacon beacon) {
    this.proximityUUID = beacon.getId1().toUuidString();
    this.major = beacon.getId2().toString();
    this.minor = beacon.getId3().toString();
    this.rssi = beacon.getRssi();
    this.accuracy = beacon.getDistance();
    this.proximity = getProximityFromBeacon(beacon);
}
 
开发者ID:presence-insights,项目名称:pi-clientsdk-android,代码行数:13,代码来源:PIBeaconData.java

示例4: gattBeaconFieldsAreNotUpdated

import org.altbeacon.beacon.Beacon; //导入方法依赖的package包/类
@Test
public void gattBeaconFieldsAreNotUpdated() {
    Beacon beacon = getGattBeacon();
    final int originalRssi = beacon.getRssi();
    final List<Long> originalData = beacon.getDataFields();
    final List<Long> originalExtra = beacon.getExtraDataFields();
    Beacon beaconUpdate = getGattBeaconUpdate();
    ExtraDataBeaconTracker tracker = new ExtraDataBeaconTracker();
    tracker.track(beacon);
    tracker.track(beaconUpdate);
    Beacon trackedBeacon = tracker.track(beacon);
    assertEquals("rssi should NOT be updated", originalRssi, trackedBeacon.getRssi());
    assertEquals("data should NOT be updated", originalData, trackedBeacon.getDataFields());
    assertEquals("extra data should NOT be updated", originalExtra, trackedBeacon.getExtraDataFields());
}
 
开发者ID:AltBeacon,项目名称:android-beacon-library,代码行数:16,代码来源:ExtraDataBeaconTrackerTest.java

示例5: didRangeBeaconsInRegion

import org.altbeacon.beacon.Beacon; //导入方法依赖的package包/类
@Override
    public void didRangeBeaconsInRegion(Collection<Beacon> beacons, Region region) {
        if (beacons.size() > 0) {

        	// We need the same timestamp for all records 
        	long timestamp = new Date().getTime();
        	
            for (Beacon beacon: beacons) {           
            	ScanRecord sr = new ScanRecord(beacon.getDistance(), beacon.getRssi(), timestamp);
                BeaconRecord br = new BeaconRecord(beacon.getId1().toString(),beacon.getId2().toString(),beacon.getId3().toString(), sr);
                
                if (isNew(br)){ // Add new beacon to list
                	records.add(br);
                	System.out.println("New Beacon added");
                	System.out.println(br);
                	
                	// Need to create conference.json ?
                	
                	File file = new File(ReferenceApplication.conferenceFile);
            		if (!file.exists()) {
            			System.out.println("Download started");

            			downloadBuilding("https://gist.githubusercontent.com/frco9/3670e5e353aadea2c417/raw/",beacon.getId2().toInt());
            			downloadConference("https://gist.githubusercontent.com/frco9/95a6ef89c7d4d4e72c82/raw/", beacon.getId2().toInt());
            			downloadBeacon("https://gist.githubusercontent.com/jejefcgb/31e6dcd7ee2b98cc06d5/raw/", beacon.getId2().toInt());
//            			downloadConference("https://gist.githubusercontent.com/frco9/95a6ef89c7d4d4e72c82/raw/cc1684e795566c08103ce87b7841715a45aa5679/Conference_10.json", beacon.getId2().toInt());
            		}
                }
                else{
                	addScanRecord(br,sr);
                	if (ReferenceApplication.displayRecords == true)
                		System.out.println(br);
                	if (br.getMinor().equals("17938"))
                		System.out.println(sr.getDistance());
//                	System.out.println(br.getMinor() + " > " + sr.getDistance());
                	ReferenceApplication.lastTimestamp = timestamp;
                	ReferenceApplication.recordAdded();
                }
                	
                 
            }
        }
    }
 
开发者ID:jejefcgb,项目名称:BLE-indoor-localization,代码行数:44,代码来源:RangingService.java


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