From b17e7231c0f43bd2ef092cb6130202ff6cf7b9fb Mon Sep 17 00:00:00 2001 From: geeksville Date: Tue, 11 Feb 2020 19:19:56 -0800 Subject: [PATCH] begin support for showing/sharing qr codes for channel settings --- TODO.md | 22 +++++++++++------- app/src/main/AndroidManifest.xml | 17 ++++++++++++++ .../com/geeksville/mesh/IMeshService.aidl | 8 +++++++ .../geeksville/mesh/service/MeshService.kt | 8 +++++++ app/src/main/proto/mesh.options | 1 + app/src/main/proto/mesh.proto | 3 +++ images/qrcode.png | Bin 0 -> 690 bytes images/qrcode.svg | 10 ++++++++ 8 files changed, 60 insertions(+), 9 deletions(-) create mode 100644 images/qrcode.png create mode 100644 images/qrcode.svg diff --git a/TODO.md b/TODO.md index 36c184005..d0aab1bce 100644 --- a/TODO.md +++ b/TODO.md @@ -1,23 +1,20 @@ # High priority MVP features required for first public alpha -* do setOwner every time we connect to the radio, use our settings +* when a text arrives, move that node info card to the bottom on the window - put the text to the left of the card. with a small arrow/distance/shortname +* let the user type texts somewhere * include a background behind our cloud graphics, so redraws work properly +* show direction and distance on the nodeinfo cards +* show radio config screen, it shows past channels (and the current one) +* do setOwner every time we connect to the radio, use our settings, radio should ignore if unchanged * send location data for devices that don't have a GPS - https://developer.android.com/training/location/change-location-settings * make nodeinfo card not look like ass -* when a text arrives, move that node info card to the bottom on the window - put the text to the left of the card. with a small arrow/distance/shortname -* all chat in the app defaults to group chat -* make my android app show mesh state -* add app icon -* when notified phone should automatically download messages * at connect we might receive messages before finished downloading the nodeinfo. In that case, process those messages later -* use https://codelabs.developers.google.com/codelabs/jetpack-compose-basics/#4 to show service state * connect to bluetooth device automatically using minimum power - start looking at phone boot * fix BT device scanning * call crashlytics from exceptionReporter!!! currently not logging failures caught there -* show direction and distance on the nodeinfo cards * test with oldest compatible android in emulator (see below for testing with hardware) -* make playstore entry +* make playstore entry, first public alpha # Signal alpha release Do this "Signal app compatible" release relatively soon after the alpha release of the android app. @@ -36,6 +33,9 @@ Do this "Signal app compatible" release relatively soon after the alpha release # Medium priority Things for the betaish period. +* make my android app show mesh state +* show qr code for each channel https://medium.com/@aanandshekharroy/generate-barcode-in-android-app-using-zxing-64c076a5d83a +* register app link for our URLs https://developer.android.com/studio/write/app-link-indexing.html * let user change radio params and share radio join info via QR code or text message (use an encoded app specific URL - to autoprompt for app installation as needed) * test with an oldish android release using real hardware * if necessary restart entire BT adapter with this tip from Michael https://stackoverflow.com/questions/35103701/ble-android-onconnectionstatechange-not-being-called @@ -88,3 +88,7 @@ Don't leave device discoverable. Don't let unpaired users do things with device * don't do mesh based algoritm for node id assignment (initially) - instead just store in flash - possibly even in the initial alpha release do this hack * show connection state on gui * parcels are busted - something wrong with the Parcelize kotlin magic +* add app icon +* when notified phone should automatically download messages +* use https://codelabs.developers.google.com/codelabs/jetpack-compose-basics/#4 to show service state +* all chat in the app defaults to group chat diff --git a/app/src/main/AndroidManifest.xml b/app/src/main/AndroidManifest.xml index 88f169851..a805bd080 100644 --- a/app/src/main/AndroidManifest.xml +++ b/app/src/main/AndroidManifest.xml @@ -87,6 +87,23 @@ + + + + + + + + + + diff --git a/app/src/main/aidl/com/geeksville/mesh/IMeshService.aidl b/app/src/main/aidl/com/geeksville/mesh/IMeshService.aidl index 503350b1f..d90384321 100644 --- a/app/src/main/aidl/com/geeksville/mesh/IMeshService.aidl +++ b/app/src/main/aidl/com/geeksville/mesh/IMeshService.aidl @@ -32,6 +32,14 @@ interface IMeshService { */ NodeInfo[] getNodes(); + /// This method is only intended for use in our GUI, so the user can set radio options + /// It returns a RadioConfig protobuf. + byte []getRadioConfig(); + + /// This method is only intended for use in our GUI, so the user can set radio options + /// It sets a RadioConfig protobuf + void setRadioConfig(in byte []payload); + /** Is the packet radio currently connected to the phone? */ diff --git a/app/src/main/java/com/geeksville/mesh/service/MeshService.kt b/app/src/main/java/com/geeksville/mesh/service/MeshService.kt index b1f8e621c..92b94ac6d 100644 --- a/app/src/main/java/com/geeksville/mesh/service/MeshService.kt +++ b/app/src/main/java/com/geeksville/mesh/service/MeshService.kt @@ -541,6 +541,14 @@ class MeshService : Service(), Logging { }) } + override fun getRadioConfig(): ByteArray = toRemoteExceptions { + return connectedRadio.readRadioConfig() + } + + override fun setRadioConfig(payload: ByteArray) = toRemoteExceptions { + connectedRadio.writeRadioConfig(payload) + } + override fun getNodes(): Array = toRemoteExceptions { val r = nodeDBbyID.values.toTypedArray() info("in getOnline, count=${r.size}") diff --git a/app/src/main/proto/mesh.options b/app/src/main/proto/mesh.options index f27659858..62503d11c 100644 --- a/app/src/main/proto/mesh.options +++ b/app/src/main/proto/mesh.options @@ -16,6 +16,7 @@ # 128 bit psk key (we don't use 256 bit yet because we want to keep our QR code small) *ChannelSettings.psk max_size:16 fixed_length:true +*ChannelSettings.name max_size:12 # MyMessage.name max_size:40 # or fixed_length or fixed_count, or max_count diff --git a/app/src/main/proto/mesh.proto b/app/src/main/proto/mesh.proto index 3eca3e800..029d2dde4 100644 --- a/app/src/main/proto/mesh.proto +++ b/app/src/main/proto/mesh.proto @@ -171,6 +171,9 @@ message ChannelSettings { /// A simple preshared key for now for crypto. At first I'm using 128 bit (16 byte) block for the Speck crypto /// but for beta we'll want something more carefully thought through. I want to keep the QR code small bytes psk = 4; + + /// A SHORT name that will be packed into the URL. Less than 12 bytes. Something for end users to call the channel + string name = 5; } // The entire set of user settable/readable settings for our radio device. Includes both the current channel settings diff --git a/images/qrcode.png b/images/qrcode.png new file mode 100644 index 0000000000000000000000000000000000000000..c92845a5f57fa0c58d1f499dad50a42348a25d73 GIT binary patch literal 690 zcmV;j0!{siP)6z_WK6{Tw7SRono=8UnbPXHx{C;rtH^G)T+Dzk zSVkkw60et^M2J+)ZSEnSgEx;^kXzy)=WZiHCR4kSVk;r?ipT*jEkT~ zSzVMhB{$Q9+cqIGIFe`6a~l|+a=@WP&BO|a*Y2|<>v;=e>Q@>0hLd2Vn>`4`$(|6N*j}amABvNqB6YEJj zP!7O(u+Po^WljC6VEg1r~yz`Vv9b zGP`V?2$4%jCRYz70?GIZTM7{({f}&l5&_PBug-GqGfsR&h&=osf;NG2qEAwZ5cw&h z`A@AipkSFk7!nyAF-1)Y|0S)~Z7VjWC>9VQauJCg%In~gZ6}^^+3uBT7LlP5iuzmq Y11(Tw!EuE76aWAK07*qoM6N<$f(oTDL;wH) literal 0 HcmV?d00001 diff --git a/images/qrcode.svg b/images/qrcode.svg new file mode 100644 index 000000000..574c0455f --- /dev/null +++ b/images/qrcode.svg @@ -0,0 +1,10 @@ + + + + QR Code + http://www.meshtastic.org/s/YXNkZnF3ZXJhc2RmcXdlcmFzZGZxd2Vy + + + + +