Browse Source

Method for setting fixed position

pull/802/head
Henri Bergius 11 months ago
parent
commit
f6804ba4c7
  1. 27
      packages/core/src/meshDevice.ts

27
packages/core/src/meshDevice.ts

@ -378,6 +378,33 @@ export class MeshDevice {
);
}
/**
* Sets the fixed position of a device. Can be used to
* position GPS-less devices.
*/
public async setFixedPosition(
latitude: number,
longitude: number,
): Promise<number> {
const setPositionMessage = create(Protobuf.Admin.AdminMessageSchema, {
payloadVariant: {
case: 'setFixedPosition',
value: create(Protobuf.Mesh.PositionSchema, {
latitudeI: Math.floor(latitude / 1e-7),
longitudeI: Math.floor(longitude / 1e-7),
}),
},
});
return await this.sendPacket(
toBinary(Protobuf.Admin.AdminMessageSchema, setPositionMessage),
Protobuf.Portnums.PortNum.ADMIN_APP,
"self",
0,
true,
false,
);
}
/**
* Gets specified channel information from the radio
*/

Loading…
Cancel
Save