LeScanParameters.java
1.61 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
/*
* Copyright (C) 2015 The Telink Bluetooth Light Project
*
*/
package com.telink.bluetooth.light;
/**
* 扫描参数类
* <p>{@link LeScanParameters}定义了{@link LightService#startScan(Parameters)}方法的必须要设置的几项参数.
*
* @see LightService#startScan(Parameters)
*/
public final class LeScanParameters extends Parameters {
/**
* 创建LeScanParameters实例
*
* @return
*/
public static LeScanParameters create() {
return new LeScanParameters();
}
/**
* 网络名
*
* @param value
* @return
*/
public LeScanParameters setMeshName(String value) {
this.set(Parameters.PARAM_MESH_NAME, value);
return this;
}
/**
* 超时时间(单位秒),在这个时间段内如果没有发现任何设备将停止扫描.
*
* @param value
* @return
*/
public LeScanParameters setTimeoutSeconds(int value) {
this.set(Parameters.PARAM_SCAN_TIMEOUT_SECONDS, value);
return this;
}
/**
* 踢出网络后的名称,默认值为out_of_mesh
*
* @param value
* @return
*/
public LeScanParameters setOutOfMeshName(String value) {
this.set(PARAM_OUT_OF_MESH, value);
return this;
}
/**
* 扫描模式,true时扫描到一个设备就会立即停止扫描.
*
* @param singleScan
* @return
*/
public LeScanParameters setScanMode(boolean singleScan) {
this.set(Parameters.PARAM_SCAN_TYPE_SINGLE, singleScan);
return this;
}
}