begin app cleanup - invent concept of PortNum

pull/3/head
Kevin Hester 2020-11-28 10:40:47 +08:00
rodzic 34cc5cca1d
commit 414fbd5609
2 zmienionych plików z 47 dodań i 20 usunięć

Wyświetl plik

@ -6,6 +6,9 @@ syntax = "proto3";
option java_package = "com.geeksville.mesh";
option java_outer_classname = "MeshProtos";
option optimize_for = LITE_RUNTIME;
import "portnums.proto";
/**
MESH RADIO PROTOCOL
@ -82,29 +85,12 @@ message Position {
}
// a data message to forward to an external app (or possibly also be consumed
// internally in the case of CLEAR_TEXT and CLEAR_READACK
// internally in the case of CLEAR_TEXT and CLEAR_READACK)
message Data {
enum Type {
/// A message sent from a device outside of the mesh, in a form the mesh
/// does not understand
OPAQUE = 0; // NOTE: This must be 0, because it is documented in
// IMeshService.aidl to be so
/// a simple UTF-8 text message, which even the little micros in the mesh
/// can understand and show on their screen eventually in some circumstances
/// even signal might send messages in this form (see below)
CLEAR_TEXT = 1;
// formerly named typ and of type Type
PortNum portnum = 1;
/// a message receive acknowledgement, sent in cleartext - allows radio to
/// show user that a message has been read by the recipient, optional
CLEAR_READACK = 2;
/// Apps will eventually be able to register their own handlers for
/// particular payload type codes so multiple apps can share the same radio
/// (this will replace OPAQUE)
}
Type typ = 1; // required
bytes payload = 2; // required
}

41
portnums.proto 100644
Wyświetl plik

@ -0,0 +1,41 @@
syntax = "proto3";
/**
For any new 'apps' that run on the device or via sister apps on phones/PCs they should pick and use a
unique 'portnum' for their application.
If you are making a new app using meshtastic, please send in a pull request to add your 'portnum' to this
master table. PortNums should be assigned in the following range:
0-63 Core Meshtastic use, do not use for third party apps
64-127 Registered 3rd party apps, send in a pull request that adds a new entry to portnums.proto to
register your application
256-512 Use one of these portnums for your private applications that you don't want to register publically
All other values are reserved.
Note: This was formerly a Type enum named 'typ' with the same id #
We have change to this 'portnum' based scheme for specifying app handlers for particular payloads.
This change is backwards compatible by treating the legacy OPAQUE/CLEAR_TEXT values identically.
*/
enum PortNum {
/// Deprecated: do not use in new code (formerly called OPAQUE)
/// A message sent from a device outside of the mesh, in a form the mesh
/// does not understand
UNKNOWN_APP = 0; // NOTE: This must be 0, because it is documented in
// IMeshService.aidl to be so
/// a simple UTF-8 text message, which even the little micros in the mesh
/// can understand and show on their screen eventually in some circumstances
/// even signal might send messages in this form (see below)
/// Formerly called CLEAR_TEXT
TEXT_MESSAGE_APP = 1;
/// a message receive acknowledgement, sent in cleartext - allows radio to
/// show user that a message has been read by the recipient, optional
// Note: this concept has been removed for now. Once READACK is implemented, use the
// new packet type/port number stuff?
// CLEAR_READACK = 2;
}