나는 안드로이드에서 신선한 사람이다. 이웃 탐색에 대한 실험을 수행하기 위해 안드로이드 장치에서 BLE 스캔 간격 및 창을 설정하고 싶습니다. 내가 구글에서 답변을 검색하고 안드로이드에서 BLE 스캔 간격과 창을 설정하는 것만 큼 아니오.
/**
* Scan params corresponding to regular scan setting
*/
private static final int SCAN_MODE_LOW_POWER_WINDOW_MS = 500;
private static final int SCAN_MODE_LOW_POWER_INTERVAL_MS = 5000;
private static final int SCAN_MODE_BALANCED_WINDOW_MS = 2000;
private static final int SCAN_MODE_BALANCED_INTERVAL_MS = 5000;
private static final int SCAN_MODE_LOW_LATENCY_WINDOW_MS = 5000;
private static final int SCAN_MODE_LOW_LATENCY_INTERVAL_MS = 5000;
/**
* Scan params corresponding to batch scan setting
*/
private static final int SCAN_MODE_BATCH_LOW_POWER_WINDOW_MS = 1500;
private static final int SCAN_MODE_BATCH_LOW_POWER_INTERVAL_MS = 150000;
private static final int SCAN_MODE_BATCH_BALANCED_WINDOW_MS = 1500;
private static final int SCAN_MODE_BATCH_BALANCED_INTERVAL_MS = 15000;
private static final int SCAN_MODE_BATCH_LOW_LATENCY_WINDOW_MS = 1500;
private static final int SCAN_MODE_BATCH_LOW_LATENCY_INTERVAL_MS = 5000;
내가 값을 변경하려면
다음과 같이 BLE 스캔 간격과 창에 대한 android's source code 몇 가지 정의가 있다는 것을 알고, 내가 안드로이드 시스템을 컴파일해야한다는 뜻인가? 더 좋은 방법이 있습니까?
당신은 사용할 수 있습니다 https://developer.android.com/reference/android/bluetooth/BluetoothAdapter.html# : 이것은 오픈 소스 Android Beacon Library이 이에 상응하는 구성 매개 변수와 함께 무엇을 정확하게 startLeScan (android.bluetooth.BluetoothAdapter.LeScanCallback)) 및 [stopLeScan] (https://developer.android.com/reference/android/bluetooth/BluetoothAdapter.html#stopLeScan (android.bluetooth.BluetoothAdapter.LeScanCallback)) 및 모든 것을 제어합니다. 당신 자신. –
@ MarkusKauppinen 알았네. 고마워요! 나는 광고 간격을 제어하는 것이 가능한지 생각하십니까? 나는 [여기] (https://developer.android.com/reference/android/bluetooth/le/AdvertiseSettings.Builder.html#setAdvertiseMode (int))의 세 가지 모드를 찾는다. 또는 광고 간격을 제어 할 수 있도록 한 번 광고하는 방법입니다. 다시 감사합니다! – nikefd
이러한 모드는 스캔과 관련이 없지만 아마도 'ScanSettings'을 의미 할 것입니다. 또한 새로운 검색 방법과 관련이 있으며 이전 검색 방법을 사용하면 검색 빈도와 검색 시간을 결정할 수 있습니다. 'startLeScan'으로 시작하고'stopLeScan'으로 멈추십시오. [https://kittensandcode.blogspot.fi/2014/08/ibeacons-and-android-parsing-uuid-major.html] (https://kittensandcode)에서이 "오래된 검색 방법"에 대한 좋은 예가 있습니다. blogspot.fi/2014/08/ibeacons-and-android-parsing-uuid-major.html). 이 코드는 iBeacons를 처리하지만 물론 모든 BLE 장치가 감지됩니다. –