57 Commits

Author SHA1 Message Date
Stefan Wahren
551176911f fix memory leaks in error case 2013-07-03 20:34:30 +02:00
Stefan Wahren
8dd1d4e4ae bugfix for +1 error in VIFE parser
now VIFE and DIFE behave equal
2013-07-03 20:30:20 +02:00
Robert Johansson
88b2b9fafa bugfix in VIFE parser 2013-07-03 22:50:03 +09:00
Robert Johansson
31f17ab4c2 use error_str instead of direct console output 2013-07-03 22:18:06 +09:00
Stefan Wahren
dd56a08811 Improve data parsing
- add length defines for variable data header and fixed data
- add size check for fixed data
- avoid problems with memory alignment / padding in mbus structures
(improve portability)
- abort parsing if there are too many DIFE or VIFEs
- check for premature end of variable data
- check size of variable length VIF
2013-06-22 11:50:36 +02:00
Stefan Wahren
c59e763a84 minor fixes
remove unreachable code
add parameter checks to mbus_data_bcd_encode
init time structure in mbus_data_tm_decode as possible
mark falltrough for splint
remove unused variable val
fix removed realloc
2013-05-04 22:43:23 +02:00
Stefan Wahren
ee209023b8 fix memleaks
avoid memleak if memory is full
fix "memleak" at the end of mbus_parse_hex
2013-05-04 19:17:27 +02:00
Stefan Wahren
3935b4013e make parseable for splint
- replace non standard u_char with unsigned char (ANSI)
- advice splint to ignore variadic macros
- move declarations from the middle to top of functions (C90)
- replace local library includes <> to ""
2013-05-04 18:14:18 +02:00
Stefan Wahren
0d6bb583c2 add missing initialization (thanks to valgrind) 2013-05-03 17:23:18 +02:00
Stefan Wahren
5500db0898 add missing checks after memory allocation
add missing memset after memory allocation
2013-04-11 22:05:08 +02:00
Jakob Skov-Pedersen
6166553755 Make my last change more readable.
As suggested by lategoodbye. Also make it more in line with the way
everything else is written.
2013-03-17 09:19:29 +01:00
Jakob Skov-Pedersen
363f59a149 Ignore filler DIF (= 0x2F) 2013-03-11 09:27:16 +01:00
Stefan Wahren
b1063db3bc replace magic numbers with defines
fix MBUS_MAX_PRIMARY_SLAVES to 250
2013-03-02 18:03:31 +01:00
Stefan Wahren
61fd2aa1c7 add new helper functions to check primary and secondary addresses 2012-12-31 13:37:17 +01:00
Stefan Wahren
2335deb742 Fix segmentation fault
- check if L Field is at least 3 to avoid crash (MBDOC48.PDF, page 23)
2012-12-22 00:08:59 +01:00
Stefan Wahren
1080031879 Merge remote-tracking branch 'origin/master'
Conflicts:
	mbus/mbus-protocol.c
