@tak-ps/node-cot
Version:
Lightweight JavaScript library for parsing and manipulating TAK messages
58 lines (57 loc) • 2.24 kB
TypeScript
import type { Static } from '@sinclair/typebox';
import type { EventAttributes, TrackAttributes, Detail, Point } from '../types/types.js';
/**
* Helper functions for generating CoT data
* @class
*/
export default class Util {
/**
* Return an event._attributes object with as many defaults as possible
*
* @param type CoT Type
* @param how CoT how
* @param time Time of CoT Message - if omitted, current time is used
* @param start Start Time of CoT - if omitted, current time is used
* @param stale Expiration of CoT - if null now+20s is used. Alternative an integer representing the ms offset
*/
static cot_event_attr(type: string, how: string, time?: Date | string | null, start?: Date | string | null, stale?: Date | string | number | null): Static<typeof EventAttributes>;
/**
* Return an event.detail object with as many defaults as possible
*
* @param [callsign=UNKNOWN] Display Callsign
*/
static cot_event_detail(callsign?: string): Static<typeof Detail>;
/**
* Return a track object with as many defaults as possible
*
* @param [course] Speed in degrees from north
* @param [speed=0] Speed in m/s
*/
static cot_track_attr(course?: number, speed?: number, slope?: number): Static<typeof TrackAttributes>;
/**
* Generate a random UUID
*/
static cot_uuid(): string;
/**
* Return the current version number this library supports
*/
static cot_version(): string;
/**
* Generate Null Island CoT point object
*/
static cot_point(): Static<typeof Point>;
/**
* Generate CoT date objects
*
* cot_date() - Time: now, Start: now, Stale: now + 20s
*
* @param time Time of CoT Message - if omitted, current time is used
* @param start Start Time of CoT - if omitted, current time is used
* @param stale Expiration of CoT - if null now+20s is used. Alternative an integer representing the ms offset
*/
static cot_date(time?: Date | string | null, start?: Date | string | null, stale?: Date | string | number | null): {
time: string;
start: string;
stale: string;
};
}