LINXD-1921: Update simulator to be able to post enter group before each call
This commit is contained in:
13
src/asset.js
13
src/asset.js
@ -44,6 +44,7 @@ class Asset {
|
||||
utils.writeLog(`Asset ${this.id} was successfully initialized`)
|
||||
|
||||
if (err) {
|
||||
console.log('err', err)
|
||||
utils.writeLog(`Asset ${this.id} was not successfully initialized`, err);
|
||||
return;
|
||||
}
|
||||
@ -71,7 +72,6 @@ class Asset {
|
||||
(error, response, body) => {
|
||||
if (!error && (response.statusCode === 200 || response.statusCode === 201)) {
|
||||
let bodyObj = JSON.parse(body);
|
||||
|
||||
// Here are the asset fields.
|
||||
this.assetProps = bodyObj.data;
|
||||
// console.log('!!!!!!!!!!!!!!!!!!!!!!!!!!!!', this.assetProps)
|
||||
@ -173,7 +173,6 @@ class Asset {
|
||||
});
|
||||
|
||||
hub.once('connect', () => {
|
||||
console.log('11111111111111111111')
|
||||
return callback();
|
||||
});
|
||||
hub.on('connect', () => {
|
||||
@ -252,6 +251,7 @@ class Asset {
|
||||
}
|
||||
|
||||
_moveToChannel(callback) {
|
||||
console.log('_moveToChannel')
|
||||
Request.post(
|
||||
this.apiEndpoint + '/audio/enter-group/' + this.id + '/' + this.groupId,
|
||||
{
|
||||
@ -374,8 +374,11 @@ class Asset {
|
||||
}
|
||||
|
||||
_makePtt(callback) {
|
||||
|
||||
// Send ptt-press, transmit all the sound then send ptt-release.
|
||||
// Sending group monitoring before we make PTT()
|
||||
// Is used for the HUB load test(_moveToChannel is sent anyway after connecting to murmur-register)
|
||||
if (this.configs.settings.send_group_monitoring_before_each_call) {
|
||||
this._moveToChannel();
|
||||
}
|
||||
|
||||
// Check hub.
|
||||
let hub = this.hub;
|
||||
@ -500,7 +503,7 @@ class Asset {
|
||||
let lat = this.configs.settings.gps_lat_start_point;
|
||||
let lng = this.configs.settings.gps_lng_start_point;
|
||||
|
||||
setInterval(() => {
|
||||
setTimeout(() => {
|
||||
var new_lat = this._randomCoordinates(lat);
|
||||
var new_lng = this._randomCoordinates(lng);
|
||||
|
||||
|
@ -34,6 +34,7 @@ class Simulator {
|
||||
}
|
||||
|
||||
_start() {
|
||||
console.log('start')
|
||||
const settings = this.configs.settings;
|
||||
|
||||
this.assetIds.forEach((id, i) => {
|
||||
@ -75,6 +76,7 @@ class Simulator {
|
||||
|
||||
_unregisterAsstes(callback) {
|
||||
let url = this.apiEndpoint + '/audio/un-register/[' + this.assetIds + ']/';
|
||||
console.log('_unregisterAsstes', url)
|
||||
Request.post(
|
||||
url,
|
||||
{timeout: 15000},
|
||||
@ -82,6 +84,7 @@ class Simulator {
|
||||
if(error) {
|
||||
utils.writeLog(`ERROR can't unregister users ${this.assetIds}`, error);
|
||||
utils.writeErrorLog(`ERROR_API`);
|
||||
console.log('url _unregisterAsstes', url)
|
||||
return callback(error);
|
||||
}
|
||||
else {
|
||||
|
Reference in New Issue
Block a user