camstreamerlib 4.0.0-beta.42 → 4.0.0-beta.45
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/PlaneTrackerAPI.js +47 -34
- package/esm/PlaneTrackerAPI.js +47 -34
- package/package.json +1 -1
- package/types/PlaneTrackerAPI.d.ts +9 -10
package/cjs/PlaneTrackerAPI.js
CHANGED
|
@@ -23,6 +23,19 @@ class PlaneTrackerAPI {
|
|
|
23
23
|
const res = await this._getJson(`${BASE_PATH}/camera_time.cgi`, undefined, options);
|
|
24
24
|
return zod_1.z.boolean().parse(res.state);
|
|
25
25
|
}
|
|
26
|
+
async serverRunCheck(options) {
|
|
27
|
+
const agent = this.getClient(options?.proxyParams);
|
|
28
|
+
return await agent.get({ path: `${BASE_PATH}/package/serverRunCheck.cgi`, timeout: options?.timeout });
|
|
29
|
+
}
|
|
30
|
+
async getLiveViewAlias(rtspUrl, options) {
|
|
31
|
+
const agent = this.getClient(options?.proxyParams);
|
|
32
|
+
const res = await agent.get({
|
|
33
|
+
path: `${BASE_PATH}/getLiveViewAlias.cgi`,
|
|
34
|
+
parameters: { rtsp_url: rtspUrl },
|
|
35
|
+
timeout: options?.timeout,
|
|
36
|
+
});
|
|
37
|
+
return PlaneTrackerAPI_1.wsAliasResponseSchema.parse(await res.json());
|
|
38
|
+
}
|
|
26
39
|
async resetPtzCalibration(options) {
|
|
27
40
|
const agent = this.getClient(options?.proxyParams);
|
|
28
41
|
const res = await agent.get({
|
|
@@ -45,19 +58,6 @@ class PlaneTrackerAPI {
|
|
|
45
58
|
throw new errors_1.ResetCalibrationError('FOCUS', await (0, utils_1.responseStringify)(res));
|
|
46
59
|
}
|
|
47
60
|
}
|
|
48
|
-
async serverRunCheck(options) {
|
|
49
|
-
const agent = this.getClient(options?.proxyParams);
|
|
50
|
-
return await agent.get({ path: `${BASE_PATH}/package/serverRunCheck.cgi`, timeout: options?.timeout });
|
|
51
|
-
}
|
|
52
|
-
async getLiveViewAlias(rtspUrl, options) {
|
|
53
|
-
const agent = this.getClient(options?.proxyParams);
|
|
54
|
-
const res = await agent.get({
|
|
55
|
-
path: `${BASE_PATH}/getLiveViewAlias.cgi`,
|
|
56
|
-
parameters: { rtsp_url: rtspUrl },
|
|
57
|
-
timeout: options?.timeout,
|
|
58
|
-
});
|
|
59
|
-
return PlaneTrackerAPI_1.wsAliasResponseSchema.parse(await res.json());
|
|
60
|
-
}
|
|
61
61
|
async fetchCameraSettings(options) {
|
|
62
62
|
const res = await this._getJson(`${BASE_PATH}/package_camera_settings.cgi`, { action: 'get' }, options);
|
|
63
63
|
return PlaneTrackerAPI_1.cameraSettingsSchema.parse(res);
|
|
@@ -95,7 +95,7 @@ class PlaneTrackerAPI {
|
|
|
95
95
|
return PlaneTrackerAPI_1.trackingModeSchema.parse(res);
|
|
96
96
|
}
|
|
97
97
|
async setTrackingMode(mode, options) {
|
|
98
|
-
await this._postJsonEncoded(`${BASE_PATH}/package/setTrackingMode.cgi`, mode, this.apiUser, options);
|
|
98
|
+
await this._postJsonEncoded(`${BASE_PATH}/package/setTrackingMode.cgi`, { mode }, this.apiUser, options);
|
|
99
99
|
}
|
|
100
100
|
async startTrackingPlane(icao, options) {
|
|
101
101
|
const agent = this.getClient(options?.proxyParams);
|
|
@@ -125,14 +125,14 @@ class PlaneTrackerAPI {
|
|
|
125
125
|
return PlaneTrackerAPI_1.whiteListSchema.parse(res);
|
|
126
126
|
}
|
|
127
127
|
async setWhiteList(whiteList, options) {
|
|
128
|
-
return await this._postJsonEncoded(`${BASE_PATH}/package/setWhiteList.cgi`, whiteList, this.apiUser, options);
|
|
128
|
+
return await this._postJsonEncoded(`${BASE_PATH}/package/setWhiteList.cgi`, { whiteList }, this.apiUser, options);
|
|
129
129
|
}
|
|
130
130
|
async getBlackList(options) {
|
|
131
131
|
const res = await this._getJson(`${BASE_PATH}/package/getBlackList.cgi`, undefined, options);
|
|
132
132
|
return PlaneTrackerAPI_1.blackListSchema.parse(res);
|
|
133
133
|
}
|
|
134
134
|
async setBlackList(blackList, options) {
|
|
135
|
-
return await this._postJsonEncoded(`${BASE_PATH}/package/setBlackList.cgi`, blackList, this.apiUser, options);
|
|
135
|
+
return await this._postJsonEncoded(`${BASE_PATH}/package/setBlackList.cgi`, { blackList }, this.apiUser, options);
|
|
136
136
|
}
|
|
137
137
|
async fetchMapInfo(options) {
|
|
138
138
|
const res = await this._getJson(`${BASE_PATH}/package/getMapInfo.cgi`, undefined, options);
|
|
@@ -170,16 +170,6 @@ class PlaneTrackerAPI {
|
|
|
170
170
|
throw new Error(await (0, utils_1.responseStringify)(res));
|
|
171
171
|
}
|
|
172
172
|
}
|
|
173
|
-
async _post(path, data, parameters, options, headers) {
|
|
174
|
-
const agent = this.getClient(options?.proxyParams);
|
|
175
|
-
const res = await agent.post({ path, data, parameters, headers, timeout: options?.timeout });
|
|
176
|
-
if (res.ok) {
|
|
177
|
-
return await res.json();
|
|
178
|
-
}
|
|
179
|
-
else {
|
|
180
|
-
throw new Error(await (0, utils_1.responseStringify)(res));
|
|
181
|
-
}
|
|
182
|
-
}
|
|
183
173
|
async _getBlob(path, parameters, options) {
|
|
184
174
|
const agent = this.getClient(options?.proxyParams);
|
|
185
175
|
const res = await agent.get({ path, parameters, timeout: options?.timeout });
|
|
@@ -198,15 +188,38 @@ class PlaneTrackerAPI {
|
|
|
198
188
|
throw new errors_1.ParsingBlobError(err);
|
|
199
189
|
}
|
|
200
190
|
}
|
|
201
|
-
async
|
|
202
|
-
const
|
|
203
|
-
const data = (0, utils_1.paramToUrl)(parameters);
|
|
204
|
-
return this._post(path, data, {}, options, { ...baseHeaders, ...headers });
|
|
205
|
-
}
|
|
206
|
-
async _postJsonEncoded(path, data, parameters, options, headers) {
|
|
207
|
-
const baseHeaders = { 'Accept': 'application/json', 'Content-Type': 'application/json' };
|
|
191
|
+
async _postJsonEncoded(path, data, parameters, options) {
|
|
192
|
+
const agent = this.getClient(options?.proxyParams);
|
|
208
193
|
const jsonData = JSON.stringify(data);
|
|
209
|
-
|
|
194
|
+
const res = await agent.post({
|
|
195
|
+
path,
|
|
196
|
+
data: jsonData,
|
|
197
|
+
parameters,
|
|
198
|
+
headers: { 'Accept': 'application/json', 'Content-Type': 'application/json' },
|
|
199
|
+
timeout: options?.timeout,
|
|
200
|
+
});
|
|
201
|
+
if (res.ok) {
|
|
202
|
+
return res;
|
|
203
|
+
}
|
|
204
|
+
else {
|
|
205
|
+
throw new Error(await (0, utils_1.responseStringify)(res));
|
|
206
|
+
}
|
|
207
|
+
}
|
|
208
|
+
async _postUrlEncoded(path, params, options) {
|
|
209
|
+
const data = (0, utils_1.paramToUrl)(params);
|
|
210
|
+
const agent = this.getClient(options?.proxyParams);
|
|
211
|
+
const res = await agent.post({
|
|
212
|
+
path,
|
|
213
|
+
data,
|
|
214
|
+
headers: { 'Content-Type': 'application/x-www-form-urlencoded' },
|
|
215
|
+
timeout: options?.timeout,
|
|
216
|
+
});
|
|
217
|
+
if (res.ok) {
|
|
218
|
+
return res;
|
|
219
|
+
}
|
|
220
|
+
else {
|
|
221
|
+
throw new Error(await (0, utils_1.responseStringify)(res));
|
|
222
|
+
}
|
|
210
223
|
}
|
|
211
224
|
}
|
|
212
225
|
exports.PlaneTrackerAPI = PlaneTrackerAPI;
|
package/esm/PlaneTrackerAPI.js
CHANGED
|
@@ -20,6 +20,19 @@ export class PlaneTrackerAPI {
|
|
|
20
20
|
const res = await this._getJson(`${BASE_PATH}/camera_time.cgi`, undefined, options);
|
|
21
21
|
return z.boolean().parse(res.state);
|
|
22
22
|
}
|
|
23
|
+
async serverRunCheck(options) {
|
|
24
|
+
const agent = this.getClient(options?.proxyParams);
|
|
25
|
+
return await agent.get({ path: `${BASE_PATH}/package/serverRunCheck.cgi`, timeout: options?.timeout });
|
|
26
|
+
}
|
|
27
|
+
async getLiveViewAlias(rtspUrl, options) {
|
|
28
|
+
const agent = this.getClient(options?.proxyParams);
|
|
29
|
+
const res = await agent.get({
|
|
30
|
+
path: `${BASE_PATH}/getLiveViewAlias.cgi`,
|
|
31
|
+
parameters: { rtsp_url: rtspUrl },
|
|
32
|
+
timeout: options?.timeout,
|
|
33
|
+
});
|
|
34
|
+
return wsAliasResponseSchema.parse(await res.json());
|
|
35
|
+
}
|
|
23
36
|
async resetPtzCalibration(options) {
|
|
24
37
|
const agent = this.getClient(options?.proxyParams);
|
|
25
38
|
const res = await agent.get({
|
|
@@ -42,19 +55,6 @@ export class PlaneTrackerAPI {
|
|
|
42
55
|
throw new ResetCalibrationError('FOCUS', await responseStringify(res));
|
|
43
56
|
}
|
|
44
57
|
}
|
|
45
|
-
async serverRunCheck(options) {
|
|
46
|
-
const agent = this.getClient(options?.proxyParams);
|
|
47
|
-
return await agent.get({ path: `${BASE_PATH}/package/serverRunCheck.cgi`, timeout: options?.timeout });
|
|
48
|
-
}
|
|
49
|
-
async getLiveViewAlias(rtspUrl, options) {
|
|
50
|
-
const agent = this.getClient(options?.proxyParams);
|
|
51
|
-
const res = await agent.get({
|
|
52
|
-
path: `${BASE_PATH}/getLiveViewAlias.cgi`,
|
|
53
|
-
parameters: { rtsp_url: rtspUrl },
|
|
54
|
-
timeout: options?.timeout,
|
|
55
|
-
});
|
|
56
|
-
return wsAliasResponseSchema.parse(await res.json());
|
|
57
|
-
}
|
|
58
58
|
async fetchCameraSettings(options) {
|
|
59
59
|
const res = await this._getJson(`${BASE_PATH}/package_camera_settings.cgi`, { action: 'get' }, options);
|
|
60
60
|
return cameraSettingsSchema.parse(res);
|
|
@@ -92,7 +92,7 @@ export class PlaneTrackerAPI {
|
|
|
92
92
|
return trackingModeSchema.parse(res);
|
|
93
93
|
}
|
|
94
94
|
async setTrackingMode(mode, options) {
|
|
95
|
-
await this._postJsonEncoded(`${BASE_PATH}/package/setTrackingMode.cgi`, mode, this.apiUser, options);
|
|
95
|
+
await this._postJsonEncoded(`${BASE_PATH}/package/setTrackingMode.cgi`, { mode }, this.apiUser, options);
|
|
96
96
|
}
|
|
97
97
|
async startTrackingPlane(icao, options) {
|
|
98
98
|
const agent = this.getClient(options?.proxyParams);
|
|
@@ -122,14 +122,14 @@ export class PlaneTrackerAPI {
|
|
|
122
122
|
return whiteListSchema.parse(res);
|
|
123
123
|
}
|
|
124
124
|
async setWhiteList(whiteList, options) {
|
|
125
|
-
return await this._postJsonEncoded(`${BASE_PATH}/package/setWhiteList.cgi`, whiteList, this.apiUser, options);
|
|
125
|
+
return await this._postJsonEncoded(`${BASE_PATH}/package/setWhiteList.cgi`, { whiteList }, this.apiUser, options);
|
|
126
126
|
}
|
|
127
127
|
async getBlackList(options) {
|
|
128
128
|
const res = await this._getJson(`${BASE_PATH}/package/getBlackList.cgi`, undefined, options);
|
|
129
129
|
return blackListSchema.parse(res);
|
|
130
130
|
}
|
|
131
131
|
async setBlackList(blackList, options) {
|
|
132
|
-
return await this._postJsonEncoded(`${BASE_PATH}/package/setBlackList.cgi`, blackList, this.apiUser, options);
|
|
132
|
+
return await this._postJsonEncoded(`${BASE_PATH}/package/setBlackList.cgi`, { blackList }, this.apiUser, options);
|
|
133
133
|
}
|
|
134
134
|
async fetchMapInfo(options) {
|
|
135
135
|
const res = await this._getJson(`${BASE_PATH}/package/getMapInfo.cgi`, undefined, options);
|
|
@@ -167,16 +167,6 @@ export class PlaneTrackerAPI {
|
|
|
167
167
|
throw new Error(await responseStringify(res));
|
|
168
168
|
}
|
|
169
169
|
}
|
|
170
|
-
async _post(path, data, parameters, options, headers) {
|
|
171
|
-
const agent = this.getClient(options?.proxyParams);
|
|
172
|
-
const res = await agent.post({ path, data, parameters, headers, timeout: options?.timeout });
|
|
173
|
-
if (res.ok) {
|
|
174
|
-
return await res.json();
|
|
175
|
-
}
|
|
176
|
-
else {
|
|
177
|
-
throw new Error(await responseStringify(res));
|
|
178
|
-
}
|
|
179
|
-
}
|
|
180
170
|
async _getBlob(path, parameters, options) {
|
|
181
171
|
const agent = this.getClient(options?.proxyParams);
|
|
182
172
|
const res = await agent.get({ path, parameters, timeout: options?.timeout });
|
|
@@ -195,14 +185,37 @@ export class PlaneTrackerAPI {
|
|
|
195
185
|
throw new ParsingBlobError(err);
|
|
196
186
|
}
|
|
197
187
|
}
|
|
198
|
-
async
|
|
199
|
-
const
|
|
200
|
-
const data = paramToUrl(parameters);
|
|
201
|
-
return this._post(path, data, {}, options, { ...baseHeaders, ...headers });
|
|
202
|
-
}
|
|
203
|
-
async _postJsonEncoded(path, data, parameters, options, headers) {
|
|
204
|
-
const baseHeaders = { 'Accept': 'application/json', 'Content-Type': 'application/json' };
|
|
188
|
+
async _postJsonEncoded(path, data, parameters, options) {
|
|
189
|
+
const agent = this.getClient(options?.proxyParams);
|
|
205
190
|
const jsonData = JSON.stringify(data);
|
|
206
|
-
|
|
191
|
+
const res = await agent.post({
|
|
192
|
+
path,
|
|
193
|
+
data: jsonData,
|
|
194
|
+
parameters,
|
|
195
|
+
headers: { 'Accept': 'application/json', 'Content-Type': 'application/json' },
|
|
196
|
+
timeout: options?.timeout,
|
|
197
|
+
});
|
|
198
|
+
if (res.ok) {
|
|
199
|
+
return res;
|
|
200
|
+
}
|
|
201
|
+
else {
|
|
202
|
+
throw new Error(await responseStringify(res));
|
|
203
|
+
}
|
|
204
|
+
}
|
|
205
|
+
async _postUrlEncoded(path, params, options) {
|
|
206
|
+
const data = paramToUrl(params);
|
|
207
|
+
const agent = this.getClient(options?.proxyParams);
|
|
208
|
+
const res = await agent.post({
|
|
209
|
+
path,
|
|
210
|
+
data,
|
|
211
|
+
headers: { 'Content-Type': 'application/x-www-form-urlencoded' },
|
|
212
|
+
timeout: options?.timeout,
|
|
213
|
+
});
|
|
214
|
+
if (res.ok) {
|
|
215
|
+
return res;
|
|
216
|
+
}
|
|
217
|
+
else {
|
|
218
|
+
throw new Error(await responseStringify(res));
|
|
219
|
+
}
|
|
207
220
|
}
|
|
208
221
|
}
|
package/package.json
CHANGED
|
@@ -9,14 +9,14 @@ export declare class PlaneTrackerAPI<Client extends IClient<TResponse, any>> {
|
|
|
9
9
|
static getProxyPath: () => string;
|
|
10
10
|
getClient(proxyParams?: TProxyParams): Client | ProxyClient<Client>;
|
|
11
11
|
checkCameraTime(options?: THttpRequestOptions): Promise<boolean>;
|
|
12
|
-
resetPtzCalibration(options?: THttpRequestOptions): Promise<void>;
|
|
13
|
-
resetFocusCalibration(options?: THttpRequestOptions): Promise<void>;
|
|
14
12
|
serverRunCheck(options?: THttpRequestOptions): Promise<TResponse>;
|
|
15
13
|
getLiveViewAlias(rtspUrl: string, options?: THttpRequestOptions): Promise<{
|
|
16
14
|
ws: string;
|
|
17
15
|
ws_initial_message: string;
|
|
18
16
|
alias: string;
|
|
19
17
|
}>;
|
|
18
|
+
resetPtzCalibration(options?: THttpRequestOptions): Promise<void>;
|
|
19
|
+
resetFocusCalibration(options?: THttpRequestOptions): Promise<void>;
|
|
20
20
|
fetchCameraSettings(options?: THttpRequestOptions): Promise<{
|
|
21
21
|
camera: {
|
|
22
22
|
ip: string;
|
|
@@ -133,7 +133,7 @@ export declare class PlaneTrackerAPI<Client extends IClient<TResponse, any>> {
|
|
|
133
133
|
displayAircraftInfo?: boolean | undefined;
|
|
134
134
|
} | undefined;
|
|
135
135
|
}>;
|
|
136
|
-
setCameraSettings(settings: TCameraSettings, options?: THttpRequestOptions): Promise<
|
|
136
|
+
setCameraSettings(settings: TCameraSettings, options?: THttpRequestOptions): Promise<TResponse>;
|
|
137
137
|
fetchServerSettings(options?: THttpRequestOptions): Promise<{
|
|
138
138
|
cameraCalibration: {
|
|
139
139
|
posLat: number;
|
|
@@ -180,15 +180,15 @@ export declare class PlaneTrackerAPI<Client extends IClient<TResponse, any>> {
|
|
|
180
180
|
getPriorityList(options?: THttpRequestOptions): Promise<{
|
|
181
181
|
priorityList: string[];
|
|
182
182
|
}>;
|
|
183
|
-
setPriorityList(priorityList: TPriorityList['priorityList'], options?: THttpRequestOptions): Promise<
|
|
183
|
+
setPriorityList(priorityList: TPriorityList['priorityList'], options?: THttpRequestOptions): Promise<TResponse>;
|
|
184
184
|
getWhiteList(options?: THttpRequestOptions): Promise<{
|
|
185
185
|
whiteList: string[];
|
|
186
186
|
}>;
|
|
187
|
-
setWhiteList(whiteList: TWhiteList['whiteList'], options?: THttpRequestOptions): Promise<
|
|
187
|
+
setWhiteList(whiteList: TWhiteList['whiteList'], options?: THttpRequestOptions): Promise<TResponse>;
|
|
188
188
|
getBlackList(options?: THttpRequestOptions): Promise<{
|
|
189
189
|
blackList: string[];
|
|
190
190
|
}>;
|
|
191
|
-
setBlackList(blackList: TBlackList['blackList'], options?: THttpRequestOptions): Promise<
|
|
191
|
+
setBlackList(blackList: TBlackList['blackList'], options?: THttpRequestOptions): Promise<TResponse>;
|
|
192
192
|
fetchMapInfo(options?: THttpRequestOptions): Promise<{
|
|
193
193
|
minZoom: number;
|
|
194
194
|
maxZoom: number;
|
|
@@ -213,18 +213,17 @@ export declare class PlaneTrackerAPI<Client extends IClient<TResponse, any>> {
|
|
|
213
213
|
maxSpeedKmph?: number | undefined;
|
|
214
214
|
}[];
|
|
215
215
|
}>;
|
|
216
|
-
setZones(zones: TZones
|
|
216
|
+
setZones(zones: TZones, options?: THttpRequestOptions): Promise<void>;
|
|
217
217
|
goToCoordinates(lat: number, lon: number, alt?: number, options?: THttpRequestOptions): Promise<TResponse>;
|
|
218
|
-
checkGenetecConnection(params: TParameters, options?: THttpRequestOptions): Promise<
|
|
218
|
+
checkGenetecConnection(params: TParameters, options?: THttpRequestOptions): Promise<TResponse>;
|
|
219
219
|
getGenetecCameraList(params: TParameters, options?: THttpRequestOptions): Promise<{
|
|
220
220
|
value: string;
|
|
221
221
|
index: number;
|
|
222
222
|
label: string;
|
|
223
223
|
}[]>;
|
|
224
224
|
private _getJson;
|
|
225
|
-
private _post;
|
|
226
225
|
private _getBlob;
|
|
227
226
|
private parseBlobResponse;
|
|
228
|
-
private _postUrlEncoded;
|
|
229
227
|
private _postJsonEncoded;
|
|
228
|
+
private _postUrlEncoded;
|
|
230
229
|
}
|