diff --git a/index.html b/index.html index 88bd244..b688ab6 100644 --- a/index.html +++ b/index.html @@ -60,10 +60,10 @@ AppStart - - @@ -95,17 +89,17 @@ - -
+
+
Contacts
+
+
Reload
+
+
@@ -113,10 +107,9 @@
<{{ bytesToHex(contact.publicKey) }}>
Type: {{ contactTypeToString(contact.type) }} • Last Advert: {{ contact.lastAdvert }}
-
-
Send Message
-
-
+
+
Message
+
Reset Path
Forget
@@ -202,14 +195,6 @@ const selfInfo = await this.connection.getSelfInfo(); console.log(selfInfo); }, - async sendCommandSendTxtMsg() { - const txtType = Constants.TxtTypes.Plain; - const attempt = 0; - const senderTimestamp = Math.floor(Date.now() / 1000); - const pubKeyPrefix = new Uint8Array([148, 63, 175, 162, 88, 212, 192, 40, 214, 185, 213, 140, 42, 145, 194, 186, 70, 71, 112, 68, 0, 192, 65, 4, 105, 143, 230, 50, 162, 79, 247, 192]); - const text = `Test Message: ${senderTimestamp}`; - await this.connection.sendCommandSendTxtMsg(txtType, attempt, senderTimestamp, pubKeyPrefix, text); - }, async sendSendSelfAdvert(type) { await this.connection.sendCommandSendSelfAdvert(type); }, @@ -228,10 +213,6 @@ const txPower = 22; await this.connection.sendCommandSetTxPower(txPower); }, - async sendCommandResetPath() { - const publicKey = new Uint8Array([244, 231, 60, 250, 245, 218, 131, 156, 156, 98, 130, 39, 222, 43, 123, 147, 98, 200, 218, 251, 242, 89, 111, 108, 25, 191, 127, 151, 222, 192, 233, 177]); - await this.connection.sendCommandResetPath(publicKey); - }, async sendCommandSetRadioParams() { const radioFreq = 917375; const radioBw = 250000; @@ -257,10 +238,6 @@ console.log(lat, lon); await this.connection.sendCommandSetAdvertLatLon(lat, lon); }, - async sendCommandRemoveContact() { - const publicKey = new Uint8Array([148, 63, 175, 162, 88, 212, 192, 40, 214, 185, 213, 140, 42, 145, 194, 186, 70, 71, 112, 68, 0, 192, 65, 4, 105, 143, 230, 50, 162, 79, 247, 192]); - await this.connection.sendCommandRemoveContact(publicKey); - }, async sendCommandAddUpdateContact() { const publicKey = new Uint8Array([148, 63, 175, 162, 88, 212, 192, 40, 214, 185, 213, 140, 42, 145, 194, 186, 70, 71, 112, 68, 0, 192, 65, 4, 105, 143, 230, 50, 162, 79, 247, 192]); const type = Constants.AdvType.Chat; @@ -294,6 +271,15 @@ // send message await this.connection.sendCommandSendTxtMsg(txtType, attempt, senderTimestamp, pubKeyPrefix, text); + }, + async resetPath(contact) { + + // remove contact from device + await this.connection.sendCommandResetPath(contact.publicKey); + + // reload contacts + await this.loadContacts(); + }, async removeContact(contact) {