diff --git a/index.html b/index.html index ae9bda3..1943a29 100644 --- a/index.html +++ b/index.html @@ -44,6 +44,9 @@ + @@ -160,6 +163,10 @@ const lon = 456; await this.device.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.device.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; diff --git a/src/constants.js b/src/constants.js index cd4662a..887c11d 100644 --- a/src/constants.js +++ b/src/constants.js @@ -18,7 +18,8 @@ class Constants { SyncNextMessage: 10, // done SetRadioParams: 11, // done SetTxPower: 12, // done - SetAdvertLatLon: 14, + SetAdvertLatLon: 14, // done + RemoveContact: 15, // done } static ResponseCodes = { diff --git a/src/device.js b/src/device.js index 44bfa3f..17b8d3a 100644 --- a/src/device.js +++ b/src/device.js @@ -174,6 +174,13 @@ class Device { await this.sendToRadioFrame(data.toBytes()); } + async sendCommandRemoveContact(pubKey) { + const data = new BufferWriter(); + data.writeByte(Constants.CommandCodes.RemoveContact); + data.writeBytes(pubKey); // 32 bytes + await this.sendToRadioFrame(data.toBytes()); + } + async readLoop() { try { while(true){