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


Java AdvertiseSettings.ADVERTISE_MODE_BALANCED属性代码示例

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


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

示例1: setAdvertiseInterval

@SuppressLint("InlinedApi")
@Override
public int setAdvertiseInterval(int advertiseIntervalMs) {
    Util.log(TAG, "setAdvertiseInterval() called with: advertiseIntervalMs = [" + advertiseIntervalMs + "]");

    @Advertiser.Mode int mode;

    if (advertiseIntervalMs <= 100 + (250 - 100) / 2) {
        // 100 ms
        mode = AdvertiseSettings.ADVERTISE_MODE_LOW_LATENCY;
    } else if (advertiseIntervalMs >= 1000 - (1000 - 250) / 2) {
        // 1000 ms
        mode = AdvertiseSettings.ADVERTISE_MODE_LOW_POWER;
    } else {
        // 250 ms actually
        mode = AdvertiseSettings.ADVERTISE_MODE_BALANCED;
    }

    if (mode != getModifiedOrOriginalBeacon().getAdvertiseMode()) {
        // restarting a beacon destroys the GATT connection, make sure we use a stopped clone
        getOrCloneConfiguredBeacon().edit().setAdvertiseMode(mode).apply();
    }

    return getAdvertiseInterval();
}
 
开发者ID:adriancretu,项目名称:beacons-android,代码行数:25,代码来源:EddystoneGattConfigurator.java

示例2: getAdvertiseInterval

@Override
public int getAdvertiseInterval() {
    switch (getModifiedOrOriginalBeacon().getAdvertiseMode()) {
        case AdvertiseSettings.ADVERTISE_MODE_LOW_POWER:
        default:
            return 1000;
        case AdvertiseSettings.ADVERTISE_MODE_BALANCED:
            return 250;
        case AdvertiseSettings.ADVERTISE_MODE_LOW_LATENCY:
            return 100;
    }
}
 
开发者ID:adriancretu,项目名称:beacons-android,代码行数:12,代码来源:EddystoneGattConfigurator.java

示例3: createBeacon

/**
 * Creates an UriioBeacon beacon based on the provided URL registration result.
 * @param urlResource         URL registration info
 * @param beaconTimeToLive    Initial value for the beacon's TTL for issuing ephemeral short URLs.
 * @return A new beaoon, without saving or starting it. You can adjust any other beacon properties and save it.
 */
@NonNull
public static UriioBeacon createBeacon(UrlResource urlResource, int beaconTimeToLive) {
    return new UriioBeacon(urlResource.getId(), urlResource.getToken(),
            beaconTimeToLive, urlResource.getUrl(),
            AdvertiseSettings.ADVERTISE_MODE_BALANCED,
            AdvertiseSettings.ADVERTISE_TX_POWER_MEDIUM);
}
 
开发者ID:uriio,项目名称:uriio-android,代码行数:13,代码来源:Uriio.java


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