camstreamerlib 4.0.0-beta.18 → 4.0.0-beta.19.1
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
CHANGED
|
@@ -12,7 +12,7 @@ class PlaneTrackerAPI {
|
|
|
12
12
|
constructor(client, apiUser) {
|
|
13
13
|
this.client = client;
|
|
14
14
|
this.apiUser = apiUser;
|
|
15
|
-
this._apiUserQuery =
|
|
15
|
+
this._apiUserQuery = (0, utils_1.paramToUrl)(this.apiUser);
|
|
16
16
|
}
|
|
17
17
|
static getProxyUrlPath = () => `${exports.BASE_URL}/proxy.cgi`;
|
|
18
18
|
async checkCameraTime() {
|
|
@@ -33,11 +33,9 @@ class PlaneTrackerAPI {
|
|
|
33
33
|
}),
|
|
34
34
|
]);
|
|
35
35
|
const response = await this._getJson(`${exports.BASE_URL}/camera_time.cgi`);
|
|
36
|
-
const cameraTime = responseSchema.
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
}
|
|
40
|
-
return cameraTime.state;
|
|
36
|
+
const cameraTime = responseSchema.safeParse(response);
|
|
37
|
+
console.log('cameraTime', cameraTime);
|
|
38
|
+
return zod_1.z.boolean().parse(response.state);
|
|
41
39
|
}
|
|
42
40
|
fetchCameraSettings = async () => {
|
|
43
41
|
return await this._getJson(`${exports.BASE_URL}/package_camera_settings.cgi`, { action: 'get' });
|
|
@@ -89,7 +87,9 @@ class PlaneTrackerAPI {
|
|
|
89
87
|
startTrackingPlane = async (icao) => {
|
|
90
88
|
return await this.client.get(`${exports.BASE_URL}/package/trackIcao.cgi`, {
|
|
91
89
|
icao: encodeURIComponent(icao),
|
|
92
|
-
|
|
90
|
+
userId: encodeURIComponent(this.apiUser.userId),
|
|
91
|
+
userName: encodeURIComponent(this.apiUser.userName),
|
|
92
|
+
userPriority: this.apiUser.userPriority,
|
|
93
93
|
});
|
|
94
94
|
};
|
|
95
95
|
stopTrackingPlane = async () => {
|
|
@@ -106,7 +106,11 @@ class PlaneTrackerAPI {
|
|
|
106
106
|
return await this.client.post(`${exports.BASE_URL}/package_data.cgi`, formData, { action: 'IMPORT', dataType });
|
|
107
107
|
};
|
|
108
108
|
resetPtzCalibration = async () => {
|
|
109
|
-
return await this.client.get(`${exports.BASE_URL}/package/resetPtzCalibration.cgi
|
|
109
|
+
return await this.client.get(`${exports.BASE_URL}/package/resetPtzCalibration.cgi`, {
|
|
110
|
+
userId: encodeURIComponent(this.apiUser.userId),
|
|
111
|
+
userName: encodeURIComponent(this.apiUser.userName),
|
|
112
|
+
userPriority: this.apiUser.userPriority,
|
|
113
|
+
});
|
|
110
114
|
};
|
|
111
115
|
checkGenetecConnection = async (params) => {
|
|
112
116
|
return await this._postUrlEncoded(`${exports.BASE_URL}/package/checkGenetecConnection.cgi`, params);
|
|
@@ -148,14 +148,15 @@ export declare const cameraDetailsResponseSchema: z.ZodObject<{
|
|
|
148
148
|
export type TCameraDetailsResponse = z.infer<typeof cameraDetailsResponseSchema>;
|
|
149
149
|
export type TCameraDetail = z.infer<typeof cameraDetailSchema>;
|
|
150
150
|
export type TParams = Array<'Guid' | 'Name' | 'EntityType'>;
|
|
151
|
+
export type TProtocol = 'http' | 'https' | 'https_insecure';
|
|
151
152
|
export type GenetecAgentOptions = {
|
|
152
|
-
protocol?:
|
|
153
|
+
protocol?: TProtocol;
|
|
153
154
|
ip?: string;
|
|
154
155
|
port?: number;
|
|
155
|
-
|
|
156
|
+
baseUri?: string;
|
|
156
157
|
user?: string;
|
|
157
158
|
pass?: string;
|
|
158
|
-
|
|
159
|
+
appId?: string;
|
|
159
160
|
};
|
|
160
161
|
export declare class GenetecAgent {
|
|
161
162
|
private settings;
|
|
@@ -37,13 +37,13 @@ class GenetecAgent {
|
|
|
37
37
|
protocol: options.protocol ?? 'http',
|
|
38
38
|
ip: options.ip ?? '127.0.0.1',
|
|
39
39
|
port: options.port ?? 80,
|
|
40
|
-
|
|
40
|
+
baseUri: options.baseUri ?? 'WebSdk',
|
|
41
41
|
user: options.user ?? 'root',
|
|
42
42
|
pass: options.pass ?? '',
|
|
43
|
-
|
|
43
|
+
appId: options.appId ?? '',
|
|
44
44
|
};
|
|
45
|
-
this.baseUrl = `${this.settings.protocol}://${this.settings.ip}:${this.settings.port}/${this.settings.
|
|
46
|
-
this.credentials = btoa(`${this.settings.user};${this.settings.
|
|
45
|
+
this.baseUrl = `${this.settings.protocol}://${this.settings.ip}:${this.settings.port}/${this.settings.baseUri}`;
|
|
46
|
+
this.credentials = btoa(`${this.settings.user};${this.settings.appId}:${this.settings.pass}`);
|
|
47
47
|
}
|
|
48
48
|
async checkConnection() {
|
|
49
49
|
const requestOptions = this.getRequestOptions('GET');
|
package/esm/PlaneTrackerAPI.js
CHANGED
|
@@ -9,7 +9,7 @@ export class PlaneTrackerAPI {
|
|
|
9
9
|
constructor(client, apiUser) {
|
|
10
10
|
this.client = client;
|
|
11
11
|
this.apiUser = apiUser;
|
|
12
|
-
this._apiUserQuery =
|
|
12
|
+
this._apiUserQuery = paramToUrl(this.apiUser);
|
|
13
13
|
}
|
|
14
14
|
static getProxyUrlPath = () => `${BASE_URL}/proxy.cgi`;
|
|
15
15
|
async checkCameraTime() {
|
|
@@ -30,11 +30,9 @@ export class PlaneTrackerAPI {
|
|
|
30
30
|
}),
|
|
31
31
|
]);
|
|
32
32
|
const response = await this._getJson(`${BASE_URL}/camera_time.cgi`);
|
|
33
|
-
const cameraTime = responseSchema.
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
}
|
|
37
|
-
return cameraTime.state;
|
|
33
|
+
const cameraTime = responseSchema.safeParse(response);
|
|
34
|
+
console.log('cameraTime', cameraTime);
|
|
35
|
+
return z.boolean().parse(response.state);
|
|
38
36
|
}
|
|
39
37
|
fetchCameraSettings = async () => {
|
|
40
38
|
return await this._getJson(`${BASE_URL}/package_camera_settings.cgi`, { action: 'get' });
|
|
@@ -86,7 +84,9 @@ export class PlaneTrackerAPI {
|
|
|
86
84
|
startTrackingPlane = async (icao) => {
|
|
87
85
|
return await this.client.get(`${BASE_URL}/package/trackIcao.cgi`, {
|
|
88
86
|
icao: encodeURIComponent(icao),
|
|
89
|
-
|
|
87
|
+
userId: encodeURIComponent(this.apiUser.userId),
|
|
88
|
+
userName: encodeURIComponent(this.apiUser.userName),
|
|
89
|
+
userPriority: this.apiUser.userPriority,
|
|
90
90
|
});
|
|
91
91
|
};
|
|
92
92
|
stopTrackingPlane = async () => {
|
|
@@ -103,7 +103,11 @@ export class PlaneTrackerAPI {
|
|
|
103
103
|
return await this.client.post(`${BASE_URL}/package_data.cgi`, formData, { action: 'IMPORT', dataType });
|
|
104
104
|
};
|
|
105
105
|
resetPtzCalibration = async () => {
|
|
106
|
-
return await this.client.get(`${BASE_URL}/package/resetPtzCalibration.cgi
|
|
106
|
+
return await this.client.get(`${BASE_URL}/package/resetPtzCalibration.cgi`, {
|
|
107
|
+
userId: encodeURIComponent(this.apiUser.userId),
|
|
108
|
+
userName: encodeURIComponent(this.apiUser.userName),
|
|
109
|
+
userPriority: this.apiUser.userPriority,
|
|
110
|
+
});
|
|
107
111
|
};
|
|
108
112
|
checkGenetecConnection = async (params) => {
|
|
109
113
|
return await this._postUrlEncoded(`${BASE_URL}/package/checkGenetecConnection.cgi`, params);
|
|
@@ -148,14 +148,15 @@ export declare const cameraDetailsResponseSchema: z.ZodObject<{
|
|
|
148
148
|
export type TCameraDetailsResponse = z.infer<typeof cameraDetailsResponseSchema>;
|
|
149
149
|
export type TCameraDetail = z.infer<typeof cameraDetailSchema>;
|
|
150
150
|
export type TParams = Array<'Guid' | 'Name' | 'EntityType'>;
|
|
151
|
+
export type TProtocol = 'http' | 'https' | 'https_insecure';
|
|
151
152
|
export type GenetecAgentOptions = {
|
|
152
|
-
protocol?:
|
|
153
|
+
protocol?: TProtocol;
|
|
153
154
|
ip?: string;
|
|
154
155
|
port?: number;
|
|
155
|
-
|
|
156
|
+
baseUri?: string;
|
|
156
157
|
user?: string;
|
|
157
158
|
pass?: string;
|
|
158
|
-
|
|
159
|
+
appId?: string;
|
|
159
160
|
};
|
|
160
161
|
export declare class GenetecAgent {
|
|
161
162
|
private settings;
|
|
@@ -34,13 +34,13 @@ export class GenetecAgent {
|
|
|
34
34
|
protocol: options.protocol ?? 'http',
|
|
35
35
|
ip: options.ip ?? '127.0.0.1',
|
|
36
36
|
port: options.port ?? 80,
|
|
37
|
-
|
|
37
|
+
baseUri: options.baseUri ?? 'WebSdk',
|
|
38
38
|
user: options.user ?? 'root',
|
|
39
39
|
pass: options.pass ?? '',
|
|
40
|
-
|
|
40
|
+
appId: options.appId ?? '',
|
|
41
41
|
};
|
|
42
|
-
this.baseUrl = `${this.settings.protocol}://${this.settings.ip}:${this.settings.port}/${this.settings.
|
|
43
|
-
this.credentials = btoa(`${this.settings.user};${this.settings.
|
|
42
|
+
this.baseUrl = `${this.settings.protocol}://${this.settings.ip}:${this.settings.port}/${this.settings.baseUri}`;
|
|
43
|
+
this.credentials = btoa(`${this.settings.user};${this.settings.appId}:${this.settings.pass}`);
|
|
44
44
|
}
|
|
45
45
|
async checkConnection() {
|
|
46
46
|
const requestOptions = this.getRequestOptions('GET');
|