Compare commits
2 Commits
90b8379e65
...
dev-contai
Author | SHA1 | Date | |
---|---|---|---|
aec2b1acff | |||
5cc8860e0c |
20
Dockerfile
Normal file
20
Dockerfile
Normal file
@ -0,0 +1,20 @@
|
||||
FROM ubuntu:16.04
|
||||
|
||||
RUN apt-get update
|
||||
RUN apt-get -qq update
|
||||
RUN apt-get install -y build-essential
|
||||
RUN apt-get install -y curl
|
||||
RUN apt-get install -y python-minimal
|
||||
RUN curl -sL https://deb.nodesource.com/setup_8.x | bash
|
||||
RUN apt-get install -y nodejs
|
||||
|
||||
WORKDIR /simulator
|
||||
ADD . /simulator
|
||||
|
||||
RUN apt-get install -y libasound2-dev
|
||||
RUN npm i -g node-gyp
|
||||
RUN apt install -y alsa-base pulseaudio
|
||||
|
||||
RUN npm install --unsafe-perm
|
||||
|
||||
# docker run -it -v /tmp/.X11-unix:/tmp/.X11-unix -e DISPLAY=unix$DISPLAY --device /dev/snd
|
@ -24,6 +24,9 @@ gps_lng_start_point = 24.776126
|
||||
testing_period = 1500
|
||||
|
||||
[assets]
|
||||
# linx-simulator-1
|
||||
ids = [15]
|
||||
|
||||
# linx-simulator-1 - linx-simulator-10
|
||||
# ids = [15,16,17,18,19,20,21,22,23,24]
|
||||
|
||||
@ -35,13 +38,13 @@ testing_period = 1500
|
||||
# ]
|
||||
|
||||
# linx-simulator-1 - linx-simulator-50
|
||||
ids = [
|
||||
15,16,17,18,19,20,21,22,23,24,
|
||||
25,26,27,28,29,30,31,32,33,34,
|
||||
35,36,37,38,39,40,41,42,43,44,
|
||||
45,46,47,48,49,50,51,52,53,54,
|
||||
55,56,57,58,59,60,61,62,63,64
|
||||
]
|
||||
# ids = [
|
||||
# 15,16,17,18,19,20,21,22,23,24,
|
||||
# 25,26,27,28,29,30,31,32,33,34,
|
||||
# 35,36,37,38,39,40,41,42,43,44,
|
||||
# 45,46,47,48,49,50,51,52,53,54,
|
||||
# 55,56,57,58,59,60,61,62,63,64
|
||||
# ]
|
||||
|
||||
[sounds]
|
||||
sound = 'sound.mp3'
|
||||
|
28
src/asset.js
28
src/asset.js
@ -27,6 +27,7 @@ class Asset {
|
||||
this.startTime = +new Date();
|
||||
this.pttEndSuccessfully = false;
|
||||
this.assetProps = {};
|
||||
this.murmurPassword = '';
|
||||
|
||||
utils.writeLog(`Creating asset ${id}`)
|
||||
|
||||
@ -87,6 +88,32 @@ class Asset {
|
||||
// Here are the asset fields.
|
||||
this.assetProps = bodyObj.data;
|
||||
// console.log('!!!!!!!!!!!!!!!!!!!!!!!!!!!!', this.assetProps)
|
||||
return this._getMumblePassword(callback);
|
||||
} else {
|
||||
utils.writeLog(`ERROR getting informations about asset ${this.id}`, error);
|
||||
utils.writeErrorLog(`ERROR_API`);
|
||||
return callback(error);
|
||||
}
|
||||
}
|
||||
);
|
||||
}
|
||||
|
||||
_getMumblePassword(callback) {
|
||||
utils.writeLog(`Get Mumble password for asset ${this.id}`);
|
||||
Request.get(
|
||||
this.apiEndpoint + '/asset/' + this.id + '/account',
|
||||
{
|
||||
headers: {
|
||||
Authorization: `Bearer ${this.token}`
|
||||
}
|
||||
},
|
||||
(error, response, body) => {
|
||||
if (!error && (response.statusCode === 200 || response.statusCode === 201)) {
|
||||
let bodyObj = JSON.parse(body);
|
||||
|
||||
// Here are the asset fields.
|
||||
this.murmurPassword = bodyObj.data.configuration.mumble_password;
|
||||
// console.log('!!!!!!!!!!!!!!!!!!!!!!!!!!!!', this.assetProps)
|
||||
return this._getGroupsFromApi(callback);
|
||||
} else {
|
||||
utils.writeLog(`ERROR getting informations about asset ${this.id}`, error);
|
||||
@ -195,6 +222,7 @@ class Asset {
|
||||
}
|
||||
|
||||
_connectToMurmur(callback) {
|
||||
this.configs.murmurPassword = this.murmurPassword;
|
||||
|
||||
this.mumble = new Mumble(this.id, this.configs, (err) => {
|
||||
if (err) {
|
||||
|
@ -12,12 +12,12 @@ const OpusEncoder = require('node-opus').OpusEncoder;
|
||||
class Mumble {
|
||||
|
||||
constructor(id, configs, connectedCallback) {
|
||||
|
||||
console.log('------', configs)
|
||||
this.id = id;
|
||||
this.configs = configs;
|
||||
let mumble = configs.mumble;
|
||||
this._createCertificatesForUser(id, () => {
|
||||
this._makeMumbleConnection(id, mumble.port, mumble.host, id, id, connectedCallback);
|
||||
this._makeMumbleConnection(id, mumble.port, mumble.host, id, this.configs.murmurPassword, connectedCallback);
|
||||
})
|
||||
}
|
||||
|
||||
@ -87,7 +87,7 @@ class Mumble {
|
||||
// Connect to mumble server.
|
||||
this.client = new MumbleClient({
|
||||
username: '' + username,
|
||||
password: '' + password,
|
||||
password,
|
||||
codecs: NodeCodecs
|
||||
});
|
||||
this.client.connectDataStream(this.socket);
|
||||
|
Reference in New Issue
Block a user