var buffer = new Uint8Array([].concat(header, _toConsumableArray(data)));
var buffer = new Uint8Array([].concat(header, _toConsumableArray(data)));
return this.sendToDevice(buffer);
var res = this.sendToDevice(buffer);
if (res)
this.lastWrite = Date.now();
return res;
}
}
/** Assembles a [MeshPacket](https://buf.build/meshtastic/protobufs/docs/main:meshtastic#meshtastic.MeshPacket) based on your parameters and writes it to the device. */
/** Assembles a [MeshPacket](https://buf.build/meshtastic/protobufs/docs/main:meshtastic#meshtastic.MeshPacket) based on your parameters and writes it to the device. */
}, {
}, {
...
@@ -16414,10 +16426,12 @@
...
@@ -16414,10 +16426,12 @@
}, {
}, {
key: "sendHeartbeat",
key: "sendHeartbeat",
value: function sendHeartbeat() {
value: function sendHeartbeat() {
if (Date.now() - this.lastWrite < this.heartbeatInterval)
return;
var toRadio = new mesh_pb_exports.ToRadio({
var toRadio = new mesh_pb_exports.ToRadio({
payloadVariant: {
payloadVariant: {
"case": "heartbeat",
"case": "heartbeat",
value: new mesh_pb_exports.Heartbeat({})
value: new mesh_pb_exports.Heartbeat()
}
}
});
});
this.write(toRadio);
this.write(toRadio);
...
@@ -16522,10 +16536,12 @@
...
@@ -16522,10 +16536,12 @@
}
}
if (!this.socket.data_waiting)
if (!this.socket.data_waiting)
return;
return;
this.log(sbbsdefs.LOG_DEBUG, "reading ".concat(this.socket.nread, " bytes from device"));
var buf = [];
var buf = [];
while (this.socket.data_waiting) {
while (this.socket.data_waiting) {
buf.push(this.socket.recvBin(1));
buf.push(this.socket.recvBin(1));
}
}
this.log(sbbsdefs.LOG_DEBUG, "read ".concat(buf.length, " bytes from device"));