mirror of
https://github.com/meshcore-dev/MeshCore.git
synced 2026-04-20 22:13:47 +00:00
* Terminal Chat: "set ..." commands, save to "node_prefs" file, consistent with the other firmwares
This commit is contained in:
parent
7b31fc8ef9
commit
466caebd9a
5 changed files with 116 additions and 20 deletions
|
|
@ -115,6 +115,10 @@ static uint8_t hexVal(char c) {
|
|||
return 0;
|
||||
}
|
||||
|
||||
bool Utils::isHexChar(char c) {
|
||||
return c == '0' || hexVal(c) > 0;
|
||||
}
|
||||
|
||||
bool Utils::fromHex(uint8_t* dest, int dest_size, const char *src_hex) {
|
||||
int len = strlen(src_hex);
|
||||
if (len != dest_size*2) return false; // incorrect length
|
||||
|
|
|
|||
|
|
@ -80,6 +80,8 @@ public:
|
|||
* \returns the number of parts parsed (in 'parts')
|
||||
*/
|
||||
static int parseTextParts(char* text, const char* parts[], int max_num, char separator=',');
|
||||
|
||||
static bool isHexChar(char c);
|
||||
};
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,11 +1,11 @@
|
|||
#include <helpers/BaseChatMesh.h>
|
||||
#include <Utils.h>
|
||||
|
||||
mesh::Packet* BaseChatMesh::createSelfAdvert(const char* name) {
|
||||
mesh::Packet* BaseChatMesh::createSelfAdvert(const char* name, double lat, double lon) {
|
||||
uint8_t app_data[MAX_ADVERT_DATA_SIZE];
|
||||
uint8_t app_data_len;
|
||||
{
|
||||
AdvertDataBuilder builder(ADV_TYPE_CHAT, name);
|
||||
AdvertDataBuilder builder(ADV_TYPE_CHAT, name, lat, lon);
|
||||
app_data_len = builder.encodeTo(app_data);
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -96,7 +96,7 @@ protected:
|
|||
void onGroupDataRecv(mesh::Packet* packet, uint8_t type, const mesh::GroupChannel& channel, uint8_t* data, size_t len) override;
|
||||
|
||||
public:
|
||||
mesh::Packet* createSelfAdvert(const char* name);
|
||||
mesh::Packet* createSelfAdvert(const char* name, double lat=0.0, double lon=0.0);
|
||||
int sendMessage(const ContactInfo& recipient, uint32_t timestamp, uint8_t attempt, const char* text, uint32_t& expected_ack, uint32_t& est_timeout);
|
||||
void resetPathTo(ContactInfo& recipient);
|
||||
void scanRecentContacts(int last_n, ContactVisitor* visitor);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue