add ability to set advert lat lon

This commit is contained in:
liamcottle 2025-02-11 17:45:53 +13:00
parent 581e159f0d
commit 54df5ed9c3
3 changed files with 17 additions and 0 deletions

View file

@ -41,6 +41,9 @@
<button @click="sendCommandSetAdvertName" class="border border-gray-500 px-2 bg-gray-100 hover:bg-gray-200 rounded">
SetAdvertName
</button>
<button @click="sendCommandSetAdvertLatLon" class="border border-gray-500 px-2 bg-gray-100 hover:bg-gray-200 rounded">
SetAdvertLatLon
</button>
<button @click="sendCommandAddUpdateContact" class="border border-gray-500 px-2 bg-gray-100 hover:bg-gray-200 rounded">
AddUpdateContact
</button>
@ -152,6 +155,11 @@
await this.device.sendCommandSetAdvertName(name);
},
async sendCommandSetAdvertLatLon() {
const lat = 123;
const lon = 456;
await this.device.sendCommandSetAdvertLatLon(lat, lon);
},
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;

View file

@ -18,6 +18,7 @@ class Constants {
SyncNextMessage: 10, // done
SetRadioParams: 11, // done
SetTxPower: 12, // done
SetAdvertLatLon: 14,
}
static ResponseCodes = {

View file

@ -166,6 +166,14 @@ class Device {
await this.sendToRadioFrame(data.toBytes());
}
async sendCommandSetAdvertLatLon(lat, lon) {
const data = new BufferWriter();
data.writeByte(Constants.CommandCodes.SetAdvertLatLon);
data.writeUInt32LE(lat);
data.writeUInt32LE(lon);
await this.sendToRadioFrame(data.toBytes());
}
async readLoop() {
try {
while(true){