From 9a61af82ded21ac395bed54d5b4981c86908861c Mon Sep 17 00:00:00 2001 From: geeksville Date: Wed, 22 Jan 2020 21:25:31 -0800 Subject: [PATCH] add IPC mesh service for use by Signal --- app/src/main/AndroidManifest.xml | 5 +++ .../com/geeksville/meshutil/IMeshService.aidl | 31 +++++++++++++++++++ .../com/geeksville/meshutil/MeshService.kt | 31 +++++++++++++++++++ app/src/main/proto/mesh.proto | 29 ++++++++++++----- 4 files changed, 89 insertions(+), 7 deletions(-) create mode 100644 app/src/main/aidl/com/geeksville/meshutil/IMeshService.aidl create mode 100644 app/src/main/java/com/geeksville/meshutil/MeshService.kt diff --git a/app/src/main/AndroidManifest.xml b/app/src/main/AndroidManifest.xml index b9c396bad..3d4e6b747 100644 --- a/app/src/main/AndroidManifest.xml +++ b/app/src/main/AndroidManifest.xml @@ -49,6 +49,11 @@ android:exported="false" android:permission="android.permission.BIND_JOB_SERVICE" /> + + ?) { + TODO("not implemented") //To change body of created functions use File | Settings | File Templates. + } + + override fun isConnected(): Boolean { + TODO("not implemented") //To change body of created functions use File | Settings | File Templates. + } + } +} \ No newline at end of file diff --git a/app/src/main/proto/mesh.proto b/app/src/main/proto/mesh.proto index bf553ad83..23bf380b0 100644 --- a/app/src/main/proto/mesh.proto +++ b/app/src/main/proto/mesh.proto @@ -11,19 +11,33 @@ MESH RADIO PROTOCOL Old TODO notes on the mesh radio protocol, merge into real docs below... -for each named group we have a preshared key known by all group members and wrapped around the device. you can only be in one group at a time (FIXME?!) -To join the group we read a qr code with the preshared key and ParamsCodeEnum. that gets sent via bluetooth to the device. ParamsCodeEnum maps to a set of various radio params (regulatory region, center freq, SF, bandwidth, bitrate, power etc...) so all members of the mesh can have their radios set the same way. +for each named group we have a preshared key known by all group members and wrapped around the device. +you can only be in one group at a time (FIXME?!) +To join the group we read a qr code with the preshared key and ParamsCodeEnum. that gets sent via +bluetooth to the device. ParamsCodeEnum maps to a set of various radio params (regulatory region, +center freq, SF, bandwidth, bitrate, power etc...) so all members of the mesh can have their radios set the same way. once in that group, we can talk between 254 node numbers. -to get our node number (and announce our presence in the channel) we pick a random node number and broadcast as that node with WANT-NODENUM(my globally unique name). If anyone on the channel has seen someone _else_ using that name within the last 24 hrs(?) they reply with DENY-NODENUM. Note: we might receive multiple denies. Note: this allows others to speak up for some other node that might be saving battery right now. -Any time we hear from another node (for any message type), we add that node number to the unpickable list. To dramatically decrease the odds a node number we request is already used by someone. -If no one denies within TBD seconds, we assume that we have that node number. As long as we keep talking to folks at least once every 24 hrs, others should remember we have it. +to get our node number (and announce our presence in the channel) we pick a random node number and +broadcast as that node with WANT-NODENUM(my globally unique name). If anyone on the channel has +seen someone _else_ using that name within the last 24 hrs(?) they reply with DENY-NODENUM. +Note: we might receive multiple denies. Note: this allows others to speak up for some other node +that might be saving battery right now. +Any time we hear from another node (for any message type), we add that node number to the unpickable +list. To dramatically decrease the odds a node number we request is already used by someone. +If no one denies within TBD seconds, we assume that we have that node number. As long as we keep +talking to folks at least once every 24 hrs, others should remember we have it. -Once we have a node number we can broadcast POSITION-UPDATE(my globally unique name, lat, lon, alt, amt battery remaining). All receivers will use this to a) update the mapping of who is at what node nums, b) the time of last rx, c) position. If we haven't heard from that node in a while we reply to that node (only) with our current POSITION_UPDATE state - so that node (presumably just rejoined the network) can build a map of all participants. +Once we have a node number we can broadcast POSITION-UPDATE(my globally unique name, lat, lon, alt, +amt battery remaining). All receivers will use this to a) update the mapping of who is at what +node nums, b) the time of last rx, c) position. If we haven't heard from that node in a while we +reply to that node (only) with our current POSITION_UPDATE state - so that node (presumably just +rejoined the network) can build a map of all participants. We will periodically broadcast POSITION-UPDATE as needed based on distance moved or a periodic minimum heartbeat. -If user wants to send a text they can SEND_TEXT(dest user, short text message). Dest user is a node number, or 0xff for broadcast. +If user wants to send a text they can SEND_TEXT(dest user, short text message). Dest user is a +node number, or 0xff for broadcast. */ // a gps position @@ -160,3 +174,4 @@ message ToRadio { WantNodes want_nodes = 4; // phone wants radio to send full node db to the phone } } +