track # of text messages received/sent

This commit is contained in:
geeksville
2020-04-22 07:59:07 -07:00
parent b194659e8a
commit b63ebadf72

View File

@@ -271,6 +271,15 @@ class MeshService : Service(), Logging {
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? {
return binder
}
@@ -689,6 +698,11 @@ class MeshService : Service(), Logging {
else -> TODO()
}
GeeksvilleApplication.analytics.track(
"num_data_receive",
DataPair(1)
)
GeeksvilleApplication.analytics.track(
"data_receive",
DataPair("num_bytes", bytes.size),
@@ -1079,18 +1093,7 @@ class MeshService : Service(), Logging {
handleReceivedPosition(myNodeInfo!!.myNodeNum, position)
// send the packet into the mesh
sendToRadio(ToRadio.newBuilder().apply {
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
})
sendMeshPacket(packet.build())
}
private val binder = object : IMeshService.Stub() {
@@ -1164,6 +1167,11 @@ class MeshService : Service(), Logging {
DataPair("type", typ)
)
GeeksvilleApplication.analytics.track(
"num_data_sent",
DataPair(1)
)
connectionState == ConnectionState.CONNECTED
}