Categories
General HowTo's VSCP

Howto: Read a #VSCP mdf file with node.js

The Module Description file is a XML file that all VSCP devices must have and which describe the device. It can either be stored on the device itself or more common linked by the device and stored on some external server storage. Software that wants to configure a device can fetch this file to get the knowledge to do so. Typically a user interface use this file to guide a user through device configuration. A good thing is that one software can handle and configure any device.

A sample MDF file is here an here.

Read a mdf file from a device, parse it and display the module name. A device can consist of several modules, there will always be one and result.vscp.module[0] will always refer to the first. Most devices contains only one module. You can get the number of modules with result.vscp.module.length

Below are some Javascript examples on how to get information from the MDF-file.

Display the module name

const axios = require('axios');
const xml2js = require('xml2js');

let parser = new xml2js.Parser();

axios.get('https://www.eurosource.se/ntc10KA_3.xml')  
  .then((response) => {
      parser.parseString(response.data,
                         (err, result) => {
        console.dir(result.vscp.module[0].name);    
      });
  })  
  .catch((err) => {    
    console.log(err);  
  });

Similar to above sample get a link to the manual for a device

console.log(result.vscp.module[0].manual[0].$.path);

List all registers with

console.dir(result.vscp.module[0].registers[0].reg);

Iterate through all registers an display there names

axios.get('https://www.eurosource.se/ntc10KA_3.xml')
  .then((response) => {
    parser.parseString(response.data, (err, result) => {
      for (let reg of result.vscp.module[0].registers[0].reg) {
        console.log(reg.name[0]._);
      }
    });

  })
  .catch((err) => {
    console.log(err);
  });

List register descriptions with

console.log(reg.description[0]._);

You get the language code for a register name or a register description with

console.log(reg.name[0].$.lang);

List abstractions with

axios.get('https://www.eurosource.se/ntc10KA_3.xml')
  .then((response) => {
    parser.parseString(response.data, (err, result) => {
      for (let reg of result.vscp.module[0].registers[0].reg) {
        console.dir(result.vscp.module[0].abstractions[0].abstraction);
      }
    });

  })
  .catch((err) => {
    console.log(err);
  });



List number of events the module can generate and the events

console.dir('# events: ' + result.vscp.module[0].events[0].event.length);
console.dir(result.vscp.module[0].events[0].event);

If you want an url to a picture of the module

console.log(result.vscp.module[0].picture[0].$.path);

If you want the manual

console.log(result.vscp.module[0].manual[0].$.path);

or a firmware image

console.log(result.vscp.module[0].firmware[0].$.path);

The number of firmware images available

axios.get('http://www.eurosource.se/paris_010.xml')
  .then((response) => {
    parser.parseString(response.data, (err, result) => {
  console.log(result.vscp.module[0].firmware.length);
    });
  })
  .catch((err) => {
    console.log(err);
  });

The release date for a specific firmware

console.log(result.vscp.module[0].firmware[3].$.date);

The way this works should be obvious by now. Enjoy!

Categories
General

11 Do-It-Yourself PCB Design For Manufacture (DFM) Checks Anyone Can Do | Seeed Studio Blog

11 DO-IT-YOURSELF PCB DESIGN FOR MANUFACTURE (DFM) CHECKS ANYONE CAN DO

Source: 11 Do-It-Yourself PCB Design For Manufacture (DFM) Checks Anyone Can Do | Seeed Studio Blog

Categories
General

The Subtle Art Of Not Making Mistakes with PCB Design For Manufacturing | Seeed Studio Blog

Getting your PCB design manufactured is no easy feat.

Source: The Subtle Art Of Not Making Mistakes with PCB Design For Manufacturing | Seeed Studio Blog

Categories
General

The US Is the Undisputed Leader in Smart Homes – PCMag UK

Judging by both companies’ revenue and household penetration, the United States is crushing it in smart home adoption. At least for now.

Source: The US Is the Undisputed Leader in Smart Homes – PCMag UK

Categories
General

Korlan USB2CAN – 8devices

Source: Korlan USB2CAN – 8devices

For better value take a look at https://grodansparadis.com/wordpress/?p=3980

Categories
General

What Web Can Do Today

Can I rely on the Web Platform features to build my app? An overview of the device integration HTML5 APIs

Source: What Web Can Do Today

Categories
General

How IoT sensors can optimize maintenance costs | Haltian

Finland’s transmission system operator, Fingrid, has been eager to digitalize the maintenance and monitoring of their operations. Over the years, Fingrid has organized 4 different innovation contests…

Source: How IoT sensors can optimize maintenance costs | Haltian

Categories
General

State of things

So what is happening on the VSCP scene?

Well, currently not much. I am still unable to do much and is waiting for the second part of my shoulder prosthesis replacement (currently just a thin steal distance instead of the upper bone). But good is at least that I am a bit more alert again after quitting a six week penicillin cure. I have never slept so much as I have done in the last weeks. Trust me.

Hopefully the next operation will be done before the summer and after that I hope I will be allowed (and able) to use the right arm again. That probably mean I will not be doing serious work again until the end of summer. It is hard to even think about that as I am VERY eager to finalize the current work and get next release out of the door.

well, things are like they are and there is no meaning to be low about the situation. Just wanted you guys know so you don’t think VSCP has gone away to the strawberry fields forever.

Have fun!

Categories
General

Privacy and Bluetooth Mesh

By encrypting destination addresses and obfuscating the source addresses, Bluetooth mesh is different. By capturing the data transmission of a Bluetooth mesh network, all you learn is that there is a network.

Source: Privacy and Bluetooth Mesh

Categories
General

Getting disparate Zigbee home automation systems on a common platform and local control.