mirror of
https://github.com/eclipse/upm.git
synced 2025-07-06 20:01:12 +03:00
Compare commits
6 Commits
master
...
json-testi
Author | SHA1 | Date | |
---|---|---|---|
c66bcc656a | |||
d52c2df7c6 | |||
02d8a16d4b | |||
4bb652cb4b | |||
59dfed087e | |||
e7f4529711 |
3
.gitignore
vendored
3
.gitignore
vendored
@ -11,3 +11,6 @@ build*/
|
||||
# Temp files
|
||||
*.swp
|
||||
*~
|
||||
|
||||
# Node modules
|
||||
**/node_modules
|
||||
|
@ -149,6 +149,14 @@ find_package (JPEG)
|
||||
# Find nodejs
|
||||
if (BUILDSWIGNODE)
|
||||
find_package (Node REQUIRED)
|
||||
if (BUILDTESTS)
|
||||
find_package (Npm REQUIRED)
|
||||
if(NPM_EXECUTABLE)
|
||||
message(STATUS "NPM Executable found at: ${NPM_EXECUTABLE}")
|
||||
else()
|
||||
message(FATAL_ERROR "Please install NPM first, you can't run tests without it")
|
||||
endif()
|
||||
endif (BUILDTESTS)
|
||||
endif (BUILDSWIGNODE)
|
||||
|
||||
# Find JAVA/JNI
|
||||
|
13
cmake/modules/FindNpm.cmake
Normal file
13
cmake/modules/FindNpm.cmake
Normal file
@ -0,0 +1,13 @@
|
||||
# Finding and pointing a variable to the npm executable if found
|
||||
# Only works on Linux systems as of now
|
||||
|
||||
find_program(NPM_EXECUTABLE NAMES npm
|
||||
HINTS
|
||||
/usr
|
||||
)
|
||||
|
||||
if(NPM_EXECUTABLE)
|
||||
message(STATUS "NPM Executable found at ${NPM_EXECUTABLE}")
|
||||
else()
|
||||
message(ERROR "Unable to find NPM installation, please install NPM")
|
||||
endif()
|
@ -12,7 +12,7 @@
|
||||
"Manufacturers": ["Shiji Lighting", "Adafruit"],
|
||||
"Image": "apa102.jpg",
|
||||
"Examples": {
|
||||
"Java": ["apa102.java"],
|
||||
"Java": ["APA102Sample.java"],
|
||||
"Python": ["apa102.py"],
|
||||
"Node.js": ["apa102.js"],
|
||||
"C++": ["apa102.cxx"]
|
||||
@ -42,4 +42,4 @@
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -12,7 +12,7 @@
|
||||
"Manufacturers": ["Avago", "Seeed"],
|
||||
"Image": "apds9002.jpg",
|
||||
"Examples": {
|
||||
"Java": ["apds9002.java"],
|
||||
"Java": ["Apds9002.java"],
|
||||
"Python": ["apds9002.py"],
|
||||
"Node.js": ["apds9002.js"],
|
||||
"C++": ["apds9002.cxx"]
|
||||
@ -58,4 +58,4 @@
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -10,7 +10,6 @@
|
||||
"Connections": ["iio", "i2c"],
|
||||
"Project Type": ["prototyping", "mobile", "robotics"],
|
||||
"Manufacturers": ["Avago", "SparkFun"],
|
||||
"Image": "apds9930.jpg",
|
||||
"Examples": {
|
||||
"C++": ["apds9930.cxx"]
|
||||
},
|
||||
@ -43,4 +42,4 @@
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -10,10 +10,9 @@
|
||||
"Connections": ["i2c"],
|
||||
"Project Type": ["prototyping", "industrial", "commercial"],
|
||||
"Manufacturers": ["DFRobot", "Rohm"],
|
||||
"Image": "bh1750.jpg",
|
||||
"Examples": {
|
||||
"Java": ["BH1750_Example.java"],
|
||||
"Python": ["bh1750"],
|
||||
"Python": ["bh1750.py"],
|
||||
"Node.js": ["bh1750.js"],
|
||||
"C++": ["bh1750.cxx"],
|
||||
"C": ["bh1750.c"]
|
||||
@ -48,4 +47,4 @@
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -10,7 +10,6 @@
|
||||
"Connections": ["i2c", "spi", "gpio"],
|
||||
"Project Type": ["industrial", "commercial"],
|
||||
"Manufacturers": ["bosch"],
|
||||
"Image": "bma250e.jpg",
|
||||
"Examples": {
|
||||
"Java": ["BMA250E_Example.java"],
|
||||
"Python": ["bma250e.py"],
|
||||
@ -72,4 +71,4 @@
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -10,7 +10,6 @@
|
||||
"Connections": ["i2c", "spi", "gpio"],
|
||||
"Project Type": ["industrial", "commercial"],
|
||||
"Manufacturers": ["bosch"],
|
||||
"Image": "bmg160.jpg",
|
||||
"Examples": {
|
||||
"Java": ["BMG160_Example.java"],
|
||||
"Python": ["bmg160.py"],
|
||||
@ -59,4 +58,4 @@
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -10,9 +10,8 @@
|
||||
"Connections": ["i2c"],
|
||||
"Project Type": ["industrial", "commercial"],
|
||||
"Manufacturers": ["bosch"],
|
||||
"Image": "bmi160.jpg",
|
||||
"Examples": {
|
||||
"Java": ["BMI190_Example.java"],
|
||||
"Java": ["BMI160_Example.java"],
|
||||
"Python": ["bmi160.py"],
|
||||
"Node.js": ["bmi160.js"],
|
||||
"C++": ["bmi160.cxx"],
|
||||
|
@ -12,7 +12,6 @@
|
||||
"Connections": ["gpio", "i2c", "spi"],
|
||||
"Project Type": ["prototyping", "industrial"],
|
||||
"Manufacturers": ["adafruit", "seeed", "bosch"],
|
||||
"Image": "bmp280.jpg",
|
||||
"Examples":
|
||||
{
|
||||
"Java": ["BMP280_Example.java"],
|
||||
@ -52,7 +51,6 @@
|
||||
"Connections": ["gpio", "i2c", "spi"],
|
||||
"Project Type": ["prototyping", "industrial"],
|
||||
"Manufacturers": ["adafruit", "seeed", "bosch"],
|
||||
"Image": "bmp280.jpg",
|
||||
"Examples":
|
||||
{
|
||||
"Java": ["BME280_Example.java", "BME280_InterfaceExample"],
|
||||
|
@ -12,7 +12,7 @@
|
||||
"Manufacturers": ["Seeed"],
|
||||
"Kits": ["gsk", "eak", "hak"],
|
||||
"Examples": {
|
||||
"C++": ["grovebutton.cxx"]
|
||||
"C++": ["grove-grovebutton.cxx"]
|
||||
},
|
||||
"Urls": {
|
||||
"Product Pages": ["https://github.com/intel-iot-devkit/upm/tree/master/src/grove"]
|
||||
@ -285,7 +285,7 @@
|
||||
"Connections": ["analog"],
|
||||
"Project Type": ["prototyping"],
|
||||
"Manufacturers": ["Seeed"],
|
||||
"Image": "groveslide.jpg",
|
||||
"Images": "slide.jpg",
|
||||
"Examples": {
|
||||
"Java": ["GroveSlideSample.java"],
|
||||
"Python": ["groveslide.py"],
|
||||
@ -378,4 +378,4 @@
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -12,7 +12,6 @@
|
||||
"Connections": ["pwm"],
|
||||
"Project Type": ["prototyping", "industrial"],
|
||||
"Manufacturers": ["meanwell"],
|
||||
"Image": "hlg150h.jpg",
|
||||
"Examples":
|
||||
{
|
||||
"C++": ["hlg150h.cxx"]
|
||||
|
@ -10,7 +10,6 @@
|
||||
"Connections": ["spi"],
|
||||
"Project Type": ["prototyping", "commercial"],
|
||||
"Manufacturers": ["maxim"],
|
||||
"Image": "max5487.jpg",
|
||||
"Examples": {
|
||||
"Java": ["MAX5487Example.java"],
|
||||
"C++": ["max5487.cxx"]
|
||||
@ -49,4 +48,4 @@
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -10,7 +10,6 @@
|
||||
"Connections": ["i2c"],
|
||||
"Project Type": ["prototyping", "commercial"],
|
||||
"Manufacturers": ["Maxim"],
|
||||
"Image": "maxds3231m.jpg",
|
||||
"Examples": {
|
||||
"Java": ["MAXds3231mExample.java"],
|
||||
"C++": ["maxds3231m.cxx"]
|
||||
@ -54,4 +53,4 @@
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -10,7 +10,6 @@
|
||||
"Connections": ["i2c"],
|
||||
"Project Type": ["prototyping", "industrial"],
|
||||
"Manufacturers": ["MaxBotix"],
|
||||
"Image": "mb704x.jpg",
|
||||
"Examples": {
|
||||
"Java": ["MB704X_Example.java"],
|
||||
"Python": ["mb704x.py"],
|
||||
@ -56,4 +55,4 @@
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -10,7 +10,6 @@
|
||||
"Connections": ["spi", "gpio"],
|
||||
"Project Type": ["prototyping"],
|
||||
"Manufacturers": ["Seeed", "Microchip"],
|
||||
"Image": "mcp2515.jpg",
|
||||
"Examples": {
|
||||
"Java": ["MCP2515_Example.java", "MCP2515_TXRX_Example.java"],
|
||||
"Python": ["mcp2515-txrx.py", "mcp2515.py"],
|
||||
@ -58,4 +57,4 @@
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -10,7 +10,6 @@
|
||||
"Connections": ["analog", "gpio"],
|
||||
"Project Type": ["prototyping"],
|
||||
"Manufacturers": ["DFRobot"],
|
||||
"Image": "mma7361.jpg",
|
||||
"Examples": {
|
||||
"Java": ["MMA7361_Example.java"],
|
||||
"Python": ["mma7361.py"],
|
||||
@ -63,4 +62,4 @@
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -10,7 +10,6 @@
|
||||
"Connections": ["i2c"],
|
||||
"Project Type": ["prototyping", "commercial"],
|
||||
"Manufacturers": ["Freescale", "Adafruit"],
|
||||
"Image": "mma8x5x.jpg",
|
||||
"Examples": {
|
||||
"Python": ["mma8x5x.py"],
|
||||
"C++": ["mma8x5x.cxx"]
|
||||
@ -66,7 +65,6 @@
|
||||
"Connections": ["i2c"],
|
||||
"Project Type": ["prototyping", "commercial"],
|
||||
"Manufacturers": ["Freescale", "Sparkfun"],
|
||||
"Image": "mma8x5x.jpg",
|
||||
"Examples": {
|
||||
"Python": ["mma8x5x.py"],
|
||||
"C++": ["mma8x5x.cxx"]
|
||||
@ -122,7 +120,6 @@
|
||||
"Connections": ["i2c"],
|
||||
"Project Type": ["prototyping", "commercial"],
|
||||
"Manufacturers": ["NXP"],
|
||||
"Image": "mma8x5x.jpg",
|
||||
"Examples": {
|
||||
"Python": ["mma8x5x.py"],
|
||||
"C++": ["mma8x5x.cxx"]
|
||||
@ -178,7 +175,6 @@
|
||||
"Connections": ["i2c"],
|
||||
"Project Type": ["prototyping", "commercial"],
|
||||
"Manufacturers": ["NXP"],
|
||||
"Image": "mma8x5x.jpg",
|
||||
"Examples": {
|
||||
"Python": ["mma8x5x.py"],
|
||||
"C++": ["mma8x5x.cxx"]
|
||||
@ -234,7 +230,6 @@
|
||||
"Connections": ["i2c"],
|
||||
"Project Type": ["prototyping", "commercial"],
|
||||
"Manufacturers": ["NXP"],
|
||||
"Image": "mma8x5x.jpg",
|
||||
"Examples": {
|
||||
"Python": ["mma8x5x.py"],
|
||||
"C++": ["mma8x5x.cxx"]
|
||||
@ -283,4 +278,4 @@
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -10,7 +10,6 @@
|
||||
"Connections": ["i2c"],
|
||||
"Project Type": ["industrial", "commercial"],
|
||||
"Manufacturers": ["Memsic"],
|
||||
"Image": "mmc35240.jpg",
|
||||
"Examples": {
|
||||
"C++": ["mmc35240.cxx"]
|
||||
},
|
||||
|
@ -15,7 +15,7 @@
|
||||
"Java": ["MPU9150Sample.java"],
|
||||
"Python": ["mpu9150.py"],
|
||||
"Node.js": ["mpu9150.js"],
|
||||
"C++": ["mpu9150-ak8975.cxx.cxx", "mpu9150-mpu60x0.cxx", "mpu9150-mpu9250.cxx", "mpu9150.cxx"]
|
||||
"C++": ["mpu9150-ak8975.cxx", "mpu9150-mpu60x0.cxx", "mpu9150-mpu9250.cxx", "mpu9150.cxx"]
|
||||
},
|
||||
"Specifications": {
|
||||
"Vsource": {
|
||||
@ -56,4 +56,4 @@
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -10,7 +10,6 @@
|
||||
"Connections": ["i2c"],
|
||||
"Project Type": ["prototyping", "industrial", "commercial"],
|
||||
"Manufacturers": ["Amsys"],
|
||||
"Image": "ms5611.jpg",
|
||||
"Examples": {
|
||||
"Node.js": ["ms5611.js"],
|
||||
"C++": ["ms5611.cxx"]
|
||||
@ -87,4 +86,4 @@
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -10,7 +10,6 @@
|
||||
"Connections": ["i2c", "spi"],
|
||||
"Project Type": ["prototyping", "industrial", "commercial"],
|
||||
"Manufacturers": ["Measurement Specialties", "SparkFun"],
|
||||
"Image": "abp.jpg",
|
||||
"Examples": {
|
||||
"Java": ["MS5803_Example.java"],
|
||||
"Python": ["ms5803.py"],
|
||||
@ -90,4 +89,4 @@
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -14,7 +14,7 @@
|
||||
"Examples": {
|
||||
"Python": ["grovecircularled.py"],
|
||||
"Node.js": ["grovecircularled.js"],
|
||||
"C++": ["my9221-grovecircularled.cxx.cxx"]
|
||||
"C++": ["my9221-grovecircularled.cxx"]
|
||||
},
|
||||
"Specifications": {
|
||||
"Vsource": {
|
||||
@ -145,4 +145,4 @@
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -10,7 +10,6 @@
|
||||
"Connections": ["uart"],
|
||||
"Project Type": ["prototyping"],
|
||||
"Manufacturers": ["Numato Lab"],
|
||||
"Image": "nlgpio16.jpg",
|
||||
"Examples": {
|
||||
"Python": ["nlgpio16.py"],
|
||||
"Node.js": ["nlgpio16.js"],
|
||||
@ -56,4 +55,4 @@
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -10,7 +10,6 @@
|
||||
"Connections": ["uart", "gpio"],
|
||||
"Project Type": ["prototyping", "industrial", "commercial"],
|
||||
"Manufacturers": ["DFRobot", "Seeed"],
|
||||
"Image": "nmea_gps.jpg",
|
||||
"Examples": {
|
||||
"Java": ["NMEAGPS_Example.java", "NMEAGPS_I2C_Example.java"],
|
||||
"Python": ["nmea_gps.py", "nmea_gps_i2c.py"],
|
||||
@ -47,4 +46,4 @@
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -10,7 +10,6 @@
|
||||
"Connections": ["uart"],
|
||||
"Project Type": ["commercial"],
|
||||
"Manufacturers": ["Aeon Labs"],
|
||||
"Image": "dsb09104.jpg",
|
||||
"Examples": {
|
||||
"Java": ["AeotecDSB09104_Example.java", "AeotecDW2E_Example.java", "AeotecSDG2_Example.java", "AeotecSS6_Example.java"],
|
||||
"Python": ["aeotecdsb09104.py", "aeotecdw2e.py", "aeotecsdg2.py", "aeotecss6.py"],
|
||||
@ -29,7 +28,6 @@
|
||||
"Connections": ["uart"],
|
||||
"Project Type": ["commercial"],
|
||||
"Manufacturers": ["Aeon Labs"],
|
||||
"Image": "dsb09104.jpg",
|
||||
"Examples": {
|
||||
"Java": ["AeotecDSB09104_Example.java"],
|
||||
"Python": ["aeotecdsb09104.py"],
|
||||
@ -59,7 +57,6 @@
|
||||
"Connections": ["uart"],
|
||||
"Project Type": ["commercial"],
|
||||
"Manufacturers": ["Aeon Labs"],
|
||||
"Image": "dsb29.jpg",
|
||||
"Examples": {
|
||||
"Java": ["AeotecDW2E_Example.java"],
|
||||
"Python": ["aeotecdw2e.py"],
|
||||
@ -78,7 +75,6 @@
|
||||
"Connections": ["uart"],
|
||||
"Project Type": ["commercial"],
|
||||
"Manufacturers": ["Aeon Labs"],
|
||||
"Image": "dg2.jpg",
|
||||
"Examples": {
|
||||
"Java": ["AeotecSDG2_Example.java"],
|
||||
"Python": ["aeotecsdg2.py"],
|
||||
@ -97,7 +93,6 @@
|
||||
"Connections": ["uart"],
|
||||
"Project Type": ["commercial"],
|
||||
"Manufacturers": ["Aeon Labs"],
|
||||
"Image": "ss6.jpg",
|
||||
"Examples": {
|
||||
"Java": ["AeotecSS6_Example.java"],
|
||||
"Python": ["aeotecss6.py"],
|
||||
@ -109,4 +104,4 @@
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -10,7 +10,6 @@
|
||||
"Connections": ["uart"],
|
||||
"Project Type": ["industrial", "commercial"],
|
||||
"Manufacturers": ["Omega"],
|
||||
"Image": "rhusb.jpg",
|
||||
"Examples": {
|
||||
"Python": ["rhusb.py"],
|
||||
"Node.js": ["rhusb.js"],
|
||||
@ -58,4 +57,4 @@
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -10,7 +10,6 @@
|
||||
"Connections": ["uart"],
|
||||
"Project Type": ["prototyping", "commercial"],
|
||||
"Manufacturers": ["Microchip"],
|
||||
"Image": "rn2903.jpg",
|
||||
"Examples": {
|
||||
"Java": ["RN2903_Example.java", "RN2903_P2P_RX_Example.java", "RN2903_P2P_TX_Example.java"],
|
||||
"Python": ["rn2903-p2p-rx.py", "rn2903-p2p-tx.py", "rn2903.py"],
|
||||
@ -51,4 +50,4 @@
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -1,44 +1,251 @@
|
||||
{
|
||||
"// Library": {
|
||||
"comment": "Library name. Usually synonymous with the chip ID (e.g. fooinc0378). However, in the case where this library implements multiple sensor classes, choose a name which describes the full functionality (e.g. fooincled).",
|
||||
"type": "string",
|
||||
"required": true
|
||||
},
|
||||
"Library": "sensortemplate",
|
||||
"Description": "Library block provides a short library description",
|
||||
"// Description": {
|
||||
"comment": "Library description. This library provides support for the fooincled family of sensors.",
|
||||
"type": "string",
|
||||
"required": true
|
||||
},
|
||||
"Description": "This is a sensor library template used for new sensors",
|
||||
"// Sensor Class": {
|
||||
"comment": "Sensor/actuator class object which corresponds to the sensor/actuator C++ class (case sensitive).",
|
||||
"type": "object",
|
||||
"required": true
|
||||
},
|
||||
"Sensor Class": {
|
||||
"sensortemplate": {
|
||||
"Name": "Short class/sensor description",
|
||||
"Description": "Then add a much more detailed description here. Include items such as board-specifics, testing, etc...",
|
||||
"Aliases": ["sensortemplate"],
|
||||
"Categories": ["One or more of: accelerometer, ainput, button, color, compass, digipot, display, electric, flexfor, gaseous, gps, led, light, liquid, medical, motor, other, pressure, relay, rfid, serial, servos, sound, temp, time, touch, video, wifi"],
|
||||
"Connections": ["analog, gpio, i2c, pwm, spi, uart"],
|
||||
"Project Type": ["General idea of the project this sensor or class would fit in."],
|
||||
"Manufacturers": ["One or more of: Sensor manufacturer. Can be 'generic'."],
|
||||
"Kits": ["gsk, hak, eak, tsk, robok"],
|
||||
"// TemplateItem": {
|
||||
"comment": "Template Item",
|
||||
"type": "object",
|
||||
"required": true
|
||||
},
|
||||
"TemplateItem": {
|
||||
"// Name": {
|
||||
"comment": "Sensor display name as indicated by the datasheet or manufacturer",
|
||||
"type": "string",
|
||||
"required": true
|
||||
},
|
||||
"Name": "Template Sensor",
|
||||
"// Description": {
|
||||
"comment": "In-depth description of the C++ sensor/actuator class. Include any necessary information on what is required for this implementation to work.",
|
||||
"type": "string",
|
||||
"required": true
|
||||
},
|
||||
"Description": "This sensor template can be used to generate code stubs for new sensor library development",
|
||||
"// Aliases": {
|
||||
"comment": "Known vendor/manufacturer part numbers or names for the sensor/actuator/s supported by this class. Part numbers/IDs are preferred when available.",
|
||||
"type": "array",
|
||||
"required": false
|
||||
},
|
||||
"Aliases": [
|
||||
"template"
|
||||
],
|
||||
"// Categories": {
|
||||
"comment": "One or more categories that his sensor class fits in.",
|
||||
"type": "array",
|
||||
"required": true
|
||||
},
|
||||
"Categories": [
|
||||
"other"
|
||||
],
|
||||
"// Connections": {
|
||||
"comment": "One or more connection types for this sensor class.",
|
||||
"type": "array",
|
||||
"required": true
|
||||
},
|
||||
"Connections": [
|
||||
"i2c"
|
||||
],
|
||||
"// Project Type": {
|
||||
"comment": "One or more application fields or project types sensor is suited for (e.g. prototyping, industrial)",
|
||||
"type": "array",
|
||||
"required": true
|
||||
},
|
||||
"Project Type": [
|
||||
"prototyping"
|
||||
],
|
||||
"// Manufacturers": {
|
||||
"comment": "One or more manufacturers for the hardware supported by this class.",
|
||||
"type": "array",
|
||||
"required": true
|
||||
},
|
||||
"Manufacturers": [
|
||||
"generic"
|
||||
],
|
||||
"// Kits": {
|
||||
"comment": "One or more retail kits that provide this sensor",
|
||||
"type": "array",
|
||||
"required": false
|
||||
},
|
||||
"Kits": [],
|
||||
"// Image": {
|
||||
"comment": "A single small (0-20k) html-viewable image file (located in docs/images). Please do not use existing, copyrighted images with your sensors.",
|
||||
"type": "string",
|
||||
"required": false
|
||||
},
|
||||
"Image": "sensortemplate.jpg",
|
||||
"// Examples": {
|
||||
"comment": "Functional examples showing the main use cases for this sensor class. At least one is required.",
|
||||
"type": "object",
|
||||
"required": true
|
||||
},
|
||||
"Examples": {
|
||||
"Java": ["SensorTemplateSample.java"],
|
||||
"Python": ["sensortemplate.py"],
|
||||
"Node.js": ["sensortemplate.js"],
|
||||
"C++": ["sensortemplate.cxx"]
|
||||
"// Java": {
|
||||
"comment": "One or more Java examples.",
|
||||
"type": "array",
|
||||
"required": false
|
||||
},
|
||||
"Java": [
|
||||
"SensorTemplateSample.java"
|
||||
],
|
||||
"// Python": {
|
||||
"comment": "One or more Python examples.",
|
||||
"type": "array",
|
||||
"required": false
|
||||
},
|
||||
"Python": [
|
||||
"sensortemplate.py"
|
||||
],
|
||||
"// Node.js": {
|
||||
"comment": "One or more Node.js examples.",
|
||||
"type": "array",
|
||||
"required": false
|
||||
},
|
||||
"Node.js": [
|
||||
"sensortemplate.js"
|
||||
],
|
||||
"// C++": {
|
||||
"comment": "One or more C++ examples.",
|
||||
"type": "array",
|
||||
"required": true
|
||||
},
|
||||
"C++": [
|
||||
"sensortemplate.cxx"
|
||||
],
|
||||
"// C": {
|
||||
"comment": "One or more C examples.",
|
||||
"type": "array",
|
||||
"required": false
|
||||
},
|
||||
"C": null
|
||||
},
|
||||
"// Specifications": {
|
||||
"comment": "Catch-all for HW specifications.",
|
||||
"type": "object",
|
||||
"required": false
|
||||
},
|
||||
"Specifications": {
|
||||
"Uses": {
|
||||
"Uses": "Used to display voltage, current, operating temperature, and other basic information a user would want in a glance."
|
||||
}
|
||||
"// Vdd": {
|
||||
"comment": "Example specification. Provides unit value and range.",
|
||||
"type": "object",
|
||||
"required": false
|
||||
},
|
||||
"Vdd": {
|
||||
"// unit": {
|
||||
"comment": "Example specification. Provides unit value and range.",
|
||||
"type": "string",
|
||||
"required": false
|
||||
},
|
||||
"unit": "v",
|
||||
"low": 1.7,
|
||||
"high": 3.6
|
||||
},
|
||||
"// Ioff": {
|
||||
"comment": "Example specification. Provides unit value and range.",
|
||||
"type": "object",
|
||||
"required": false
|
||||
},
|
||||
"Ioff": {
|
||||
"unit": "mA",
|
||||
"typical": 0
|
||||
},
|
||||
"// Iavg": {
|
||||
"comment": "Example specification. Provides unit value and range.",
|
||||
"type": "object",
|
||||
"required": false
|
||||
},
|
||||
"Iavg": {
|
||||
"unit": "mA",
|
||||
"low": 1,
|
||||
"high": 2
|
||||
},
|
||||
"// Measured Range": {
|
||||
"comment": "Example specification. Provides unit value and range.",
|
||||
"type": "object",
|
||||
"required": false
|
||||
},
|
||||
"Measured Range": {
|
||||
"unit": "raw",
|
||||
"low": 0,
|
||||
"high": 1023
|
||||
},
|
||||
"// Other Specs": {
|
||||
"comment": "Example specification. Provides unit value and range.",
|
||||
"type": "object",
|
||||
"required": false
|
||||
},
|
||||
"Other Specs": {}
|
||||
},
|
||||
"// Platforms": {
|
||||
"comment": "Catch-all for listing platforms used to validate this sensor class.",
|
||||
"type": "object",
|
||||
"required": false
|
||||
},
|
||||
"Platforms": {
|
||||
"// Intel Joule Module": {
|
||||
"comment": "Example platform.",
|
||||
"type": "object",
|
||||
"required": false
|
||||
},
|
||||
"Intel Joule Module": {
|
||||
"Notes": ["Notes on usage for the sensor or library with the Intel Joule Module"]
|
||||
},
|
||||
"Intel Edison": {
|
||||
"Notes": ["Notes on usage for the sensor or library with the Intel Edison"]
|
||||
},
|
||||
"Arduino 101": {
|
||||
"Notes": ["Notes on usage for the sensor or library with the Arduino 101"]
|
||||
"// Notes": {
|
||||
"comment": "JSON Object or Array which documents this platform.",
|
||||
"type": "array",
|
||||
"required": false
|
||||
},
|
||||
"Notes": [
|
||||
"Requires pull-up resistors with carrier board"
|
||||
],
|
||||
"// Images": {
|
||||
"comment": "JSON Object or Array which documents this platform.",
|
||||
"type": "array",
|
||||
"required": false
|
||||
},
|
||||
"Images": [
|
||||
""
|
||||
]
|
||||
}
|
||||
},
|
||||
"// Urls": {
|
||||
"comment": "Collection of external URLs which provide additional documentation for this sensor class.",
|
||||
"type": "object",
|
||||
"required": true
|
||||
},
|
||||
"Urls": {
|
||||
"Product Pages": ["URL to a product page or pages of the hardware mentioned"],
|
||||
"Datasheets": ["URL to a datasheet or datasheets of the hardware mentioned"],
|
||||
"Schematics": ["URL to a schematic or schematics of the hardware mentioned"]
|
||||
"// Product Pages": {
|
||||
"comment": "Provide at least one URL for a product web-site where users can get additional information on this sensor.",
|
||||
"type": "array",
|
||||
"required": true
|
||||
},
|
||||
"Product Pages": [
|
||||
"https://software.intel.com/en-us/iot/hardware/sensors/short-title-case-description-from-datasheet-manditory"
|
||||
],
|
||||
"// Datasheets": {
|
||||
"comment": "Array of product datasheets",
|
||||
"type": "array",
|
||||
"required": false
|
||||
},
|
||||
"Datasheets": [],
|
||||
"// Schematics": {
|
||||
"comment": "Array of product schematic pages.",
|
||||
"type": "array",
|
||||
"required": false
|
||||
},
|
||||
"Schematics": []
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -1,33 +0,0 @@
|
||||
{
|
||||
"Library": "Servo",
|
||||
"Description": "Servo Library",
|
||||
"Sensor Class":
|
||||
{
|
||||
"ES9257":
|
||||
{
|
||||
"Name": "Micro Digital 3D Tail Servo",
|
||||
"Description": "The ES9257 servo is a fast, heavy duty servo that is popular for moving control surfaces on RC models.",
|
||||
"Aliases": ["ES9257"],
|
||||
"Categories": ["servos"],
|
||||
"Connections": ["pwm"],
|
||||
"Project Type": ["prototyping"],
|
||||
"Manufacturers": ["emax"],
|
||||
"Image": "es9257.jpg",
|
||||
"Examples":
|
||||
{
|
||||
"C": ["servo.c"]
|
||||
},
|
||||
"Specifications":
|
||||
{
|
||||
"Vdd": {"unit": "v", "typical": 4.8},
|
||||
"Stall Torque": {"unit": "Kgf.cm", "low": 2.5},
|
||||
"Operating Speed (no load)": {"unit": "sec / 60 deg", "max": 0.08},
|
||||
"Pulse Cycle": {"unit": "ms", "typical": 3}
|
||||
},
|
||||
"Urls" :
|
||||
{
|
||||
"Product Pages": ["https://www.seeedstudio.com/EMAX-ES9257-2.5kg%26amp%3B-.05-sec-Micro-Digital-3D-Tail-Servo-p-762.html"]
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
@ -10,7 +10,6 @@
|
||||
"Connections": ["gpio"],
|
||||
"Project Type": ["prototyping", "industrial", "commercial"],
|
||||
"Manufacturers": ["DFRobot", "Sensirion"],
|
||||
"Image": "sht1x.jpg",
|
||||
"Examples": {
|
||||
"Java": ["SHT1X_Example.java"],
|
||||
"Python": ["sht1x.py"],
|
||||
@ -79,4 +78,4 @@
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -10,7 +10,6 @@
|
||||
"Connections": ["i2c"],
|
||||
"Project Type": ["industrial", "commercial"],
|
||||
"Manufacturers": ["Silicon Labs"],
|
||||
"Image": "si1132.jpg",
|
||||
"Examples": {
|
||||
"C++": ["si1132.cxx"]
|
||||
},
|
||||
@ -48,4 +47,4 @@
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -10,7 +10,6 @@
|
||||
"Connections": ["i2c"],
|
||||
"Project Type": ["industrial", "commercial"],
|
||||
"Manufacturers": ["Silicon Labs"],
|
||||
"Image": "si7005.jpg",
|
||||
"Examples": {
|
||||
"C++": ["si7005.cxx"]
|
||||
},
|
||||
@ -52,4 +51,4 @@
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -15,8 +15,7 @@
|
||||
"Java": ["SM130Example.java"],
|
||||
"Python": ["sm130.py"],
|
||||
"Node.js": ["sm130.js"],
|
||||
"C++": ["sm130.cxx"],
|
||||
"C": ["sm130.c"]
|
||||
"C++": ["sm130.cxx"]
|
||||
},
|
||||
"Specifications": {
|
||||
"Vsource": {
|
||||
@ -41,4 +40,4 @@
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -10,7 +10,6 @@
|
||||
"Connections": ["i2c"],
|
||||
"Project Type": ["prototyping", "robotics"],
|
||||
"Manufacturers": ["OpenElectronics"],
|
||||
"Image": "smartdrive.jpg",
|
||||
"Examples": {
|
||||
"C++": ["smartdrive.cxx"]
|
||||
},
|
||||
@ -40,4 +39,4 @@
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -10,7 +10,6 @@
|
||||
"Connections": ["uart"],
|
||||
"Project Type": ["industrial"],
|
||||
"Manufacturers": ["Comet"],
|
||||
"Image": "t3311.jpg",
|
||||
"Examples": {
|
||||
"Python": ["t3311.py"],
|
||||
"Node.js": ["t3311.js"],
|
||||
@ -58,4 +57,4 @@
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -10,7 +10,6 @@
|
||||
"Connections": ["i2c"],
|
||||
"Project Type": ["industrial", "commercial"],
|
||||
"Manufacturers": ["Amphenol"],
|
||||
"Image": "t6713.jpg",
|
||||
"Examples": {
|
||||
"C++": ["t6713-co2-sensor.cxx", "t6713.cxx"]
|
||||
},
|
||||
@ -58,4 +57,4 @@
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -10,7 +10,6 @@
|
||||
"Connections": ["uart"],
|
||||
"Project Type": ["industrial", "commercial"],
|
||||
"Manufacturers": ["Amphenol"],
|
||||
"Image": "t8100.jpg",
|
||||
"Examples": {
|
||||
"Java": ["T8100_Example.java"],
|
||||
"Python": ["t8100.py"],
|
||||
@ -81,4 +80,4 @@
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -10,7 +10,6 @@
|
||||
"Connections": ["uart"],
|
||||
"Project Type": ["industrial", "commercial"],
|
||||
"Manufacturers": ["honeywell"],
|
||||
"Image": "tb7300.jpg",
|
||||
"Examples": {
|
||||
"Java": ["TB7300_Example.java"],
|
||||
"Python": ["tb7300.py"],
|
||||
@ -44,4 +43,4 @@
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -10,7 +10,6 @@
|
||||
"Connections": ["i2c"],
|
||||
"Project Type": ["industrial", "commercial"],
|
||||
"Manufacturers": ["AMS"],
|
||||
"Image": "tcs37727.jpg",
|
||||
"Examples": {
|
||||
"Python": ["tcs37727.py"],
|
||||
"C++": ["tcs37727.cxx"]
|
||||
@ -38,4 +37,4 @@
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -10,7 +10,6 @@
|
||||
"Connections": ["ainput"],
|
||||
"Project Type": ["industrial", "commercial"],
|
||||
"Manufacturers": ["Veris"],
|
||||
"Image": "teams.jpg",
|
||||
"Examples": {
|
||||
"Java": ["TEAMS_Example.java"],
|
||||
"Python": ["teams.py"],
|
||||
@ -45,4 +44,4 @@
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -10,7 +10,6 @@
|
||||
"Connections": ["ainput"],
|
||||
"Project Type": ["industrial", "commercial"],
|
||||
"Manufacturers": ["Veris"],
|
||||
"Image": "tex00.jpg",
|
||||
"Examples": {
|
||||
"Java": ["TEX00_Example.java"],
|
||||
"Python": ["tex00.py"],
|
||||
@ -50,4 +49,4 @@
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -10,7 +10,7 @@
|
||||
"Connections": ["gpio"],
|
||||
"Project Type": ["prototyping", "commercial"],
|
||||
"Manufacturers": ["Seeed", "Titan Micro Electronics"],
|
||||
"Image": "tm1637.jpg",
|
||||
"Image": "tm1637.jpeg",
|
||||
"Examples": {
|
||||
"Java": ["TM1637Sample.java"],
|
||||
"Python": ["tm1637.py"],
|
||||
@ -49,4 +49,4 @@
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -10,7 +10,6 @@
|
||||
"Connections": ["i2c"],
|
||||
"Project Type": ["prototyping", "industrial", "commercial"],
|
||||
"Manufacturers": ["Texas Instruments"],
|
||||
"Image": "tmp006.jpg",
|
||||
"Examples": {
|
||||
"Python": ["tmp006.py"],
|
||||
"C++": ["tmp006.cxx"]
|
||||
@ -48,4 +47,4 @@
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -10,7 +10,6 @@
|
||||
"Connections": ["uart"],
|
||||
"Project Type": ["other"],
|
||||
"Manufacturers": ["generic"],
|
||||
"Image": "uartat.jpg",
|
||||
"Examples": {
|
||||
"Java": ["LE910_Example.java"],
|
||||
"Python": ["le910.py"],
|
||||
@ -23,4 +22,4 @@
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -10,7 +10,6 @@
|
||||
"Connections": ["other"],
|
||||
"Project Type": ["medical", "industrial", "commercial", "prototyping"],
|
||||
"Manufacturers": ["other"],
|
||||
"Image": "vcap.jpg",
|
||||
"Examples": {
|
||||
"Java": ["VCAP_Example.java"],
|
||||
"Python": ["vcap.py"],
|
||||
@ -22,4 +21,4 @@
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -10,7 +10,6 @@
|
||||
"Connections": ["i2c"],
|
||||
"Project Type": ["prototyping", "commercial"],
|
||||
"Manufacturers": ["Vishay", "Adafruit"],
|
||||
"Image": "veml6070.jpg",
|
||||
"Examples": {
|
||||
"Java": ["VEML6070Sample.java"],
|
||||
"Python": ["veml6070.py"],
|
||||
@ -53,4 +52,4 @@
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -74,3 +74,11 @@ if (BUILDSWIGPYTHON AND PYTHON3INTERP_FOUND)
|
||||
${CMAKE_SOURCE_DIR}/examples/python/*.py
|
||||
WORKING_DIRECTORY ${CMAKE_BINARY_DIR}/src/)
|
||||
endif (BUILDSWIGPYTHON AND PYTHON3INTERP_FOUND)
|
||||
|
||||
# add JSON test
|
||||
if(NPM_EXECUTABLE)
|
||||
add_test (NAME check_jsons COMMAND ${CMAKE_COMMAND}
|
||||
-DNPMEXEC=${NPM_EXECUTABLE}
|
||||
-DUPMBASEDIR=${CMAKE_SOURCE_DIR}
|
||||
-P ${CMAKE_SOURCE_DIR}/tests/runjsontest.cmake)
|
||||
endif(NPM_EXECUTABLE)
|
||||
|
61
tests/node/jsonlint.js
Normal file
61
tests/node/jsonlint.js
Normal file
@ -0,0 +1,61 @@
|
||||
var shell = require('shelljs');
|
||||
var path = require('path');
|
||||
|
||||
var rootPath = path.resolve(__dirname, '../../');
|
||||
var srcPath = path.resolve(rootPath, 'src');
|
||||
|
||||
var jsonlintCmd = path.resolve(__dirname, 'node_modules/.bin/jsonlint');
|
||||
var jsonlintOpts = ' --quiet ';
|
||||
|
||||
var failures = [];
|
||||
|
||||
function getRelativePath(filePath) {
|
||||
return path.relative(rootPath, filePath);
|
||||
}
|
||||
|
||||
function printSummaryAndExit() {
|
||||
var exitCode = 0;
|
||||
|
||||
if (failures.length > 0) {
|
||||
console.error();
|
||||
console.error('Failures:');
|
||||
failures.forEach(function (file) {
|
||||
console.error(' ', getRelativePath(file));
|
||||
});
|
||||
exitCode = 1;
|
||||
}
|
||||
else {
|
||||
console.log();
|
||||
console.log('Success');
|
||||
}
|
||||
|
||||
process.exit(exitCode);
|
||||
}
|
||||
|
||||
var pending = 0;
|
||||
|
||||
shell.find(srcPath)
|
||||
.filter(function (file) {
|
||||
return file.match(/\.json$/);
|
||||
})
|
||||
.forEach(function (jsonFile) {
|
||||
pending++;
|
||||
var relativePath = getRelativePath(jsonFile);
|
||||
shell.exec(jsonlintCmd + jsonlintOpts + jsonFile, {silent: true}, function (code, stdout, stderr) {
|
||||
if (code) {
|
||||
console.error('Failed', relativePath);
|
||||
console.error(stderr);
|
||||
failures.push(jsonFile);
|
||||
}
|
||||
else {
|
||||
console.log('Success', relativePath);
|
||||
}
|
||||
|
||||
pending--;
|
||||
|
||||
if (pending == 0) {
|
||||
printSummaryAndExit();
|
||||
}
|
||||
});
|
||||
});
|
||||
|
20
tests/node/package.json
Normal file
20
tests/node/package.json
Normal file
@ -0,0 +1,20 @@
|
||||
{
|
||||
"name": "upm-node-tests",
|
||||
"version": "1.0.0",
|
||||
"description": "Node.js tests for UPM",
|
||||
"main": "index.js",
|
||||
"scripts": {
|
||||
"test": "npm run jsonlint && npm run mocha",
|
||||
"mocha": "mocha test.js",
|
||||
"jsonlint": "node jsonlint.js"
|
||||
},
|
||||
"author": "",
|
||||
"license": "ISC",
|
||||
"devDependencies": {
|
||||
"chai": "^4.1.1",
|
||||
"json-query": "^2.2.2",
|
||||
"jsonlint": "^1.6.2",
|
||||
"mocha": "^3.5.0",
|
||||
"shelljs": "^0.7.8"
|
||||
}
|
||||
}
|
207
tests/node/test.js
Normal file
207
tests/node/test.js
Normal file
@ -0,0 +1,207 @@
|
||||
var shell = require('shelljs');
|
||||
var path = require('path');
|
||||
var expect = require('chai').expect;
|
||||
var jsonQuery = require('json-query');
|
||||
|
||||
var rootPath = path.resolve(__dirname, '../../');
|
||||
var srcPath = path.resolve(rootPath, 'src');
|
||||
var examplesPath = path.resolve(rootPath, 'examples');
|
||||
var imagesPath = path.resolve(rootPath, 'docs/images');
|
||||
|
||||
var sensorTemplateJson = require(path.join(srcPath, 'sensortemplate/sensortemplate.json'));
|
||||
|
||||
/**
|
||||
* Get type name
|
||||
*/
|
||||
function getTypeName(value) {
|
||||
if(Array.isArray(value)) {
|
||||
return 'array'
|
||||
}
|
||||
return typeof value;
|
||||
}
|
||||
|
||||
/**
|
||||
* Check property
|
||||
* @param {object} target Target Object to check
|
||||
* @param {string} propertyName Target property to check in target object
|
||||
* @param {object} propertySpecs Property specs
|
||||
* @param {string} propertySpecs.comment
|
||||
* @param {string} propertySpecs.type
|
||||
* @param {boolean} propertySpecs.required
|
||||
*/
|
||||
function checkProperty(target, propertyName, propertySpecs) {
|
||||
// Fail if a required property is missing
|
||||
if (propertySpecs.required) {
|
||||
expect(target).to.have.property(propertyName);
|
||||
}
|
||||
// Check non required property
|
||||
if (target[propertyName]) {
|
||||
var propertyType = getTypeName(target[propertyName]);
|
||||
var errorMsg = propertyName + ' property should be a ' + propertySpecs.type + '.';
|
||||
expect(propertyType).to.be.equal(propertySpecs.type, errorMsg);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Check object specs
|
||||
* @param {object} object Json schema specification
|
||||
* @param {object} target Json object to check
|
||||
*/
|
||||
function checkObjectSpecs(object, target) {
|
||||
for (var key in object) {
|
||||
/**
|
||||
* Properties specs start with a // character
|
||||
* Properties that are not specs are skipped
|
||||
*/
|
||||
if (key.indexOf('//') !== 0) {
|
||||
continue;
|
||||
}
|
||||
|
||||
/**
|
||||
* We need to do a closure here to make
|
||||
* async calls like it() to hold the
|
||||
* current values of object and key in
|
||||
* the iteration
|
||||
*/
|
||||
(function (object, key) {
|
||||
var keySpecs = object[key];
|
||||
var realKeyName = key.replace('// ', '');
|
||||
|
||||
/**
|
||||
* "TemplateItem" is a special case
|
||||
* For objects, the TemplateItem define
|
||||
* the specs for each of the items in the object
|
||||
*/
|
||||
if (realKeyName === 'TemplateItem') {
|
||||
for (var key in target) {
|
||||
(function(key, target){
|
||||
/**
|
||||
* Create a test case for each property in the
|
||||
* target object. This test will check the property
|
||||
* spectations
|
||||
*/
|
||||
it('Test for ' + key + ' property', function () {
|
||||
checkProperty(target, key, keySpecs);
|
||||
});
|
||||
|
||||
if (target[key] && keySpecs.type === 'object') {
|
||||
(function (object, target) {
|
||||
describe(key, function () {
|
||||
checkObjectSpecs(object, target);
|
||||
});
|
||||
})(object['TemplateItem'], target[key]);
|
||||
}
|
||||
})(key, target);
|
||||
}
|
||||
}
|
||||
else {
|
||||
/**
|
||||
* Create a test case for each property in the
|
||||
* target object. This test will check the property
|
||||
* spectations
|
||||
*/
|
||||
it('Test for ' + realKeyName + ' property', function () {
|
||||
checkProperty(target, realKeyName, keySpecs);
|
||||
});
|
||||
|
||||
if (target[realKeyName] && keySpecs.type === 'object') {
|
||||
(function (object, target) {
|
||||
describe(realKeyName, function () {
|
||||
checkObjectSpecs(object, target);
|
||||
});
|
||||
})(object[realKeyName], target[realKeyName]);
|
||||
}
|
||||
}
|
||||
})(object, key);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Check if the included image in the target actually exists
|
||||
* in docs/images folder
|
||||
* @param {object} target The json object to check
|
||||
*/
|
||||
function checkImageLinks(target) {
|
||||
var imageLinksArray = jsonQuery('Sensor Class[**]Image', {
|
||||
data: target
|
||||
}).value;
|
||||
|
||||
if(imageLinksArray) {
|
||||
imageLinksArray.forEach(function (imageLink) {
|
||||
it(imageLink + ' should exists in docs/images', function () {
|
||||
var globalImagePath = path.join(imagesPath, imageLink);
|
||||
var exists = shell.test('-e', globalImagePath);
|
||||
var errorMsg = 'docs/images/' + imageLink + ' should exist, but was not found.';
|
||||
expect(exists).to.be.equal(true, errorMsg);
|
||||
});
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Check if the included examples in the target actually exists
|
||||
* in examples folder
|
||||
* @param {object} target The json object to check
|
||||
*/
|
||||
function checkExamplesLinks(target) {
|
||||
var examplesLinksArray = jsonQuery('Sensor Class[**]Examples', {
|
||||
data: target
|
||||
}).value;
|
||||
|
||||
function checkExamplesLinksForLanguage(language, examplesSubfolder) {
|
||||
var examples = examplesLinksArray[0][language];
|
||||
examples.forEach(function (example) {
|
||||
it(example + ' should exists in examples/' + examplesSubfolder, function () {
|
||||
var globalExamplePath = path.join(examplesPath, examplesSubfolder, example);
|
||||
var exists = shell.test('-e', globalExamplePath);
|
||||
var errorMsg = 'examples/' + examplesSubfolder + '/' + example + ' should exist, but was not found.';
|
||||
expect(exists).to.be.equal(true, errorMsg);
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
if(examplesLinksArray[0]) {
|
||||
// Check C++ examples
|
||||
if(examplesLinksArray[0]['C++']) {
|
||||
checkExamplesLinksForLanguage('C++', 'c++');
|
||||
}
|
||||
// Check C examples
|
||||
if(examplesLinksArray[0]['C']) {
|
||||
checkExamplesLinksForLanguage('C', 'c');
|
||||
}
|
||||
// Check Java examples
|
||||
if(examplesLinksArray[0]['Java']) {
|
||||
checkExamplesLinksForLanguage('Java', 'java');
|
||||
}
|
||||
// Check Python examples
|
||||
if(examplesLinksArray[0]['Python']) {
|
||||
checkExamplesLinksForLanguage('Python', 'python');
|
||||
}
|
||||
// Check Node.js examples
|
||||
if(examplesLinksArray[0]['Node.js']) {
|
||||
checkExamplesLinksForLanguage('Node.js', 'javascript');
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
shell.find(srcPath)
|
||||
.filter(function (file) {
|
||||
return file.match(/\.json$/);
|
||||
})
|
||||
.filter(function (file) {
|
||||
// Filter sensortemplate.json file
|
||||
return !file.match(/sensortemplate\.json$/);
|
||||
})
|
||||
.forEach(function (jsonFile) {
|
||||
var relativePath = path.relative(rootPath, jsonFile);
|
||||
|
||||
/**
|
||||
* For each json file found, create a Test Suite
|
||||
*/
|
||||
describe(relativePath, function () {
|
||||
var parsedJson = require(jsonFile);
|
||||
checkObjectSpecs(sensorTemplateJson, parsedJson);
|
||||
checkImageLinks(parsedJson);
|
||||
checkExamplesLinks(parsedJson);
|
||||
});
|
||||
});
|
36
tests/runjsontest.cmake
Normal file
36
tests/runjsontest.cmake
Normal file
@ -0,0 +1,36 @@
|
||||
# This macro sets up the initial JSON test environment
|
||||
# it copies over everything required by the test over to the
|
||||
# build directory so that the tests can be run from there
|
||||
macro(SETUP_JSON_COLLATERAL UBD NE)
|
||||
execute_process(COMMAND mkdir -p ${UBD}/build/node_test;
|
||||
COMMAND cp ${UBD}/tests/node/package.json ${UBD}/build/node_test/;
|
||||
COMMAND cp ${UBD}/tests/node/jsonlint.js ${UBD}/build/node_test/;
|
||||
COMMAND cp ${UBD}/tests/node/test.js ${UBD}/build/node_test/;
|
||||
COMMAND ${NE} install --prefix=${UBD}/build/node_test/;
|
||||
RESULT_VARIABLE ret_val
|
||||
)
|
||||
if(ret_val)
|
||||
message(FATAL_ERROR "value of result of first test: ${ret_val_1}")
|
||||
endif()
|
||||
endmacro()
|
||||
|
||||
# This macro runs the json test and checks the json files for
|
||||
# their validity and also checks for the required fields
|
||||
macro(EXEC_JSON_TEST UBD NE)
|
||||
execute_process(COMMAND ${NE} test --prefix=${UBD}/build/node_test/
|
||||
RESULT_VARIABLE ret_val
|
||||
)
|
||||
execute_process(COMMAND rm -rf ${UBD}/build/node_test)
|
||||
if(ret_val)
|
||||
message(FATAL_ERROR "value of the result of the second test: ${ret_val_2}")
|
||||
endif()
|
||||
endmacro()
|
||||
|
||||
# this macro removes all the JSON collateral from the build directory
|
||||
#macro(REMOVE_JSON_COLLATERAL UBD)
|
||||
# execute_process(COMMAND rm -rf ${UBD}/build/node_test)
|
||||
#endmacro()
|
||||
|
||||
setup_json_collateral(${UPMBASEDIR} ${NPMEXEC})
|
||||
exec_json_test(${UPMBASEDIR} ${NPMEXEC})
|
||||
#remove_json_collateral(${UPMBASEDIR})
|
Reference in New Issue
Block a user