-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathDroneSignalDetector.kt
More file actions
29 lines (24 loc) · 849 Bytes
/
DroneSignalDetector.kt
File metadata and controls
29 lines (24 loc) · 849 Bytes
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
package com.example.dronedetect
import android.content.BroadcastReceiver
import android.content.Context
import android.content.Intent
import android.net.wifi.WifiManager
import android.os.Handler
import android.os.Looper
class DroneSignalDetector(private val context: Context) {
private val handler = Handler(Looper.getMainLooper())
private val wifiManager = context.applicationContext.getSystemService(Context.WIFI_SERVICE) as WifiManager
private val receiver = WifiScanReceiver()
fun startScan() {
// TODO: implement scanning logic
}
fun stopScan() {
handler.removeCallbacksAndMessages(null)
context.unregisterReceiver(receiver)
}
}
class WifiScanReceiver : BroadcastReceiver() {
override fun onReceive(context: Context?, intent: Intent?) {
// TODO: handle scan results
}
}