Initial commit
This commit is contained in:
commit
b7d90b9afe
16245 files changed
+3396666
No files matched your search
@@ -0,0 +1,146 @@
|
||||
var socket;
|
||||
var moutObjectId;
|
||||
var moutAreaId;
|
||||
var equipmentNumber;
|
||||
|
||||
$(function() {
|
||||
|
||||
$("#connectWs").click(function() {
|
||||
connect();
|
||||
});
|
||||
$('#changeFloor').val('floor1').selectmenu('refresh');
|
||||
|
||||
});
|
||||
|
||||
function connect(){
|
||||
var ipadresse=document.getElementById("ipadresse").value;
|
||||
console.log("ipadresse="+ipadresse);
|
||||
var host = "ws://"+ipadresse;
|
||||
console.log("connect "+ipadresse);
|
||||
try{
|
||||
socket = new WebSocket(host);
|
||||
console.log("connect state:" +socket.readyState);
|
||||
socket.onopen = function(){
|
||||
console.log("onopen: connect state:" +socket.readyState);
|
||||
document.getElementById("Serverconnect").innerHTML = "Server: connected";
|
||||
document.getElementById("Serverconnect").style.color = "green"
|
||||
}
|
||||
|
||||
socket.onmessage = function(msg){
|
||||
console.log('<p class="message">Received: '+msg.data);
|
||||
}
|
||||
|
||||
socket.onclose = function(){
|
||||
console.log('<p class="event">Socket Status: '+socket.readyState+' (Closed)');
|
||||
document.getElementById("Serverconnect").innerHTML = "Server: not connected";
|
||||
document.getElementById("Serverconnect").style.color = "red"
|
||||
}
|
||||
|
||||
} catch(exception){
|
||||
console.log('<p>Error'+exception);
|
||||
}
|
||||
}
|
||||
|
||||
function sendRoom(moutObjectId, moutAreaId, moutRoomId, lat, lon, z){
|
||||
equipmentNumber = Number(document.getElementById("equipmentNumber").value);
|
||||
var type = "PositionReport";
|
||||
var timestamp = Date.now();
|
||||
console.log("sendRoom: moutRoomId="+moutRoomId);
|
||||
var latRad = lat*Math.PI/180;
|
||||
var lonRad = lon*Math.PI/180;
|
||||
var jsonMsg = JSON.stringify({ //make JSON-string from the data
|
||||
data:{
|
||||
equipmentNumber: equipmentNumber,
|
||||
lat: latRad,
|
||||
lon: lonRad,
|
||||
moutAreaId: moutAreaId,
|
||||
moutObjectId: moutObjectId,
|
||||
moutRoomId: moutRoomId,
|
||||
timestamp: timestamp,
|
||||
z: z
|
||||
},
|
||||
type: type
|
||||
});
|
||||
|
||||
//socket.send(jsonMsg); //send the JSON telegram
|
||||
|
||||
var jsonMsgNeu = JSON.stringify({ //make JSON-string from the data
|
||||
type:"PositionReport",
|
||||
typeId:21,
|
||||
data:{
|
||||
geoPosition:{
|
||||
lat: latRad,
|
||||
lon: lonRad,
|
||||
z: z
|
||||
},
|
||||
gpsQuality:{
|
||||
dgpsModeAvailable : false,
|
||||
moreThan4SatellitesAvailable: false,
|
||||
pdopValue:0
|
||||
},
|
||||
header:{
|
||||
equipmentNumber: equipmentNumber,
|
||||
timeStamp:timestamp},
|
||||
opsPosition:{
|
||||
moutObjectId : 90,
|
||||
moutRoomId : 7549,
|
||||
opsId : 0},
|
||||
relPosition:{
|
||||
offsetX: 0,
|
||||
offsetY: 0,
|
||||
offsetZ:0}
|
||||
}});
|
||||
console.log(jsonMsgNeu);
|
||||
//socket.send(jsonMsgNeu);
|
||||
// Example:
|
||||
// jsonStr: {"data":{"geoPosition":{"lat":0.9259749342860095,"lon":0.15527446692104546,"z":2},"gpsQuality":{"dgpsModeAvailable":false,"moreThan4SatellitesAvailable":false,"pdopValue":0},"header":{"equipmentNumber":1006,"timeStamp":1581525171137},"opsPosition":{"moutObjectId":90,"moutRoomId":7549,"opsId":0},"relPosition":{"offsetX":0,"offsetY":0,"offsetZ":0}},"type":"PositionReport","typeId":21}
|
||||
}
|
||||
|
||||
function updateUnix(){ //update timestamp
|
||||
date = Date.now();
|
||||
document.getElementById("timestamp").value= date;
|
||||
}
|
||||
|
||||
function showHideFunction() {
|
||||
var x = document.getElementById('inputmenu');
|
||||
if (x.style.display === 'none') {
|
||||
x.style.display = 'block';
|
||||
} else {
|
||||
x.style.display = 'none';
|
||||
}
|
||||
}
|
||||
function hideFunction() {
|
||||
var x = document.getElementById('inputmenu');
|
||||
x.style.display = 'none';
|
||||
}
|
||||
function showFunction() {
|
||||
var x = document.getElementById('inputmenu');
|
||||
x.style.display = 'block';
|
||||
}
|
||||
function hideButtonsFunction() {
|
||||
var x = document.getElementById('buttons');
|
||||
x.style.display = 'none';
|
||||
}
|
||||
function showButtonsFunction() {
|
||||
var x = document.getElementById('buttons');
|
||||
x.style.display = 'block';
|
||||
}
|
||||
function hideMoveFunction() {
|
||||
hideFunction();
|
||||
hideButtonsFunction();
|
||||
var x = document.getElementById('moveMenu');
|
||||
x.style.display = 'none';
|
||||
}
|
||||
function showMoveFunction() {
|
||||
hideFunction();
|
||||
hideButtonsFunction();
|
||||
var x = document.getElementById('moveMenu');
|
||||
x.style.display = 'block';
|
||||
}
|
||||
function backToMenuFunction() {
|
||||
hideMoveFunction();
|
||||
showFunction();
|
||||
showButtonsFunction();
|
||||
var x = document.getElementById('menu');
|
||||
x.style.display = 'block';
|
||||
}
|
||||
Reference in new issue
Block a user