sketch-thru-plan-sdk
Version:
Sketch-thru-Plan SDK for JavaScript
508 lines (500 loc) • 21.2 kB
TypeScript
interface IStpConnector {
name: string | undefined;
isConnected: boolean;
connect(serviceName: string, solvables: string[], timeout?: number, machineId?: string, sessionId?: string): Promise<string | undefined>;
disconnect(timeout?: number): Promise<void>;
inform(message: string, timeout?: number): Promise<void>;
request(message: string, timeout?: number): Promise<any>;
onInform: ((message: string) => void) | undefined;
onRequest: ((message: string) => string[]) | undefined;
onError: ((error: string) => void) | undefined;
}
interface IStpConnectorConstructor {
new (connstring: string): IStpConnector;
}
interface ISpeechRecoResult {
results: ISpeechRecoItem[];
startTime: Date;
endTime: Date;
}
interface ISpeechRecoItem {
text: string;
confidence: number;
}
interface StpMessage {
method: string;
params: object;
}
interface SymbolAddedEvent {
symbol: StpSymbol;
isUndo: boolean;
}
interface OnSpeechRecognizedEvent {
phrases: string[];
}
interface OnStpMessageEvent {
message: string;
level: StpMessageLevel;
}
declare enum StpMessageLevel {
Error = "Error",
Warning = "Warning",
Info = "Info",
Debug = "Debug"
}
declare enum StpRole {
s2 = "S2",
s3 = "S3",
s4 = "S4",
fso = "FSO",
eng = "ENG"
}
declare class StpItem {
fsTYPE: string | undefined;
poid: string | undefined;
parentCoa: string | undefined;
creatorRole: string | undefined;
interval: Interval | undefined;
confidence: number | undefined;
alt: number | undefined;
}
declare class StpSymbol extends StpItem {
sidc: Sidc | undefined;
location: Location | undefined;
shortDescription: string | undefined;
description: string | undefined;
fullDescription: string | undefined;
affiliation: ('pending' | 'unknown' | 'assumedfriend' | 'friend' | 'neutral' | 'suspected' | 'hostile') | undefined;
echelon: ('none' | 'team' | 'squad' | 'section' | 'platoon' | 'company' | 'battalion' | 'regiment' | 'brigade' | 'division' | 'corps' | 'army' | 'armygroup' | 'region' | 'command') | undefined;
parent: string | undefined;
designator1: string | undefined;
designator2: string | undefined;
status: ('present' | 'anticipated') | undefined;
modifier: ('none' | 'dummy' | 'hq' | 'dummy_hq' | 'task_force ' | 'dummy_task_force' | 'task_force_hq' | 'dummytask_force_hq' | 'installation') | undefined;
strength: ('none' | 'reduced' | 'reinforced' | 'reduced_reinforced') | undefined;
branch: ('weapon' | 'ground_unit' | 'civilian_air' | 'special_operations' | 'vstol' | 'equipment' | 'installation' | 'military_air' | 'military_sea' | 'military_submarine') | undefined;
timeFrom: Date | undefined;
timeTo: Date | undefined;
altitude: number | undefined;
minAltitude: number | undefined;
maxAltitude: number | undefined;
toUnitPoid: string | undefined;
federate: string | undefined;
disCode: DISCode | undefined;
resources: Resource[] | undefined;
asGeoJSON(): GeoJSON.Feature<any>;
}
declare class StpTaskOrg {
fsTYPE: 'task_org' | undefined;
poid: string | undefined;
name: string | undefined;
affiliation: ('friend' | 'hostile') | undefined;
timestamp: string | undefined;
}
declare class StpTaskOrgUnit extends StpSymbol {
fsTYPE: 'task_org_unit' | undefined;
name: string | undefined;
speechPhrases: string[] | undefined;
unitType: string | undefined;
info: string | undefined;
parentTO: string | undefined;
}
declare class StpTaskOrgRelationship {
fsTYPE: 'task_org_relationship' | undefined;
poid: string | undefined;
parent: string | undefined;
child: string | undefined;
relationship: CommandRelationship | undefined;
isMTOE: boolean | undefined;
parentTO: string | undefined;
}
declare enum CommandRelationship {
None = "none",
Organic = "organic",
Attached = "attached",
Assigned = "assigned",
AdCon = "adcon",
OpCon = "opcon",
TaCon = "tacon",
DirectSupport = "ds",
Reinforcing = "r",
GeneralSupportReinforcing = "gsr",
GeneralSupport = "gs"
}
declare class StpTask extends StpItem {
description: string | undefined;
who: string | undefined;
supported: string | undefined;
tgs: string[] | undefined;
name: string | undefined;
how: TaskHow | undefined;
what: TaskWhat | undefined;
why: TaskWhy | undefined;
rulesOfEngagement: TaskROE | undefined;
startTime: number | undefined;
endTime: number | undefined;
speech: string | undefined;
language: string | undefined;
taskStatus: ('implicit' | 'explicit') | undefined;
uiStatus: ('confirming' | 'confirmed') | undefined;
prob: number | undefined;
movementFeatures: MovementFeatures | undefined;
}
declare class StpCoa {
fsTYPE: string | undefined;
name: string | undefined;
poid: string | undefined;
affiliation: string | undefined;
creatorRole: string | undefined;
state: TaskOrgState | undefined;
}
declare class TaskOrgState {
fsTYPE: string | undefined;
date: string | undefined;
userRole: string | undefined;
}
declare class Sidc {
partA: string | undefined;
partB: string | undefined;
partC: string | undefined;
symbolSet: string | undefined;
legacy: string | undefined;
}
declare class Location {
fsTYPE: ('point' | 'line' | 'area' | 'multipoint') | undefined;
width: number | undefined;
altitude: number | undefined;
shape: ('point' | 'line' | 'area' | 'straightline' | 'arrowthin' | 'arrowfat' | 'hook' | 'ubend' | 'ubendthreepoints' | 'vee' | 'opencircle' | 'multipoint') | undefined;
radius: number | undefined;
coords: LatLon[] | undefined;
centroid: LatLon | undefined;
candidatePoids: string[] | undefined;
}
declare class MovementFeatures {
fsTYPE: 'movement_features' | undefined;
movement: boolean | undefined;
movesTo: string | undefined;
}
declare enum TaskWhat {
NotSpecified = "not_specified",
AdvisePolice = "advise_police",
Ambush = "ambush",
AssignResponsibility = "assign_responsibility",
Block = "block",
BombAttack = "bomb_attack",
Breach = "breach",
Bypass = "bypass",
Clear = "clear",
CoerciveRecruiting = "coercive_recruiting",
CollectCasualties = "collect_casualties",
CollectCivilians = "collect_civilians",
CollectPrisoners = "collect_prisoners",
ConductAmbush = "conduct_ambush",
ConductAviatonAmbush = "conduct_aviaton_ambush",
ConductBilat = "conduct_bilat",
ConductGroupEngagement = "conduct_group_engagement",
ConductRaid = "conduct_raid",
ConductTcpOperation = "conduct_tcp_operation",
ConstituteReserve = "constitute_reserve",
Convoy = "convoy",
Defeat = "defeat",
Delay = "delay",
DeliverLeafletPsyop = "deliver_leaflet_psyop",
Demonstrate = "demonstrate",
Destroy = "destroy",
Disrupt = "disrupt",
DistributeFood = "distribute_food",
Emplace = "emplace",
EquipPolice = "equip_police",
EscortConvoy = "escort_convoy",
EvacuateCasualties = "evacuate_casualties",
EvacuateCivilians = "evacuate_civilians",
EvacuatePrisoners = "evacuate_prisoners",
Fix = "fix",
Follow = "follow",
FollowAndAssume = "follow_and_assume",
FollowAndSupport = "follow_and_support",
Halt = "halt",
HarrassmentFires = "harrassment_fires",
HouseToHousePsyop = "house_to_house_psyop",
IedAttack = "ied_attack",
Limit = "limit",
Looting = "looting",
MaintainHide = "maintain_hide",
MaintainOutpost = "maintain_outpost",
Move = "move",
Neutralize = "neutralize",
Observe = "observe",
Occupy = "occupy",
Patrol = "patrol",
Penetrate = "penetrate",
PositionSniper = "position_sniper",
PriorityOfFires = "priority_of_fires",
ProvideMedicalServices = "provide_medical_services",
ProvideService = "provide_service",
Receive = "receive",
Reconstruction = "reconstruction",
RecruitPolice = "recruit_police",
Refuel = "refuel",
RegulateTraffic = "regulate_traffic",
Reinforce = "reinforce",
Release = "release",
Resupply = "resupply",
Retain = "retain",
Rioting = "rioting",
Secure = "secure",
SeekRefuge = "seek_refuge",
Seize = "seize",
SniperAttack = "sniper_attack",
Supply = "supply",
SupplyMunitions = "supply_munitions",
TrainPolice = "train_police",
TransferMunitions = "transfer_munitions",
TrashRemoval = "trash_removal",
Turn = "turn",
TvRadioPsyop = "tv_radio_psyop",
WaterDelivery = "water_delivery",
WillfulRecruiting = "willful_recruiting"
}
declare enum TaskHow {
NotSpecified = "not_specified",
AirAssault = "air_assault",
AirReconnaissance = "air_reconnaissance",
AreaDefense = "area_defense",
Assault = "assault",
Attack = "attack",
AttackInZone = "attack_in_zone",
AttackByFire = "attack_by_fire",
CerpFunding = "cerp_funding",
Civilian = "civilian",
Contracting = "contracting",
CordonAndSearch = "cordon_and_search",
Counterattack = "counterattack",
CounterattackByFire = "counterattack_by_fire",
Cover = "cover",
Defend = "defend",
DeliverServices = "deliver_services",
Guard = "guard",
InformationOperations = "information_operations",
Insurgent = "insurgent",
MobileDefense = "mobile_defense",
MovingScreen = "moving_screen",
NgoOperation = "ngo_operation",
PassageOfLines = "passage_of_lines",
Screen = "screen",
SearchAndAttack = "search_and_attack",
Security = "security",
SecurityForceAssistance = "security_force_assistance",
SupportByFire = "support_by_fire",
Withdrawal = "withdrawal"
}
declare enum TaskWhy {
Unknown = "unknown",
Allow = "allow",
Cause = "cause",
Create = "create",
Deceive = "deceive",
Deny = "deny",
Divert = "divert",
Enable = "enable",
Envelop = "envelop",
Influence = "influence",
Open = "open",
Prevent = "prevent",
Protect = "protect",
Support = "support",
Surprise = "surprise"
}
declare enum TaskROE {
NotSpecified = "not_specified",
Hold = "hold",
Tight = "tight",
Free = "free"
}
declare class LatLon {
lat: number;
lon: number;
constructor(lat: number, lon: number);
equals(rhs: LatLon): boolean;
}
declare class Interval {
start: Date;
end: Date;
constructor(start: Date, end: Date);
equals(rhs: Interval): boolean;
}
declare class Size {
width: number;
height: number;
constructor(width: number, height: number);
equals(rhs: Size): boolean;
}
declare class DISCode {
category: number | undefined;
country: string | undefined;
domain: number | undefined;
extra: number | undefined;
kind: number | undefined;
specific: number | undefined;
subcategory: number | undefined;
constructor(category: number, country: string, domain: number, extra: number, kind: number, specific: number, subcategory: number);
equals(rhs: DISCode): boolean;
}
declare class Resource {
name: string | undefined;
operationalQuantity: number | undefined;
disCode: DISCode | undefined;
onHandQuantity: number | undefined;
requiredOnHandQuantity: number | undefined;
constructor(name: string, operationalQuantity: number, disCode: DISCode, onHandQuantity: number | undefined, requiredOnHandQuantity: number | undefined);
equals(rhs: Resource): boolean;
}
interface IC2SIMProxy {
exportPlanDataToC2SIMServer(name: string, dataType: ('initialization' | 'order'), affiliation?: ('all' | 'friend' | 'hostile'), coaPoids?: string[], timeout?: number): Promise<void>;
importInitializationFromC2SIMServer(timeout?: number): Promise<void>;
getC2SIMContent(name: string, dataType: ('initialization' | 'order'), affiliation?: ('all' | 'friend' | 'hostile'), coaPoids?: string[], timeout?: number): Promise<string>;
pushC2SIMContent(content: string, dataType: ('initialization' | 'order'), timeout?: number): Promise<void>;
pullC2SIMInitialization(timeout?: number): Promise<string>;
convertC2SIMContent(content: string, timeout?: number): Promise<string>;
onSymbolReport: ((poid: string, symbol: StpSymbol) => void) | undefined;
}
declare class StpC2SIMOptions {
restUrl: string | undefined;
restPassword: string | undefined;
stompUrl: string | undefined;
serverProtocol: string | undefined;
systemName: string | undefined;
resetBeforeInitialize: boolean | undefined;
runAfterInitialize: boolean | undefined;
fullTO: boolean | undefined;
schemaVersion: string | undefined;
addOrphanTgToInitialization: boolean | undefined;
placeAllTgInInitialization: boolean | undefined;
includeMapGraphicId: boolean | undefined;
entityNameCharLimit: number | undefined;
rulesOfEngagement: 'ROEHold' | 'ROEFree' | 'ROETight' | undefined;
updateUnitPositions: boolean | undefined;
exportFileDir: string | undefined;
startDate: Date | undefined;
phaseDuration: number | undefined;
fromSenderUUID: string | undefined;
toReceiverUUID: string | undefined;
friendFstName: string | undefined;
friendFstUUID: string | undefined;
hostileFstName: string | undefined;
hostileFstUUID: string | undefined;
neutralFstName: string | undefined;
neutralFstUUID: string | undefined;
unknownFstName: string | undefined;
unknownFstUUID: string | undefined;
}
declare class StpRecognizer {
stpConnector: IStpConnector;
serviceName: string;
constructor(stpConnector: IStpConnector);
connect(serviceName: string, timeout: number, machineId?: string, sessionId?: string): Promise<string | undefined>;
private buildSolvables;
private onInform;
private onRequest;
private onError;
private handleInform;
informStp(name: string, parms: any): void;
requestStp(name: string, parms: any, timeout?: number): Promise<any>;
sendPenDown(location: LatLon, timestamp: string): void;
sendInk(pixelBoundsWindow: Size, topLeftGeoMap: LatLon, bottomRightGeoMap: LatLon, strokePoints: LatLon[], timeStrokeStart: string, timeStrokeEnd: string, intersectedPoids: string[]): void;
sendSpeechRecognition(recoList: ISpeechRecoItem[], startTime: Date, endTime: Date): void;
createNewScenario(name: string, timeout?: number): Promise<void>;
loadNewScenario(content: string, timeout?: number): Promise<void>;
importPlanData(content: string, timeout?: number): Promise<void>;
getScenarioContent(timeout?: number): Promise<string>;
joinScenarioSession(timeout?: number): Promise<void>;
syncScenarioSession(content: string, timeout?: number): Promise<void>;
hasActiveScenario(timeout?: number): Promise<boolean>;
createC2SIMProxy(options?: StpC2SIMOptions): IC2SIMProxy;
addSymbol(symbol: StpSymbol): void;
updateSymbol(poid: string, symbol: StpSymbol): void;
deleteSymbol(poid: string): void;
chooseAlternate(poid: string, nBestIndex: number): void;
importTaskOrgContent(content: string, timeout?: number): Promise<string>;
getTaskOrgContent(poid: string, timeout?: number): Promise<string>;
setDefaultTaskOrg(poid: string, timeout?: number): Promise<void>;
resetDefaultTaskOrg(affiliation: ('friend' | 'hostile'), timeout?: number): Promise<void>;
addTaskOrg(taskOrg: StpTaskOrg): void;
updateTaskOrg(poid: string, taskOrg: StpTaskOrg): void;
deleteTaskOrg(poid: string): void;
addTaskOrgUnit(toUnit: StpTaskOrgUnit): void;
updateTaskOrgUnit(poid: string, toUnit: StpTaskOrgUnit): void;
deleteTaskOrgUnit(poid: string): void;
addTaskOrgRelationship(toUnit: StpTaskOrgRelationship): void;
updateTaskOrgRelationship(poid: string, toUnit: StpTaskOrgRelationship): void;
deleteTaskOrgRelationship(poid: string): void;
addTask(task: StpTask): void;
updateTask(poid: string, alternates: StpTask[]): void;
deleteTask(poid: string): void;
confirmTask(poid: string, nBestIndex: number, isConfirmed?: boolean): void;
setCoaTaskOrg(toPoid: string, coaPoid?: string, timeout?: number): Promise<void>;
resetCoaTaskOrg(coaPoid?: string, timeout?: number): Promise<void>;
importCoaContent(toContent: string, timeout?: number): Promise<string>;
getCoaContent(poid: string, timeout?: number): Promise<string>;
setCurrentCoa(poid: string, timeout?: number): Promise<void>;
addCoa(coa: StpCoa): void;
updateCoa(poid: string, coa: StpCoa): void;
deleteCoa(poid: string): void;
setCurrentRole(role: StpRole, createIfNone?: boolean, timeout?: number): Promise<void>;
onPenDown: ((time: Date, coord: LatLon) => void) | undefined;
onInkProcessed: (() => void) | undefined;
onSpeechRecognized: ((phrases: string[]) => void) | undefined;
onSymbolAdded: ((alternates: StpSymbol[], isUndo: boolean) => void) | undefined;
onSymbolModified: ((poid: string, symbol: StpSymbol, isUndo: boolean) => void) | undefined;
onSymbolDeleted: ((poid: string, isUndo: boolean) => void) | undefined;
onSymbolReport: ((poid: string, symbol: StpSymbol) => void) | undefined;
onTaskOrgAdded: ((taskOrg: StpTaskOrg, isUndo: boolean) => void) | undefined;
onTaskOrgModified: ((poid: string, taskOrg: StpTaskOrg, isUndo: boolean) => void) | undefined;
onTaskOrgDeleted: ((poid: string, isUndo: boolean) => void) | undefined;
onTaskOrgUnitAdded: ((unit: StpTaskOrgUnit, isUndo: boolean) => void) | undefined;
onTaskOrgUnitModified: ((poid: string, unit: StpTaskOrgUnit, isUndo: boolean) => void) | undefined;
onTaskOrgUnitDeleted: ((poid: string, isUndo: boolean) => void) | undefined;
onTaskOrgRelationshipAdded: ((rel: StpTaskOrgRelationship, isUndo: boolean) => void) | undefined;
onTaskOrgRelationshipModified: ((poid: string, rel: StpTaskOrgRelationship, isUndo: boolean) => void) | undefined;
onTaskOrgRelationshipDeleted: ((poid: string, isUndo: boolean) => void) | undefined;
onTaskOrgSwitched: ((taskOrg: StpTaskOrg) => void) | undefined;
onTaskAdded: ((poid: string, alternates: StpTask[], taskPoids: string[], isUndo: boolean) => void) | undefined;
onTaskModified: ((poid: string, alternates: StpTask[], taskPoids: string[], isUndo: boolean) => void) | undefined;
onTaskDeleted: ((poid: string, isUndo: boolean) => void) | undefined;
onCoaAdded: ((poid: string, coa: StpCoa, isUndo: boolean) => void) | undefined;
onCoaModified: ((poid: string, coa: StpCoa, isUndo: boolean) => void) | undefined;
onCoaDeleted: ((poid: string, isUndo: boolean) => void) | undefined;
onRoleSwitched: ((role: StpRole) => void) | undefined;
onSymbolEdited: ((operation: string, location: Location) => void) | undefined;
onMapOperation: ((operation: string, location: Location) => void) | undefined;
onCommand: ((operation: string, location: Location) => void) | undefined;
onStpMessage: ((msg: string, level: StpMessageLevel) => void) | undefined;
private promiseWithTimeout;
}
declare class StpWebSocketsConnector implements IStpConnector {
connstring: string;
socket: WebSocket | null;
name: string | undefined;
serviceName: string | undefined;
solvables: string[] | undefined;
timeout: number | undefined;
machineId: string | undefined;
sessionId: string | undefined;
get isConnected(): boolean;
get isConnecting(): boolean;
get connState(): string;
readonly DEFAULT_TIMEOUT: number;
constructor(connstring: string);
connect(serviceName: string, solvables: string[], timeout?: number, machineId?: string | null, sessionId?: string | null): Promise<string | undefined>;
private register;
disconnect(timeout?: number): Promise<void>;
inform(message: string, timeout?: number): Promise<void>;
request(message: string, timeout?: number): Promise<any>;
onInform: ((message: string) => void) | undefined;
onRequest: ((message: string) => string[]) | undefined;
onError: ((error: string) => void) | undefined;
private tryConnect;
private promiseWithTimeout;
private getUniqueId;
}
export { CommandRelationship, DISCode, IC2SIMProxy, ISpeechRecoItem, ISpeechRecoResult, IStpConnector, IStpConnectorConstructor, Interval, LatLon, Location, MovementFeatures, OnSpeechRecognizedEvent, OnStpMessageEvent, Resource, Sidc, Size, StpC2SIMOptions, StpCoa, StpItem, StpMessage, StpMessageLevel, StpRecognizer, StpRole, StpSymbol, StpTask, StpTaskOrg, StpTaskOrgRelationship, StpTaskOrgUnit, StpWebSocketsConnector, SymbolAddedEvent, TaskHow, TaskOrgState, TaskROE, TaskWhat, TaskWhy };