swarms
Version:
The ultimate node.js library for controlling Bitcraze Crazyflie 2.0 drones
60 lines (59 loc) • 1.65 kB
TypeScript
/// <reference types="node" />
import { Type } from './constants';
export declare class Packet {
port: number;
channel: number;
length: number;
data: Buffer;
/**
* Generate header with current port and channel
* Header format located here:
* (https://wiki.bitcraze.io/projects:crazyflie:firmware:comm_protocol#packet_structure)
*/
readonly header: number;
/**
* Represents a packet to send to the Crazyflie
*/
constructor(data?: Buffer);
/**
* Write a type onto the packet payload
*/
write(type: Type, value: number): this;
/**
* Export packet into a complete buffer to send to the Crazyflie
* (https://wiki.bitcraze.io/projects:crazyflie:firmware:comm_protocol#packet_structure)
*/
export(): Buffer;
/**
* Return an array of hex codes for debugging
*/
exportHexCodes(): string[];
/**
* Determine of two packets are equal to each other
*/
equals(other: Packet): boolean;
/**
* You take the header... then you parse it
*/
static parseHeader(header: number): {
port: number;
channel: number;
};
}
/**
* Acknowledge packet response from the Crazyflie
* Header byte format is documented here:
* (https://wiki.bitcraze.io/doc:crazyradio:usb:index#data_transfer)
*/
export declare class Ack extends Packet {
ackHeader: number;
retry: number;
powerDetector: boolean;
ackReceived: boolean;
constructor(packet: Buffer);
/**
* Determine if two ack packets are equal to each other
*/
equals(other: Ack): boolean;
static emptyPing: Ack;
}