Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Another question #16

Open
wmmihaa opened this issue May 10, 2018 · 3 comments
Open

Another question #16

wmmihaa opened this issue May 10, 2018 · 3 comments
Labels
enhancement New feature or request

Comments

@wmmihaa
Copy link

wmmihaa commented May 10, 2018

Hello again,
Our requirements have changed and I lack both skill and time to develop it. I was wondering if you were up for a short consult gig as you clearly have the skill (but perhaps not the time ;) ).

Should you choose to accept this mission (hopefully not impossible):

It has been decided the parsing and decryption of messages should be done in a cloud application rather than on the IoT device, so we need to submit raw mbus data readings.
The problem is that I still need to parse the data on the device to compare it to the white-list (received from the cloud application).
So.. in short... create a reader that returns the header and the raw data Eg.

{
  "SlaveInformation": {
    "Id": 68024764,
    "Manufacturer": "ELV",
    "Version": 31,
    "ProductName": "",
    "Medium": "Unknown medium (0x1b)",
    "AccessNumber": 82,
    "Status": 0,
    "Signature": 0
  },
"Radata": [0x68, 0x36, 0x36, 0x68, 0x08, 0x01, 0x72, 0x64, 0x47, 0x02, 0x68, 0x96, 0x15, 0x1F, 0x1B, 0x51, 0x00, 0x00, 0x00, 0x0C, 0x78, 0x53, 0x16, 0x00, 0x62, 0x02, 0x75, 0x01, 0x00, 0x01, 0xFD, 0x71, 0x13, 0x2F, 0x2F, 0x02, 0x65, 0xA9, 0x08, 0x42, 0x65, 0xA9, 0x08, 0x02, 0xFD, 0x1B, 0x30, 0x43, 0x0D, 0xFD, 0x0F, 0x05, 0x35, 0x2E, 0x30, 0x2E, 0x33, 0x0F, 0x8B, 0x16];
    
}

I totally understand if you're not up for it, but I though I'd check with you first as you know this stuff :)

Cheers

@Apollon77
Copy link
Owner

This mixture would mean to completely change the parsing and so reimplement stuff from libmbus. Don‘t like that and is a very special use case.

I could imaging to offer methods to just read a mbus message and return that raw message. Additionally offer a method that receives raw data (from wherever) and parse it.

Then you could read the message on the device and also parse it (completely) for the check but only submit the raw data to your server and parse there (again).

What you think of that?

But all in all because of other priorities and 2 week vacation I have no time for that before mid June earliest ...

@wmmihaa
Copy link
Author

wmmihaa commented May 10, 2018

You're absolutely right... I already got the id's from the white-list, so I'd just need to call something like this:

var response = [];
whitelist.forEach(function(id){
    mbusMaster.getRawData(id, function(err, data) {
        response.push(data);
    });
}):

btw... not asking you to change your library (or libmbus for that matter). I'm happy to reimburse for a working sample or just pointers of where to get started...

PS... As you've been answering so quickly I thought I found someone with the same work ethics as myself. Then I had a look at your number of contributions on your profile and realized you're on a different level ;)

@Apollon77
Copy link
Owner

Also thought about that.

As pointer where to start:
In fact it should be not that problematic. It would be needed to offer twoe additional methods that "split" the current "all-in-one" method into two ... rough at line https://github.com/Apollon77/node-mbus/blob/master/src/mbus-master.cc#L330. So anything before is "read the message", all after is parsing it.
To get the raw data again you need to reassable from the struct a but (because is partly parsed) and to star from scratch to parse only you need to prepare the raw data to get them in that partly parsed state again (there is a mbus_parse method that is normally used for this that could be used).

In at the end we need to transfer those binary data between nodejs and the "native c++" space ... Buffer should work ...

So far the theory. So you need to go into c++ and not possible without changes to the library to allow these two new functions

@Apollon77 Apollon77 added the enhancement New feature or request label Jun 29, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants