camstreamerlib 4.0.0-beta.46 → 4.0.0-beta.48

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (70) hide show
  1. package/README.md +123 -30
  2. package/cjs/CamSwitcherAPI.js +1 -1
  3. package/cjs/PlaneTrackerAPI.js +4 -0
  4. package/cjs/index.js +18 -9
  5. package/cjs/internal/WsEvents.js +6 -5
  6. package/cjs/node/CamOverlayDrawingAPI.js +10 -10
  7. package/cjs/node/CamScripterAPICameraEventsGenerator.js +9 -9
  8. package/cjs/node/Digest.test.js +13 -0
  9. package/cjs/node/VapixEvents.js +9 -9
  10. package/cjs/node/WsClient.js +20 -13
  11. package/cjs/types/CamOverlayAPI/pipSchema.js +1 -1
  12. package/cjs/types/PlaneTrackerAPI.js +18 -2
  13. package/cjs/types/ws/CamOverlayEvents.js +19 -0
  14. package/cjs/types/ws/CamStreamerEvents.js +32 -0
  15. package/cjs/types/ws/PlaneTrackerEvents.js +77 -0
  16. package/cjs/web/DefaultClient.js +6 -2
  17. package/cjs/web/WsClient.js +13 -15
  18. package/cjs/ws/CamOverlayEvents.js +24 -0
  19. package/cjs/ws/CamStreamerEvents.js +24 -0
  20. package/cjs/ws/CamSwitcherEvents.js +24 -0
  21. package/cjs/ws/PlaneTrackerEvents.js +22 -0
  22. package/esm/CamSwitcherAPI.js +1 -1
  23. package/esm/PlaneTrackerAPI.js +5 -1
  24. package/esm/index.js +12 -6
  25. package/esm/internal/WsEvents.js +6 -5
  26. package/esm/node/CamOverlayDrawingAPI.js +10 -10
  27. package/esm/node/CamScripterAPICameraEventsGenerator.js +9 -9
  28. package/esm/node/Digest.test.js +11 -0
  29. package/esm/node/VapixEvents.js +9 -9
  30. package/esm/node/WsClient.js +20 -13
  31. package/esm/types/CamOverlayAPI/pipSchema.js +1 -1
  32. package/esm/types/PlaneTrackerAPI.js +17 -1
  33. package/esm/types/ws/CamOverlayEvents.js +16 -0
  34. package/esm/types/ws/CamStreamerEvents.js +29 -0
  35. package/esm/types/ws/PlaneTrackerEvents.js +74 -0
  36. package/esm/web/DefaultClient.js +6 -2
  37. package/esm/web/WsClient.js +13 -15
  38. package/esm/ws/CamOverlayEvents.js +20 -0
  39. package/esm/ws/CamStreamerEvents.js +20 -0
  40. package/esm/ws/CamSwitcherEvents.js +20 -0
  41. package/esm/ws/PlaneTrackerEvents.js +18 -0
  42. package/package.json +1 -1
  43. package/types/CamSwitcherAPI.d.ts +1 -1
  44. package/types/PlaneTrackerAPI.d.ts +2 -1
  45. package/types/index.d.ts +12 -6
  46. package/types/internal/WsEvents.d.ts +3 -5
  47. package/types/internal/types.d.ts +7 -6
  48. package/types/node/CamScripterAPICameraEventsGenerator.d.ts +2 -2
  49. package/types/node/Digest.test.d.ts +1 -0
  50. package/types/node/VapixEvents.d.ts +2 -2
  51. package/types/node/WsClient.d.ts +9 -19
  52. package/types/types/CamOverlayAPI/CamOverlayAPI.d.ts +5 -5
  53. package/types/types/CamOverlayAPI/pipSchema.d.ts +2 -2
  54. package/types/types/CamOverlayDrawingAPI.d.ts +2 -2
  55. package/types/types/PlaneTrackerAPI.d.ts +12 -4
  56. package/types/types/ws/CamOverlayEvents.d.ts +88 -0
  57. package/types/types/ws/CamStreamerEvents.d.ts +249 -0
  58. package/types/types/ws/PlaneTrackerEvents.d.ts +947 -0
  59. package/types/web/DefaultClient.d.ts +2 -0
  60. package/types/web/WsClient.d.ts +9 -5
  61. package/types/ws/CamOverlayEvents.d.ts +8 -0
  62. package/types/ws/CamStreamerEvents.d.ts +8 -0
  63. package/types/ws/CamSwitcherEvents.d.ts +8 -0
  64. package/types/ws/PlaneTrackerEvents.d.ts +9 -0
  65. package/cjs/CamSwitcherEvents.js +0 -11
  66. package/esm/CamSwitcherEvents.js +0 -7
  67. package/types/CamSwitcherEvents.d.ts +0 -8
  68. /package/cjs/types/{CamSwitcherEvents.js → ws/CamSwitcherEvents.js} +0 -0
  69. /package/esm/types/{CamSwitcherEvents.js → ws/CamSwitcherEvents.js} +0 -0
  70. /package/types/types/{CamSwitcherEvents.d.ts → ws/CamSwitcherEvents.d.ts} +0 -0
