camstreamerlib 4.0.0-beta.27 → 4.0.0-beta.28
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.
- package/cjs/CamOverlayPainter/Frame.d.ts +35 -10
- package/cjs/CamOverlayPainter/Frame.js +0 -33
- package/cjs/CamOverlayPainter/Painter.d.ts +1 -2
- package/cjs/VapixAPI.d.ts +13 -3
- package/cjs/VapixAPI.js +35 -5
- package/cjs/types/VapixAPI.d.ts +157 -0
- package/cjs/types/VapixAPI.js +32 -1
- package/esm/CamOverlayPainter/Frame.d.ts +35 -10
- package/esm/CamOverlayPainter/Frame.js +0 -33
- package/esm/CamOverlayPainter/Painter.d.ts +1 -2
- package/esm/VapixAPI.d.ts +13 -3
- package/esm/VapixAPI.js +36 -6
- package/esm/types/VapixAPI.d.ts +157 -0
- package/esm/types/VapixAPI.js +31 -0
- package/package.json +6 -5
- package/cjs/CamOverlayPainter/types.d.ts +0 -61
- package/cjs/CamOverlayPainter/types.js +0 -2
- package/esm/CamOverlayPainter/types.d.ts +0 -61
- package/esm/CamOverlayPainter/types.js +0 -1
|
@@ -2,7 +2,41 @@
|
|
|
2
2
|
import { EventEmitter } from 'events';
|
|
3
3
|
import { CamOverlayDrawingAPI, TAlign, TCairoCreateResponse, TUploadImageResponse } from '../CamOverlayDrawingAPI';
|
|
4
4
|
import ResourceManager from './ResourceManager';
|
|
5
|
-
|
|
5
|
+
export type TRgb = [number, number, number];
|
|
6
|
+
export type TRgba = [number, number, number, number];
|
|
7
|
+
export type TTmf = 'TFM_OVERFLOW' | 'TFM_SCALE' | 'TFM_TRUNCATE';
|
|
8
|
+
export type TObjectFitType = 'fill' | 'fit' | 'none';
|
|
9
|
+
export type TFrameOptions = {
|
|
10
|
+
enabled?: boolean;
|
|
11
|
+
x: number;
|
|
12
|
+
y: number;
|
|
13
|
+
width: number;
|
|
14
|
+
height: number;
|
|
15
|
+
text?: string;
|
|
16
|
+
fontColor?: TRgb;
|
|
17
|
+
font?: string;
|
|
18
|
+
bgColor?: TRgba;
|
|
19
|
+
bgImage?: string;
|
|
20
|
+
bgType?: TObjectFitType;
|
|
21
|
+
borderRadius?: number;
|
|
22
|
+
borderWidth?: number;
|
|
23
|
+
borderColor?: TRgba;
|
|
24
|
+
customDraw?: TDrawingCallback;
|
|
25
|
+
layer?: number;
|
|
26
|
+
};
|
|
27
|
+
export type TFrameInfo = {
|
|
28
|
+
width: number;
|
|
29
|
+
height: number;
|
|
30
|
+
};
|
|
31
|
+
export type TDrawingCallback = (cod: CamOverlayDrawingAPI, cairo: string, info: TFrameInfo) => Promise<void>;
|
|
32
|
+
export interface Frame {
|
|
33
|
+
on(event: 'open', listener: () => void): this;
|
|
34
|
+
on(event: 'close', listener: () => void): this;
|
|
35
|
+
on(event: 'layoutChanged', listener: () => void): this;
|
|
36
|
+
emit(event: 'open'): boolean;
|
|
37
|
+
emit(event: 'close'): boolean;
|
|
38
|
+
emit(event: 'layoutChanged'): boolean;
|
|
39
|
+
}
|
|
6
40
|
export declare class Frame extends EventEmitter {
|
|
7
41
|
protected enabled: boolean;
|
|
8
42
|
protected posX: number;
|
|
@@ -30,26 +64,17 @@ export declare class Frame extends EventEmitter {
|
|
|
30
64
|
disable(): void;
|
|
31
65
|
setFramePosition(x: number, y: number): void;
|
|
32
66
|
setFrameSize(width: number, height: number): void;
|
|
33
|
-
getFrameInfo(): {
|
|
34
|
-
x: number;
|
|
35
|
-
y: number;
|
|
36
|
-
width: number;
|
|
37
|
-
height: number;
|
|
38
|
-
};
|
|
39
67
|
setText(text: string, align: TAlign, textType?: TTmf, fontColor?: TRgb): void;
|
|
40
68
|
setFontColor(fontColor: TRgb): void;
|
|
41
69
|
setFont(fontName: string): void;
|
|
42
70
|
setFontData(fontData: TCairoCreateResponse): void;
|
|
43
|
-
getTextInfo(): TTextInfo;
|
|
44
71
|
setBgColor(color: TRgba): void;
|
|
45
72
|
setBgImage(imageName: string, type?: TObjectFitType): void;
|
|
46
73
|
setBgImageData(imageData: TUploadImageResponse, type?: TObjectFitType): void;
|
|
47
74
|
setBgType(type: TObjectFitType): void;
|
|
48
|
-
getBgInfo(): TBgInfo;
|
|
49
75
|
setBorderRadius(radius: number): void;
|
|
50
76
|
setBorderWidth(width: number): void;
|
|
51
77
|
setBorderColor(color: TRgba): void;
|
|
52
|
-
getBorderInfo(): TBorderInfo;
|
|
53
78
|
setCustomDraw(customDraw: TDrawingCallback): void;
|
|
54
79
|
resetFont(): void;
|
|
55
80
|
resetBgColor(): void;
|
|
@@ -57,14 +57,6 @@ class Frame extends events_1.EventEmitter {
|
|
|
57
57
|
this.width = width;
|
|
58
58
|
this.height = height;
|
|
59
59
|
}
|
|
60
|
-
getFrameInfo() {
|
|
61
|
-
return {
|
|
62
|
-
x: this.posX,
|
|
63
|
-
y: this.posY,
|
|
64
|
-
width: this.width,
|
|
65
|
-
height: this.height,
|
|
66
|
-
};
|
|
67
|
-
}
|
|
68
60
|
setText(text, align, textType = 'TFM_OVERFLOW', fontColor) {
|
|
69
61
|
this.text = text;
|
|
70
62
|
this.align = align;
|
|
@@ -84,16 +76,6 @@ class Frame extends events_1.EventEmitter {
|
|
|
84
76
|
this.fontName = undefined;
|
|
85
77
|
this.font = fontData;
|
|
86
78
|
}
|
|
87
|
-
getTextInfo() {
|
|
88
|
-
return {
|
|
89
|
-
text: this.text,
|
|
90
|
-
textType: this.textType,
|
|
91
|
-
font: this.font,
|
|
92
|
-
fontName: this.fontName,
|
|
93
|
-
fontColor: this.fontColor,
|
|
94
|
-
align: this.align,
|
|
95
|
-
};
|
|
96
|
-
}
|
|
97
79
|
setBgColor(color) {
|
|
98
80
|
this.bgColor = color;
|
|
99
81
|
}
|
|
@@ -110,14 +92,6 @@ class Frame extends events_1.EventEmitter {
|
|
|
110
92
|
setBgType(type) {
|
|
111
93
|
this.bgType = type;
|
|
112
94
|
}
|
|
113
|
-
getBgInfo() {
|
|
114
|
-
return {
|
|
115
|
-
color: this.bgColor,
|
|
116
|
-
imageName: this.bgImageName,
|
|
117
|
-
image: this.bgImage,
|
|
118
|
-
type: this.bgType,
|
|
119
|
-
};
|
|
120
|
-
}
|
|
121
95
|
setBorderRadius(radius) {
|
|
122
96
|
this.borderRadius = radius;
|
|
123
97
|
}
|
|
@@ -127,13 +101,6 @@ class Frame extends events_1.EventEmitter {
|
|
|
127
101
|
setBorderColor(color) {
|
|
128
102
|
this.borderColor = color;
|
|
129
103
|
}
|
|
130
|
-
getBorderInfo() {
|
|
131
|
-
return {
|
|
132
|
-
color: this.borderColor,
|
|
133
|
-
width: this.borderWidth,
|
|
134
|
-
radius: this.borderRadius,
|
|
135
|
-
};
|
|
136
|
-
}
|
|
137
104
|
setCustomDraw(customDraw) {
|
|
138
105
|
this.customDraw = customDraw;
|
|
139
106
|
}
|
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
import { CamOverlayDrawingAPI, CamOverlayDrawingOptions } from '../CamOverlayDrawingAPI';
|
|
2
2
|
import ResourceManager from './ResourceManager';
|
|
3
|
-
import { Frame } from './Frame';
|
|
4
|
-
import { TFrameOptions } from './types';
|
|
3
|
+
import { Frame, TFrameOptions } from './Frame';
|
|
5
4
|
export declare const COORD: {
|
|
6
5
|
readonly top_left: readonly [-1, -1];
|
|
7
6
|
readonly center_left: readonly [-1, 0];
|
package/cjs/VapixAPI.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { IClient, TParameters, TResponse } from './internal/types';
|
|
2
|
-
import { TAudioSampleRates, TSDCardInfo, TPtzOverview, TCameraPTZItem, TCameraPTZItemData, TAudioDevice } from './types/VapixAPI';
|
|
2
|
+
import { TAudioSampleRates, TSDCardInfo, TPtzOverview, TCameraPTZItem, TCameraPTZItemData, TAudioDevice, TPortSetSchema, TPortSequenceStateSchema } from './types/VapixAPI';
|
|
3
3
|
import { ProxyClient } from './internal/ProxyClient';
|
|
4
4
|
import { TCameraImageConfig, TProxyParam } from './types/common';
|
|
5
5
|
export declare class VapixAPI<Client extends IClient<TResponse> = IClient<TResponse>> {
|
|
@@ -56,8 +56,18 @@ export declare class VapixAPI<Client extends IClient<TResponse> = IClient<TRespo
|
|
|
56
56
|
listPtzVideoSourceOverview(proxy?: TProxyParam): Promise<TPtzOverview>;
|
|
57
57
|
goToPreset(channel: number, presetName: string, proxy?: TProxyParam): Promise<TResponse>;
|
|
58
58
|
getPtzPosition(camera: number, proxy?: TProxyParam): Promise<TCameraPTZItemData>;
|
|
59
|
-
|
|
60
|
-
|
|
59
|
+
getPorts(proxy?: TProxyParam): Promise<{
|
|
60
|
+
name: string;
|
|
61
|
+
port: string;
|
|
62
|
+
state: "open" | "closed";
|
|
63
|
+
configurable: boolean;
|
|
64
|
+
usage: string;
|
|
65
|
+
direction: "input" | "output";
|
|
66
|
+
normalState: "open" | "closed";
|
|
67
|
+
readonly?: boolean | undefined;
|
|
68
|
+
}[]>;
|
|
69
|
+
setPorts(ports: TPortSetSchema[], proxy?: TProxyParam): Promise<void>;
|
|
70
|
+
setPortStateSequence(port: number, sequence: TPortSequenceStateSchema[], proxy?: TProxyParam): Promise<void>;
|
|
61
71
|
getApplicationList(proxy?: TProxyParam): Promise<any>;
|
|
62
72
|
startApplication(applicationID: string, proxy?: TProxyParam): Promise<void>;
|
|
63
73
|
restartApplication(applicationID: string, proxy?: TProxyParam): Promise<void>;
|
package/cjs/VapixAPI.js
CHANGED
|
@@ -354,12 +354,42 @@ class VapixAPI {
|
|
|
354
354
|
zoom: Number(params.zoom),
|
|
355
355
|
};
|
|
356
356
|
}
|
|
357
|
-
async
|
|
358
|
-
const
|
|
359
|
-
|
|
357
|
+
async getPorts(proxy = null) {
|
|
358
|
+
const body = JSON.stringify({
|
|
359
|
+
apiVersion: '1.0',
|
|
360
|
+
context: '',
|
|
361
|
+
method: 'getPorts',
|
|
362
|
+
});
|
|
363
|
+
const res = await this.client.post(proxy, '/axis-cgi/io/portmanagement.cgi', body, {}, { 'Content-Type': 'application/json' });
|
|
364
|
+
if (!res.ok) {
|
|
365
|
+
throw new Error(await (0, utils_1.responseStringify)(res));
|
|
366
|
+
}
|
|
367
|
+
const portResponseParsed = await VapixAPI_1.getPortsResponseSchema.parse(res.json());
|
|
368
|
+
return portResponseParsed.data.items;
|
|
360
369
|
}
|
|
361
|
-
async
|
|
362
|
-
|
|
370
|
+
async setPorts(ports, proxy = null) {
|
|
371
|
+
const body = JSON.stringify({
|
|
372
|
+
apiVersion: '1.0',
|
|
373
|
+
context: '',
|
|
374
|
+
method: 'setPorts',
|
|
375
|
+
params: { ports },
|
|
376
|
+
});
|
|
377
|
+
const res = await this.client.post(proxy, '/axis-cgi/io/portmanagement.cgi', body, {}, { 'Content-Type': 'application/json' });
|
|
378
|
+
if (!res.ok) {
|
|
379
|
+
throw new Error(await (0, utils_1.responseStringify)(res));
|
|
380
|
+
}
|
|
381
|
+
}
|
|
382
|
+
async setPortStateSequence(port, sequence, proxy = null) {
|
|
383
|
+
const body = JSON.stringify({
|
|
384
|
+
apiVersion: '1.0',
|
|
385
|
+
context: '',
|
|
386
|
+
method: 'setStateSequence',
|
|
387
|
+
params: { port, sequence },
|
|
388
|
+
});
|
|
389
|
+
const res = await this.client.post(proxy, '/axis-cgi/io/portmanagement.cgi', body, {}, { 'Content-Type': 'application/json' });
|
|
390
|
+
if (!res.ok) {
|
|
391
|
+
throw new Error(await (0, utils_1.responseStringify)(res));
|
|
392
|
+
}
|
|
363
393
|
}
|
|
364
394
|
async getApplicationList(proxy = null) {
|
|
365
395
|
const res = await this.client.get(proxy, '/axis-cgi/applications/list.cgi');
|
package/cjs/types/VapixAPI.d.ts
CHANGED
|
@@ -1661,4 +1661,161 @@ export declare const audioSampleRatesResponseSchema: z.ZodObject<{
|
|
|
1661
1661
|
};
|
|
1662
1662
|
};
|
|
1663
1663
|
}>;
|
|
1664
|
+
export declare const portStatusSchema: z.ZodObject<{
|
|
1665
|
+
port: z.ZodString;
|
|
1666
|
+
state: z.ZodEnum<["open", "closed"]>;
|
|
1667
|
+
configurable: z.ZodBoolean;
|
|
1668
|
+
readonly: z.ZodOptional<z.ZodBoolean>;
|
|
1669
|
+
usage: z.ZodString;
|
|
1670
|
+
direction: z.ZodEnum<["input", "output"]>;
|
|
1671
|
+
name: z.ZodString;
|
|
1672
|
+
normalState: z.ZodEnum<["open", "closed"]>;
|
|
1673
|
+
}, "strip", z.ZodTypeAny, {
|
|
1674
|
+
name: string;
|
|
1675
|
+
port: string;
|
|
1676
|
+
state: "open" | "closed";
|
|
1677
|
+
configurable: boolean;
|
|
1678
|
+
usage: string;
|
|
1679
|
+
direction: "input" | "output";
|
|
1680
|
+
normalState: "open" | "closed";
|
|
1681
|
+
readonly?: boolean | undefined;
|
|
1682
|
+
}, {
|
|
1683
|
+
name: string;
|
|
1684
|
+
port: string;
|
|
1685
|
+
state: "open" | "closed";
|
|
1686
|
+
configurable: boolean;
|
|
1687
|
+
usage: string;
|
|
1688
|
+
direction: "input" | "output";
|
|
1689
|
+
normalState: "open" | "closed";
|
|
1690
|
+
readonly?: boolean | undefined;
|
|
1691
|
+
}>;
|
|
1692
|
+
export type TPortStatusSchema = z.infer<typeof portStatusSchema>;
|
|
1693
|
+
export declare const getPortsResponseSchema: z.ZodObject<{
|
|
1694
|
+
apiVersion: z.ZodString;
|
|
1695
|
+
context: z.ZodString;
|
|
1696
|
+
method: z.ZodLiteral<"getPorts">;
|
|
1697
|
+
data: z.ZodObject<{
|
|
1698
|
+
numberOfPorts: z.ZodNumber;
|
|
1699
|
+
items: z.ZodArray<z.ZodObject<{
|
|
1700
|
+
port: z.ZodString;
|
|
1701
|
+
state: z.ZodEnum<["open", "closed"]>;
|
|
1702
|
+
configurable: z.ZodBoolean;
|
|
1703
|
+
readonly: z.ZodOptional<z.ZodBoolean>;
|
|
1704
|
+
usage: z.ZodString;
|
|
1705
|
+
direction: z.ZodEnum<["input", "output"]>;
|
|
1706
|
+
name: z.ZodString;
|
|
1707
|
+
normalState: z.ZodEnum<["open", "closed"]>;
|
|
1708
|
+
}, "strip", z.ZodTypeAny, {
|
|
1709
|
+
name: string;
|
|
1710
|
+
port: string;
|
|
1711
|
+
state: "open" | "closed";
|
|
1712
|
+
configurable: boolean;
|
|
1713
|
+
usage: string;
|
|
1714
|
+
direction: "input" | "output";
|
|
1715
|
+
normalState: "open" | "closed";
|
|
1716
|
+
readonly?: boolean | undefined;
|
|
1717
|
+
}, {
|
|
1718
|
+
name: string;
|
|
1719
|
+
port: string;
|
|
1720
|
+
state: "open" | "closed";
|
|
1721
|
+
configurable: boolean;
|
|
1722
|
+
usage: string;
|
|
1723
|
+
direction: "input" | "output";
|
|
1724
|
+
normalState: "open" | "closed";
|
|
1725
|
+
readonly?: boolean | undefined;
|
|
1726
|
+
}>, "many">;
|
|
1727
|
+
}, "strip", z.ZodTypeAny, {
|
|
1728
|
+
numberOfPorts: number;
|
|
1729
|
+
items: {
|
|
1730
|
+
name: string;
|
|
1731
|
+
port: string;
|
|
1732
|
+
state: "open" | "closed";
|
|
1733
|
+
configurable: boolean;
|
|
1734
|
+
usage: string;
|
|
1735
|
+
direction: "input" | "output";
|
|
1736
|
+
normalState: "open" | "closed";
|
|
1737
|
+
readonly?: boolean | undefined;
|
|
1738
|
+
}[];
|
|
1739
|
+
}, {
|
|
1740
|
+
numberOfPorts: number;
|
|
1741
|
+
items: {
|
|
1742
|
+
name: string;
|
|
1743
|
+
port: string;
|
|
1744
|
+
state: "open" | "closed";
|
|
1745
|
+
configurable: boolean;
|
|
1746
|
+
usage: string;
|
|
1747
|
+
direction: "input" | "output";
|
|
1748
|
+
normalState: "open" | "closed";
|
|
1749
|
+
readonly?: boolean | undefined;
|
|
1750
|
+
}[];
|
|
1751
|
+
}>;
|
|
1752
|
+
}, "strip", z.ZodTypeAny, {
|
|
1753
|
+
data: {
|
|
1754
|
+
numberOfPorts: number;
|
|
1755
|
+
items: {
|
|
1756
|
+
name: string;
|
|
1757
|
+
port: string;
|
|
1758
|
+
state: "open" | "closed";
|
|
1759
|
+
configurable: boolean;
|
|
1760
|
+
usage: string;
|
|
1761
|
+
direction: "input" | "output";
|
|
1762
|
+
normalState: "open" | "closed";
|
|
1763
|
+
readonly?: boolean | undefined;
|
|
1764
|
+
}[];
|
|
1765
|
+
};
|
|
1766
|
+
apiVersion: string;
|
|
1767
|
+
context: string;
|
|
1768
|
+
method: "getPorts";
|
|
1769
|
+
}, {
|
|
1770
|
+
data: {
|
|
1771
|
+
numberOfPorts: number;
|
|
1772
|
+
items: {
|
|
1773
|
+
name: string;
|
|
1774
|
+
port: string;
|
|
1775
|
+
state: "open" | "closed";
|
|
1776
|
+
configurable: boolean;
|
|
1777
|
+
usage: string;
|
|
1778
|
+
direction: "input" | "output";
|
|
1779
|
+
normalState: "open" | "closed";
|
|
1780
|
+
readonly?: boolean | undefined;
|
|
1781
|
+
}[];
|
|
1782
|
+
};
|
|
1783
|
+
apiVersion: string;
|
|
1784
|
+
context: string;
|
|
1785
|
+
method: "getPorts";
|
|
1786
|
+
}>;
|
|
1787
|
+
export declare const portSetSchema: z.ZodObject<{
|
|
1788
|
+
port: z.ZodString;
|
|
1789
|
+
state: z.ZodEnum<["open", "closed"]>;
|
|
1790
|
+
usage: z.ZodOptional<z.ZodString>;
|
|
1791
|
+
direction: z.ZodOptional<z.ZodEnum<["input", "output"]>>;
|
|
1792
|
+
name: z.ZodOptional<z.ZodString>;
|
|
1793
|
+
normalState: z.ZodOptional<z.ZodEnum<["open", "closed"]>>;
|
|
1794
|
+
}, "strip", z.ZodTypeAny, {
|
|
1795
|
+
port: string;
|
|
1796
|
+
state: "open" | "closed";
|
|
1797
|
+
name?: string | undefined;
|
|
1798
|
+
usage?: string | undefined;
|
|
1799
|
+
direction?: "input" | "output" | undefined;
|
|
1800
|
+
normalState?: "open" | "closed" | undefined;
|
|
1801
|
+
}, {
|
|
1802
|
+
port: string;
|
|
1803
|
+
state: "open" | "closed";
|
|
1804
|
+
name?: string | undefined;
|
|
1805
|
+
usage?: string | undefined;
|
|
1806
|
+
direction?: "input" | "output" | undefined;
|
|
1807
|
+
normalState?: "open" | "closed" | undefined;
|
|
1808
|
+
}>;
|
|
1809
|
+
export type TPortSetSchema = z.infer<typeof portSetSchema>;
|
|
1810
|
+
export declare const portSequenceStateSchema: z.ZodObject<{
|
|
1811
|
+
state: z.ZodEnum<["open", "closed"]>;
|
|
1812
|
+
time: z.ZodNumber;
|
|
1813
|
+
}, "strip", z.ZodTypeAny, {
|
|
1814
|
+
time: number;
|
|
1815
|
+
state: "open" | "closed";
|
|
1816
|
+
}, {
|
|
1817
|
+
time: number;
|
|
1818
|
+
state: "open" | "closed";
|
|
1819
|
+
}>;
|
|
1820
|
+
export type TPortSequenceStateSchema = z.infer<typeof portSequenceStateSchema>;
|
|
1664
1821
|
export {};
|
package/cjs/types/VapixAPI.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.audioSampleRatesResponseSchema = exports.timeZoneSchema = exports.dateTimeinfoSchema = exports.maxFpsResponseSchema = exports.audioDeviceRequestSchema = exports.audioDeviceSchema = exports.audioDeviceInputOutputSchema = exports.audioDeviceConnectionTypeSchema = exports.audioDeviceSignalingTypeSchema = exports.audioDeviceSignalingChannelTypeSchema = exports.cameraPTZItemSchema = exports.cameraPTZItemDataSchema = exports.PtzOverviewSchema = exports.sdCardWatchedStatuses = exports.guardTourSchema = exports.APP_IDS = exports.applicationSchema = void 0;
|
|
3
|
+
exports.portSequenceStateSchema = exports.portSetSchema = exports.getPortsResponseSchema = exports.portStatusSchema = exports.audioSampleRatesResponseSchema = exports.timeZoneSchema = exports.dateTimeinfoSchema = exports.maxFpsResponseSchema = exports.audioDeviceRequestSchema = exports.audioDeviceSchema = exports.audioDeviceInputOutputSchema = exports.audioDeviceConnectionTypeSchema = exports.audioDeviceSignalingTypeSchema = exports.audioDeviceSignalingChannelTypeSchema = exports.cameraPTZItemSchema = exports.cameraPTZItemDataSchema = exports.PtzOverviewSchema = exports.sdCardWatchedStatuses = exports.guardTourSchema = exports.APP_IDS = exports.applicationSchema = void 0;
|
|
4
4
|
const zod_1 = require("zod");
|
|
5
5
|
const transformers_1 = require("../internal/transformers");
|
|
6
6
|
exports.applicationSchema = zod_1.z.object({
|
|
@@ -137,3 +137,34 @@ exports.audioSampleRatesResponseSchema = zod_1.z.object({
|
|
|
137
137
|
.partial(),
|
|
138
138
|
}),
|
|
139
139
|
});
|
|
140
|
+
exports.portStatusSchema = zod_1.z.object({
|
|
141
|
+
port: zod_1.z.string(),
|
|
142
|
+
state: zod_1.z.enum(['open', 'closed']),
|
|
143
|
+
configurable: zod_1.z.boolean(),
|
|
144
|
+
readonly: zod_1.z.boolean().optional(),
|
|
145
|
+
usage: zod_1.z.string(),
|
|
146
|
+
direction: zod_1.z.enum(['input', 'output']),
|
|
147
|
+
name: zod_1.z.string(),
|
|
148
|
+
normalState: zod_1.z.enum(['open', 'closed']),
|
|
149
|
+
});
|
|
150
|
+
exports.getPortsResponseSchema = zod_1.z.object({
|
|
151
|
+
apiVersion: zod_1.z.string(),
|
|
152
|
+
context: zod_1.z.string(),
|
|
153
|
+
method: zod_1.z.literal('getPorts'),
|
|
154
|
+
data: zod_1.z.object({
|
|
155
|
+
numberOfPorts: zod_1.z.number(),
|
|
156
|
+
items: zod_1.z.array(exports.portStatusSchema),
|
|
157
|
+
}),
|
|
158
|
+
});
|
|
159
|
+
exports.portSetSchema = zod_1.z.object({
|
|
160
|
+
port: zod_1.z.string(),
|
|
161
|
+
state: zod_1.z.enum(['open', 'closed']),
|
|
162
|
+
usage: zod_1.z.string().optional(),
|
|
163
|
+
direction: zod_1.z.enum(['input', 'output']).optional(),
|
|
164
|
+
name: zod_1.z.string().optional(),
|
|
165
|
+
normalState: zod_1.z.enum(['open', 'closed']).optional(),
|
|
166
|
+
});
|
|
167
|
+
exports.portSequenceStateSchema = zod_1.z.object({
|
|
168
|
+
state: zod_1.z.enum(['open', 'closed']),
|
|
169
|
+
time: zod_1.z.number().min(0).max(65535),
|
|
170
|
+
});
|
|
@@ -2,7 +2,41 @@
|
|
|
2
2
|
import { EventEmitter } from 'events';
|
|
3
3
|
import { CamOverlayDrawingAPI, TAlign, TCairoCreateResponse, TUploadImageResponse } from '../CamOverlayDrawingAPI';
|
|
4
4
|
import ResourceManager from './ResourceManager';
|
|
5
|
-
|
|
5
|
+
export type TRgb = [number, number, number];
|
|
6
|
+
export type TRgba = [number, number, number, number];
|
|
7
|
+
export type TTmf = 'TFM_OVERFLOW' | 'TFM_SCALE' | 'TFM_TRUNCATE';
|
|
8
|
+
export type TObjectFitType = 'fill' | 'fit' | 'none';
|
|
9
|
+
export type TFrameOptions = {
|
|
10
|
+
enabled?: boolean;
|
|
11
|
+
x: number;
|
|
12
|
+
y: number;
|
|
13
|
+
width: number;
|
|
14
|
+
height: number;
|
|
15
|
+
text?: string;
|
|
16
|
+
fontColor?: TRgb;
|
|
17
|
+
font?: string;
|
|
18
|
+
bgColor?: TRgba;
|
|
19
|
+
bgImage?: string;
|
|
20
|
+
bgType?: TObjectFitType;
|
|
21
|
+
borderRadius?: number;
|
|
22
|
+
borderWidth?: number;
|
|
23
|
+
borderColor?: TRgba;
|
|
24
|
+
customDraw?: TDrawingCallback;
|
|
25
|
+
layer?: number;
|
|
26
|
+
};
|
|
27
|
+
export type TFrameInfo = {
|
|
28
|
+
width: number;
|
|
29
|
+
height: number;
|
|
30
|
+
};
|
|
31
|
+
export type TDrawingCallback = (cod: CamOverlayDrawingAPI, cairo: string, info: TFrameInfo) => Promise<void>;
|
|
32
|
+
export interface Frame {
|
|
33
|
+
on(event: 'open', listener: () => void): this;
|
|
34
|
+
on(event: 'close', listener: () => void): this;
|
|
35
|
+
on(event: 'layoutChanged', listener: () => void): this;
|
|
36
|
+
emit(event: 'open'): boolean;
|
|
37
|
+
emit(event: 'close'): boolean;
|
|
38
|
+
emit(event: 'layoutChanged'): boolean;
|
|
39
|
+
}
|
|
6
40
|
export declare class Frame extends EventEmitter {
|
|
7
41
|
protected enabled: boolean;
|
|
8
42
|
protected posX: number;
|
|
@@ -30,26 +64,17 @@ export declare class Frame extends EventEmitter {
|
|
|
30
64
|
disable(): void;
|
|
31
65
|
setFramePosition(x: number, y: number): void;
|
|
32
66
|
setFrameSize(width: number, height: number): void;
|
|
33
|
-
getFrameInfo(): {
|
|
34
|
-
x: number;
|
|
35
|
-
y: number;
|
|
36
|
-
width: number;
|
|
37
|
-
height: number;
|
|
38
|
-
};
|
|
39
67
|
setText(text: string, align: TAlign, textType?: TTmf, fontColor?: TRgb): void;
|
|
40
68
|
setFontColor(fontColor: TRgb): void;
|
|
41
69
|
setFont(fontName: string): void;
|
|
42
70
|
setFontData(fontData: TCairoCreateResponse): void;
|
|
43
|
-
getTextInfo(): TTextInfo;
|
|
44
71
|
setBgColor(color: TRgba): void;
|
|
45
72
|
setBgImage(imageName: string, type?: TObjectFitType): void;
|
|
46
73
|
setBgImageData(imageData: TUploadImageResponse, type?: TObjectFitType): void;
|
|
47
74
|
setBgType(type: TObjectFitType): void;
|
|
48
|
-
getBgInfo(): TBgInfo;
|
|
49
75
|
setBorderRadius(radius: number): void;
|
|
50
76
|
setBorderWidth(width: number): void;
|
|
51
77
|
setBorderColor(color: TRgba): void;
|
|
52
|
-
getBorderInfo(): TBorderInfo;
|
|
53
78
|
setCustomDraw(customDraw: TDrawingCallback): void;
|
|
54
79
|
resetFont(): void;
|
|
55
80
|
resetBgColor(): void;
|
|
@@ -54,14 +54,6 @@ export class Frame extends EventEmitter {
|
|
|
54
54
|
this.width = width;
|
|
55
55
|
this.height = height;
|
|
56
56
|
}
|
|
57
|
-
getFrameInfo() {
|
|
58
|
-
return {
|
|
59
|
-
x: this.posX,
|
|
60
|
-
y: this.posY,
|
|
61
|
-
width: this.width,
|
|
62
|
-
height: this.height,
|
|
63
|
-
};
|
|
64
|
-
}
|
|
65
57
|
setText(text, align, textType = 'TFM_OVERFLOW', fontColor) {
|
|
66
58
|
this.text = text;
|
|
67
59
|
this.align = align;
|
|
@@ -81,16 +73,6 @@ export class Frame extends EventEmitter {
|
|
|
81
73
|
this.fontName = undefined;
|
|
82
74
|
this.font = fontData;
|
|
83
75
|
}
|
|
84
|
-
getTextInfo() {
|
|
85
|
-
return {
|
|
86
|
-
text: this.text,
|
|
87
|
-
textType: this.textType,
|
|
88
|
-
font: this.font,
|
|
89
|
-
fontName: this.fontName,
|
|
90
|
-
fontColor: this.fontColor,
|
|
91
|
-
align: this.align,
|
|
92
|
-
};
|
|
93
|
-
}
|
|
94
76
|
setBgColor(color) {
|
|
95
77
|
this.bgColor = color;
|
|
96
78
|
}
|
|
@@ -107,14 +89,6 @@ export class Frame extends EventEmitter {
|
|
|
107
89
|
setBgType(type) {
|
|
108
90
|
this.bgType = type;
|
|
109
91
|
}
|
|
110
|
-
getBgInfo() {
|
|
111
|
-
return {
|
|
112
|
-
color: this.bgColor,
|
|
113
|
-
imageName: this.bgImageName,
|
|
114
|
-
image: this.bgImage,
|
|
115
|
-
type: this.bgType,
|
|
116
|
-
};
|
|
117
|
-
}
|
|
118
92
|
setBorderRadius(radius) {
|
|
119
93
|
this.borderRadius = radius;
|
|
120
94
|
}
|
|
@@ -124,13 +98,6 @@ export class Frame extends EventEmitter {
|
|
|
124
98
|
setBorderColor(color) {
|
|
125
99
|
this.borderColor = color;
|
|
126
100
|
}
|
|
127
|
-
getBorderInfo() {
|
|
128
|
-
return {
|
|
129
|
-
color: this.borderColor,
|
|
130
|
-
width: this.borderWidth,
|
|
131
|
-
radius: this.borderRadius,
|
|
132
|
-
};
|
|
133
|
-
}
|
|
134
101
|
setCustomDraw(customDraw) {
|
|
135
102
|
this.customDraw = customDraw;
|
|
136
103
|
}
|
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
import { CamOverlayDrawingAPI, CamOverlayDrawingOptions } from '../CamOverlayDrawingAPI';
|
|
2
2
|
import ResourceManager from './ResourceManager';
|
|
3
|
-
import { Frame } from './Frame';
|
|
4
|
-
import { TFrameOptions } from './types';
|
|
3
|
+
import { Frame, TFrameOptions } from './Frame';
|
|
5
4
|
export declare const COORD: {
|
|
6
5
|
readonly top_left: readonly [-1, -1];
|
|
7
6
|
readonly center_left: readonly [-1, 0];
|
package/esm/VapixAPI.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { IClient, TParameters, TResponse } from './internal/types';
|
|
2
|
-
import { TAudioSampleRates, TSDCardInfo, TPtzOverview, TCameraPTZItem, TCameraPTZItemData, TAudioDevice } from './types/VapixAPI';
|
|
2
|
+
import { TAudioSampleRates, TSDCardInfo, TPtzOverview, TCameraPTZItem, TCameraPTZItemData, TAudioDevice, TPortSetSchema, TPortSequenceStateSchema } from './types/VapixAPI';
|
|
3
3
|
import { ProxyClient } from './internal/ProxyClient';
|
|
4
4
|
import { TCameraImageConfig, TProxyParam } from './types/common';
|
|
5
5
|
export declare class VapixAPI<Client extends IClient<TResponse> = IClient<TResponse>> {
|
|
@@ -56,8 +56,18 @@ export declare class VapixAPI<Client extends IClient<TResponse> = IClient<TRespo
|
|
|
56
56
|
listPtzVideoSourceOverview(proxy?: TProxyParam): Promise<TPtzOverview>;
|
|
57
57
|
goToPreset(channel: number, presetName: string, proxy?: TProxyParam): Promise<TResponse>;
|
|
58
58
|
getPtzPosition(camera: number, proxy?: TProxyParam): Promise<TCameraPTZItemData>;
|
|
59
|
-
|
|
60
|
-
|
|
59
|
+
getPorts(proxy?: TProxyParam): Promise<{
|
|
60
|
+
name: string;
|
|
61
|
+
port: string;
|
|
62
|
+
state: "open" | "closed";
|
|
63
|
+
configurable: boolean;
|
|
64
|
+
usage: string;
|
|
65
|
+
direction: "input" | "output";
|
|
66
|
+
normalState: "open" | "closed";
|
|
67
|
+
readonly?: boolean | undefined;
|
|
68
|
+
}[]>;
|
|
69
|
+
setPorts(ports: TPortSetSchema[], proxy?: TProxyParam): Promise<void>;
|
|
70
|
+
setPortStateSequence(port: number, sequence: TPortSequenceStateSchema[], proxy?: TProxyParam): Promise<void>;
|
|
61
71
|
getApplicationList(proxy?: TProxyParam): Promise<any>;
|
|
62
72
|
startApplication(applicationID: string, proxy?: TProxyParam): Promise<void>;
|
|
63
73
|
restartApplication(applicationID: string, proxy?: TProxyParam): Promise<void>;
|
package/esm/VapixAPI.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import * as prettifyXml from 'prettify-xml';
|
|
2
2
|
import { arrayToUrl, isNullish, paramToUrl, responseStringify } from './internal/utils';
|
|
3
|
-
import { sdCardWatchedStatuses, APP_IDS, maxFpsResponseSchema, dateTimeinfoSchema, audioDeviceRequestSchema, audioSampleRatesResponseSchema, timeZoneSchema, } from './types/VapixAPI';
|
|
3
|
+
import { sdCardWatchedStatuses, APP_IDS, maxFpsResponseSchema, dateTimeinfoSchema, audioDeviceRequestSchema, audioSampleRatesResponseSchema, timeZoneSchema, getPortsResponseSchema, } from './types/VapixAPI';
|
|
4
4
|
import { ApplicationAPIError, MaxFPSError, NoDeviceInfoError, PtzNotSupportedError, SDCardActionError, SDCardJobError, } from './errors/errors';
|
|
5
5
|
import { ProxyClient } from './internal/ProxyClient';
|
|
6
6
|
import { z } from 'zod';
|
|
@@ -351,12 +351,42 @@ export class VapixAPI {
|
|
|
351
351
|
zoom: Number(params.zoom),
|
|
352
352
|
};
|
|
353
353
|
}
|
|
354
|
-
async
|
|
355
|
-
const
|
|
356
|
-
|
|
354
|
+
async getPorts(proxy = null) {
|
|
355
|
+
const body = JSON.stringify({
|
|
356
|
+
apiVersion: '1.0',
|
|
357
|
+
context: '',
|
|
358
|
+
method: 'getPorts',
|
|
359
|
+
});
|
|
360
|
+
const res = await this.client.post(proxy, '/axis-cgi/io/portmanagement.cgi', body, {}, { 'Content-Type': 'application/json' });
|
|
361
|
+
if (!res.ok) {
|
|
362
|
+
throw new Error(await responseStringify(res));
|
|
363
|
+
}
|
|
364
|
+
const portResponseParsed = await getPortsResponseSchema.parse(res.json());
|
|
365
|
+
return portResponseParsed.data.items;
|
|
357
366
|
}
|
|
358
|
-
async
|
|
359
|
-
|
|
367
|
+
async setPorts(ports, proxy = null) {
|
|
368
|
+
const body = JSON.stringify({
|
|
369
|
+
apiVersion: '1.0',
|
|
370
|
+
context: '',
|
|
371
|
+
method: 'setPorts',
|
|
372
|
+
params: { ports },
|
|
373
|
+
});
|
|
374
|
+
const res = await this.client.post(proxy, '/axis-cgi/io/portmanagement.cgi', body, {}, { 'Content-Type': 'application/json' });
|
|
375
|
+
if (!res.ok) {
|
|
376
|
+
throw new Error(await responseStringify(res));
|
|
377
|
+
}
|
|
378
|
+
}
|
|
379
|
+
async setPortStateSequence(port, sequence, proxy = null) {
|
|
380
|
+
const body = JSON.stringify({
|
|
381
|
+
apiVersion: '1.0',
|
|
382
|
+
context: '',
|
|
383
|
+
method: 'setStateSequence',
|
|
384
|
+
params: { port, sequence },
|
|
385
|
+
});
|
|
386
|
+
const res = await this.client.post(proxy, '/axis-cgi/io/portmanagement.cgi', body, {}, { 'Content-Type': 'application/json' });
|
|
387
|
+
if (!res.ok) {
|
|
388
|
+
throw new Error(await responseStringify(res));
|
|
389
|
+
}
|
|
360
390
|
}
|
|
361
391
|
async getApplicationList(proxy = null) {
|
|
362
392
|
const res = await this.client.get(proxy, '/axis-cgi/applications/list.cgi');
|
package/esm/types/VapixAPI.d.ts
CHANGED
|
@@ -1661,4 +1661,161 @@ export declare const audioSampleRatesResponseSchema: z.ZodObject<{
|
|
|
1661
1661
|
};
|
|
1662
1662
|
};
|
|
1663
1663
|
}>;
|
|
1664
|
+
export declare const portStatusSchema: z.ZodObject<{
|
|
1665
|
+
port: z.ZodString;
|
|
1666
|
+
state: z.ZodEnum<["open", "closed"]>;
|
|
1667
|
+
configurable: z.ZodBoolean;
|
|
1668
|
+
readonly: z.ZodOptional<z.ZodBoolean>;
|
|
1669
|
+
usage: z.ZodString;
|
|
1670
|
+
direction: z.ZodEnum<["input", "output"]>;
|
|
1671
|
+
name: z.ZodString;
|
|
1672
|
+
normalState: z.ZodEnum<["open", "closed"]>;
|
|
1673
|
+
}, "strip", z.ZodTypeAny, {
|
|
1674
|
+
name: string;
|
|
1675
|
+
port: string;
|
|
1676
|
+
state: "open" | "closed";
|
|
1677
|
+
configurable: boolean;
|
|
1678
|
+
usage: string;
|
|
1679
|
+
direction: "input" | "output";
|
|
1680
|
+
normalState: "open" | "closed";
|
|
1681
|
+
readonly?: boolean | undefined;
|
|
1682
|
+
}, {
|
|
1683
|
+
name: string;
|
|
1684
|
+
port: string;
|
|
1685
|
+
state: "open" | "closed";
|
|
1686
|
+
configurable: boolean;
|
|
1687
|
+
usage: string;
|
|
1688
|
+
direction: "input" | "output";
|
|
1689
|
+
normalState: "open" | "closed";
|
|
1690
|
+
readonly?: boolean | undefined;
|
|
1691
|
+
}>;
|
|
1692
|
+
export type TPortStatusSchema = z.infer<typeof portStatusSchema>;
|
|
1693
|
+
export declare const getPortsResponseSchema: z.ZodObject<{
|
|
1694
|
+
apiVersion: z.ZodString;
|
|
1695
|
+
context: z.ZodString;
|
|
1696
|
+
method: z.ZodLiteral<"getPorts">;
|
|
1697
|
+
data: z.ZodObject<{
|
|
1698
|
+
numberOfPorts: z.ZodNumber;
|
|
1699
|
+
items: z.ZodArray<z.ZodObject<{
|
|
1700
|
+
port: z.ZodString;
|
|
1701
|
+
state: z.ZodEnum<["open", "closed"]>;
|
|
1702
|
+
configurable: z.ZodBoolean;
|
|
1703
|
+
readonly: z.ZodOptional<z.ZodBoolean>;
|
|
1704
|
+
usage: z.ZodString;
|
|
1705
|
+
direction: z.ZodEnum<["input", "output"]>;
|
|
1706
|
+
name: z.ZodString;
|
|
1707
|
+
normalState: z.ZodEnum<["open", "closed"]>;
|
|
1708
|
+
}, "strip", z.ZodTypeAny, {
|
|
1709
|
+
name: string;
|
|
1710
|
+
port: string;
|
|
1711
|
+
state: "open" | "closed";
|
|
1712
|
+
configurable: boolean;
|
|
1713
|
+
usage: string;
|
|
1714
|
+
direction: "input" | "output";
|
|
1715
|
+
normalState: "open" | "closed";
|
|
1716
|
+
readonly?: boolean | undefined;
|
|
1717
|
+
}, {
|
|
1718
|
+
name: string;
|
|
1719
|
+
port: string;
|
|
1720
|
+
state: "open" | "closed";
|
|
1721
|
+
configurable: boolean;
|
|
1722
|
+
usage: string;
|
|
1723
|
+
direction: "input" | "output";
|
|
1724
|
+
normalState: "open" | "closed";
|
|
1725
|
+
readonly?: boolean | undefined;
|
|
1726
|
+
}>, "many">;
|
|
1727
|
+
}, "strip", z.ZodTypeAny, {
|
|
1728
|
+
numberOfPorts: number;
|
|
1729
|
+
items: {
|
|
1730
|
+
name: string;
|
|
1731
|
+
port: string;
|
|
1732
|
+
state: "open" | "closed";
|
|
1733
|
+
configurable: boolean;
|
|
1734
|
+
usage: string;
|
|
1735
|
+
direction: "input" | "output";
|
|
1736
|
+
normalState: "open" | "closed";
|
|
1737
|
+
readonly?: boolean | undefined;
|
|
1738
|
+
}[];
|
|
1739
|
+
}, {
|
|
1740
|
+
numberOfPorts: number;
|
|
1741
|
+
items: {
|
|
1742
|
+
name: string;
|
|
1743
|
+
port: string;
|
|
1744
|
+
state: "open" | "closed";
|
|
1745
|
+
configurable: boolean;
|
|
1746
|
+
usage: string;
|
|
1747
|
+
direction: "input" | "output";
|
|
1748
|
+
normalState: "open" | "closed";
|
|
1749
|
+
readonly?: boolean | undefined;
|
|
1750
|
+
}[];
|
|
1751
|
+
}>;
|
|
1752
|
+
}, "strip", z.ZodTypeAny, {
|
|
1753
|
+
data: {
|
|
1754
|
+
numberOfPorts: number;
|
|
1755
|
+
items: {
|
|
1756
|
+
name: string;
|
|
1757
|
+
port: string;
|
|
1758
|
+
state: "open" | "closed";
|
|
1759
|
+
configurable: boolean;
|
|
1760
|
+
usage: string;
|
|
1761
|
+
direction: "input" | "output";
|
|
1762
|
+
normalState: "open" | "closed";
|
|
1763
|
+
readonly?: boolean | undefined;
|
|
1764
|
+
}[];
|
|
1765
|
+
};
|
|
1766
|
+
apiVersion: string;
|
|
1767
|
+
context: string;
|
|
1768
|
+
method: "getPorts";
|
|
1769
|
+
}, {
|
|
1770
|
+
data: {
|
|
1771
|
+
numberOfPorts: number;
|
|
1772
|
+
items: {
|
|
1773
|
+
name: string;
|
|
1774
|
+
port: string;
|
|
1775
|
+
state: "open" | "closed";
|
|
1776
|
+
configurable: boolean;
|
|
1777
|
+
usage: string;
|
|
1778
|
+
direction: "input" | "output";
|
|
1779
|
+
normalState: "open" | "closed";
|
|
1780
|
+
readonly?: boolean | undefined;
|
|
1781
|
+
}[];
|
|
1782
|
+
};
|
|
1783
|
+
apiVersion: string;
|
|
1784
|
+
context: string;
|
|
1785
|
+
method: "getPorts";
|
|
1786
|
+
}>;
|
|
1787
|
+
export declare const portSetSchema: z.ZodObject<{
|
|
1788
|
+
port: z.ZodString;
|
|
1789
|
+
state: z.ZodEnum<["open", "closed"]>;
|
|
1790
|
+
usage: z.ZodOptional<z.ZodString>;
|
|
1791
|
+
direction: z.ZodOptional<z.ZodEnum<["input", "output"]>>;
|
|
1792
|
+
name: z.ZodOptional<z.ZodString>;
|
|
1793
|
+
normalState: z.ZodOptional<z.ZodEnum<["open", "closed"]>>;
|
|
1794
|
+
}, "strip", z.ZodTypeAny, {
|
|
1795
|
+
port: string;
|
|
1796
|
+
state: "open" | "closed";
|
|
1797
|
+
name?: string | undefined;
|
|
1798
|
+
usage?: string | undefined;
|
|
1799
|
+
direction?: "input" | "output" | undefined;
|
|
1800
|
+
normalState?: "open" | "closed" | undefined;
|
|
1801
|
+
}, {
|
|
1802
|
+
port: string;
|
|
1803
|
+
state: "open" | "closed";
|
|
1804
|
+
name?: string | undefined;
|
|
1805
|
+
usage?: string | undefined;
|
|
1806
|
+
direction?: "input" | "output" | undefined;
|
|
1807
|
+
normalState?: "open" | "closed" | undefined;
|
|
1808
|
+
}>;
|
|
1809
|
+
export type TPortSetSchema = z.infer<typeof portSetSchema>;
|
|
1810
|
+
export declare const portSequenceStateSchema: z.ZodObject<{
|
|
1811
|
+
state: z.ZodEnum<["open", "closed"]>;
|
|
1812
|
+
time: z.ZodNumber;
|
|
1813
|
+
}, "strip", z.ZodTypeAny, {
|
|
1814
|
+
time: number;
|
|
1815
|
+
state: "open" | "closed";
|
|
1816
|
+
}, {
|
|
1817
|
+
time: number;
|
|
1818
|
+
state: "open" | "closed";
|
|
1819
|
+
}>;
|
|
1820
|
+
export type TPortSequenceStateSchema = z.infer<typeof portSequenceStateSchema>;
|
|
1664
1821
|
export {};
|
package/esm/types/VapixAPI.js
CHANGED
|
@@ -134,3 +134,34 @@ export const audioSampleRatesResponseSchema = z.object({
|
|
|
134
134
|
.partial(),
|
|
135
135
|
}),
|
|
136
136
|
});
|
|
137
|
+
export const portStatusSchema = z.object({
|
|
138
|
+
port: z.string(),
|
|
139
|
+
state: z.enum(['open', 'closed']),
|
|
140
|
+
configurable: z.boolean(),
|
|
141
|
+
readonly: z.boolean().optional(),
|
|
142
|
+
usage: z.string(),
|
|
143
|
+
direction: z.enum(['input', 'output']),
|
|
144
|
+
name: z.string(),
|
|
145
|
+
normalState: z.enum(['open', 'closed']),
|
|
146
|
+
});
|
|
147
|
+
export const getPortsResponseSchema = z.object({
|
|
148
|
+
apiVersion: z.string(),
|
|
149
|
+
context: z.string(),
|
|
150
|
+
method: z.literal('getPorts'),
|
|
151
|
+
data: z.object({
|
|
152
|
+
numberOfPorts: z.number(),
|
|
153
|
+
items: z.array(portStatusSchema),
|
|
154
|
+
}),
|
|
155
|
+
});
|
|
156
|
+
export const portSetSchema = z.object({
|
|
157
|
+
port: z.string(),
|
|
158
|
+
state: z.enum(['open', 'closed']),
|
|
159
|
+
usage: z.string().optional(),
|
|
160
|
+
direction: z.enum(['input', 'output']).optional(),
|
|
161
|
+
name: z.string().optional(),
|
|
162
|
+
normalState: z.enum(['open', 'closed']).optional(),
|
|
163
|
+
});
|
|
164
|
+
export const portSequenceStateSchema = z.object({
|
|
165
|
+
state: z.enum(['open', 'closed']),
|
|
166
|
+
time: z.number().min(0).max(65535),
|
|
167
|
+
});
|
package/package.json
CHANGED
|
@@ -1,8 +1,11 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "camstreamerlib",
|
|
3
|
-
"version": "4.0.0-beta.
|
|
3
|
+
"version": "4.0.0-beta.28",
|
|
4
4
|
"description": "Helper library for CamStreamer ACAP applications.",
|
|
5
5
|
"prettier": "@camstreamer/prettier-config",
|
|
6
|
+
"engine": {
|
|
7
|
+
"node": ">=18.0.0"
|
|
8
|
+
},
|
|
6
9
|
"dependencies": {
|
|
7
10
|
"adm-zip": "^0.5.9",
|
|
8
11
|
"eventemitter2": "^5.0.1",
|
|
@@ -14,9 +17,6 @@
|
|
|
14
17
|
"ws": "^8.18.0",
|
|
15
18
|
"zod": "^3.24.3"
|
|
16
19
|
},
|
|
17
|
-
"engine": {
|
|
18
|
-
"node": ">=18.0.0"
|
|
19
|
-
},
|
|
20
20
|
"devDependencies": {
|
|
21
21
|
"@camstreamer/eslint-config": "^1.0.2",
|
|
22
22
|
"@camstreamer/prettier-config": "^2.0.4",
|
|
@@ -48,7 +48,8 @@
|
|
|
48
48
|
"lint:fix": "eslint \"src/**/*.ts\" --fix",
|
|
49
49
|
"pretty": "prettier --write \"./{{src,doc}/**/*.{ts,tsx,md},README.md}\"",
|
|
50
50
|
"pretty:check": "prettier --check \"./{{src,doc}/**/*.{ts,tsx,md},README.md}\"",
|
|
51
|
-
"test": "node --experimental-vm-modules node_modules/jest/bin/jest.js"
|
|
51
|
+
"test": "node --experimental-vm-modules node_modules/jest/bin/jest.js",
|
|
52
|
+
"audit": "npm audit --audit-level=high"
|
|
52
53
|
},
|
|
53
54
|
"files": [
|
|
54
55
|
"/**/*.js",
|
|
@@ -1,61 +0,0 @@
|
|
|
1
|
-
import { CamOverlayDrawingAPI, TAlign, TCairoCreateResponse, TUploadImageResponse } from '../CamOverlayDrawingAPI';
|
|
2
|
-
export type TRgb = [number, number, number];
|
|
3
|
-
export type TRgba = [number, number, number, number];
|
|
4
|
-
export type TTmf = 'TFM_OVERFLOW' | 'TFM_SCALE' | 'TFM_TRUNCATE';
|
|
5
|
-
export type TObjectFitType = 'fill' | 'fit' | 'none';
|
|
6
|
-
export type TFrameOptions = {
|
|
7
|
-
enabled?: boolean;
|
|
8
|
-
x: number;
|
|
9
|
-
y: number;
|
|
10
|
-
width: number;
|
|
11
|
-
height: number;
|
|
12
|
-
text?: string;
|
|
13
|
-
fontColor?: TRgb;
|
|
14
|
-
font?: string;
|
|
15
|
-
bgColor?: TRgba;
|
|
16
|
-
bgImage?: string;
|
|
17
|
-
bgType?: TObjectFitType;
|
|
18
|
-
borderRadius?: number;
|
|
19
|
-
borderWidth?: number;
|
|
20
|
-
borderColor?: TRgba;
|
|
21
|
-
customDraw?: TDrawingCallback;
|
|
22
|
-
layer?: number;
|
|
23
|
-
};
|
|
24
|
-
export type TFrameInfo = {
|
|
25
|
-
width: number;
|
|
26
|
-
height: number;
|
|
27
|
-
};
|
|
28
|
-
export type TDrawingCallback = (cod: CamOverlayDrawingAPI, cairo: string, info: TFrameInfo) => Promise<void>;
|
|
29
|
-
export interface Frame {
|
|
30
|
-
on(event: 'open', listener: () => void): this;
|
|
31
|
-
on(event: 'close', listener: () => void): this;
|
|
32
|
-
on(event: 'layoutChanged', listener: () => void): this;
|
|
33
|
-
emit(event: 'open'): boolean;
|
|
34
|
-
emit(event: 'close'): boolean;
|
|
35
|
-
emit(event: 'layoutChanged'): boolean;
|
|
36
|
-
}
|
|
37
|
-
export type TBorderInfo = {
|
|
38
|
-
color: TRgba;
|
|
39
|
-
width: number;
|
|
40
|
-
radius: number;
|
|
41
|
-
};
|
|
42
|
-
export type TBgInfo = {
|
|
43
|
-
color: TRgba | undefined;
|
|
44
|
-
imageName: string | undefined;
|
|
45
|
-
image: TUploadImageResponse | undefined;
|
|
46
|
-
type: TObjectFitType | undefined;
|
|
47
|
-
};
|
|
48
|
-
export type TTextInfo = {
|
|
49
|
-
text: string;
|
|
50
|
-
align: TAlign;
|
|
51
|
-
textType: TTmf;
|
|
52
|
-
fontColor: TRgb;
|
|
53
|
-
font: TCairoCreateResponse | undefined;
|
|
54
|
-
fontName: string | undefined;
|
|
55
|
-
};
|
|
56
|
-
export type TFrameInfo2 = {
|
|
57
|
-
x: number;
|
|
58
|
-
y: number;
|
|
59
|
-
width: number;
|
|
60
|
-
height: number;
|
|
61
|
-
};
|
|
@@ -1,61 +0,0 @@
|
|
|
1
|
-
import { CamOverlayDrawingAPI, TAlign, TCairoCreateResponse, TUploadImageResponse } from '../CamOverlayDrawingAPI';
|
|
2
|
-
export type TRgb = [number, number, number];
|
|
3
|
-
export type TRgba = [number, number, number, number];
|
|
4
|
-
export type TTmf = 'TFM_OVERFLOW' | 'TFM_SCALE' | 'TFM_TRUNCATE';
|
|
5
|
-
export type TObjectFitType = 'fill' | 'fit' | 'none';
|
|
6
|
-
export type TFrameOptions = {
|
|
7
|
-
enabled?: boolean;
|
|
8
|
-
x: number;
|
|
9
|
-
y: number;
|
|
10
|
-
width: number;
|
|
11
|
-
height: number;
|
|
12
|
-
text?: string;
|
|
13
|
-
fontColor?: TRgb;
|
|
14
|
-
font?: string;
|
|
15
|
-
bgColor?: TRgba;
|
|
16
|
-
bgImage?: string;
|
|
17
|
-
bgType?: TObjectFitType;
|
|
18
|
-
borderRadius?: number;
|
|
19
|
-
borderWidth?: number;
|
|
20
|
-
borderColor?: TRgba;
|
|
21
|
-
customDraw?: TDrawingCallback;
|
|
22
|
-
layer?: number;
|
|
23
|
-
};
|
|
24
|
-
export type TFrameInfo = {
|
|
25
|
-
width: number;
|
|
26
|
-
height: number;
|
|
27
|
-
};
|
|
28
|
-
export type TDrawingCallback = (cod: CamOverlayDrawingAPI, cairo: string, info: TFrameInfo) => Promise<void>;
|
|
29
|
-
export interface Frame {
|
|
30
|
-
on(event: 'open', listener: () => void): this;
|
|
31
|
-
on(event: 'close', listener: () => void): this;
|
|
32
|
-
on(event: 'layoutChanged', listener: () => void): this;
|
|
33
|
-
emit(event: 'open'): boolean;
|
|
34
|
-
emit(event: 'close'): boolean;
|
|
35
|
-
emit(event: 'layoutChanged'): boolean;
|
|
36
|
-
}
|
|
37
|
-
export type TBorderInfo = {
|
|
38
|
-
color: TRgba;
|
|
39
|
-
width: number;
|
|
40
|
-
radius: number;
|
|
41
|
-
};
|
|
42
|
-
export type TBgInfo = {
|
|
43
|
-
color: TRgba | undefined;
|
|
44
|
-
imageName: string | undefined;
|
|
45
|
-
image: TUploadImageResponse | undefined;
|
|
46
|
-
type: TObjectFitType | undefined;
|
|
47
|
-
};
|
|
48
|
-
export type TTextInfo = {
|
|
49
|
-
text: string;
|
|
50
|
-
align: TAlign;
|
|
51
|
-
textType: TTmf;
|
|
52
|
-
fontColor: TRgb;
|
|
53
|
-
font: TCairoCreateResponse | undefined;
|
|
54
|
-
fontName: string | undefined;
|
|
55
|
-
};
|
|
56
|
-
export type TFrameInfo2 = {
|
|
57
|
-
x: number;
|
|
58
|
-
y: number;
|
|
59
|
-
width: number;
|
|
60
|
-
height: number;
|
|
61
|
-
};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export {};
|