LAPI-633: Add config for no gps

This commit is contained in:
2023-05-03 17:59:13 +03:00
parent e2b3b35e33
commit 8793db7c00
3 changed files with 487 additions and 86 deletions

View File

@ -90,8 +90,8 @@ class Asset {
this.hubAddress = data.configuration.hub_address;
return callback();
} else {
utils.writeLog(`_getConfiguration | response ${JSON.stringify(response)} | body: ${JSON.stringify(body)}`)
utils.writeLog(`ERROR getting informations about asset ${this.id}`, error);
utils.writeLog(`ERROR | _getConfiguration | response ${JSON.stringify(response)} | body: ${JSON.stringify(body)}`)
utils.writeLog(`ERROR | _getConfiguration | Getting informations about asset ${this.id}`, error);
utils.writeErrorLog(`ERROR_API | _getConfiguration`);
return callback(error);
}
@ -121,7 +121,7 @@ class Asset {
}
} else {
utils.writeLog(`_checkGroupToJoin | response ${JSON.stringify(response)} | body: ${JSON.stringify(body)}`)
utils.writeLog(`ERROR getting informations about asset ${this.id}`, error);
utils.writeLog(`ERROR | _checkGroupToJoin | Getting informations about asset ${this.id}`, error);
utils.writeErrorLog(`ERROR_API | _checkGroupToJoin`);
return callback(error);
}
@ -144,7 +144,7 @@ class Asset {
this.assetProps = bodyObj.data;
return this._getGroupsFromApi(callback);
} else {
utils.writeLog(`ERROR getting informations about asset ${this.id}`, error);
utils.writeLog(`ERROR | _getDataFromApi | Getting informations about asset ${this.id}`, error);
utils.writeErrorLog(`ERROR_API | _getDataFromApi`);
return callback(error);
}
@ -186,14 +186,14 @@ class Asset {
}
if (!this.group_id) {
utils.writeErrorLog(`Group/Default voice group not found for asset: ${this.group_id}`);
utils.writeLog(`Group/Default voice group not found for asset: ${this.group_id}`);
}
utils.writeLog(`Group: ${this.group_id} found for asset: ${this.id}`);
utils.writeLog(`Informations about asset ${this.id} received | groupId: ${this.group_id} | groupName: ${this.groupName}`);
return callback();
} else {
utils.writeLog(`Error getting informations about asset ${this.id}`, error);
utils.writeLog(`ERROR | _getGroupsFromApi | Getting informations about asset ${this.id}`, error);
utils.writeErrorLog(`ERROR_API | _getGroupsFromApi`);
return callback(error);
}
@ -269,7 +269,7 @@ class Asset {
};
this.mumble = new Mumble(this.id, murmurConnectionDetails, (err) => {
if (err) {
utils.writeLog(`Asset ${this.id} Murmur connection error`, err);
utils.writeLog(`ERROR | _connectToMurmur | Asset ${this.id} Murmur connection error`, err);
utils.writeErrorLog(`ERROR_MURMUR | _connectToMurmur`);
return callback(err);
} else {
@ -294,8 +294,7 @@ class Asset {
utils.writeLog(`Asset ${this.id} audio registered`);
return callback();
} else {
console.log('body', body)
utils.writeLog(`Asset ${this.id} audio registered error`, error);
utils.writeLog(`ERROR | _register | Asset ${this.id} audio registered error`, error);
utils.writeErrorLog(`ERROR_AUDIO | _register`);
return callback(error);
}
@ -336,7 +335,7 @@ class Asset {
if (callback) return callback('Cannot send group-monitoring: Hub not connected');
}
} else {
utils.writeLog(`Asset ${this.id} audio enter group error`, error);
utils.writeLog(`ERROR | _moveToChannel | Asset ${this.id} audio enter group error`, error);
utils.writeErrorLog(`ERROR_AUDIO | _moveToChannel`);
return callback(error);
}
@ -389,7 +388,7 @@ class Asset {
console.log(chalk.yellow(`[RECORDER] for asset ${this.id} not found`));
}
} else {
utils.writeLog(`Error getting record for asset ${this.id} | ${error}`);
utils.writeLog(`ERROR | _getRecord | Error getting record for asset ${this.id} | ${error}`);
utils.writeErrorLog(`ERROR_RECORDER | _getRecord`);
}
let assetIds = configs.assets.ids;
@ -461,7 +460,7 @@ class Asset {
this._sendPttRelease();
const now = +new Date();
if(this.endTime > now) {
this._makePtt();
this._makePtt(callback);
} else {
setTimeout(() => {