dailab / libsml Goto Github PK
View Code? Open in Web Editor NEWImplementation in C of the Smart Message Language (SML) protocol
License: GNU General Public License v3.0
Implementation in C of the Smart Message Language (SML) protocol
License: GNU General Public License v3.0
I tried to compile libsml on a fresh Debian 9 Stretch amd64 box. uuid-dev and uuid-runtime is installed. This happens:
make[1]: Entering directory '/home/roi/src/libsml/sml'
make[1]: Nothing to be done for 'libsml'.
make[1]: Leaving directory '/home/roi/src/libsml/sml'
make[1]: Entering directory '/home/roi/src/libsml/examples'
make[1]: 'sml_server' is up to date.
make[1]: Leaving directory '/home/roi/src/libsml/examples'
make[1]: Entering directory '/home/roi/src/libsml/test'
make[2]: Entering directory '/home/roi/src/libsml/sml'
make[2]: Nothing to be done for 'libsml'.
make[2]: Leaving directory '/home/roi/src/libsml/sml'
cc -I../sml/include/ -Wall -luuid unity/unity.o unity/unity_fixture.o src/test_helper.o src/sml_octet_string_test.o src/sml_buffer_test.o src/sml_number_test.o src/sml_boolean_test.o src/sml_value_test.o src/sml_status_test.o src/sml_list_test.o src/sml_time_test.o src/sml_tree_test.o src/sml_file_test.o src/sml_open_request_test.o src/sml_get_profile_pack_request_test.o src/sml_message_test.o ../sml/lib/libsml.a test_main.c -o test
src/test_helper.o: In function `hex2binary':
test_helper.c:(.text+0xa3): undefined reference to `test_helper_c2ptoi'
collect2: error: ld returned 1 exit status
Makefile:33: recipe for target 'test' failed
make[1]: *** [test] Error 1
make[1]: Leaving directory '/home/roi/src/libsml/test'
Makefile:3: recipe for target 'all' failed
make: *** [all] Error 2
Bug or did I do something wrong?
Hi Juri,
I do this:
git clone https://github.com/dailab/libsml.git
cd libsml
make
and I get this:
make
make[1]: Entering directory /opt/libsml/sml' cc -I./include/ -fPIC -g -Wall -c -o src/sml_file.o src/sml_file.c cc -I./include/ -fPIC -g -Wall -c -o src/sml_attention_response.o src/sml_attention_response.c cc -I./include/ -fPIC -g -Wall -c -o src/sml_transport.o src/sml_transport.c cc -I./include/ -fPIC -g -Wall -c -o src/sml_octet_string.o src/sml_octet_string.c cc -I./include/ -fPIC -g -Wall -c -o src/sml_shared.o src/sml_shared.c cc -I./include/ -fPIC -g -Wall -c -o src/sml_number.o src/sml_number.c cc -I./include/ -fPIC -g -Wall -c -o src/sml_message.o src/sml_message.c cc -I./include/ -fPIC -g -Wall -c -o src/sml_time.o src/sml_time.c cc -I./include/ -fPIC -g -Wall -c -o src/sml_list.o src/sml_list.c cc -I./include/ -fPIC -g -Wall -c -o src/sml_status.o src/sml_status.c cc -I./include/ -fPIC -g -Wall -c -o src/sml_value.o src/sml_value.c cc -I./include/ -fPIC -g -Wall -c -o src/sml_tree.o src/sml_tree.c cc -I./include/ -fPIC -g -Wall -c -o src/sml_boolean.o src/sml_boolean.c cc -I./include/ -fPIC -g -Wall -c -o src/sml_crc16.o src/sml_crc16.c cc -I./include/ -fPIC -g -Wall -c -o src/sml_open_request.o src/sml_open_request.c cc -I./include/ -fPIC -g -Wall -c -o src/sml_open_response.o src/sml_open_response.c cc -I./include/ -fPIC -g -Wall -c -o src/sml_get_list_request.o src/sml_get_list_request.c cc -I./include/ -fPIC -g -Wall -c -o src/sml_get_list_response.o src/sml_get_list_response.c cc -I./include/ -fPIC -g -Wall -c -o src/sml_close_request.o src/sml_close_request.c cc -I./include/ -fPIC -g -Wall -c -o src/sml_close_response.o src/sml_close_response.c cc -I./include/ -fPIC -g -Wall -c -o src/sml_set_proc_parameter_request.o src/sml_set_proc_parameter_request.c cc -I./include/ -fPIC -g -Wall -c -o src/sml_get_proc_parameter_request.o src/sml_get_proc_parameter_request.c cc -I./include/ -fPIC -g -Wall -c -o src/sml_get_proc_parameter_response.o src/sml_get_proc_parameter_response.c cc -I./include/ -fPIC -g -Wall -c -o src/sml_get_profile_pack_request.o src/sml_get_profile_pack_request.c cc -I./include/ -fPIC -g -Wall -c -o src/sml_get_profile_pack_response.o src/sml_get_profile_pack_response.c cc -I./include/ -fPIC -g -Wall -c -o src/sml_get_profile_list_request.o src/sml_get_profile_list_request.c cc -I./include/ -fPIC -g -Wall -c -o src/sml_get_profile_list_response.o src/sml_get_profile_list_response.c ld -luuid -shared -soname libsml.so.1 -o lib/libsml.so.1 src/sml_file.o src/sml_attention_response.o src/sml_transport.o src/sml_octet_string.o src/sml_shared.o src/sml_number.o src/sml_message.o src/sml_time.o src/sml_list.o src/sml_status.o src/sml_value.o src/sml_tree.o src/sml_boolean.o src/sml_crc16.o src/sml_open_request.o src/sml_open_response.o src/sml_get_list_request.o src/sml_get_list_response.o src/sml_close_request.o src/sml_close_response.o src/sml_set_proc_parameter_request.o src/sml_get_proc_parameter_request.o src/sml_get_proc_parameter_response.o src/sml_get_profile_pack_request.o src/sml_get_profile_pack_response.o src/sml_get_profile_list_request.o src/sml_get_profile_list_response.o src/sml_transport.o: In function
sml_transport_read':
/opt/libsml/sml/src/sml_transport.c:109: undefined reference to __stack_chk_fail_local' src/sml_transport.o: In function
sml_transport_write':
/opt/libsml/sml/src/sml_transport.c:163: undefined reference to __stack_chk_fail_local' src/sml_octet_string.o: In function
sml_octet_string_init_from_hex':
/opt/libsml/sml/src/sml_octet_string.c:55: undefined reference to __stack_chk_fail_local' src/sml_octet_string.o: In function
sml_octet_string_generate_uuid':
/opt/libsml/sml/src/sml_octet_string.c:122: undefined reference to __stack_chk_fail_local' src/sml_number.o: In function
sml_number_byte_swap':
/opt/libsml/sml/src/sml_number.c:106: undefined reference to __stack_chk_fail_local' ld: lib/libsml.so.1: hidden symbol
__stack_chk_fail_local' isn't defined
ld: final link failed: Nonrepresentable section on output
make[1]: *** [lib/libsml.so.1] Error 1
make[1]: Leaving directory `/opt/libsml/sml'
make: *** [all] Error 2
I'm running Ubuntu 10.04.3 LTS using commit dd813cd.
Following http://ubuntuforums.org/showthread.php?t=352642 (thx to stv0g!) I found out that adding "-fno-stack-protector" to the CFLAGS helps - make runs fine, then.
Please let me know, if you need more details.
Regards, J.
libsml prints errors on stdout and not on stderr.
please consider using fprintf(stderr,"error.....\n",value); instead
2 reasons for that:
1st:
root@wheezy:~/libsml# while true;do cat /dev/ttyUSB0 |./sml_server_stdio ;done
error: unknown type in sml_value_to_double
error: unknown type in sml_value_to_double
14797050.70 Wh
2012.40 Wh
error: unknown type in sml_value_to_double
20.70 W
^C
root@wheezy:~/libsml# while true;do cat /dev/ttyUSB0 |./sml_server_stdio ;done 2>/dev/null
14797050.80 Wh
2012.40 Wh
21.10 W
^C
2nd:
People re-implement sml_value_to_double() within their code - see: http://knx-user-forum.de/201949-post60.html
regards
roland
root@wheezy:~/libsml/libsml/sml/src# grep print * |egrep "warning|error"
sml_file.c: printf("warning: could not read the whole file\n");
sml_message.c: printf("error: message type %04X not yet implemented\n", *(msg_body->tag));
sml_message.c: printf("error: message type %04X not yet implemented\n", *(message_body->tag));
sml_transport.c: printf("error: unrecognized sequence\n");
sml_tree.c: printf("error: unknown tag in %s\n", FUNCTION);
sml_value.c: printf("error: unknown type in %s\n", FUNCTION);
In my understanding SML_SKIP_OPTIONAL is not required as its get checked again here:
https://github.com/stv0g/libsml/blob/master/sml/src/sml_time.c#L32
My commit:
stv0g@4ff38d7
Please go to: https://github.com/volkszaehler/libsml
For reason, have a look at https://demo.volkszaehler.org/pipermail/volkszaehler-dev/2015-January/004064.html (german text)
Translated with www.DeepL.com/Translator
Servus,
after a bit of initiative and mail requests from Roland to Juri and the Dai-Lab it turned out that libsml (an important base component for the census project) is currently "unmaintained", i. e. nobody cares about the further development of libsml (as it has been in the last 2 years).
Adding even small but helpful changes like "make install"support (PR by Peter Evertz, also here on the list: peterevertz@d7ab04a) has been pending for almost two years now, but this has failed due to the fact that Juri is no longer working in the Dai-Lab and has no more commit privileges on the repository, and that the priorities are elsewhere in the Dai-Lab and the actual successor of Juri does not take on the role of maintainer.
We, i. e. Juri, Roland and I have come to the conclusion that it makes sense to fork libsml and hang it within the census project. As a prerequisite for this, however, I see that there are also people here who are involved - otherwise we will only be able to create the next siding here.
Roland himself would in principle be willing to take over the position as libsml-maintainer, but says that he does not have enough experience with SML, C and Git for maintaining a not uncomplicated C-software. In short, he would feel a little overwhelmed on his own.
Would people on this list be willing to take over or at least carry the libsml care?
This means that we are looking for people who would either take over the maintenance of the library completely or who could at least provide technical advisory board and support to help Roland to bring libsml "forward".
In short: now is the time to implement the New Year's resolutions; -)
Thanks again to Roland for his commitment!
Greetings, J.
src/sml_value.c: In function ‘sml_value_init’
sml_value *sml_value_init() {
sml_value *value = (sml_value *) malloc(sizeof(sml_value));
memset(value, 0, sizeof(value));
return value;
}
the memset size argument should be either sizeof(*value) or sizeof(sml_value). sizeof(value) is the size of the pointer itself. Can work, but I guess thats wrong... ;-)
message_body->tag is undefined in the following switch statement.
I am searching for a way to decode a binary sml message. So far I've managed to read and isolate the data:
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.