mirror of
https://github.com/meshtastic/Meshtastic-Android.git
synced 2026-04-20 22:23:37 +00:00
pass packet type info to other apps
This commit is contained in:
parent
7fb0cabee8
commit
54ca2d4eec
2 changed files with 6 additions and 3 deletions
|
|
@ -31,15 +31,17 @@ class MeshService : Service(), Logging {
|
||||||
* The RECEIVED_OPAQUE:
|
* The RECEIVED_OPAQUE:
|
||||||
* Payload will be the raw bytes which were contained within a MeshPacket.Opaque field
|
* Payload will be the raw bytes which were contained within a MeshPacket.Opaque field
|
||||||
* Sender will be a user ID string
|
* 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")
|
val intent = Intent("$prefix.RECEIVED_OPAQUE")
|
||||||
intent.putExtra(EXTRA_SENDER, senderId)
|
intent.putExtra(EXTRA_SENDER, senderId)
|
||||||
intent.putExtra(EXTRA_PAYLOAD, payload)
|
intent.putExtra(EXTRA_PAYLOAD, payload)
|
||||||
|
intent.putExtra(EXTRA_TYP, typ)
|
||||||
sendBroadcast(intent)
|
sendBroadcast(intent)
|
||||||
}
|
}
|
||||||
|
|
||||||
fun broadcastNodeChange(nodeId: String, isOnline: Boolean) {
|
private fun broadcastNodeChange(nodeId: String, isOnline: Boolean) {
|
||||||
val intent = Intent("$prefix.NODE_CHANGE")
|
val intent = Intent("$prefix.NODE_CHANGE")
|
||||||
intent.putExtra(EXTRA_ID, nodeId)
|
intent.putExtra(EXTRA_ID, nodeId)
|
||||||
intent.putExtra(EXTRA_ONLINE, isOnline)
|
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")
|
error("Ignoring opaque from $fromNum because we don't yet know its ID")
|
||||||
else {
|
else {
|
||||||
debug("Received opaque from $fromId ${bytes.size}")
|
debug("Received opaque from $fromId ${bytes.size}")
|
||||||
broadcastReceivedOpaque(fromId, bytes)
|
broadcastReceivedOpaque(fromId, bytes, data.typValue)
|
||||||
}
|
}
|
||||||
else -> TODO()
|
else -> TODO()
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -12,6 +12,7 @@ const val EXTRA_PAYLOAD = "$prefix.Payload"
|
||||||
const val EXTRA_SENDER = "$prefix.Sender"
|
const val EXTRA_SENDER = "$prefix.Sender"
|
||||||
const val EXTRA_ID = "$prefix.Id"
|
const val EXTRA_ID = "$prefix.Id"
|
||||||
const val EXTRA_ONLINE = "$prefix.Online"
|
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,
|
* Handles the bluetooth link with a mesh radio device. Does not cache any device state,
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue