22 lines
583 B
JavaScript
22 lines
583 B
JavaScript
/*
|
|
@Packet name confirmationPacket
|
|
@Packet identifier 255
|
|
@Description Confirms packets
|
|
@Data pId, confirmedpId
|
|
@Structure -
|
|
*/
|
|
|
|
module.exports = function (data) {
|
|
const packetLength = 3 + 1;
|
|
const buffer = new ArrayBuffer(packetLength);
|
|
const view = new DataView(buffer);
|
|
|
|
const { packetId, isSuccessful } = data;
|
|
|
|
view.setUint8(0, 255);
|
|
view.setUint8(1, packetLength);
|
|
view.setUint8(2, packetId);
|
|
view.setUint8(3, isSuccessful);
|
|
|
|
return buffer;
|
|
}; |