-
Notifications
You must be signed in to change notification settings - Fork 49
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
libsml crc enhancements ? #103
Comments
quoting @fkohlgrueber from devZer0/libsml-testing#12 (comment)
|
wrote some code that at least detects the unaligned escapes and provides a warning: #112 it detects the issue in the file from devZer0/libsml-testing#12 right away:
|
@fkohlgrueber: |
it's very unfortunate that the libsml (transport) api is very limited, we should maybe define a new API and deprecate the current sml_transport API. we already defined that we signal EOF/error by returning 0 from |
@r00t- sry for the late reply, didn't have much time for OSS work lately. I'm writing a library for parsing SML in Rust, see here: https://github.com/fkohlgrueber/sml-rs. I'm pretty happy with the transport API and the parser is coming together too. I'm not too comfortable writing C and I prefer to put my time and energy into sml-rs, but I could assist in case you have specific questions regarding sml (transport). Another idea I've been thinking about is to implement a C API for sml-rs. This would allow libsml or vzlogger to use the library. I guess that there would be some effort required to get a Rust project integrated into the build process, but other than that I think this should work fine. What do you think? Would it make sense for libsml / vzlogger etc. to use the transport implementation of sml-rs? |
@fkohlgrueber: i'm not sure on the efficiency of linking rust code into a C/C++ application, |
As Rust compiles to machine code (using LLVM), interoperability with C/C++ can be done using C FFI. The overhead of this small and given the data rate of typical smart meters (one message per second, message size ~300 bytes), efficiency shouldn't be a problem. Regarding efficiency in general: I've designed Also, I put quite some effort into the transport layer. It will only return correct transmissions that are complete and unaltered. If there are errors, they are surfaced in the API such that upper layers in the software can decide what to do with them. Also, it is designed such that it doesn't crash, no matter what input it is given. |
(@fkohlgrueber: i was refering to efficiency at build-time. vzlogger being C++ is already quite heavy, but it can still be compiled natively on a raspberry pi somewhat sensibly, but rust would probably make that impractical.) |
(using my new account from now on - but still the same guy as @fkohlgrueber) Ah, I see. The Rust compiler indeed needs more resources than a C++ compiler as it's doing more work (specifically lifetime checking). I haven't compiled rust code natively on RPi, but now that you mention it I'd like to try it. I've used cross-compilation to compile Rust programs for my RPi 1 which worked fine, but I can see that that would be challenging for a project using both C++ and Rust. |
@fkohlgrueber I like the rust idea! (this vzlogger/libsml c/c++ code is so error prone...) |
please have a look at
devZer0/libsml-testing#12
maybe there is room for some enhancement of crc checks and error verbosity ?
The text was updated successfully, but these errors were encountered: