This commit is contained in:
commit
8c11154a3a
5 files changed
+56
-1
No files matched your search
@@ -413,6 +413,18 @@ Radio parameters are common to all roles and handled by `CommonRadioPrefs`.
|
||||
|
||||
---
|
||||
|
||||
#### Change BLE name
|
||||
**Usage:**
|
||||
- `get ble.name`
|
||||
- `set ble.name <name>`
|
||||
|
||||
**Parameters:**
|
||||
- `name`: New BLE name
|
||||
|
||||
**Note:** By default the BLE name is `Meshcore-` followed by the node name. If `<name>` is empty the BLE name will be reset to the aforementioned default. These commands require a reboot to take effect.
|
||||
|
||||
---
|
||||
|
||||
### Wifi
|
||||
|
||||
#### Get status
|
||||
|
||||
@@ -2214,6 +2214,30 @@ bool MyMesh::handleCommand(const char* command, uint32_t sender_timestamp, char*
|
||||
sprintf(reply, "> pin is now %06d", _prefs.ble_pin);
|
||||
return true;
|
||||
}
|
||||
if (strcmp(command, "set ble.name") == 0) {
|
||||
_prefs.ble_name[0] = 0;
|
||||
savePrefs();
|
||||
sprintf(reply, "> BLE name reset to %s%s (reboot to apply)", BLE_NAME_PREFIX, _prefs.node_name);
|
||||
return true;
|
||||
}
|
||||
if (memcmp(command, "set ble.name ", 13) == 0) {
|
||||
if (AdvertDataParser::isValidName(&command[13])) {
|
||||
StrHelper::strncpy(_prefs.ble_name, &command[13], sizeof(_prefs.ble_name));
|
||||
savePrefs();
|
||||
sprintf(reply, "> BLE name is now %s (reboot to apply)", _prefs.ble_name);
|
||||
} else {
|
||||
strcpy(reply, "Error, bad chars");
|
||||
}
|
||||
return true;
|
||||
}
|
||||
if (strcmp(command, "get ble.name") == 0) {
|
||||
if (_prefs.ble_name[0]) {
|
||||
sprintf(reply, "> %s", _prefs.ble_name);
|
||||
} else {
|
||||
sprintf(reply, "> %s%s", BLE_NAME_PREFIX, _prefs.node_name);
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
#ifdef ENABLE_WIFI_INTERFACE
|
||||
if (memcmp(command, "set wifi.ssid ", 14) == 0) {
|
||||
|
||||
@@ -31,6 +31,7 @@ public:
|
||||
float tx_delay_factor = 0;
|
||||
float direct_tx_delay_factor = 0;
|
||||
uint32_t ble_pin = 0;
|
||||
char ble_name[32] = {0};
|
||||
uint8_t advert_loc_policy = 0;
|
||||
uint8_t buzzer_quiet = 0;
|
||||
uint8_t vibe_quiet = 0;
|
||||
@@ -225,6 +226,7 @@ private:
|
||||
def("defs_nm", _parent->default_scope_name, sizeof(_parent->default_scope_name));
|
||||
def("defs_key", (void *) _parent->default_scope_key, sizeof(_parent->default_scope_key));
|
||||
def("pin", _parent->ble_pin);
|
||||
def("ble_name", _parent->ble_name, sizeof(_parent->ble_name));
|
||||
def("buzz_q", _parent->buzzer_quiet);
|
||||
def("vibe_q", _parent->vibe_quiet);
|
||||
def("auto_add", _parent->autoadd_config); // bitmask for auto-add contacts config
|
||||
|
||||
@@ -215,7 +215,13 @@ void setup() {
|
||||
|
||||
// add bluetooth interface
|
||||
#if defined(BLE_PIN_CODE)
|
||||
bluetooth_interface.begin(BLE_NAME_PREFIX, the_mesh.getNodePrefs()->node_name, the_mesh.getBLEPin());
|
||||
char *prefix = BLE_NAME_PREFIX;
|
||||
char *ble_name = the_mesh.getNodePrefs()->node_name;
|
||||
if (the_mesh.getNodePrefs()->ble_name[0]) {
|
||||
prefix = "";
|
||||
ble_name = the_mesh.getNodePrefs()->ble_name;
|
||||
}
|
||||
bluetooth_interface.begin((const char *) prefix, ble_name, the_mesh.getBLEPin());
|
||||
interface_manager.addInterface(InterfaceType::Bluetooth, &bluetooth_interface);
|
||||
#endif
|
||||
|
||||
|
||||
@@ -7,6 +7,10 @@
|
||||
#ifdef USE_CC310_HW_CRYPTO
|
||||
#include <Adafruit_nRFCrypto.h>
|
||||
#include "nrf_cc310/include/crys_ec_edw_api.h"
|
||||
#include "nrf_cc310/include/ssi_pal_mutex.h"
|
||||
extern "C" {
|
||||
extern SaSi_PalMutex sasiAsymCryptoMutex;
|
||||
}
|
||||
#endif
|
||||
|
||||
namespace mesh {
|
||||
@@ -30,6 +34,13 @@ bool Identity::verify(const uint8_t* sig, const uint8_t* message, int msg_len) c
|
||||
CRYSError_t rc = CRYS_ECEDW_Verify((uint8_t*)sig, CRYS_ECEDW_SIGNATURE_BYTES,
|
||||
(uint8_t*)pub_key, CRYS_ECEDW_MOD_SIZE_IN_BYTES,
|
||||
(uint8_t*)message, (size_t)msg_len, &cc310_tmp);
|
||||
|
||||
// workaround for CC310 v0.9.13 where mutex can still be locked after a failed verification
|
||||
if (rc != CRYS_OK && sasiAsymCryptoMutex != 0) {
|
||||
MESH_DEBUG_PRINTLN("CRYS_ECEDW_Verify mutex still locked after error result, unlocking");
|
||||
SaSi_PalMutexUnlock(&sasiAsymCryptoMutex);
|
||||
}
|
||||
|
||||
return rc == CRYS_OK;
|
||||
#elif 0
|
||||
// NOTE: memory corruption bug was found in this function!!
|
||||
|
||||
Reference in new issue
Block a user