forked from Blendman974/faceclaw
Faceclaw support for G1s
Relies on the glasses having the firmware from https://github.com/jimrandomh/scouter_kit, based on Mafik's Scouter Kit.
This commit is contained in:
1 parent
f803f4212c
commit
67aff19923
27 files changed
+1902
-45
No files matched your search
@@ -46,6 +46,8 @@ class AndroidSessionLink(private val bleManager: FaceclawBleManager) : SessionLi
|
||||
|
||||
override fun isBonded(address: String): Boolean = bleManager.isBonded(address)
|
||||
|
||||
override fun requestBond(address: String) = bleManager.requestBond(address)
|
||||
|
||||
override fun prepareBenchmarkLink(address: String, mode: Int) = bleManager.prepareBenchmarkLink(address, mode)
|
||||
|
||||
override fun recordDisplayFrameSent() = FaceclawBleManager.recordDisplayFrameSent()
|
||||
|
||||
@@ -208,6 +208,9 @@ class FaceclawBleCommunicator(context: Context, rightAddress: String?, leftAddre
|
||||
|
||||
fun isRayNeoIo(): Boolean = core.isRayNeoIo()
|
||||
|
||||
/** Drive an Even G1 on g1v0 (two arms, as a G2 pair's addresses). */
|
||||
fun useG1() = core.useG1()
|
||||
|
||||
fun start() {
|
||||
if (core.start()) {
|
||||
activeInstance = this
|
||||
|
||||
@@ -160,6 +160,21 @@ class FaceclawBleManager(context: Context) {
|
||||
}
|
||||
}
|
||||
|
||||
/** Start bonding, without waiting: the OS may ask the user, and [isBonded] tells when it is done. */
|
||||
fun requestBond(address: String?) {
|
||||
if (address == null || address.trim().isEmpty()) {
|
||||
return
|
||||
}
|
||||
try {
|
||||
val device = bluetoothAdapter.getRemoteDevice(address)
|
||||
if (device.bondState == BluetoothDevice.BOND_NONE) {
|
||||
Log.i(TAG, "requestBond " + address + ": " + device.createBond())
|
||||
}
|
||||
} catch (t: Throwable) {
|
||||
Log.w(TAG, "requestBond failed: " + address, t)
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Android's bond state for this address (BluetoothDevice.BOND_NONE /
|
||||
* BOND_BONDING / BOND_BONDED), or -1 when it cannot be determined.
|
||||
|
||||
@@ -141,7 +141,9 @@ class FaceclawDeviceDiscovery(context: Context) {
|
||||
val upper = name.uppercase()
|
||||
// A bare "R1" substring also matches unrelated hardware ("Oppo Enco
|
||||
// R1"), and TS only classifies rings from the stock name prefix.
|
||||
return upper.contains("G2") || upper.startsWith("EVEN R1") || upper.startsWith("RAYNEO")
|
||||
// Even G1: its stock name, or g1v0's G1v0_L / G1v0S_R (safe mode).
|
||||
return upper.contains("G2") || upper.startsWith("EVEN R1") || upper.startsWith("RAYNEO") ||
|
||||
upper.startsWith("EVEN G1") || upper.startsWith("G1V0")
|
||||
}
|
||||
|
||||
private fun buildJson(
|
||||
|
||||
Reference in new issue
Block a user