begin support for showing/sharing qr codes for channel settings

This commit is contained in:
geeksville 2020-02-11 19:19:56 -08:00
parent 4ca5828914
commit b17e7231c0
8 changed files with 60 additions and 9 deletions

View file

@ -87,6 +87,23 @@
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
<!-- The QR codes to share channel settings are shared as meshtastic URLS
an approximate example:
http://www.meshtastic.org/s/YXNkZnF3ZXJhc2RmcXdlcmFzZGZxd2Vy
-->
<intent-filter>
<action android:name="android.intent.action.VIEW" />
<category android:name="android.intent.category.DEFAULT" />
<category android:name="android.intent.category.BROWSABLE" />
<data
android:scheme="http"
android:host="www.meshtastic.org"
android:pathPrefix="/s" />
</intent-filter>
</activity>
<receiver android:name="com.geeksville.mesh.service.BootCompleteReceiver">

View file

@ -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?
*/

View file

@ -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<NodeInfo> = toRemoteExceptions {
val r = nodeDBbyID.values.toTypedArray()
info("in getOnline, count=${r.size}")

View file

@ -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

View file

@ -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