mirror of
https://github.com/eclipse/upm.git
synced 2025-03-24 01:10:22 +03:00
sensortemplate: Use SensorTemplate as class name in json
Replace TemplateItem with SensorTemplate in the sensortemplate.json and json ctest. Change to contributions.md which removes all objects with a key starting with "//" from the generated sensor .json file. This allows the json ctest to pass OOTB for new sensor libraries generated from the make_new_sensor function. Signed-off-by: Noel Eck <noel.eck@intel.com>
This commit is contained in:
parent
35e4fc012e
commit
bc4f124d54
@ -125,6 +125,8 @@ function make_new_sensor {
|
|||||||
# Search/replace the new files, replacing all instances of sensortemplate
|
# Search/replace the new files, replacing all instances of sensortemplate
|
||||||
perl -p -i -e "s/SensorTemplate/${SensorName}/g" src/${sensorname}/* examples/*/*${sensorname}* examples/*/*${SensorName}*
|
perl -p -i -e "s/SensorTemplate/${SensorName}/g" src/${sensorname}/* examples/*/*${sensorname}* examples/*/*${SensorName}*
|
||||||
perl -p -i -e "s/sensortemplate/${sensorname}/g" src/${sensorname}/* examples/*/*${sensorname}* examples/*/*${SensorName}*
|
perl -p -i -e "s/sensortemplate/${sensorname}/g" src/${sensorname}/* examples/*/*${sensorname}* examples/*/*${SensorName}*
|
||||||
|
# Remove objects starting with "//" from the new library descriptor .json file
|
||||||
|
perl -p -i -e 'BEGIN{undef $/;} s/\s+"\/\/.*?},//smg' src/${sensorname}/${sensorname}.json
|
||||||
# Add mynewmodule example target for java
|
# Add mynewmodule example target for java
|
||||||
perl -p -i -e "s/^((.*)SensorTemplateSample sensortemplate(.*))/\1\n\2${SensorName}Sample ${sensorname}\3/g" examples/java/CMakeLists.txt
|
perl -p -i -e "s/^((.*)SensorTemplateSample sensortemplate(.*))/\1\n\2${SensorName}Sample ${sensorname}\3/g" examples/java/CMakeLists.txt
|
||||||
# Add mynewmodule example mappings for doxygen
|
# Add mynewmodule example mappings for doxygen
|
||||||
|
@ -17,12 +17,12 @@
|
|||||||
"required": true
|
"required": true
|
||||||
},
|
},
|
||||||
"Sensor Class": {
|
"Sensor Class": {
|
||||||
"// TemplateItem": {
|
"// SensorTemplate": {
|
||||||
"comment": "Template Item",
|
"comment": "Template Item",
|
||||||
"type": "object",
|
"type": "object",
|
||||||
"required": true
|
"required": true
|
||||||
},
|
},
|
||||||
"TemplateItem": {
|
"SensorTemplate": {
|
||||||
"// Name": {
|
"// Name": {
|
||||||
"comment": "Sensor display name as indicated by the datasheet or manufacturer",
|
"comment": "Sensor display name as indicated by the datasheet or manufacturer",
|
||||||
"type": "string",
|
"type": "string",
|
||||||
@ -86,7 +86,7 @@
|
|||||||
"type": "string",
|
"type": "string",
|
||||||
"required": false
|
"required": false
|
||||||
},
|
},
|
||||||
"Image": "sensortemplate.jpg",
|
"Image": "sensortemplate.png",
|
||||||
"// Examples": {
|
"// Examples": {
|
||||||
"comment": "Functional examples showing the main use cases for this sensor class. At least one is required.",
|
"comment": "Functional examples showing the main use cases for this sensor class. At least one is required.",
|
||||||
"type": "object",
|
"type": "object",
|
||||||
|
@ -68,11 +68,11 @@ function checkObjectSpecs(object, target) {
|
|||||||
var realKeyName = key.replace('// ', '');
|
var realKeyName = key.replace('// ', '');
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* "TemplateItem" is a special case
|
* "SensorTemplate" is a special case
|
||||||
* For objects, the TemplateItem define
|
* For objects, the SensorTemplate define
|
||||||
* the specs for each of the items in the object
|
* the specs for each of the items in the object
|
||||||
*/
|
*/
|
||||||
if (realKeyName === 'TemplateItem') {
|
if (realKeyName === 'SensorTemplate') {
|
||||||
for (var key in target) {
|
for (var key in target) {
|
||||||
(function(key, target){
|
(function(key, target){
|
||||||
/**
|
/**
|
||||||
@ -89,7 +89,7 @@ function checkObjectSpecs(object, target) {
|
|||||||
describe(key, function () {
|
describe(key, function () {
|
||||||
checkObjectSpecs(object, target);
|
checkObjectSpecs(object, target);
|
||||||
});
|
});
|
||||||
})(object['TemplateItem'], target[key]);
|
})(object['SensorTemplate'], target[key]);
|
||||||
}
|
}
|
||||||
})(key, target);
|
})(key, target);
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user