mirror of
https://github.com/nasa/openmct.git
synced 2025-06-16 14:18:16 +00:00
Added telemetry request ID prefix
This commit is contained in:
@ -19,7 +19,7 @@
|
|||||||
"glyph": "T",
|
"glyph": "T",
|
||||||
"model": {"telemetry": {}},
|
"model": {"telemetry": {}},
|
||||||
"telemetry": {
|
"telemetry": {
|
||||||
"source": "msl.source",
|
"source": "rems.source",
|
||||||
"domains": [
|
"domains": [
|
||||||
{
|
{
|
||||||
"name": "Time",
|
"name": "Time",
|
||||||
@ -29,6 +29,12 @@
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
|
"constants": [
|
||||||
|
{
|
||||||
|
"key": "REMS_WS_URL",
|
||||||
|
"value": "http://cab.inta-csic.es/rems/wp-content/plugins/marsweather-widget/api.php"
|
||||||
|
}
|
||||||
|
],
|
||||||
"roots": [
|
"roots": [
|
||||||
{
|
{
|
||||||
"id": "msl:curiosity",
|
"id": "msl:curiosity",
|
||||||
@ -44,7 +50,7 @@
|
|||||||
{
|
{
|
||||||
"key":"rems.adapter",
|
"key":"rems.adapter",
|
||||||
"implementation": "RemsTelemetryServerAdapter.js",
|
"implementation": "RemsTelemetryServerAdapter.js",
|
||||||
"depends": ["$q", "$http"]
|
"depends": ["$q", "$http", "REMS_WS_URL"]
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
"runs": [
|
"runs": [
|
||||||
|
@ -39,7 +39,7 @@ define(
|
|||||||
"type": "float"
|
"type": "float"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"name": "Max. Air Temperatyre",
|
"name": "Max. Air Temperature",
|
||||||
"identifier": "rems.max_temp",
|
"identifier": "rems.max_temp",
|
||||||
"units": "degrees",
|
"units": "degrees",
|
||||||
"type": "float"
|
"type": "float"
|
||||||
|
@ -27,13 +27,13 @@ define(
|
|||||||
function RemsTelemetrySeries(data) {
|
function RemsTelemetrySeries(data) {
|
||||||
return {
|
return {
|
||||||
getPointCount: function(){
|
getPointCount: function(){
|
||||||
return 100;
|
return data.length;
|
||||||
},
|
},
|
||||||
getDomainValue: function(index) {
|
getDomainValue: function(index) {
|
||||||
return index + 45 * 365 * 24 * 60 * 60 * 1000;
|
return data[index].date;
|
||||||
},
|
},
|
||||||
getRangeValue: function(index){
|
getRangeValue: function(index){
|
||||||
return index * 10;
|
return data[index].value;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -25,20 +25,43 @@ define(
|
|||||||
["./RemsDataDictionary"],
|
["./RemsDataDictionary"],
|
||||||
function (RemsDataDictionary) {
|
function (RemsDataDictionary) {
|
||||||
"use strict";
|
"use strict";
|
||||||
|
|
||||||
|
var TERRESTRIAL_DATE = "terrestrial_date",
|
||||||
|
NO_DATA = "--",
|
||||||
|
PREFIX = "rems.";
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* For now just returns a hard-coded data dictionary, but in future
|
* For now just returns a hard-coded data dictionary, but in future
|
||||||
* could be adapted to provide data from remote source.
|
* could be adapted to provide data from remote source.
|
||||||
* @constructor
|
* @constructor
|
||||||
*/
|
*/
|
||||||
function RemsTelemetryServerAdapter($q, $http){
|
function RemsTelemetryServerAdapter($q, $http, REMS_WS_URL){
|
||||||
var histories = {};
|
var histories = {},
|
||||||
|
deferred;
|
||||||
|
function requestHistory (id) {
|
||||||
|
$http.get(REMS_WS_URL).then(
|
||||||
|
function(response){
|
||||||
|
/**
|
||||||
|
* All history is fetched in one go, cache it all to save round trips to the server on subsequent requests
|
||||||
|
*/
|
||||||
|
response.data.soles.forEach(function(solData){
|
||||||
|
for (var prop in solData){
|
||||||
|
var propName = PREFIX + prop;
|
||||||
|
histories[propName] = histories[propName] || [];
|
||||||
|
histories[propName].push({date: Date.parse(solData[TERRESTRIAL_DATE]), value: solData[prop]=== NO_DATA ? undefined : solData[prop]});
|
||||||
|
}
|
||||||
|
});
|
||||||
|
deferred.resolve(histories[id]);
|
||||||
|
}, function (error){
|
||||||
|
deferred.reject(error);
|
||||||
|
});
|
||||||
|
}
|
||||||
return {
|
return {
|
||||||
dictionary: RemsDataDictionary,
|
dictionary: RemsDataDictionary,
|
||||||
history: function(id) {
|
history: function(id) {
|
||||||
histories[id] = histories[id] || $q.defer();
|
deferred = deferred || $q.defer();
|
||||||
return histories[id].promise;
|
requestHistory(id);
|
||||||
|
return deferred.promise;
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user