@@ -205,7 +205,8 @@ export const cameraSettingsSchema = z.object({
205
205
  }),
206
206
  });
207
207
  export const serverSettingsSchema = z.object({
208
- cameraCalibration: z.object({
208
+ cameraCalibration: z
209
+ .object({
209
210
  posLat: z.number(),
210
211
  posLon: z.number(),
211
212
  geoidHN: z.number(),
@@ -216,8 +217,23 @@ export const serverSettingsSchema = z.object({
216
217
  tiltTransformationCoefA: z.number(),
217
218
  tiltCameraKnownPoint: z.number(),
218
219
  tiltRealKnownPoint: z.number(),
220
+ })
221
+ .default({
222
+ posLat: 50,
223
+ posLon: 14,
224
+ geoidHN: 45,
225
+ altitudeAmsl: 372,
226
+ rotationEast: 0,
227
+ rotationNorth: 0,
228
+ rotationUp: 0,
229
+ tiltTransformationCoefA: 1.0,
230
+ tiltCameraKnownPoint: 90,
231
+ tiltRealKnownPoint: 90,
219
232
  }),
220
233
  });
234
+ export const getIcaoSchema = z.object({
235
+ icao: z.string(),
236
+ });
221
237
  export const trackingModeSchema = z.object({
222
238
  mode: z.union([z.literal('MANUAL'), z.literal('AUTOMATIC')]),
223
239
  });
@@ -0,0 +1,16 @@
1
+ import { z } from 'zod';
2
+ const coEventsDataSchema = z.discriminatedUnion('type', [
3
+ z.object({ type: z.literal('authorization'), state: z.string() }),
4
+ z.object({
5
+ type: z.literal('ServiceStart'),
6
+ serviceId: z.number(),
7
+ }),
8
+ z.object({
9
+ type: z.literal('ServiceStop'),
10
+ serviceId: z.number(),
11
+ }),
12
+ ]);
13
+ export const coEventsSchema = z.discriminatedUnion('type', [
14
+ z.object({ type: z.literal('init'), data: coEventsDataSchema }),
15
+ ...coEventsDataSchema.options,
16
+ ]);
@@ -0,0 +1,29 @@
1
+ import { z } from 'zod';
2
+ const csEventsDataSchema = z.discriminatedUnion('type', [
3
+ z.object({ type: z.literal('authorization'), state: z.string() }),
4
+ z.object({
5
+ type: z.literal('StreamState'),
6
+ streamID: z.number(),
7
+ enabled: z.union([z.literal(0), z.literal(1)]),
8
+ active: z.union([z.literal(0), z.literal(1)]),
9
+ automationState: z.union([z.literal(0), z.literal(1)]),
10
+ isStreaming: z.union([z.literal(0), z.literal(1)]),
11
+ }),
12
+ z.object({
13
+ type: z.literal('CS_API_SUCCESS'),
14
+ apiCall: z.string(),
15
+ message: z.string(),
16
+ streamID: z.string(),
17
+ }),
18
+ z.object({
19
+ type: z.literal('CS_API_ERROR'),
20
+ apiCall: z.string(),
21
+ message: z.string(),
22
+ streamID: z.string(),
23
+ code: z.string(),
24
+ }),
25
+ ]);
26
+ export const csEventsSchema = z.discriminatedUnion('type', [
27
+ z.object({ type: z.literal('init'), data: csEventsDataSchema }),
28
+ ...csEventsDataSchema.options,
29
+ ]);
@@ -0,0 +1,74 @@
1
+ import { z } from 'zod';
2
+ const apiFlightDataSchema = z.object({
3
+ icao: z.string(),
4
+ lat: z.number(),
5
+ lon: z.number(),
6
+ heading: z.number(),
7
+ groundSpeed: z.number(),
8
+ altitudeAMSL: z.number(),
9
+ cameraDistance: z.number(),
10
+ autoTrackingOrder: z.number(),
11
+ whiteListed: z.boolean(),
12
+ blackListed: z.boolean(),
13
+ priorityListed: z.boolean(),
14
+ autoSelectionIgnored: z.boolean(),
15
+ signalQuality: z.number(),
16
+ emergencyState: z.boolean(),
17
+ emergencyStatusMessage: z.string(),
18
+ });
19
+ const apiUserSchema = z.object({
20
+ userId: z.string(),
21
+ userName: z.string(),
22
+ userPriority: z.number(),
23
+ ip: z.string(),
24
+ });
25
+ const ptrEventsDataSchema = z.discriminatedUnion('type', [
26
+ z.object({
27
+ type: z.literal('CAMERA_POSITION'),
28
+ lat: z.number(),
29
+ lon: z.number(),
30
+ azimuth: z.number().min(0).max(360),
31
+ elevation: z.number().min(-90).max(90),
32
+ fov: z.number(),
33
+ }),
34
+ z.object({
35
+ type: z.literal('TRACKING_START'),
36
+ icao: z.string(),
37
+ }),
38
+ z.object({
39
+ type: z.literal('TRACKING_STOP'),
40
+ }),
41
+ z.object({
42
+ type: z.literal('FLIGHT_LIST'),
43
+ list: z.array(apiFlightDataSchema),
44
+ }),
45
+ z.object({
46
+ type: z.literal('USER_ACTION'),
47
+ ip: z.string(),
48
+ params: z.object({
49
+ userId: z.string(),
50
+ userName: z.string(),
51
+ userPriority: z.number(),
52
+ }),
53
+ cgi: z.string(),
54
+ postJsonBody: z.any(),
55
+ }),
56
+ z.object({
57
+ type: z.literal('CONNECTED_USERS'),
58
+ users: z.array(apiUserSchema),
59
+ }),
60
+ z.object({
61
+ type: z.literal('FORCE_TRACKING_STATUS'),
62
+ enabled: z.boolean(),
63
+ icao: z.string().optional(),
64
+ }),
65
+ z.object({
66
+ type: z.literal('API_LOCK_STATUS'),
67
+ isLocked: z.boolean(),
68
+ user: apiUserSchema.optional(),
69
+ }),
70
+ ]);
71
+ export const ptrEventsSchema = z.discriminatedUnion('type', [
72
+ z.object({ type: z.literal('init'), data: ptrEventsDataSchema }),
73
+ ...ptrEventsDataSchema.options,
74
+ ]);
@@ -1,5 +1,9 @@
1
1
  import { addParametersToPath } from '../internal/utils';
2
2
  export class DefaultClient {
3
+ domain;
4
+ constructor(domain = '') {
5
+ this.domain = domain;
6
+ }
3
7
  get = (params) => {
4
8
  return this.fetchWithTimeout(addParametersToPath(params.path, params.parameters), {
5
9
  method: 'GET',
@@ -13,11 +17,11 @@ export class DefaultClient {
13
17
  headers: params.headers,
14
18
  }, params.timeout);
15
19
  };
16
- async fetchWithTimeout(url, options, timeout) {
20
+ async fetchWithTimeout(path, options, timeout) {
17
21
  const controller = new AbortController();
18
22
  const timeoutId = timeout !== undefined ? setTimeout(() => controller.abort(), timeout) : null;
19
23
  try {
20
- return await fetch(url, { ...options, signal: controller.signal });
24
+ return await fetch(`${this.domain}${path}`, { ...options, signal: controller.signal });
21
25
  }
22
26
  finally {
23
27
  if (timeoutId) {
@@ -1,13 +1,11 @@
1
1
  const REFRESH_TIMEOUT = 5000;
2
2
  export class WsClient {
3
3
  getUrl;
4
- getAuthToken;
5
4
  isDestroyed = false;
6
5
  ws = null;
7
6
  restartTimeout = null;
8
- constructor(getUrl, getAuthToken) {
7
+ constructor(getUrl) {
9
8
  this.getUrl = getUrl;
10
- this.getAuthToken = getAuthToken;
11
9
  }
12
10
  init() {
13
11
  if (this.isDestroyed) {
@@ -15,17 +13,9 @@ export class WsClient {
15
13
  }
16
14
  this.destroyWebsocket();
17
15
  const ws = new WebSocket(this.getUrl(), 'events');
18
- ws.onopen = async () => {
19
- try {
20
- const token = await this.getAuthToken();
21
- ws.send(JSON.stringify({ authorization: token }));
22
- }
23
- catch (error) {
24
- console.error('Error sending auth token:', error);
25
- ws.close();
26
- }
27
- };
28
- ws.onmessage = (e) => this.onmessage(e);
16
+ ws.binaryType = 'arraybuffer';
17
+ ws.onopen = () => this.onOpen();
18
+ ws.onmessage = (e) => this.onMessage(e.data);
29
19
  ws.onclose = () => {
30
20
  this.restartTimeout = window.setTimeout(() => this.init(), REFRESH_TIMEOUT);
31
21
  };
@@ -34,7 +24,15 @@ export class WsClient {
34
24
  send = (msg) => {
35
25
  this.ws?.send(msg);
36
26
  };
37
- onmessage = (_) => { };
27
+ onMessage = (_) => { };
28
+ onOpen = () => { };
29
+ onClose = () => { };
30
+ onError = (error) => {
31
+ console.error(error);
32
+ };
33
+ reconnect = () => {
34
+ this.ws?.close();
35
+ };
38
36
  destroy = () => {
39
37
  this.isDestroyed = true;
40
38
  this.destroyWebsocket();
@@ -0,0 +1,20 @@
1
+ import { WsEvents } from '../internal/WsEvents';
2
+ import { coEventsSchema } from '../types/ws/CamOverlayEvents';
3
+ export class CamOverlayEvents extends WsEvents {
4
+ getAuthToken;
5
+ constructor(ws, getAuthToken) {
6
+ super(coEventsSchema, ws);
7
+ this.getAuthToken = getAuthToken;
8
+ this.ws.onOpen = this.sendInitMsg;
9
+ }
10
+ sendInitMsg = async () => {
11
+ try {
12
+ const token = await this.getAuthToken();
13
+ this.ws.send(JSON.stringify({ authorization: token }));
14
+ }
15
+ catch (error) {
16
+ console.error('Error on open:', error);
17
+ this.ws.reconnect();
18
+ }
19
+ };
20
+ }
@@ -0,0 +1,20 @@
1
+ import { WsEvents } from '../internal/WsEvents';
2
+ import { csEventsSchema } from '../types/ws/CamStreamerEvents';
3
+ export class CamStreamerEvents extends WsEvents {
4
+ getAuthToken;
5
+ constructor(ws, getAuthToken) {
6
+ super(csEventsSchema, ws);
7
+ this.getAuthToken = getAuthToken;
8
+ this.ws.onOpen = this.sendInitMsg;
9
+ }
10
+ sendInitMsg = async () => {
11
+ try {
12
+ const token = await this.getAuthToken();
13
+ this.ws.send(JSON.stringify({ authorization: token }));
14
+ }
15
+ catch (error) {
16
+ console.error('Error on open:', error);
17
+ this.ws.reconnect();
18
+ }
19
+ };
20
+ }
@@ -0,0 +1,20 @@
1
+ import { WsEvents } from '../internal/WsEvents';
2
+ import { cswEventsSchema } from '../types/ws/CamSwitcherEvents';
3
+ export class CamSwitcherEvents extends WsEvents {
4
+ getAuthToken;
5
+ constructor(ws, getAuthToken) {
6
+ super(cswEventsSchema, ws);
7
+ this.getAuthToken = getAuthToken;
8
+ this.ws.onOpen = this.sendInitMsg;
9
+ }
10
+ sendInitMsg = async () => {
11
+ try {
12
+ const token = await this.getAuthToken();
13
+ this.ws.send(JSON.stringify({ authorization: token }));
14
+ }
15
+ catch (error) {
16
+ console.error('Error on open:', error);
17
+ this.ws.reconnect();
18
+ }
19
+ };
20
+ }
@@ -0,0 +1,18 @@
1
+ import { WsEvents } from '../internal/WsEvents';
2
+ import { ptrEventsSchema } from '../types/ws/PlaneTrackerEvents';
3
+ export class PlaneTrackerEvents extends WsEvents {
4
+ _apiUser;
5
+ constructor(ws, _apiUser) {
6
+ super(ptrEventsSchema, ws);
7
+ this._apiUser = _apiUser;
8
+ this.ws.onOpen = this.sendInitMsg;
9
+ }
10
+ sendInitMsg = () => {
11
+ this.ws.send(JSON.stringify({
12
+ type: 'USER_INFO',
13
+ userId: this._apiUser.userId,
14
+ userName: this._apiUser.userName,
15
+ userPriority: this._apiUser.userPriority,
16
+ }));
17
+ };
18
+ }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "camstreamerlib",
3
- "version": "4.0.0-beta.46",
3
+ "version": "4.0.0-beta.48",
4
4
  "description": "Helper library for CamStreamer ACAP applications.",
5
5
  "prettier": "@camstreamer/prettier-config",
6
6
  "engine": {
@@ -12,7 +12,7 @@ export declare class CamSwitcherAPI<Client extends IClient<TResponse, any>> {
12
12
  });
13
13
  static getProxyPath: () => string;
14
14
  static getWsEventsPath: () => string;
15
- static getClipPreviewPath: (id: string, storage: TStorageType) => string;
15
+ static getClipPreviewPath: (clipId: string, storage: TStorageType) => string;
16
16
  getClient(proxyParams?: TProxyParams): Client | ProxyClient<Client>;
17
17
  checkCameraTime(options?: THttpRequestOptions): Promise<boolean>;
18
18
  getNetworkCameraList(options?: THttpRequestOptions): Promise<{
@@ -1,5 +1,5 @@
1
1
  import { IClient, TBlobResponse, TParameters, TResponse } from './internal/types';
2
- import { ICAO, TApiUser, TBlackList, TCameraSettings, TExportDataType, TImportDataType, TPriorityList, TTrackingMode, TWhiteList, TZones } from './types/PlaneTrackerAPI';
2
+ import { ICAO, TApiUser, TBlackList, TCameraSettings, TExportDataType, TGetIcaoByOption, TImportDataType, TPriorityList, TTrackingMode, TWhiteList, TZones } from './types/PlaneTrackerAPI';
3
3
  import { THttpRequestOptions, TProxyParams } from './types/common';
4
4
  import { ProxyClient } from './internal/ProxyClient';
5
5
  export declare class PlaneTrackerAPI<Client extends IClient<TResponse, any>> {
@@ -177,6 +177,7 @@ export declare class PlaneTrackerAPI<Client extends IClient<TResponse, any>> {
177
177
  setTrackingMode(mode: TTrackingMode['mode'], options?: THttpRequestOptions): Promise<void>;
178
178
  startTrackingPlane(icao: ICAO, options?: THttpRequestOptions): Promise<void>;
179
179
  stopTrackingPlane(options?: THttpRequestOptions): Promise<void>;
180
+ getIcao(by: TGetIcaoByOption, value: string, options?: THttpRequestOptions): Promise<string>;
180
181
  getPriorityList(options?: THttpRequestOptions): Promise<{
181
182
  priorityList: string[];
182
183
  }>;
package/types/index.d.ts CHANGED
@@ -4,17 +4,23 @@ export * from './internal/utils';
4
4
  export * from './internal/versionCompare';
5
5
  export * from './internal/ProxyClient';
6
6
  export * from './types/common';
7
- export { CamOverlayAPI } from './CamOverlayAPI';
8
- export * from './types/CamOverlayAPI';
9
- export { CamScripterAPI } from './CamScripterAPI';
10
- export * from './types/CamScripterAPI';
11
7
  export { CamStreamerAPI } from './CamStreamerAPI';
12
8
  export * from './types/CamStreamerAPI';
9
+ export { CamStreamerEvents } from './ws/CamStreamerEvents';
10
+ export * from './types/ws/CamStreamerEvents';
11
+ export { CamOverlayAPI } from './CamOverlayAPI';
12
+ export * from './types/CamOverlayAPI';
13
+ export { CamOverlayEvents } from './ws/CamOverlayEvents';
14
+ export * from './types/ws/CamOverlayEvents';
13
15
  export { CamSwitcherAPI } from './CamSwitcherAPI';
14
16
  export * from './types/CamSwitcherAPI';
15
- export { CamSwitcherEvents } from './CamSwitcherEvents';
16
- export * from './types/CamSwitcherEvents';
17
+ export { CamSwitcherEvents } from './ws/CamSwitcherEvents';
18
+ export * from './types/ws/CamSwitcherEvents';
17
19
  export { PlaneTrackerAPI } from './PlaneTrackerAPI';
18
20
  export * from './types/PlaneTrackerAPI';
21
+ export { PlaneTrackerEvents } from './ws/PlaneTrackerEvents';
22
+ export * from './types/ws/PlaneTrackerEvents';
23
+ export { CamScripterAPI } from './CamScripterAPI';
24
+ export * from './types/CamScripterAPI';
19
25
  export { VapixAPI } from './VapixAPI';
20
26
  export * from './types/VapixAPI';
@@ -1,4 +1,4 @@
1
- import { IWebsocket } from './types';
1
+ import { IWsClient } from './types';
2
2
  type TEventType<T extends {
3
3
  type: string;
4
4
  }> = T extends {
@@ -22,14 +22,12 @@ type TListenerFunction<T extends {
22
22
  }, Type extends TEventType<T>> = (data: TEvent<T, Type>, isInit: boolean) => void;
23
23
  export declare class WsEvents<T extends {
24
24
  type: string;
25
- }, Event extends {
26
- data: string;
27
25
  }> {
28
26
  private zodSchema;
29
- ws: IWebsocket<Event>;
27
+ ws: IWsClient;
30
28
  private _isDestroyed;
31
29
  private listeners;
32
- constructor(zodSchema: TZodSchema<T>, ws: IWebsocket<Event>);
30
+ constructor(zodSchema: TZodSchema<T>, ws: IWsClient);
33
31
  get isDestroyed(): boolean;
34
32
  resendInitData(): void;
35
33
  addListener<Type extends TEventType<T>>(type: Type, listener: TListenerFunction<T, Type>, id: string): void;
@@ -9,7 +9,6 @@ export type Options = {
9
9
  export type HttpOptions = Options & {
10
10
  keepAlive?: boolean;
11
11
  };
12
- export type WsOptions = Options;
13
12
  export type TParameters = Record<string, string | number | boolean | null | undefined>;
14
13
  export type TResponse = {
15
14
  json: () => Promise<any>;
@@ -36,10 +35,12 @@ export interface IClient<TRes extends TResponse, Data> {
36
35
  post: (params: TPostParams<Data>) => Promise<TRes>;
37
36
  }
38
37
  export type TBlobResponse<Client extends IClient<TResponse, any>> = Awaited<ReturnType<Awaited<ReturnType<Client['get']>>['blob']>>;
39
- export interface IWebsocket<Event extends {
40
- readonly data: string;
41
- }> {
38
+ export interface IWsClient {
39
+ onMessage: null | ((data: ArrayBuffer | string) => void);
40
+ onOpen: () => void;
41
+ onClose: () => void;
42
+ onError: (error: Error) => void;
43
+ send: (data: ArrayBuffer | string) => void;
44
+ reconnect: () => void;
42
45
  destroy: () => void;
43
- onmessage: null | ((event: Event) => void);
44
- send: (data: string) => void;
45
46
  }
@@ -1,6 +1,6 @@
1
1
  /// <reference types="node" />
2
2
  import EventEmitter from 'events';
3
- import { WsOptions } from '../internal/types';
3
+ import { Options } from '../internal/types';
4
4
  import { TCamScripterEvent, TEventDeclaration, TEventUndeclaration, TCamScripterResponse } from '../types/CamScripterAPICameraEventsGenerator';
5
5
  export declare class CamScripterAPICameraEventsGenerator extends EventEmitter {
6
6
  private tls;
@@ -14,7 +14,7 @@ export declare class CamScripterAPICameraEventsGenerator extends EventEmitter {
14
14
  private timeoutCheckTimer;
15
15
  private wsConnected;
16
16
  private ws;
17
- constructor(options?: WsOptions);
17
+ constructor(options?: Options);
18
18
  connect(): void;
19
19
  disconnect(): void;
20
20
  declareEvent(eventDeclaration: TEventDeclaration): Promise<TCamScripterResponse>;
@@ -0,0 +1 @@
1
+ export {};
@@ -1,5 +1,5 @@
1
1
  import { EventEmitter2 as EventEmitter } from 'eventemitter2';
2
- import { WsOptions } from '../internal/types';
2
+ import { Options } from '../internal/types';
3
3
  export declare class VapixEvents extends EventEmitter {
4
4
  private tls;
5
5
  private tlsInsecure;
@@ -8,7 +8,7 @@ export declare class VapixEvents extends EventEmitter {
8
8
  private user;
9
9
  private pass;
10
10
  private ws;
11
- constructor(options?: WsOptions);
11
+ constructor(options?: Options);
12
12
  connect(): void;
13
13
  disconnect(): void;
14
14
  private createWsClient;
@@ -1,25 +1,11 @@
1
- /// <reference types="node" />
2
- /// <reference types="node" />
3
- /// <reference types="node" />
4
- import EventEmitter from 'events';
5
- import { WsOptions } from '../internal/types';
6
- export type WsClientOptions = WsOptions & {
1
+ import { IWsClient, Options } from '../internal/types';
2
+ export type WsClientOptions = Options & {
7
3
  address: string;
8
4
  headers?: Record<string, string>;
9
5
  pingInterval?: number;
10
6
  protocol?: string;
11
7
  };
12
- export interface WsClient {
13
- on(event: 'open', listener: () => void): this;
14
- on(event: 'close', listener: () => void): this;
15
- on(event: 'message', listener: (data: Buffer) => void): this;
16
- on(event: 'error', listener: (err: Error) => void): this;
17
- emit(event: 'open'): boolean;
18
- emit(event: 'close'): boolean;
19
- emit(event: 'message', data: Buffer): boolean;
20
- emit(event: 'error', err: Error): boolean;
21
- }
22
- export declare class WsClient extends EventEmitter {
8
+ export declare class WsClient implements IWsClient {
23
9
  private user;
24
10
  private pass;
25
11
  private address;
@@ -33,8 +19,12 @@ export declare class WsClient extends EventEmitter {
33
19
  private isClosed;
34
20
  constructor(options: WsClientOptions);
35
21
  open(wwwAuthenticateHeader?: string): void;
36
- send(data: Buffer | string): void;
37
- close(): void;
22
+ onMessage: (_: ArrayBuffer | string) => void;
23
+ onOpen: () => void;
24
+ onClose: () => void;
25
+ onError: (error: Error) => void;
26
+ send(data: ArrayBuffer | string): void;
27
+ destroy(): void;
38
28
  reconnect(): void;
39
29
  private closeWsConnection;
40
30
  }
@@ -527,7 +527,7 @@ export declare const servicesSchema: z.ZodDiscriminatedUnion<"name", [z.ZodObjec
527
527
  camera_height: z.ZodNumber;
528
528
  camera_view_area: z.ZodString;
529
529
  camera_overlay_params: z.ZodUnion<[z.ZodLiteral<"overlays=off">, z.ZodLiteral<"overlays=all">, z.ZodLiteral<"overlays=text">, z.ZodLiteral<"overlays=image">, z.ZodLiteral<"overlays=application">]>;
530
- rotate: z.ZodUnion<[z.ZodLiteral<0>, z.ZodLiteral<90>, z.ZodLiteral<180>, z.ZodLiteral<270>]>;
530
+ rotate: z.ZodDefault<z.ZodUnion<[z.ZodLiteral<0>, z.ZodLiteral<90>, z.ZodLiteral<180>, z.ZodLiteral<270>]>>;
531
531
  dewarping: z.ZodObject<{
532
532
  enabled: z.ZodBoolean;
533
533
  rectangle: z.ZodArray<z.ZodTuple<[z.ZodNumber, z.ZodNumber], null>, "many">;
@@ -608,7 +608,6 @@ export declare const servicesSchema: z.ZodDiscriminatedUnion<"name", [z.ZodObjec
608
608
  camera_height: number;
609
609
  camera_view_area: string;
610
610
  camera_overlay_params: "overlays=off" | "overlays=all" | "overlays=text" | "overlays=image" | "overlays=application";
611
- rotate: 0 | 90 | 180 | 270;
612
611
  dewarping: {
613
612
  enabled: boolean;
614
613
  rectangle: [number, number][];
@@ -620,6 +619,7 @@ export declare const servicesSchema: z.ZodDiscriminatedUnion<"name", [z.ZodObjec
620
619
  schedule?: string | undefined;
621
620
  invertInput?: boolean | undefined;
622
621
  zIndex?: number | undefined;
622
+ rotate?: 0 | 90 | 180 | 270 | undefined;
623
623
  }>, z.ZodObject<{
624
624
  id: z.ZodNumber;
625
625
  enabled: z.ZodUnion<[z.ZodLiteral<0>, z.ZodLiteral<1>]>;
@@ -1997,7 +1997,7 @@ export declare const serviceListSchema: z.ZodObject<{
1997
1997
  camera_height: z.ZodNumber;
1998
1998
  camera_view_area: z.ZodString;
1999
1999
  camera_overlay_params: z.ZodUnion<[z.ZodLiteral<"overlays=off">, z.ZodLiteral<"overlays=all">, z.ZodLiteral<"overlays=text">, z.ZodLiteral<"overlays=image">, z.ZodLiteral<"overlays=application">]>;
2000
- rotate: z.ZodUnion<[z.ZodLiteral<0>, z.ZodLiteral<90>, z.ZodLiteral<180>, z.ZodLiteral<270>]>;
2000
+ rotate: z.ZodDefault<z.ZodUnion<[z.ZodLiteral<0>, z.ZodLiteral<90>, z.ZodLiteral<180>, z.ZodLiteral<270>]>>;
2001
2001
  dewarping: z.ZodObject<{
2002
2002
  enabled: z.ZodBoolean;
2003
2003
  rectangle: z.ZodArray<z.ZodTuple<[z.ZodNumber, z.ZodNumber], null>, "many">;
@@ -2078,7 +2078,6 @@ export declare const serviceListSchema: z.ZodObject<{
2078
2078
  camera_height: number;
2079
2079
  camera_view_area: string;
2080
2080
  camera_overlay_params: "overlays=off" | "overlays=all" | "overlays=text" | "overlays=image" | "overlays=application";
2081
- rotate: 0 | 90 | 180 | 270;
2082
2081
  dewarping: {
2083
2082
  enabled: boolean;
2084
2083
  rectangle: [number, number][];
@@ -2090,6 +2089,7 @@ export declare const serviceListSchema: z.ZodObject<{
2090
2089
  schedule?: string | undefined;
2091
2090
  invertInput?: boolean | undefined;
2092
2091
  zIndex?: number | undefined;
2092
+ rotate?: 0 | 90 | 180 | 270 | undefined;
2093
2093
  }>, z.ZodObject<{
2094
2094
  id: z.ZodNumber;
2095
2095
  enabled: z.ZodUnion<[z.ZodLiteral<0>, z.ZodLiteral<1>]>;
@@ -3533,7 +3533,6 @@ export declare const serviceListSchema: z.ZodObject<{
3533
3533
  camera_height: number;
3534
3534
  camera_view_area: string;
3535
3535
  camera_overlay_params: "overlays=off" | "overlays=all" | "overlays=text" | "overlays=image" | "overlays=application";
3536
- rotate: 0 | 90 | 180 | 270;
3537
3536
  dewarping: {
3538
3537
  enabled: boolean;
3539
3538
  rectangle: [number, number][];
@@ -3545,6 +3544,7 @@ export declare const serviceListSchema: z.ZodObject<{
3545
3544
  schedule?: string | undefined;
3546
3545
  invertInput?: boolean | undefined;
3547
3546
  zIndex?: number | undefined;
3547
+ rotate?: 0 | 90 | 180 | 270 | undefined;
3548
3548
  } | {
3549
3549
  name: "customGraphics";
3550
3550
  enabled: 0 | 1;
@@ -29,7 +29,7 @@ export declare const pipSchema: z.ZodObject<{
29
29
  camera_height: z.ZodNumber;
30
30
  camera_view_area: z.ZodString;
31
31
  camera_overlay_params: z.ZodUnion<[z.ZodLiteral<"overlays=off">, z.ZodLiteral<"overlays=all">, z.ZodLiteral<"overlays=text">, z.ZodLiteral<"overlays=image">, z.ZodLiteral<"overlays=application">]>;
32
- rotate: z.ZodUnion<[z.ZodLiteral<0>, z.ZodLiteral<90>, z.ZodLiteral<180>, z.ZodLiteral<270>]>;
32
+ rotate: z.ZodDefault<z.ZodUnion<[z.ZodLiteral<0>, z.ZodLiteral<90>, z.ZodLiteral<180>, z.ZodLiteral<270>]>>;
33
33
  dewarping: z.ZodObject<{
34
34
  enabled: z.ZodBoolean;
35
35
  rectangle: z.ZodArray<z.ZodTuple<[z.ZodNumber, z.ZodNumber], null>, "many">;
@@ -110,7 +110,6 @@ export declare const pipSchema: z.ZodObject<{
110
110
  camera_height: number;
111
111
  camera_view_area: string;
112
112
  camera_overlay_params: "overlays=off" | "overlays=all" | "overlays=text" | "overlays=image" | "overlays=application";
113
- rotate: 0 | 90 | 180 | 270;
114
113
  dewarping: {
115
114
  enabled: boolean;
116
115
  rectangle: [number, number][];
@@ -122,4 +121,5 @@ export declare const pipSchema: z.ZodObject<{
122
121
  schedule?: string | undefined;
123
122
  invertInput?: boolean | undefined;
124
123
  zIndex?: number | undefined;
124
+ rotate?: 0 | 90 | 180 | 270 | undefined;
125
125
  }>;
@@ -1,5 +1,5 @@
1
- import { WsOptions } from '../internal/types';
2
- export type CamOverlayDrawingOptions = WsOptions & {
1
+ import { Options } from '../internal/types';
2
+ export type CamOverlayDrawingOptions = Options & {
3
3
  camera?: number | number[];
4
4
  zIndex?: number;
5
5
  };
@@ -603,7 +603,7 @@ export declare const cameraSettingsSchema: z.ZodObject<{
603
603
  }>;
604
604
  export type TCameraSettings = z.infer<typeof cameraSettingsSchema>;
605
605
  export declare const serverSettingsSchema: z.ZodObject<{
606
- cameraCalibration: z.ZodObject<{
606
+ cameraCalibration: z.ZodDefault<z.ZodObject<{
607
607
  posLat: z.ZodNumber;
608
608
  posLon: z.ZodNumber;
609
609
  geoidHN: z.ZodNumber;
@@ -636,7 +636,7 @@ export declare const serverSettingsSchema: z.ZodObject<{
636
636
  tiltTransformationCoefA: number;
637
637
  tiltCameraKnownPoint: number;
638
638
  tiltRealKnownPoint: number;
639
- }>;
639
+ }>>;
640
640
  }, "strip", z.ZodTypeAny, {
641
641
  cameraCalibration: {
642
642
  posLat: number;
@@ -651,7 +651,7 @@ export declare const serverSettingsSchema: z.ZodObject<{
651
651
  tiltRealKnownPoint: number;
652
652
  };
653
653
  }, {
654
- cameraCalibration: {
654
+ cameraCalibration?: {
655
655
  posLat: number;
656
656
  posLon: number;
657
657
  geoidHN: number;
@@ -662,10 +662,18 @@ export declare const serverSettingsSchema: z.ZodObject<{
662
662
  tiltTransformationCoefA: number;
663
663
  tiltCameraKnownPoint: number;
664
664
  tiltRealKnownPoint: number;
665
- };
665
+ } | undefined;
666
666
  }>;
667
667
  export type TServerSettings = z.infer<typeof serverSettingsSchema>;
668
668
  export type ICAO = string;
669
+ export declare const getIcaoSchema: z.ZodObject<{
670
+ icao: z.ZodString;
671
+ }, "strip", z.ZodTypeAny, {
672
+ icao: string;
673
+ }, {
674
+ icao: string;
675
+ }>;
676
+ export type TGetIcaoByOption = 'registration' | 'callsign';
669
677
  export declare const trackingModeSchema: z.ZodObject<{
670
678
  mode: z.ZodUnion<[z.ZodLiteral<"MANUAL">, z.ZodLiteral<"AUTOMATIC">]>;
671
679
  }, "strip", z.ZodTypeAny, {