track # of text messages received/sent

pull/28/head
geeksville 2020-04-22 07:59:07 -07:00
rodzic b194659e8a
commit b63ebadf72
1 zmienionych plików z 20 dodań i 12 usunięć

Wyświetl plik

@ -271,6 +271,15 @@ class MeshService : Service(), Logging {
connectedRadio.sendToRadio(b) connectedRadio.sendToRadio(b)
} }
/**
* Send a mesh packet to the radio, if the radio is not currently connected this function will throw NotConnectedException
*/
private fun sendMeshPacket(packet: MeshPacket) {
sendToRadio(ToRadio.newBuilder().apply {
this.packet = packet
})
}
override fun onBind(intent: Intent?): IBinder? { override fun onBind(intent: Intent?): IBinder? {
return binder return binder
} }
@ -689,6 +698,11 @@ class MeshService : Service(), Logging {
else -> TODO() else -> TODO()
} }
GeeksvilleApplication.analytics.track(
"num_data_receive",
DataPair(1)
)
GeeksvilleApplication.analytics.track( GeeksvilleApplication.analytics.track(
"data_receive", "data_receive",
DataPair("num_bytes", bytes.size), DataPair("num_bytes", bytes.size),
@ -1079,18 +1093,7 @@ class MeshService : Service(), Logging {
handleReceivedPosition(myNodeInfo!!.myNodeNum, position) handleReceivedPosition(myNodeInfo!!.myNodeNum, position)
// send the packet into the mesh // send the packet into the mesh
sendToRadio(ToRadio.newBuilder().apply { sendMeshPacket(packet.build())
this.packet = packet.build()
})
}
/**
* Send a mesh packet to the radio, if the radio is not currently connected this function will throw NotConnectedException
*/
private fun sendMeshPacket(packet: MeshPacket) {
sendToRadio(ToRadio.newBuilder().apply {
this.packet = packet
})
} }
private val binder = object : IMeshService.Stub() { private val binder = object : IMeshService.Stub() {
@ -1164,6 +1167,11 @@ class MeshService : Service(), Logging {
DataPair("type", typ) DataPair("type", typ)
) )
GeeksvilleApplication.analytics.track(
"num_data_sent",
DataPair(1)
)
connectionState == ConnectionState.CONNECTED connectionState == ConnectionState.CONNECTED
} }