mirror of
https://github.com/meshtastic/Meshtastic-Android.git
synced 2026-03-23 00:02:31 -04:00
pass packet type info to other apps
This commit is contained in:
@@ -31,15 +31,17 @@ class MeshService : Service(), Logging {
|
||||
* The RECEIVED_OPAQUE:
|
||||
* Payload will be the raw bytes which were contained within a MeshPacket.Opaque field
|
||||
* Sender will be a user ID string
|
||||
* Type will be the Data.Type enum code for this payload
|
||||
*/
|
||||
fun broadcastReceivedOpaque(senderId: String, payload: ByteArray) {
|
||||
private fun broadcastReceivedOpaque(senderId: String, payload: ByteArray, typ: Int) {
|
||||
val intent = Intent("$prefix.RECEIVED_OPAQUE")
|
||||
intent.putExtra(EXTRA_SENDER, senderId)
|
||||
intent.putExtra(EXTRA_PAYLOAD, payload)
|
||||
intent.putExtra(EXTRA_TYP, typ)
|
||||
sendBroadcast(intent)
|
||||
}
|
||||
|
||||
fun broadcastNodeChange(nodeId: String, isOnline: Boolean) {
|
||||
private fun broadcastNodeChange(nodeId: String, isOnline: Boolean) {
|
||||
val intent = Intent("$prefix.NODE_CHANGE")
|
||||
intent.putExtra(EXTRA_ID, nodeId)
|
||||
intent.putExtra(EXTRA_ONLINE, isOnline)
|
||||
@@ -165,7 +167,7 @@ class MeshService : Service(), Logging {
|
||||
error("Ignoring opaque from $fromNum because we don't yet know its ID")
|
||||
else {
|
||||
debug("Received opaque from $fromId ${bytes.size}")
|
||||
broadcastReceivedOpaque(fromId, bytes)
|
||||
broadcastReceivedOpaque(fromId, bytes, data.typValue)
|
||||
}
|
||||
else -> TODO()
|
||||
}
|
||||
|
||||
@@ -12,6 +12,7 @@ const val EXTRA_PAYLOAD = "$prefix.Payload"
|
||||
const val EXTRA_SENDER = "$prefix.Sender"
|
||||
const val EXTRA_ID = "$prefix.Id"
|
||||
const val EXTRA_ONLINE = "$prefix.Online"
|
||||
const val EXTRA_TYP = "$prefix.Typ"
|
||||
|
||||
/**
|
||||
* Handles the bluetooth link with a mesh radio device. Does not cache any device state,
|
||||
|
||||
Reference in New Issue
Block a user