Remove trailing whitespace

Signed-off-by: Stefan Wahren <info@lategoodbye.de>
This commit is contained in:
Stefan Wahren
2013-09-13 17:53:33 +02:00
parent 654905a94d
commit 55d4c0fba2
25 changed files with 1168 additions and 1168 deletions

View File

@ -2,7 +2,7 @@
// Copyright (C) 2011, Robert Johansson and contributors, Raditex AB
// All rights reserved.
//
// rSCADA
// rSCADA
// http://www.rSCADA.se
// info@rscada.se
//
@ -13,9 +13,9 @@
/**
* @file mbus-protocol-aux.h
*
*
* @brief Auxiliary functions to the Freescada libmbus library
*
*
* The idea is to simplify the basic task of querying MBus slaves and
* the data processing.
* Typical use might be (in oversimplified "pseudocode"):
@ -160,26 +160,26 @@ extern void (*_mbus_found_event)(mbus_handle * handle, mbus_frame *frame);
void mbus_register_scan_progress(void (*event)(mbus_handle * handle, const char *mask));
void mbus_register_found_event(void (*event)(mbus_handle * handle, mbus_frame *frame));
/**
/**
* Allocate and initialize M-Bus serial context.
*
*
* @param device Serial device (like /dev/ttyUSB0 or /dev/ttyS0)
*
*
* @return Initialized "unified" handler when successful, NULL otherwise;
*/
mbus_handle * mbus_context_serial(const char *device);
/**
/**
* Allocate and initialize M-Bus TCP context.
*
*
* @param host Gateway host
* @param port Gateway port
*
*
* @return Initialized "unified" handler when successful, NULL otherwise;
*/
mbus_handle * mbus_context_tcp(const char *host, uint16_t port);
/**
/**
* Deallocate memory used by M-Bus context.
*
* @param handle Initialized handle
@ -198,9 +198,9 @@ int mbus_connect(mbus_handle * handle);
/**
* Disconnects the "unified" handle.
*
*
* @param handle Initialized handle
*
*
* @return Zero when successful.
*/
int mbus_disconnect(mbus_handle * handle);
@ -216,17 +216,17 @@ int mbus_disconnect(mbus_handle * handle);
*/
int mbus_context_set_option(mbus_handle * handle, mbus_context_option option, long value);
/**
/**
* Receives a frame using "unified" handle
*
*
* @param handle Initialized handle
* @param frame Received frame
*
*
* @return Zero when successful.
*/
int mbus_recv_frame(mbus_handle * handle, mbus_frame *frame);
/**
/**
* Used for handling collisions. Blocks as long as receiving frames or corrupted data.
*
* @param handle Initialized handle
@ -237,232 +237,232 @@ int mbus_purge_frames(mbus_handle * handle);
/**
* Sends frame using "unified" handle
*
*
* @param handle Initialized handle
* @param frame Frame to send
*
*
* @return Zero when successful.
*/
int mbus_send_frame(mbus_handle * handle, mbus_frame *frame);
/**
/**
* Sends secondary address selection frame using "unified" handle
*
*
* @param handle Initialized handle
* @param secondary_addr_str Secondary address
*
*
* @return Zero when successful.
*/
int mbus_send_select_frame(mbus_handle * handle, const char *secondary_addr_str);
/**
/**
* Sends application reset to given slave using "unified" handle
*
*
* @param handle Initialized handle
* @param address Address (0-255)
* @param subcode Subcode (0-255) or no subcode (-1)
*
*
* @return Zero when successful.
*/
int mbus_send_application_reset_frame(mbus_handle * handle, int address, int subcode);
/**
/**
* Sends switch baudrate frame using "unified" handle
*
*
* @param handle Initialized handle
* @param address Address (0-255)
* @param baudrate Baudrate (300,600,1200,2400,4800,9600,19200,38400)
*
*
* @return Zero when successful.
*/
int mbus_send_switch_baudrate_frame(mbus_handle * handle, int address, long baudrate);
/**
/**
* Sends request frame (REQ_UD2) to given slave using "unified" handle
*
*
* @param handle Initialized handle
* @param address Address (0-255)
*
*
* @return Zero when successful.
*/
int mbus_send_request_frame(mbus_handle * handle, int address);
/**
/**
* Sends a request and read replies until no more records available
* or limit is reached.
*
*
* @param handle Initialized handle
* @param address Address (0-255)
* @param reply pointer to an mbus frame for the reply
* @param max_frames limit of frames to readout (0 = no limit)
*
*
* @return Zero when successful.
*/
int mbus_sendrecv_request(mbus_handle *handle, int address, mbus_frame *reply, int max_frames);
/**
/**
* Sends ping frame to given slave using "unified" handle
*
*
* @param handle Initialized handle
* @param address Address (0-255)
* @param purge_response Response flag (=0 don't receive response, >0 purge response)
*
*
* @return Zero when successful.
*/
int mbus_send_ping_frame(mbus_handle *handle, int address, char purge_response);
/**
/**
* Select slave by secondary address using "unified" handle
*
*
* @param handle Initialized handle
* @param mask Address/mask to select
*
*
* @return See MBUS_PROBE_* constants
*/
int mbus_select_secondary_address(mbus_handle * handle, const char *mask);
/**
/**
* Probe/address slave by secondary address using "unified" handle
*
*
* @param handle Initialized handle
* @param mask Address/mask to probe
* @param matching_addr Matched address (the buffer has tobe at least 16 bytes)
*
*
* @return See MBUS_PROBE_* constants
*/
int mbus_probe_secondary_address(mbus_handle * handle, const char *mask, char *matching_addr);
/**
/**
* Read data from given slave using "unified" handle and address types
*
*
* @param handle Initialized handle
* @param address Address of the slave
* @param reply Reply from the slave
*
*
* @return Zero when successful.
*/
int mbus_read_slave(mbus_handle *handle, mbus_address *address, mbus_frame *reply);
/**
/**
* Allocate new data record. Use #mbus_record_free when finished.
*
*
* @return pointer to the new record, NULL when failed
*/
mbus_record * mbus_record_new();
/**
/**
* Destructor for mbus_record
*
*
* @param rec record to be freed
*/
void mbus_record_free(mbus_record *rec);
/**
/**
* Create/parse single counter from the fixed data structure
*
*
* @param statusByte status byte
* @param medium_unit_byte medium/unit byte
* @param data pointer to the data counter (4 bytes)
*
*
* @return Newly allocated record if succesful, NULL otherwise. Later on need to use #mbus_record_free
*/
mbus_record *mbus_parse_fixed_record(char statusByte, char medium_unit_byte, unsigned char *data);
/**
/**
* Create/parse single counter from the variable data structure record
*
*
* @param record record data to be parsed
*
*
* @return Newly allocated record if succesful, NULL otherwise. Later on need to use #mbus_record_free
*/
mbus_record * mbus_parse_variable_record(mbus_data_record *record);
/**
/**
* Get normalized counter value for a fixed counter
*
* Get "normalized" value and unit of the counter
*
*
* @param medium_unit_byte medium/unit byte of the fixed counter
* @param medium_value raw counter value
* @param unit_out units of the counter - use free when done
* @param value_out resulting counter value
* @param quantity_out parsed quantity, when done use "free"
*
*
* @return zero when OK
*/
int mbus_data_fixed_normalize(int medium_unit_byte, long medium_value, char **unit_out, double *value_out, char **quantity_out);
/**
/**
* Decode value of a variable data structure
*
*
* @param record record to be decoded
* @param value_out_real numerical counter value output (when numerical)
* @param value_out_str string counter value output (when string, NULL otherwise), when finished use "free *value_out_str"
* @param value_out_str_size string counter value size
*
*
* @return zero when OK
*/
int mbus_data_variable_value_decode(mbus_record *record, double *value_out_real, char **value_out_str, int *value_out_str_size);
/**
/**
* Decode units and normalize value using VIF/VIFE (used internally by mbus_vib_unit_normalize)
*
*
* @param vif VIF (including standard extensions)
* @param value already parsed "raw" numerical value
* @param unit_out parsed unit, when done use "free"
* @param value_out normalized value
* @param quantity_out parsed quantity, when done use "free"
*
*
* @return zero when OK
*/
int mbus_vif_unit_normalize(int vif, double value, char **unit_out, double *value_out, char **quantity_out);
/**
/**
* Decode units and normalize value from VIB
*
*
* @param vib mbus value information block of the variable record
* @param value already parsed "raw" numerical value
* @param unit_out parsed unit, when done use "free"
* @param value_out normalized value
* @param quantity_out parsed quantity, when done use "free"
*
*
* @return zero when OK
*/
int mbus_vib_unit_normalize(mbus_value_information_block *vib, double value, char **unit_out, double *value_out, char ** quantity_out);
/**
/**
* Generate XML for normalized variable-length data
*
*
* @param data variable-length data
*
*
* @return string with XML
*/
char * mbus_data_variable_xml_normalized(mbus_data_variable *data);
/**
/**
* Return a string containing an XML representation of the normalized M-BUS frame data.
*
*
* @param data M-Bus frame data
*
*
* @return string with XML
*/
char * mbus_frame_data_xml_normalized(mbus_frame_data *data);
/**
/**
* Iterate over secondary addresses, send a probe package to all addresses matching
* the given addresses mask.
*
*
* @param handle Initialized handle
* @param pos current address
* @param addr_mask address mask to
*
* @param addr_mask address mask to
*
* @return zero when OK
*/
int mbus_scan_2nd_address_range(mbus_handle * handle, int pos, char *addr_mask);