mirror of
https://github.com/nasa/openmct.git
synced 2025-06-16 14:18:16 +00:00
Added providers, adapters, data dictionary
This commit is contained in:
@ -19,6 +19,7 @@
|
|||||||
"platform/features/plot",
|
"platform/features/plot",
|
||||||
"platform/features/scrolling",
|
"platform/features/scrolling",
|
||||||
"platform/features/events",
|
"platform/features/events",
|
||||||
|
"platform/features/conductor",
|
||||||
"platform/forms",
|
"platform/forms",
|
||||||
"platform/identity",
|
"platform/identity",
|
||||||
"platform/persistence/local",
|
"platform/persistence/local",
|
||||||
@ -29,5 +30,6 @@
|
|||||||
|
|
||||||
"example/imagery",
|
"example/imagery",
|
||||||
"example/eventGenerator",
|
"example/eventGenerator",
|
||||||
"example/generator"
|
"example/generator",
|
||||||
|
"example/msl"
|
||||||
]
|
]
|
||||||
|
64
example/msl/bundle.json
Normal file
64
example/msl/bundle.json
Normal file
@ -0,0 +1,64 @@
|
|||||||
|
{
|
||||||
|
"name" : "Mars Science Laboratory Data Adapter",
|
||||||
|
"extensions" : {
|
||||||
|
"types": [
|
||||||
|
{
|
||||||
|
"name":"Mars Science Laboratory",
|
||||||
|
"key": "msl.curiosity",
|
||||||
|
"glyph": "o"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "Instrument",
|
||||||
|
"key": "msl.instrument",
|
||||||
|
"glyph": "o",
|
||||||
|
"model": {"composition": []}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "Measurement",
|
||||||
|
"key": "msl.measurement",
|
||||||
|
"glyph": "T",
|
||||||
|
"model": {"telemetry": {}},
|
||||||
|
"telemetry": {
|
||||||
|
"source": "msl.source",
|
||||||
|
"domains": [
|
||||||
|
{
|
||||||
|
"name": "Time",
|
||||||
|
"key": "timestamp"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"roots": [
|
||||||
|
{
|
||||||
|
"id": "msl:curiosity",
|
||||||
|
"priority" : "preferred",
|
||||||
|
"model": {
|
||||||
|
"type": "msl.curiosity",
|
||||||
|
"name": "Mars Science Laboratory",
|
||||||
|
"composition": []
|
||||||
|
}
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"services": [
|
||||||
|
{
|
||||||
|
"key":"rems.adapter",
|
||||||
|
"implementation": "RemsTelemetryServerAdapter.js"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"runs": [
|
||||||
|
{
|
||||||
|
"implementation": "RemsTelemetryInitializer.js",
|
||||||
|
"depends": ["rems.adapter", "objectService"]
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"components": [
|
||||||
|
{
|
||||||
|
"provides": "modelService",
|
||||||
|
"type": "provider",
|
||||||
|
"implementation": "RemsTelemetryModelProvider.js",
|
||||||
|
"depends": ["rems.adapter"]
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
}
|
69
example/msl/src/RemsDataDictionary.js
Normal file
69
example/msl/src/RemsDataDictionary.js
Normal file
@ -0,0 +1,69 @@
|
|||||||
|
/*****************************************************************************
|
||||||
|
* Open MCT Web, Copyright (c) 2014-2015, United States Government
|
||||||
|
* as represented by the Administrator of the National Aeronautics and Space
|
||||||
|
* Administration. All rights reserved.
|
||||||
|
*
|
||||||
|
* Open MCT Web is licensed under the Apache License, Version 2.0 (the
|
||||||
|
* "License"); you may not use this file except in compliance with the License.
|
||||||
|
* You may obtain a copy of the License at
|
||||||
|
* http://www.apache.org/licenses/LICENSE-2.0.
|
||||||
|
*
|
||||||
|
* Unless required by applicable law or agreed to in writing, software
|
||||||
|
* distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
|
||||||
|
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
|
||||||
|
* License for the specific language governing permissions and limitations
|
||||||
|
* under the License.
|
||||||
|
*
|
||||||
|
* Open MCT Web includes source code licensed under additional open source
|
||||||
|
* licenses. See the Open Source Licenses file (LICENSES.md) included with
|
||||||
|
* this source code distribution or the Licensing information page available
|
||||||
|
* at runtime from the About dialog for additional information.
|
||||||
|
*****************************************************************************/
|
||||||
|
/*global define*/
|
||||||
|
|
||||||
|
define(
|
||||||
|
[],
|
||||||
|
function () {
|
||||||
|
return {
|
||||||
|
"name": "Mars Science Laboratory",
|
||||||
|
"identifier": "msl",
|
||||||
|
"instruments": [
|
||||||
|
{
|
||||||
|
"name":"rems",
|
||||||
|
"identifier": "rems",
|
||||||
|
"measurements": [
|
||||||
|
{
|
||||||
|
"name": "Min. Air Temperature",
|
||||||
|
"identifier": "rems.min_temp",
|
||||||
|
"units": "degrees",
|
||||||
|
"type": "float"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "Max. Air Temperatyre",
|
||||||
|
"identifier": "rems.max_temp",
|
||||||
|
"units": "degrees",
|
||||||
|
"type": "float"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "Atmospheric Pressure",
|
||||||
|
"identifier": "rems.pressure",
|
||||||
|
"units": "pascals",
|
||||||
|
"type": "float"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "Min. Ground Temperature",
|
||||||
|
"identifier": "rems.min_gts_temp",
|
||||||
|
"units": "degrees",
|
||||||
|
"type": "float"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "Max. Ground Temperature",
|
||||||
|
"identifier": "rems.max_gts_temp",
|
||||||
|
"units": "degrees",
|
||||||
|
"type": "float"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
});
|
58
example/msl/src/RemsTelemetryInitializer.js
Normal file
58
example/msl/src/RemsTelemetryInitializer.js
Normal file
@ -0,0 +1,58 @@
|
|||||||
|
/*****************************************************************************
|
||||||
|
* Open MCT Web, Copyright (c) 2014-2015, United States Government
|
||||||
|
* as represented by the Administrator of the National Aeronautics and Space
|
||||||
|
* Administration. All rights reserved.
|
||||||
|
*
|
||||||
|
* Open MCT Web is licensed under the Apache License, Version 2.0 (the
|
||||||
|
* "License"); you may not use this file except in compliance with the License.
|
||||||
|
* You may obtain a copy of the License at
|
||||||
|
* http://www.apache.org/licenses/LICENSE-2.0.
|
||||||
|
*
|
||||||
|
* Unless required by applicable law or agreed to in writing, software
|
||||||
|
* distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
|
||||||
|
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
|
||||||
|
* License for the specific language governing permissions and limitations
|
||||||
|
* under the License.
|
||||||
|
*
|
||||||
|
* Open MCT Web includes source code licensed under additional open source
|
||||||
|
* licenses. See the Open Source Licenses file (LICENSES.md) included with
|
||||||
|
* this source code distribution or the Licensing information page available
|
||||||
|
* at runtime from the About dialog for additional information.
|
||||||
|
*****************************************************************************/
|
||||||
|
/*global define*/
|
||||||
|
|
||||||
|
define(
|
||||||
|
function (){
|
||||||
|
"use strict";
|
||||||
|
|
||||||
|
var TAXONOMY_ID = "msl.curiosity",
|
||||||
|
PREFIX = "msl_tlm:";
|
||||||
|
|
||||||
|
function RemsTelemetryInitializer(adapter, objectService) {
|
||||||
|
function makeId(element) {
|
||||||
|
return PREFIX + element.identifier;
|
||||||
|
}
|
||||||
|
|
||||||
|
function initializeTaxonomy(dictionary) {
|
||||||
|
function getTaxonomyObject(domainObjects) {
|
||||||
|
return domainObjects[TAXONOMY_ID];
|
||||||
|
}
|
||||||
|
|
||||||
|
function populateModel (taxonomyObject) {
|
||||||
|
return taxonomyObject.useCapability(
|
||||||
|
"mutation",
|
||||||
|
function (model) {
|
||||||
|
model.name = dictionary.name;
|
||||||
|
model.composition = dictionary.instruments.map(makeId);
|
||||||
|
}
|
||||||
|
)
|
||||||
|
}
|
||||||
|
|
||||||
|
objectService.getObjects([TAXONOMY_ID])
|
||||||
|
.then(getTaxonomyObject)
|
||||||
|
.then(populateModel);
|
||||||
|
}
|
||||||
|
initializeTaxonomy(adapter.dictionary);
|
||||||
|
}
|
||||||
|
return RemsTelemetryInitializer;
|
||||||
|
});
|
86
example/msl/src/RemsTelemetryModelProvider.js
Normal file
86
example/msl/src/RemsTelemetryModelProvider.js
Normal file
@ -0,0 +1,86 @@
|
|||||||
|
/*****************************************************************************
|
||||||
|
* Open MCT Web, Copyright (c) 2014-2015, United States Government
|
||||||
|
* as represented by the Administrator of the National Aeronautics and Space
|
||||||
|
* Administration. All rights reserved.
|
||||||
|
*
|
||||||
|
* Open MCT Web is licensed under the Apache License, Version 2.0 (the
|
||||||
|
* "License"); you may not use this file except in compliance with the License.
|
||||||
|
* You may obtain a copy of the License at
|
||||||
|
* http://www.apache.org/licenses/LICENSE-2.0.
|
||||||
|
*
|
||||||
|
* Unless required by applicable law or agreed to in writing, software
|
||||||
|
* distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
|
||||||
|
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
|
||||||
|
* License for the specific language governing permissions and limitations
|
||||||
|
* under the License.
|
||||||
|
*
|
||||||
|
* Open MCT Web includes source code licensed under additional open source
|
||||||
|
* licenses. See the Open Source Licenses file (LICENSES.md) included with
|
||||||
|
* this source code distribution or the Licensing information page available
|
||||||
|
* at runtime from the About dialog for additional information.
|
||||||
|
*****************************************************************************/
|
||||||
|
/*global define*/
|
||||||
|
|
||||||
|
define(
|
||||||
|
function (){
|
||||||
|
"use strict";
|
||||||
|
|
||||||
|
var PREFIX = "msl_tlm:",
|
||||||
|
FORMAT_MAPPINGS = {
|
||||||
|
float: "number",
|
||||||
|
integer: "number",
|
||||||
|
string: "string"
|
||||||
|
};
|
||||||
|
|
||||||
|
function RemsTelemetryModelProvider(adapter){
|
||||||
|
|
||||||
|
function isRelevant(id) {
|
||||||
|
return id.indexOf(PREFIX) === 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
function makeId(element){
|
||||||
|
return PREFIX + element.identifier;
|
||||||
|
}
|
||||||
|
|
||||||
|
function buildTaxonomy(dictionary){
|
||||||
|
var models = {};
|
||||||
|
|
||||||
|
function addMeasurement(measurement){
|
||||||
|
var format = FORMAT_MAPPINGS[measurement.type];
|
||||||
|
models[makeId(measurement)] = {
|
||||||
|
type: "msl.measurement",
|
||||||
|
name: measurement.name,
|
||||||
|
telemetry: {
|
||||||
|
key: measurement.identifier,
|
||||||
|
ranges: [{
|
||||||
|
key: "value",
|
||||||
|
name: "Value",
|
||||||
|
units: measurement.units,
|
||||||
|
format: format
|
||||||
|
}]
|
||||||
|
}
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
function addInstrument(subsystem) {
|
||||||
|
var measurements = (subsystem.measurements || []);
|
||||||
|
models[makeId(subsystem)] = {
|
||||||
|
type: "msl.instrument",
|
||||||
|
name: subsystem.name,
|
||||||
|
composition: measurements.map(makeId)
|
||||||
|
};
|
||||||
|
measurements.forEach(addMeasurement);
|
||||||
|
}
|
||||||
|
|
||||||
|
(dictionary.instruments || []).forEach(addInstrument);
|
||||||
|
return models;
|
||||||
|
}
|
||||||
|
|
||||||
|
return {
|
||||||
|
getModels: function (ids) {
|
||||||
|
return ids.some(isRelevant) ? buildTaxonomy(adapter.dictionary) : {};
|
||||||
|
}
|
||||||
|
};
|
||||||
|
}
|
||||||
|
return RemsTelemetryModelProvider;
|
||||||
|
});
|
0
example/msl/src/RemsTelemetryProvider.js
Normal file
0
example/msl/src/RemsTelemetryProvider.js
Normal file
40
example/msl/src/RemsTelemetryServerAdapter.js
Normal file
40
example/msl/src/RemsTelemetryServerAdapter.js
Normal file
@ -0,0 +1,40 @@
|
|||||||
|
/*****************************************************************************
|
||||||
|
* Open MCT Web, Copyright (c) 2014-2015, United States Government
|
||||||
|
* as represented by the Administrator of the National Aeronautics and Space
|
||||||
|
* Administration. All rights reserved.
|
||||||
|
*
|
||||||
|
* Open MCT Web is licensed under the Apache License, Version 2.0 (the
|
||||||
|
* "License"); you may not use this file except in compliance with the License.
|
||||||
|
* You may obtain a copy of the License at
|
||||||
|
* http://www.apache.org/licenses/LICENSE-2.0.
|
||||||
|
*
|
||||||
|
* Unless required by applicable law or agreed to in writing, software
|
||||||
|
* distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
|
||||||
|
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
|
||||||
|
* License for the specific language governing permissions and limitations
|
||||||
|
* under the License.
|
||||||
|
*
|
||||||
|
* Open MCT Web includes source code licensed under additional open source
|
||||||
|
* licenses. See the Open Source Licenses file (LICENSES.md) included with
|
||||||
|
* this source code distribution or the Licensing information page available
|
||||||
|
* at runtime from the About dialog for additional information.
|
||||||
|
*****************************************************************************/
|
||||||
|
/*global define*/
|
||||||
|
|
||||||
|
define(
|
||||||
|
["./RemsDataDictionary"],
|
||||||
|
function (RemsDataDictionary) {
|
||||||
|
"use strict";
|
||||||
|
|
||||||
|
/**
|
||||||
|
* For now just returns a hard-coded data dictionary, but in future
|
||||||
|
* could be adapted to provide data from remote source.
|
||||||
|
* @constructor
|
||||||
|
*/
|
||||||
|
function RemsTelemetryServerAdapter(){
|
||||||
|
return {
|
||||||
|
"dictionary": RemsDataDictionary
|
||||||
|
};
|
||||||
|
}
|
||||||
|
return RemsTelemetryServerAdapter;
|
||||||
|
});
|
Reference in New Issue
Block a user