2012-12-20 20:57:33 +01:00
Stefan Wahren
404e245af5 replace magic number with define 2012-12-20 20:42:10 +01:00
Stefan Wahren
a4e92f6eab replace magic number with define 2012-12-20 20:12:19 +01:00
Stefan Wahren
688f0d3bc0 Added product name mapping for Elvaco meters 2012-10-21 23:24:04 +02:00
Stefan Wahren
bc2c85c378 Add custom VIFE handling with a corrective factor (from Jakob
Skov-Pedersen)
2012-10-21 11:21:07 +02:00
Stefan Wahren
0c26bc17a7 Add VIF for digital input and output
Correct some cases
2012-10-21 11:09:21 +02:00
Stefan Wahren
99d48d27b2 Extended mbus_data_variable_print to print out VIF/VIFE 2012-10-21 11:05:08 +02:00
Stefan Wahren
3de91c5eab Added product name mapping for Ista sensonic II mbus 2012-10-05 22:09:07 +02:00
Stefan Wahren
30ab8dd643 handle direction of ACK correctly 2012-10-04 23:20:28 +02:00
Stefan Wahren
d6c5529247 new function mbus_frame_direction to get the direction of a frame
(slave to master or vice versa)
extended mbus_frame_data_parse to check the direction of a frame
2012-10-03 23:01:44 +02:00
Stefan Wahren
fe4217772c Added product name mapping for Sensus PolluCom E 2012-09-17 21:01:53 +02:00
Stefan Wahren
1ae8869d7b convert all control chars into spaces to be xml 1.0 conform 2012-09-16 18:15:55 +02:00
Stefan Wahren
e653894bce Merge remote-tracking branch 'upstream/master' 2012-08-25 09:09:50 +02:00
Robert Johansson
dbd69e49f5 make sure that records are initialized to avoid potential core dumps after incomplete parsning and repacking 2012-08-12 19:08:14 +09:00
Stefan Wahren
166b93a1b1 Added product name mapping for Kamstrup 382 2012-07-25 00:09:11 +02:00
Robert Johansson
ed61932579 fixed bug in float point decoding. previously failed when exponent<0. 2012-07-24 23:59:20 +09:00
Robert Johansson
4af9518ce5 correct fprintf format type for size_t 2012-07-24 23:11:02 +09:00
jakubovsky
c848090f56 Rebuilding M-Bus context structs in progress
- changed local library file includes from <> to ""
- get rid of 'if (is_serial)' conditions
- mbus_context_serial() and mbus_context_tcp() allocates memory and initialize context specific function pointers
- simply mbus_connect() called instead of mbus_connect_tcp() or mbus_connect_serial()
- context specific data can still be accessed via (void* auxdata) pointer
- strdup(3) to copy host IP into TCP context struct
2012-07-04 17:18:36 +02:00
Stefan Wahren
f492e97186 Improved model mapping
- added und fixed mapping
2012-06-10 19:19:46 +02:00
Stefan Wahren
bf12395af9 Fixed segmentation fault in case of much XML output
Because of the multi telegrams it is impossible to use a fixed
buffer for XML output on the stack. Now the buffer is allocated on the
heap. These also leads to a change in return behaviour for all XML
functions, because it's possible that the buffer is NULL. For variable
data this buffer grows every time there are less than 1024 bytes left
for a new record.
2012-05-29 21:24:30 +02:00
Stefan Wahren
c2f7c0d48e Improved wildcard search results (still not all meters were found)
- sleep 1 second after each init frame
- select secondary address with enabled FCB bit
2012-05-29 20:51:34 +02:00
Stefan Wahren
989eada28a Improved model mapping
- initialize result buffer
- added new mappings
- added und fixed man codes
2012-05-29 20:33:09 +02:00
Stefan Wahren
0cb23161e7 Added receive timestamp for each data record in XML output 2012-05-29 20:17:05 +02:00
Stefan Wahren
f41b982093 New events for wildcard search 2012-05-20 03:22:02 +02:00
Stefan Wahren
11f6392df3 Fixed potential segmentation faults 2012-05-18 13:35:02 +02:00
Stefan Wahren
f7c644bee6 Fixed output format of secondary address (always 16 digits, leading
zeros)
2012-05-15 23:06:14 +02:00
Stefan Wahren
8e56943fc8 Merge remote branch 'upstream/master' 2012-05-15 23:01:13 +02:00
Stefan Wahren
90aec91bff Added frame tracing (hex format) via debug switch 2012-05-15 22:57:03 +02:00
Stefan Wahren
61893a1b3d Fixed gcc warnings 2012-05-14 00:30:15 +02:00
Stefan Wahren
4178ffceb1 Added access to DRH in xml output function for data records 2012-05-14 00:26:41 +02:00
Stefan Wahren
5a7e69f90d Merge remote branch 'upstream/master'
Conflicts:
	mbus/mbus-serial.c
2012-05-14 00:09:05 +02:00
Stefan Wahren
8f48d75fb0 Added 2 event callbacks to handle send and receive events outside the
library
(now it is possible to trigger a led from an application if m-bus data
is received)
2012-05-13 23:57:24 +02:00
Robert Johansson
29201258e7 in mbus_frame_print for dumping frame in HEX format to stdout, now looping over all frames in a multi-telegram frame list 2012-05-13 16:33:53 +09:00
Stefan Wahren
6dd17954d2 Added check to avoid segmentation fault 2012-05-06 21:55:39 +02:00
Stefan Wahren
df06b93e97 Merge remote branch 'upstream/master'
Conflicts:
	mbus/mbus-protocol.c
2012-04-22 19:37:55 +02:00